Package org.tensorics.core.lang
Class TensoricScript<E,T>
- java.lang.Object
-
- org.tensorics.core.lang.TensoricExpressionSupport<E>
-
- org.tensorics.core.lang.TensoricScript<E,T>
-
- Type Parameters:
E
- the type of the elements of the field on which all the calculations are based on.T
- the type which shall be returned by the script, after it is executed (resolved)
- All Implemented Interfaces:
java.io.Serializable
,Expression<T>
,Node
- Direct Known Subclasses:
DoubleScript
public abstract class TensoricScript<E,T> extends TensoricExpressionSupport<E> implements Expression<T>, java.io.Serializable
This class is intended to be subclassed in order to describe calculations with tensorics, which shall be executed at a later time. This class itself inherits fromTensoricExpressionSupport
such that it provides the full capability of the eDSL.To define a script, a field has to be given in the constructor, which describes all the operations which can be performed on its elements.
The script logic itself has to be implemented in the
describe()
method. To resolve a script, aResolvingEngine
has to be used.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TensoricScript(EnvironmentImpl<E> environment)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Expression<T>
describe()
boolean
equals(java.lang.Object obj)
T
get()
Retrieves the value of the expression.java.util.List<Node>
getChildren()
Has to return the children of the node.Expression<T>
getInternalExpression()
int
hashCode()
boolean
isResolved()
returnstrue
if the expression contains a concrete value.java.lang.String
toString()
-
Methods inherited from class org.tensorics.core.lang.TensoricExpressionSupport
averageOf, averageOf, averageOfF, calculate, calculate, calculate, calculate, calculateQ, calculateQTB, calculateT, calculateTB, elementInverseOf, elementNegativeOf, elementNegativeOfQTB, elementNegativeOfTB, inverseOf, inverseOf, inverseOf, negativeOf, negativeOf, negativeOf, one, ones, rmsOf, rmsOf, rmsOfF, sizeOf, sizeOf, squareOf, squareOf, squareRootOf, squareRootOf, sumOf, sumOf, sumOfSquaresOf, sumOfSquaresOf, testIf, testIfIt, two, valueOf, valueOf, with, withConversionAndComparator, zero, zeros
-
-
-
-
Constructor Detail
-
TensoricScript
public TensoricScript(EnvironmentImpl<E> environment)
-
-
Method Detail
-
describe
protected abstract Expression<T> describe()
-
getChildren
public java.util.List<Node> getChildren()
Description copied from interface:Node
Has to return the children of the node. This must never returnnull
- Specified by:
getChildren
in interfaceNode
- Returns:
- a list containing all the children of the node
-
isResolved
public boolean isResolved()
Description copied from interface:Expression
returnstrue
if the expression contains a concrete value. Thus the methodExpression.get()
can be used to retrieve the actual value. If this method returnsfalse
, then the get method will throw an exception.- Specified by:
isResolved
in interfaceExpression<E>
- Returns:
true
if the value can be retrieved,false
otherwise.
-
get
public T get()
Description copied from interface:Expression
Retrieves the value of the expression. If the expression is deferred, then an expression will be thrown.- Specified by:
get
in interfaceExpression<E>
- Returns:
- the value of the expression.
-
getInternalExpression
public Expression<T> getInternalExpression()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-