Package fr.uga.pddl4j.parser
Class Symbol<T>
java.lang.Object
fr.uga.pddl4j.parser.Symbol<T>
- Type Parameters:
T
- the type of symbol, i.e., integer of string.
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
TypedSymbol
This class implements the symbols manipulated by the parser and by the instantiation process.
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates a symbol from a specified symbol.Symbol(SymbolType type, T value)
Creates a new symbol with a specified value.Symbol(SymbolType type, T value, int beginLine, int beginColumn, int endLine, int endColumn)
Create a symbol with a specified image, line and column.Symbol(SymbolType type, T value, Location location)
Create a new symbol from a specified token. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return if this symbol is equal to another object, i.e., if they have the same value.getImage()
Return the string image of this symbol.Return the location of the symbol.getType()
Returns the type of this symbol.getValue()
Returns the value of the symbol.int
hashCode()
Returns the hash code value of this symbol.Renames the symbol.void
setBegin(fr.uga.pddl4j.parser.lexer.Token begin)
Sets the begin line and column of the expression from a specified token.void
setEnd(fr.uga.pddl4j.parser.lexer.Token end)
Sets the end line and column of the expression from a specified token.void
setLocation(Location location)
Sets the location of the symbol.void
setType(SymbolType type)
Sets the type of this symbol.void
Sets the value of the symbol.toString()
Returns a string representation of this symbol.
-
Field Details
-
DEFAULT_VARIABLE_SYMBOL
The name of rename variable.- See Also:
- Constant Field Values
-
DEFAULT_TASK_ID_SYMBOL
The name of rename task tag.- See Also:
- Constant Field Values
-
OBJECT_TYPE
The default symbol for object type. -
NUMBER_TYPE
The default symbol for number type.
-
-
Constructor Details
-
Symbol
Creates a symbol from a specified symbol.- Parameters:
other
- the symbol.
-
Symbol
Create a new symbol from a specified token.- Parameters:
type
- the type of the symbol.value
- the token.location
- the location of the symbol.
-
Symbol
public Symbol(SymbolType type, T value, int beginLine, int beginColumn, int endLine, int endColumn)Create a symbol with a specified image, line and column.- Parameters:
type
- the type of the symbol.value
- the value of the symbol.beginLine
- the begin line of the symbol.beginColumn
- the begin column of the symbol.endLine
- the end line of the symbol.endColumn
- the end column of the symbol.
-
Symbol
Creates a new symbol with a specified value.- Parameters:
type
- the kind of the symbol.value
- the string image of the symbol.
-
-
Method Details
-
getType
Returns the type of this symbol.- Returns:
- the type of this symbol.
-
setType
Sets the type of this symbol.- Parameters:
type
- the type of the symbol.
-
getValue
Returns the value of the symbol.- Returns:
- the value of the symbol.
-
setValue
Sets the value of the symbol.- Parameters:
value
- the value to set.
-
getLocation
Return the location of the symbol.- Returns:
- the location of the symbol.
-
setLocation
Sets the location of the symbol.- Parameters:
location
- the location to set.
-
setBegin
public final void setBegin(fr.uga.pddl4j.parser.lexer.Token begin)Sets the begin line and column of the expression from a specified token.- Parameters:
begin
- the first token of the expression.
-
setEnd
public final void setEnd(fr.uga.pddl4j.parser.lexer.Token end)Sets the end line and column of the expression from a specified token.- Parameters:
end
- the last token of the expression.
-
getImage
Return the string image of this symbol.- Returns:
- the string image of this symbol.
-
rename
Renames the symbol. The symbol is renamed if only if this symbol is contained the map in parameters, otherwise nothing is done.- Parameters:
context
- the images of the symbol to renamed .- Returns:
- the old image of the symbol or null if the symbol was not renamed.
-
equals
Return if this symbol is equal to another object, i.e., if they have the same value.- Overrides:
equals
in classObject
- Parameters:
object
- the other object.- Returns:
true
if this symbol is equal toobject
, i.e.,other
is not null and of typeSymbol
and it has the same value; otherwise returnfalse
.- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()Returns the hash code value of this symbol.- Overrides:
hashCode
in classObject
- Returns:
- the hash code value of this symbol.
- See Also:
Object.hashCode()
-
toString
Returns a string representation of this symbol.
-