Class SemanticNodeBase
- java.lang.Object
-
- com.aquima.interactions.expressions.semantics.SemanticNodeBase
-
- All Implemented Interfaces:
ISemanticNode
- Direct Known Subclasses:
AllVariable
,Arithmetic
,Condition
,Constant
,Conversion
,DimensionChange
,ErrorNode
,ExpressionList
,FieldVariable
,FunctionCall
,InstanceOf
,Inversion
,ListArithmetic
,ListCondition
,LocalVariable
,LogicalConnective
,NamedVariable
,Not
,Predicate
,Root
,Select
,TemplateCall
,TypeOf
,Unknown
,Variable
public abstract class SemanticNodeBase extends Object implements ISemanticNode
Base class for all nodes from the semantic tree.- Since:
- 6.0
- Author:
- O. Kerpershoek, F. van der Meer
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SemanticNodeBase(Position position)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMessage(Severity severity, ErrorMessage message)
This method adds a message to the semantic node.DataType
getDataType()
This method returns the data type of the node.Domain
getDomain()
This method returns the domain of values that may be returned by the expression.ErrorMessage[]
getMessages(Severity severity, boolean includeChildMessages)
This method returns an array of messages that were detected while parsing the node.Position
getPosition()
This method returns the position information of the node.Type
getType()
This method returns the type information of the node.boolean
hasMessage(Severity severity, ErrorCode errorCode, boolean includeChildMessages)
This method detects whether a specific message is found within the semantic node.boolean
isDerivedType()
This method returns a boolean indicating if the type of this node is derived.boolean
isMultivalue()
This method returns a boolean indicating if the expression will result in multiple values.protected void
setDerived(boolean isDerived)
protected void
setDomain(Domain domain)
protected void
setType(Type type)
protected void
setType(DataType type, boolean multivalue)
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.aquima.interactions.expressions.semantics.ISemanticNode
collectScopedObjects, getChildNodes, visit
-
-
-
-
Constructor Detail
-
SemanticNodeBase
protected SemanticNodeBase(Position position)
-
-
Method Detail
-
setType
protected void setType(DataType type, boolean multivalue)
-
setType
protected void setType(Type type)
-
setDomain
protected void setDomain(Domain domain)
-
setDerived
protected void setDerived(boolean isDerived)
-
getPosition
public Position getPosition()
Description copied from interface:ISemanticNode
This method returns the position information of the node.- Specified by:
getPosition
in interfaceISemanticNode
- Returns:
- The position information of the node.
-
getType
public Type getType()
Description copied from interface:ISemanticNode
This method returns the type information of the node. The type information is a combination of the data type, the domain and the multivalue indicator.- Specified by:
getType
in interfaceISemanticNode
- Returns:
- The type information of the node.
-
getDataType
public DataType getDataType()
Description copied from interface:ISemanticNode
This method returns the data type of the node.- Specified by:
getDataType
in interfaceISemanticNode
- Returns:
- the data type of the node.
-
isMultivalue
public boolean isMultivalue()
Description copied from interface:ISemanticNode
This method returns a boolean indicating if the expression will result in multiple values.- Specified by:
isMultivalue
in interfaceISemanticNode
- Returns:
- a boolean indicating if the expression will result in multiple values.
-
getDomain
public Domain getDomain()
Description copied from interface:ISemanticNode
This method returns the domain of values that may be returned by the expression.- Specified by:
getDomain
in interfaceISemanticNode
- Returns:
- the domain of values that may be returned by the expression.
-
isDerivedType
public boolean isDerivedType()
Description copied from interface:ISemanticNode
This method returns a boolean indicating if the type of this node is derived. A derived type is usually the result of an operation where the result type may be ambiguous. For instance the multiplication of a number with a percentage, may result in either a number or a percentage. Usually the most specific type is chosen (percentage in the previous example). Nodes representing constants or variables will often return false as a result of this method.- Specified by:
isDerivedType
in interfaceISemanticNode
- Returns:
- a boolean indicating if the type of this node is derived.
-
getMessages
public final ErrorMessage[] getMessages(Severity severity, boolean includeChildMessages)
Description copied from interface:ISemanticNode
This method returns an array of messages that were detected while parsing the node. If the severity parameter is null, all messages will be returned regardless of their severity. When a severity is specified, only the messages matching the severity will be returned. The boolean argument may be used to indicate if only the messages of this node should be returned, or also the messages of any child nodes.- Specified by:
getMessages
in interfaceISemanticNode
- Parameters:
severity
- The severity may be used to request only the messages matching the specified severity.includeChildMessages
- Boolean indicating if child messages should also be returned.- Returns:
- Array of messages that were detected during the parse phase for this node.
-
addMessage
public void addMessage(Severity severity, ErrorMessage message)
Description copied from interface:ISemanticNode
This method adds a message to the semantic node.- Specified by:
addMessage
in interfaceISemanticNode
- Parameters:
severity
- The severity of the message.message
- The message that should be added.
-
hasMessage
public boolean hasMessage(Severity severity, ErrorCode errorCode, boolean includeChildMessages)
Description copied from interface:ISemanticNode
This method detects whether a specific message is found within the semantic node. The boolean argument may be used to indicate if only the messages of this node should be checked, or also the messages of any child nodes. The severity parameter may be used to specify if only messages matching that severity should be searched. When the severity parameter is null, all messages regardless of severity will be searched.- Specified by:
hasMessage
in interfaceISemanticNode
- Parameters:
severity
- The severity of the error (optional).errorCode
- The error code for which to search.includeChildMessages
- Boolean indicating if child messages should also be checked.- Returns:
- A boolean indicating the error was found in the node.
-
-