public class ExpressionLeaf extends ExpressionTree
ExpressionTree
Ein Blatt enthält entweder eine Zeichenkette, Bool, Attribute, Zahlen oder
eine Funktion mit AusdruckModifier and Type | Class and Description |
---|---|
static class |
ExpressionLeaf.LeafType
Typ, der in diesem Blatt gespeichert wird.
|
ExpressionTree.Operation
Modifier and Type | Field and Description |
---|---|
private java.util.List<AttributeDescription> |
_attributes |
private java.lang.Boolean |
_bool |
private java.lang.Double |
_doubleN |
private java.util.List<ExpressionTree> |
_expressionList
Operanden der Funktion (Jedes Listenelement entspricht einem Operanden)
|
private ExpressionInterface |
_expressionObject
Funktion
|
private java.lang.Long |
_longN |
private java.lang.String |
_string |
private ExpressionLeaf.LeafType |
_type
Typ der in diesem Blatt gespeichert wird.
|
left, operation, right
Modifier | Constructor and Description |
---|---|
private |
ExpressionLeaf()
Lege Blatt ohne Wert an.
|
|
ExpressionLeaf(AttributeDescription a)
Legt ein Blatt an, das ein Attribut speichert
|
|
ExpressionLeaf(AttributeDescription[] a)
Legt ein Blatt an, das mehrere Attribute speichert.
|
|
ExpressionLeaf(java.lang.Boolean b)
Legt ein Blatt mit einem booleschen Wert an.
|
|
ExpressionLeaf(java.lang.Double d)
Legt ein Blatt an, das eine Fließkommazahl speichert
|
|
ExpressionLeaf(java.lang.Long n)
Legt ein Blatt an, das eine Ganzzahl speichert
|
|
ExpressionLeaf(java.lang.String s)
Legt ein Blatt an, das einen String speichert
|
|
ExpressionLeaf(java.lang.String functionName,
java.util.List<ExpressionTree> expressionList)
Legt ein Blatt an, das eine Funktion beinhaltet
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsAttribute()
Überprüft ob der Ausdruck ein Attribut enthält.
|
static ExpressionLeaf |
createDoubleLeaf(antlr.collections.AST ast,
java.lang.String number)
Erzeugt ein Blatt das die Fließkommazahl 'number' speichert
|
static ExpressionLeaf |
createLongLeaf(antlr.collections.AST ast,
java.lang.String number)
Erzeugt ein Blatt das die ganzzahl 'number' speichert
|
boolean |
equals(java.lang.Object other) |
ExpressionResultAndState |
evaluateEx(java.util.Hashtable<RealElement,BaseDataSet> realElements,
java.util.Hashtable<TempAttributeDescription,TempAttribut> tempElements,
int pseudoObjectIndex)
Gibt den Ausdruck zurück, der in diesem Blatt abgelegt ist Ist es ein Attribut, wird der Wert aus der übergebenen Hashtable gesucht.
|
protected void |
getAttributeOrder(java.util.ArrayList<AttributeDescription> list,
java.util.HashSet<AttributeDescription> visited)
Liefert alle Attribute auf die der Baum zugreift.
|
java.util.List<AttributeDescription> |
getAttributes()
Liefert alle Attribute, auf die der Baum zugreift, zurück.
|
java.lang.Boolean |
getBool() |
java.util.HashSet<TempAttributeDescription> |
getDirectTempAttributes()
Liefert ein Set mit den temporären Attributen, die dieser Ausdruck direkt verwendet.
|
java.lang.Double |
getDouble() |
java.util.List<ExpressionTree> |
getExpressionList() |
ExpressionInterface |
getExpressionObject() |
RealAttributeDescription |
getFirstRealAttribute()
Liefert das erste Reale Attribut, das im Ausdruck verwendet wird.
|
TempAttributeDescription |
getFirstTempAttribute()
Liefert das erste temporäre Attribut, das im Ausdruck verwendet wird.
|
java.lang.Long |
getLong() |
int |
getNumColumns()
Gibt zurück, für wie viele Spalten ein TempAttribut definiert werden soll, dass diesen Ausdruck verwendet (bei der Verwendung von Aliasen in Attributen)
|
java.util.HashSet<RealAttributeDescription> |
getRealAttributes()
Liefert alle realen Attribute die im Ausdruck verwendet werden.
|
ExpressionResult.ResultType |
getResultType(antlr.collections.AST ast)
Gibt zurück, welchen Datentyp dieses Blatt liefert.
|
java.lang.String |
getString() |
ExpressionLeaf.LeafType |
getType() |
private static ExpressionResult.ResultType |
resultTypeFromAttributeType(SystemObject type,
antlr.collections.AST ast)
Gitbt anhand eines Attributtyps den erwarteteten Datentyp zurück.
|
java.lang.String |
toString() |
evaluate
private java.lang.Double _doubleN
private java.lang.Long _longN
private java.util.List<AttributeDescription> _attributes
private java.lang.String _string
private java.lang.Boolean _bool
private ExpressionInterface _expressionObject
private java.util.List<ExpressionTree> _expressionList
private ExpressionLeaf.LeafType _type
private ExpressionLeaf()
public ExpressionLeaf(java.lang.Boolean b)
b
- Wert des Blattespublic ExpressionLeaf(java.lang.String s)
s
- Stringpublic ExpressionLeaf(AttributeDescription a)
a
- Attributpublic ExpressionLeaf(AttributeDescription[] a)
a
- Attributpublic ExpressionLeaf(java.lang.Double d)
d
- Doublepublic ExpressionLeaf(java.lang.Long n)
n
- Ganzzahlpublic ExpressionLeaf(java.lang.String functionName, java.util.List<ExpressionTree> expressionList) throws CriticalParserException
functionName
- Name der Klasse, die die Funktion repräsentiertexpressionList
- Operanden der Funktion (Jedes Listenelement entspricht einem Operanden)CriticalParserException
- Zur Funktion passende KLasse existiert nicht.public java.util.List<AttributeDescription> getAttributes()
ExpressionTree
getAttributes
in class ExpressionTree
protected void getAttributeOrder(java.util.ArrayList<AttributeDescription> list, java.util.HashSet<AttributeDescription> visited)
ExpressionTree
getAttributeOrder
in class ExpressionTree
list
- liste der Elementevisited
- Elemente die bereits in der Liste eingetragen wurden.ExpressionTree.getAttributeOrder(ArrayList,HashSet)
public ExpressionResultAndState evaluateEx(java.util.Hashtable<RealElement,BaseDataSet> realElements, java.util.Hashtable<TempAttributeDescription,TempAttribut> tempElements, int pseudoObjectIndex)
ExpressionResult.getType()
den Wert ExpressionResult.ResultType.NONE
. Falls der
Typ des Verwendeten realen Attributs nicht unterstützt wird (z.B. ReferenceAttributeType
) ist result.type = error;evaluateEx
in class ExpressionTree
realElements
- Mapping der realen Elemente zu den ihnen zugeordeten Werten.tempElements
- Mapping der temporären Attribute zu den ihnen zugeordneten Werten.pseudoObjectIndex
- Falls ein Attribut Aliase verwendet kann hier der Pseudoobjekt-Index festgelegt werden, von welchem Pseudoobjekt/Alias der Wert
geholt werden soll. Ansonsten -1.public ExpressionResult.ResultType getResultType(antlr.collections.AST ast) throws SemanticErrorException
getResultType
in class ExpressionTree
ast
- ASTSemanticErrorException
- Falls ein Fehler auftritt (aufgrund eines ungültigen Skripts)public int getNumColumns()
ExpressionTree
getNumColumns
in class ExpressionTree
private static ExpressionResult.ResultType resultTypeFromAttributeType(SystemObject type, antlr.collections.AST ast) throws SemanticErrorException
type
- Attributtypast
- ASTSemanticErrorException
- Falls ein Fehler auftrittpublic static ExpressionLeaf createLongLeaf(antlr.collections.AST ast, java.lang.String number) throws SemanticErrorException
ast
- Knoten, der die Zahl enthält (wird nur für die Zeilenangabe in der Fehlermeldung benötigt)number
- Ganz- oder FliesskommazahlSemanticErrorException
- Falls 'number' eine ungültige Zahl istpublic static ExpressionLeaf createDoubleLeaf(antlr.collections.AST ast, java.lang.String number) throws SemanticErrorException
ast
- Knoten, der die Zahl enthält (wird nur für die Zeilenangabe in der Fehlermeldung benötigt)number
- Ganz- oder FliesskommazahlSemanticErrorException
- Falls 'number' eine ungültige Zahl istpublic java.lang.String toString()
toString
in class ExpressionTree
Object.toString()
public RealAttributeDescription getFirstRealAttribute()
ExpressionTree
getFirstRealAttribute
in class ExpressionTree
ExpressionTree.getFirstRealAttribute()
public TempAttributeDescription getFirstTempAttribute()
ExpressionTree
getFirstTempAttribute
in class ExpressionTree
ExpressionTree.getFirstTempAttribute()
public java.util.HashSet<TempAttributeDescription> getDirectTempAttributes()
ExpressionTree
getDirectTempAttributes
in class ExpressionTree
ExpressionTree.getDirectTempAttributes()
public java.util.HashSet<RealAttributeDescription> getRealAttributes()
ExpressionTree
getRealAttributes
in class ExpressionTree
ExpressionTree.getRealAttributes()
public boolean equals(java.lang.Object other)
equals
in class ExpressionTree
Object.equals(java.lang.Object)
public boolean containsAttribute()
ExpressionTree
containsAttribute
in class ExpressionTree
true
falls der Ausdruck ein Attribut enthält.false
sonst.ExpressionTree.containsAttribute()
public ExpressionLeaf.LeafType getType()
public java.lang.Boolean getBool()
public java.lang.Double getDouble()
public java.lang.Long getLong()
public java.lang.String getString()
public java.util.List<ExpressionTree> getExpressionList()
getExpressionObject()
public ExpressionInterface getExpressionObject()
getExpressionList()