Package com.uppaal.engine
Class Parser
- java.lang.Object
-
- com.uppaal.engine.LexicalAnalyser
-
- com.uppaal.engine.Parser
-
public class Parser extends LexicalAnalyser
Simple recursive decent parser for the communication protocol. Used by the EngineStub.
-
-
Constructor Summary
Constructors Constructor Description Parser(InputStream in)Constructor
-
Method Summary
Modifier and Type Method Description StringgetErrorContext(String errorLocation, int errorStartLine, int errorEndLine)Get the location string from the declaration text where the error happenedvoidparseAcknowledgement()Parses the prolog and the end of the charactersBigDecimalparseBigDecimal()Parse the float of the next tokenStringparseBlock()Read the context of the blockConcreteStateparseConcreteInitial(UppaalSystem system)Parses the concrete initial state in the systemConcreteStateparseConcreteState(UppaalSystem system)Create the concrete state in the system: - Get the list of locations in the system - Get the list of variables of the system - Get the invariant value <l-len> <location>* <v-len> ( <value> <rate> )* <limit> <strict>ConcreteSuccessorparseConcreteSuccessor(UppaalSystem system)To create the concrete successor: - parses the concrete state - get the list of the concrete transitionSystemEdge[]parseEdges(UppaalSystem system)Get the list of the system edgesSystemEdgeSelect[]parseEdgesWS(UppaalSystem system)Parses the selected edge of the system.ArrayList<ConcreteTransition>parseEnabledConcreteTransitions(UppaalSystem system)Parses the limit of the concrete transition and collect the enabled concrete transition into the listArrayList<SymbolicTransition>parseEnabledTransitions(UppaalSystem system)Parses the transitions that are transit enabledvoidparseEnd()Parses the end of the characters.GanttChartparseGanttChart(UppaalSystem system, BigDecimal globalTime)Parses a Gantt chart.voidparseGanttHeader(UppaalSystem system)Parses the header of the ganttchardStringparseId()Parses and gets the string.intparseInteger()Parses and get the integer valueLimitparseLimit()Parses the limit : limit consists of a value and information about whether the limit is strict or not.longparseLong()Parses the response string in 'long'LscProcessparseLscProcess(Document document)Parse LSC processvoidparsePartialEnd()Parses the partial end of the charactersArrayList<Problem>parseProblems()Parses problems in the systemvoidparseProblems(ArrayList<Problem> problems)Parses problems in the systemvoidparseProlog()Parses the prologcharparseQueryResult()Parses query and get the query resultSymbolicStateparseSymbolicInitial(UppaalSystem system)Parses the symbolic initial state in the systemSymbolicStateparseSymbolicState(UppaalSystem system)Parses the symbolic state in the systemUppaalSystemparseSystem(Document document)Parses the uppaal system: - get the list of variables - get the list of clocks - add the processes into the system - add Gantt Chart parsingSymbolicTraceparseXTRTrace(UppaalSystem system)Parses the TraceProblemproblem()Create the problembooleanskipProblems()To skip problems-
Methods inherited from class com.uppaal.engine.LexicalAnalyser
getException, getFloat, getIntValue, getLookahead, getValue, getWord, nextToken, read, readBlock
-
-
-
-
Constructor Detail
-
Parser
public Parser(InputStream in)
Constructor- Parameters:
in- - The input stream
-
-
Method Detail
-
parseProlog
public void parseProlog() throws EngineException, IOExceptionParses the prolog- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
parseId
public String parseId() throws ProtocolException, IOException
Parses and gets the string.- Returns:
- The response string
- Throws:
ProtocolException- broken engine communication protocolIOException- engine crash or problem in communication.
-
parseInteger
public int parseInteger() throws ProtocolException, IOException, ServerExceptionParses and get the integer value- Returns:
- The integer value of characters
- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.ServerException- engine returned an error
-
parseLong
public long parseLong() throws ProtocolException, IOException, ServerExceptionParses the response string in 'long'- Returns:
- The value in 'long' of the string
- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.ServerException- engine returned an error
-
parseBigDecimal
public BigDecimal parseBigDecimal() throws ProtocolException, IOException
Parse the float of the next token- Returns:
- The float value
- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.
-
parseLimit
public Limit parseLimit() throws ProtocolException, IOException, ServerException
Parses the limit : limit consists of a value and information about whether the limit is strict or not.- Returns:
- The limit object
- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.ServerException- engine returned an error
-
parseEnd
public void parseEnd() throws ProtocolException, IOExceptionParses the end of the characters.- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.
-
parsePartialEnd
public void parsePartialEnd() throws ProtocolException, IOExceptionParses the partial end of the characters- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.
-
parseSymbolicState
public SymbolicState parseSymbolicState(UppaalSystem system) throws ProtocolException, IOException, ServerException
Parses the symbolic state in the system- Parameters:
system- - The uppaal system- Returns:
- The new symbolic state in the system
- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.ServerException- engine returned an error
-
parseEdges
public SystemEdge[] parseEdges(UppaalSystem system) throws ProtocolException, IOException, ServerException
Get the list of the system edges- Parameters:
system- - The uppaal system- Returns:
- l - The list of the edges
- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.ServerException- engine returned an error
-
parseEnabledTransitions
public ArrayList<SymbolicTransition> parseEnabledTransitions(UppaalSystem system) throws EngineException, IOException, CannotEvaluateException
Parses the transitions that are transit enabled- Parameters:
system- - The uppaal system- Returns:
- succs - The list of symbolic transitions
- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.EngineException- engine returned an errorCannotEvaluateException- an expression could not be evaluated
-
getErrorContext
public String getErrorContext(String errorLocation, int errorStartLine, int errorEndLine)
Get the location string from the declaration text where the error happened- Parameters:
errorLocation- - The all error location texterrorStartLine- - The start line number where the error string starts fromerrorEndLine- - The end line number where the error string ends to- Returns:
- location - The error location
-
parseAcknowledgement
public void parseAcknowledgement() throws EngineException, IOExceptionParses the prolog and the end of the characters- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
parseBlock
public String parseBlock() throws EngineException, IOException
Read the context of the block- Returns:
- The string
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
parseGanttHeader
public void parseGanttHeader(UppaalSystem system) throws ProtocolException, EngineException, IOException
Parses the header of the ganttchard- Parameters:
system- - The uppaal system- Throws:
ProtocolException- broken engine communication protocol.IOException- engine crash or problem in communication.EngineException- engine returned an error
-
parseSymbolicInitial
public SymbolicState parseSymbolicInitial(UppaalSystem system) throws EngineException, IOException, CannotEvaluateException
Parses the symbolic initial state in the system- Parameters:
system- - The uppaal system- Returns:
- state - The symbolic state
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.CannotEvaluateException- in the Uppaal engine.
-
parseConcreteInitial
public ConcreteState parseConcreteInitial(UppaalSystem system) throws EngineException, IOException, ServerException, CannotEvaluateException
Parses the concrete initial state in the system- Parameters:
system- - The uppaal system- Returns:
- state - The concrete state
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.ServerException- engine returned an error.CannotEvaluateException- in the uppaal engine
-
parseSystem
public UppaalSystem parseSystem(Document document) throws EngineException, IOException
Parses the uppaal system: - get the list of variables - get the list of clocks - add the processes into the system - add Gantt Chart parsing- Parameters:
document- - The document- Returns:
- system - The uppaal system
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
parseLscProcess
public LscProcess parseLscProcess(Document document) throws EngineException, IOException
Parse LSC process- Parameters:
document- - The model document- Returns:
- null
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
parseProblems
public ArrayList<Problem> parseProblems() throws EngineException, IOException
Parses problems in the system- Returns:
- The list of the problems
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
parseProblems
public void parseProblems(ArrayList<Problem> problems) throws EngineException, IOException
Parses problems in the system- Parameters:
problems- - Problems of the system- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
skipProblems
public boolean skipProblems() throws EngineException, IOExceptionTo skip problems- Returns:
- True - Do it
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
problem
public Problem problem() throws EngineException, IOException
Create the problem- Returns:
- The new problem
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
parseQueryResult
public char parseQueryResult() throws EngineException, IOExceptionParses query and get the query result- Returns:
- The query ID
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.
-
parseXTRTrace
public SymbolicTrace parseXTRTrace(UppaalSystem system) throws ProtocolException, IOException
Parses the Trace- Parameters:
system- - The uppaal system- Returns:
- trace - The list of the symbolic transition.
- Throws:
IOException- engine crash or problem in communication.ProtocolException- broken engine communication protocol.
-
parseConcreteState
public ConcreteState parseConcreteState(UppaalSystem system) throws IOException, ProtocolException, ServerException
Create the concrete state in the system: - Get the list of locations in the system - Get the list of variables of the system - Get the invariant value <l-len> <location>* <v-len> ( <value> <rate> )* <limit> <strict>- Parameters:
system- - The uppaal system- Returns:
- The concrete state in the system
- Throws:
IOException- engine crash or problem in communication.ProtocolException- broken engine communication protocol.ServerException- engine returned an error.
-
parseEdgesWS
public SystemEdgeSelect[] parseEdgesWS(UppaalSystem system) throws ProtocolException, IOException, ServerException
Parses the selected edge of the system.- Parameters:
system- - The uppaal system- Returns:
- listEdge - The list of the selected edges
- Throws:
IOException- engine crash or problem in communication.ProtocolException- broken engine communication protocol.ServerException- engine returned an error.
-
parseEnabledConcreteTransitions
public ArrayList<ConcreteTransition> parseEnabledConcreteTransitions(UppaalSystem system) throws EngineException, IOException, CannotEvaluateException
Parses the limit of the concrete transition and collect the enabled concrete transition into the list- Parameters:
system- - The uppaal system- Returns:
- succs - The enabled transition
- Throws:
IOException- I/O communication error.EngineException- error in the server protocol.CannotEvaluateException- some expression could not be evaluated.
-
parseConcreteSuccessor
public ConcreteSuccessor parseConcreteSuccessor(UppaalSystem system) throws IOException, EngineException, ServerException, CannotEvaluateException
To create the concrete successor: - parses the concrete state - get the list of the concrete transition- Parameters:
system- - The uppaal system- Returns:
- The concrete successor
- Throws:
IOException- engine crash or problem in communication.EngineException- problem in the Uppaal engine.ServerException- engine returned an error.CannotEvaluateException- some expression could not be evaluated.
-
parseGanttChart
public GanttChart parseGanttChart(UppaalSystem system, BigDecimal globalTime) throws ProtocolException, ServerException, IOException
Parses a Gantt chart. <num> (<identifier> <value> <value> <strict> <value> <strict>)* <num> a positive integer: Number of messages in the following <identifier> the row number/id <value> the value of the bar to be displayed. This number can be positive, 0 or negative. <value> a positive number: interval start time <strict> start of interval open or closed? <value> a positive number: interval stop time <strict> end of interval open or closed?- Parameters:
system- - The uppaal systemglobalTime- - The global time- Returns:
- The ganttChart
- Throws:
IOException- engine crash or problem in communication.ProtocolException- broken engine communication protocol.ServerException- engine returned an error.
-
-