Class TLcdExpressionFactory
This builder contains static methods to construct nested expressions
.
- Boolean operations:
and
,or
,not
,eq
,neq
,lt
,lte
,gt
,gte
- Numerical operations:
min
,max
,clamp
,mix
,add
,sub
,mul
,div
,between
,fraction
- Control operations:
ifThenElse
,map
,mixmap
,cases
,when
- Value expressions:
constant
,attribute
,parameter
- Trigonometric operations:
sin
,cos
,tan
,asin
,acos
,atan
- Vector operations:
cross product
,dot product
,divide
,multiply
,add
,substract
- Distance operations:
distance
,view position
- Type conversion operations:
float
Attributes are used to retrieve values from domain objects. The values can be retrieved in three ways:
- By implementing a simple
AttributeValueProvider
: seehere
- From
ILcdDataObject
s by supplying aTLcdDataProperty
: seehere
- From
ILcdDataObject
s by supplying aILcdDataObjectExpression
: seehere
Parameters are like constants, but can be varied over time, without having to re-create the expression they are used in. They can be created using parameter
.
Examples
This expression will return a color depending on whether an ID is 4321.
ILcdExpression<Integer> idAttribute = attribute(Integer.class, dataType.getProperty("ID"));
ILcdExpression<Color> expression = ifThenElse(eq(idAttribute, constant(4321)), constant(Color.red), constant(Color.blue))
This expression returns true for objects that have class 43 and lie in a time window specified by varying parameters.
ILcdParameter<Integer> minTimeParameter = parameter("minTime", 0);
ILcdParameter<Integer> maxTimeParameter = parameter("maxTime", 1);
ILcdExpression<Boolean> visible = and(eq(classAttribute, constant(43)), between(timeAttribute, minTimeParameter, maxTimeParameter));
- Since:
- 2012.1
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Can retrieve values from domain objects.static interface
An expression that can be used to chain many if-then expressions. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Number>
ILcdExpression<Float> acos
(ILcdExpression<T> aValue) Returns an expression that is the arc cosine of the input value; the returned angle is in the range 0.0 through pi.static <T extends Number>
ILcdExpression<T> add
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that adds up its parameters.static <T extends Number>
ILcdExpression<T> add
(ILcdExpression<T> aLeft, T aRight) Returns an expression that adds up its parameters.static <T extends Number>
ILcdExpression<T> add
(T aLeft, ILcdExpression<T> aRight) Returns an expression that adds up its parameters.static <T extends ILcdPoint>
ILcdExpression<T> addPoint
(ILcdExpression<T> aLeft, ILcdExpression<? extends Number> aRight) Returns an expression that adds a number to a point.static <T extends ILcdPoint>
ILcdExpression<T> addPoints
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that adds two points.static ILcdExpression
<Boolean> and
(ILcdExpression<Boolean> aLeft, ILcdExpression<Boolean> aRight) Returns an expression that is the boolean 'and' of its parts.static <T extends Number>
ILcdExpression<Float> asin
(ILcdExpression<T> aValue) Returns an expression that is the arc sine of the input value; the returned angle is in the range -pi/2 through pi/2.static <T extends Number>
ILcdExpression<Float> atan
(ILcdExpression<T> aValue) Returns an expression that is the arc tangent of the input value; the returned angle is in the range -pi/2 through pi/2.static <T> ILcdExpression
<T> attribute
(Class<T> aType, TLcdDataProperty aProperty) Creates a new attribute expression that can retrieve values from data properties.static <T> ILcdExpression
<T> attribute
(String aName, Class<T> aType, ILcdDataObjectExpression aExpression) Creates a new attribute expression that can retrieve values from domain objects.static <T> ILcdExpression
<T> attribute
(String aName, Class<T> aType, TLcdExpressionFactory.AttributeValueProvider<T> aProvider) Creates a new attribute expression that can retrieve values from domain objects.static <T extends Number>
ILcdExpression<Boolean> between
(ILcdExpression<T> aValue, ILcdExpression<T> aLowerBound, ILcdExpression<T> aUpperBound) Returns an expression that verifies if a given value is between a lower and upper bound.static <T> TLcdExpressionFactory.CaseExpression
<T> cases
(ILcdExpression<T> aDefault) Returns an expression that can be used to chain multiple if-then statements together.static <T> TLcdExpressionFactory.CaseExpression
<T> cases
(T aDefault) Returns an expression that can be used to chain multiple if-then statements together.static <T extends Number>
ILcdExpression<T> clamp
(ILcdExpression<T> aValue, ILcdExpression<T> aMin, ILcdExpression<T> aMax) Returns an expression that limits a value to the given range.static <T extends Number>
ILcdExpression<T> clamp
(ILcdExpression<T> aValue, T aMin, T aMax) Returns an expression that limits a value to the given range.static <T> ILcdExpression
<T> constant
(T aValue) Returns an expression that always evaluates to the same constant value.static <T extends Number>
ILcdExpression<Float> cos
(ILcdExpression<T> aValue) Returns an expression that is the trigonometric cosine of the input value.static <T extends ILcdPoint>
ILcdExpression<T> crossProduct
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that calculates the cross product of two points.static <T extends ILcdPoint>
ILcdExpression<Float> distance
(ILcdExpression<T> aFirst, ILcdExpression<T> aSecond) Returns an expression that is the Euclidean distance between two points.static <T extends Number>
ILcdExpression<T> div
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that divides its parameters.static <T extends Number>
ILcdExpression<T> div
(ILcdExpression<T> aLeft, T aRight) Returns an expression that divides its parameters.static <T extends Number>
ILcdExpression<T> div
(T aLeft, ILcdExpression<T> aRight) Returns an expression that divides its parameters.static <T extends ILcdPoint>
ILcdExpression<T> dividePoint
(ILcdExpression<T> aLeft, ILcdExpression<? extends Number> aRight) Returns an expression that divides a point with a number.static <T extends ILcdPoint>
ILcdExpression<Float> dotProduct
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that calculates the dot product of two points.static <T> ILcdExpression
<Boolean> eq
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that verifies if its parameters are equal.static <T> ILcdExpression
<Boolean> eq
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight, float aEpsilon) Returns an expression that verifies if its parameters are equal given an epsilon deviation.static <T extends Number>
ILcdExpression<Boolean> eq
(ILcdExpression<T> aLeft, T aRight) Returns an expression that verifies if its parameters are equal.static <T extends Number>
ILcdExpression<Boolean> eq
(T aLeft, ILcdExpression<T> aRight) Returns an expression that verifies if its parameters are equal.static <T extends Number>
ILcdExpression<T> fraction
(ILcdExpression<T> aValue, ILcdExpression<T> aLowerBound, ILcdExpression<T> aUpperBound) Returns an expression that calculates the percentage of the given value in the range [aLowerBound, aUpperBound].static <T extends Number>
ILcdExpression<T> fraction
(ILcdExpression<T> aValue, T aLowerBound, T aUpperBound) Returns an expression that calculates the percentage of the given value in the range [aLowerBound, aUpperBound].static <T extends Number>
ILcdExpression<Boolean> gt
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the greater-than operator.static <T extends Number>
ILcdExpression<Boolean> gt
(ILcdExpression<T> aLeft, T aRight) Returns an expression that compares its parts using the greater-than operator.static <T extends Number>
ILcdExpression<Boolean> gt
(T aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the greater-than operator.static <T extends Number>
ILcdExpression<Boolean> gte
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the greater-than-or-equal operator.static <T extends Number>
ILcdExpression<Boolean> gte
(ILcdExpression<T> aLeft, T aRight) Returns an expression that compares its parts using the greater-than-or-equal operator.static <T extends Number>
ILcdExpression<Boolean> gte
(T aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the greater-than-or-equal operator.static <T> ILcdExpression
<T> ifThenElse
(ILcdExpression<Boolean> aIf, ILcdExpression<T> aThen, ILcdExpression<T> aElse) Returns an expression that corresponds to an if-then-else structure.static <T extends Number>
ILcdExpression<Float> log
(ILcdExpression<T> aValue) Returns an expression that is the natural logarithm of the parameter.static <L extends Number,
R extends Number>
ILcdExpression<Boolean> lt
(ILcdExpression<L> aLeft, ILcdExpression<R> aRight) Returns an expression that compares its parts using the less-than operator.static <T extends Number>
ILcdExpression<Boolean> lt
(ILcdExpression<T> aLeft, T aRight) Returns an expression that compares its parts using the less-than operator.static <T extends Number>
ILcdExpression<Boolean> lt
(T aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the less-than operator.static <T extends Number>
ILcdExpression<Boolean> lte
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the less-than-or-equal operator.static <T extends Number>
ILcdExpression<Boolean> lte
(ILcdExpression<T> aLeft, T aRight) Returns an expression that compares its parts using the less-than-or-equal operator.static <T extends Number>
ILcdExpression<Boolean> lte
(T aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the less-than-or-equal operator.static <T,
I extends Number>
ILcdExpression<T> map
(ILcdExpression<I> aIndex, ILcdExpression<T>[] aValues, ILcdExpression<T> aDefault) Returns an expression that maps an index onto an expression.static <T,
I extends Number>
ILcdExpression<T> map
(ILcdExpression<I> aIndex, T[] aValues, T aDefault) Returns an expression that maps an index onto a value.static <T extends Number>
ILcdExpression<T> max
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that returns the maximum of its parameters.static <T extends Number>
ILcdExpression<T> max
(ILcdExpression<T> aLeft, T aRight) Returns an expression that returns the maximum of its parameters.static <T extends Number>
ILcdExpression<T> max
(T aLeft, ILcdExpression<T> aRight) Returns an expression that returns the maximum of its parameters.static <T extends Number>
ILcdExpression<T> min
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that returns the minimum of its parameters.static <T extends Number>
ILcdExpression<T> min
(ILcdExpression<T> aLeft, T aRight) Returns an expression that returns the minimum of its parameters.static <T extends Number>
ILcdExpression<T> min
(T aLeft, ILcdExpression<T> aRight) Returns an expression that returns the minimum of its parameters.static <R,
T extends Number>
ILcdExpression<R> mix
(ILcdExpression<R> aFrom, ILcdExpression<R> aTo, ILcdExpression<T> aFraction) Returns an expression that calculates an interpolated or extrapolated result betweenaFrom
andaTo
based on the given fraction.static <R,
T extends Number>
ILcdExpression<R> mix
(R aFrom, R aTo, ILcdExpression<T> aFraction) Returns an expression that calculates an interpolated or extrapolated result betweenaFrom
andaTo
based on the given fraction.static <R> ILcdExpression
<R> mixmap
(ILcdExpression<Float> aValue, float[] aThresholds, R[] aValues) static ILcdExpression
<Color> mixmap
(ILcdExpression<Float> aValue, TLcdColorMap aColorMap) Returns an expression that behaves as acolor map
.static <R> ILcdExpression
<R> mixmap
(ILcdExpression<Float> aFraction, R[] aValues) static <T extends Number>
ILcdExpression<T> mod
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that finds the modulus of its left parameter with respect to the right parameter.static <T extends Number>
ILcdExpression<T> mod
(ILcdExpression<T> aLeft, T aRight) Returns an expression that finds the modulus of its left parameter with respect to the right parameter.static <T extends Number>
ILcdExpression<T> mod
(T aLeft, ILcdExpression<T> aRight) Returns an expression that finds the modulus of its left parameter with respect to the right parameter.static <T extends Number>
ILcdExpression<ILcdPoint> modPoint
(ILcdExpression<ILcdPoint> aLeft, ILcdExpression<T> aRight) Returns an expression that finds the modulus of its left parameter with respect to the right parameter.static <T extends Number>
ILcdExpression<T> mul
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that multiplies its parameters.static <T extends Number>
ILcdExpression<T> mul
(ILcdExpression<T> aLeft, T aRight) Returns an expression that multiplies its parameters.static <T extends Number>
ILcdExpression<T> mul
(T aLeft, ILcdExpression<T> aRight) Returns an expression that multiplies its parameters.static <T extends ILcdPoint>
ILcdExpression<T> multiplyPoint
(ILcdExpression<T> aLeft, ILcdExpression<? extends Number> aRight) Returns an expression that multiplies a point with a number.static <T> ILcdExpression
<Boolean> neq
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that verifies if its parameters are not equal.static <T> ILcdExpression
<Boolean> neq
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight, float aEpsilon) Returns an expression that verifies if its parameters are not equal given an epsilon deviation.static <T extends Number>
ILcdExpression<Boolean> neq
(ILcdExpression<T> aLeft, T aRight) Returns an expression that verifies if its parameters are not equal.static <T extends Number>
ILcdExpression<Boolean> neq
(T aLeft, ILcdExpression<T> aRight) Returns an expression that verifies if its parameters are not equal.static ILcdExpression
<Boolean> not
(ILcdExpression<Boolean> aParameter) Returns an expression that is the boolean 'not' of its parameter.static ILcdExpression
<Boolean> or
(ILcdExpression<Boolean> aLeft, ILcdExpression<Boolean> aRight) Returns an expression that is the boolean 'or' of its parts.static <T> ILcdParameter
<T> Creates a new parameter expression.static <R,
T extends Number>
ILcdExpression<R> scale
(ILcdExpression<R> aValue, ILcdExpression<T> aScale) Returns an expression that scales a given value by a factor.static <T extends Number>
ILcdExpression<Float> sin
(ILcdExpression<T> aValue) Returns an expression that is the trigonometric sine of the input value.static <T extends Number>
ILcdExpression<T> sub
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that subtracts its parameters.static <T extends Number>
ILcdExpression<T> sub
(ILcdExpression<T> aLeft, T aRight) Returns an expression that subtracts its parameters.static <T extends Number>
ILcdExpression<T> sub
(T aLeft, ILcdExpression<T> aRight) Returns an expression that subtracts its parameters.static <T extends ILcdPoint>
ILcdExpression<T> subtractPoint
(ILcdExpression<T> aLeft, ILcdExpression<? extends Number> aRight) Returns an expression that subtracts a number from a point.static <T extends ILcdPoint>
ILcdExpression<T> subtractPoints
(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that subtracts two points.static <T extends Number>
ILcdExpression<Float> tan
(ILcdExpression<T> aValue) Returns an expression that is the trigonometric tangent of the input value.static ILcdExpression
<Float> toFloat
(ILcdExpression<? extends Number> aValue) Returns an expression that converts (casts) to floating point number.static ILcdExpression
<ILcdPoint> Returns an expression that represents the swing view position of the object.
-
Method Details
-
and
public static ILcdExpression<Boolean> and(ILcdExpression<Boolean> aLeft, ILcdExpression<Boolean> aRight) Returns an expression that is the boolean 'and' of its parts.For example,
and(constant(true), constant(false))
returns true.- Parameters:
aLeft
- Expression parameteraRight
- Expression parameter- Returns:
- A boolean expression
-
or
public static ILcdExpression<Boolean> or(ILcdExpression<Boolean> aLeft, ILcdExpression<Boolean> aRight) Returns an expression that is the boolean 'or' of its parts.For example,
or(constant(true), constant(false))
returns true.- Parameters:
aLeft
- Expression parameteraRight
- Expression parameter- Returns:
- A boolean expression
-
not
Returns an expression that is the boolean 'not' of its parameter.For example,
not(constant(true))
returns false.- Parameters:
aParameter
- Expression parameter- Returns:
- A boolean expression
-
lt
public static <L extends Number,R extends Number> ILcdExpression<Boolean> lt(ILcdExpression<L> aLeft, ILcdExpression<R> aRight) Returns an expression that compares its parts using the less-than operator.The expression evaluates to
true
ifaLeft < aRight
.For example,
lt(constant(3), constant(5))
returns true.- Type Parameters:
L
- Type of the left-side expression, must be aNumber
R
- Type of the left-side expression, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- A boolean expression
-
lt
Returns an expression that compares its parts using the less-than operator.The expression evaluates to
true
ifaLeft < aRight
.For example,
lt(3, constant(5))
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- A boolean expression
-
lt
Returns an expression that compares its parts using the less-than operator.The expression evaluates to
true
ifaLeft < aRight
.For example,
lt(constant(3), 5)
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- A boolean expression
-
lte
public static <T extends Number> ILcdExpression<Boolean> lte(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the less-than-or-equal operator.The expression evaluates to
true
ifaLeft <= aRight
.For example,
lte(constant(3), constant(3))
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- A boolean expression
-
lte
Returns an expression that compares its parts using the less-than-or-equal operator.The expression evaluates to
true
ifaLeft <= aRight
.For example,
lte(3, constant(3))
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- A boolean expression
-
lte
Returns an expression that compares its parts using the less-than-or-equal operator.The expression evaluates to
true
ifaLeft <= aRight
.For example,
lte(constant(3), 3)
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- A boolean expression
-
gt
public static <T extends Number> ILcdExpression<Boolean> gt(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the greater-than operator.The expression evaluates to
true
ifaLeft > aRight
.For example,
gt(constant(3), constant(3))
returns false.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- A boolean expression
-
gt
Returns an expression that compares its parts using the greater-than operator.The expression evaluates to
true
ifaLeft > aRight
.For example,
gt(3, constant(3))
returns false.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- A boolean expression
-
gt
Returns an expression that compares its parts using the greater-than operator.The expression evaluates to
true
ifaLeft > aRight
.For example,
gt(constant(3), 3)
returns false.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- A boolean expression
-
gte
public static <T extends Number> ILcdExpression<Boolean> gte(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that compares its parts using the greater-than-or-equal operator.The expression evaluates to
true
ifaLeft >= aRight
.For example,
gte(constant(3), constant(3))
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- A boolean expression
-
gte
Returns an expression that compares its parts using the greater-than-or-equal operator.The expression evaluates to
true
ifaLeft >= aRight
.For example,
gte(3, constant(3))
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- A boolean expression
-
gte
Returns an expression that compares its parts using the greater-than-or-equal operator.The expression evaluates to
true
ifaLeft >= aRight
.For example,
gte(constant(3), 3)
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- A boolean expression
-
between
public static <T extends Number> ILcdExpression<Boolean> between(ILcdExpression<T> aValue, ILcdExpression<T> aLowerBound, ILcdExpression<T> aUpperBound) Returns an expression that verifies if a given value is between a lower and upper bound.In other words, this expression checks whether
aValue
is in the range[aLowerBound, aUpperBound]
.The expression evaluates to
true
ifaValue >= aLowerBound
andaValue <= aUpperBound
.For example,
between(constant(4), constant(3), constant(5))
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aValue
- Value to evaluateaLowerBound
- Lower-bound expressionaUpperBound
- Upper-bound expression- Returns:
- A boolean expression
-
eq
public static <T> ILcdExpression<Boolean> eq(ILcdExpression<T> aLeft, ILcdExpression<T> aRight, float aEpsilon) Returns an expression that verifies if its parameters are equal given an epsilon deviation.The expression evaluates to
true
ifMath.abs(aLeft-aRight) <= aEpsilon
(for numbers). For points and colors each component is checked for equality with the epsilon value. For objects e.g.ILcdIcon
, the epsilon value is ignored.For example,
eq(constant(3.005), constant(3), 0.01f)
returns true.- Type Parameters:
T
- Type of the parameter expressions- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expressionaEpsilon
- the allowed epsilon value for the equality check.- Returns:
- A boolean expression
- Since:
- 2021.1
-
eq
Returns an expression that verifies if its parameters are equal.The expression evaluates to
true
ifaLeft
==aRight
(for numbers), oraLeft.equals(aRight)
(for objects).For example,
eq(constant(3), constant(4))
returns false.- Type Parameters:
T
- Type of the parameter expressions- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- A boolean expression
-
eq
Returns an expression that verifies if its parameters are equal.The expression evaluates to
true
ifaLeft
==aRight
.For example,
eq(3, constant(4))
returns false.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- A boolean expression
-
eq
Returns an expression that verifies if its parameters are equal.The expression evaluates to
true
ifaLeft
==aRight
.For example,
eq(constant(3), 4)
returns false.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- A boolean expression
-
neq
public static <T> ILcdExpression<Boolean> neq(ILcdExpression<T> aLeft, ILcdExpression<T> aRight, float aEpsilon) Returns an expression that verifies if its parameters are not equal given an epsilon deviation.The expression evaluates to
false
ifMath.abs(aLeft-aRight) <= aEpsilon
(for numbers). For points and colors each component is checked for non-equality with the epsilon value. For objects e.g.ILcdIcon
, the epsilon value is ignored.For example,
eq(constant(3.005), constant(3), 0.01f)
returns false.- Type Parameters:
T
- Type of the parameter expressions- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expressionaEpsilon
- the allowed epsilon value for the non-equality check.- Returns:
- A boolean expression
- Since:
- 2021.1
-
neq
Returns an expression that verifies if its parameters are not equal.The expression evaluates to
true
ifaLeft
!=aRight
(for numbers), or!aLeft.equals(aRight)
(for objects).For example,
neq(constant(3), constant(4))
returns true.- Type Parameters:
T
- Type of the parameter expressions- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- A boolean expression
-
neq
Returns an expression that verifies if its parameters are not equal.The expression evaluates to
true
ifaLeft
!=aRight
.For example,
neq(3, constant(4))
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- A boolean expression
-
neq
Returns an expression that verifies if its parameters are not equal.The expression evaluates to
true
ifaLeft
!=aRight
.For example,
neq(constant(3), 4)
returns true.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- A boolean expression
-
mul
public static <T extends Number> ILcdExpression<T> mul(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that multiplies its parameters.The expression evaluates
aLeft
*aRight
.For example,
mul(constant(3), constant(4))
returns 12.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a number
-
mul
Returns an expression that multiplies its parameters.The expression evaluates
aLeft
*aRight
.For example,
mul(3, constant(4))
returns 12.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- An expression that returns a number
-
mul
Returns an expression that multiplies its parameters.The expression evaluates
aLeft
*aRight
.For example,
mul(constant(3), 4)
returns 12.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- An expression that returns a number
-
multiplyPoint
public static <T extends ILcdPoint> ILcdExpression<T> multiplyPoint(ILcdExpression<T> aLeft, ILcdExpression<? extends Number> aRight) Returns an expression that multiplies a point with a number.The expression evaluates
aLeft
*aRight
.For example,
multiplyPoint(constant(new TLcdXYZPoint(2, 3, 4)), constant(2))
returnsnew TLcdXYZPoint(4, 6, 8)
.- Type Parameters:
T
- Type of the parameter expressions, must be aILcdPoint
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a point
- Since:
- 2018.0
-
div
public static <T extends Number> ILcdExpression<T> div(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that divides its parameters.The expression evaluates
aLeft
/aRight
.For example,
div(constant(5.0), constant(2.0))
returns 2.5.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a number
-
div
Returns an expression that divides its parameters.The expression evaluates
aLeft
/aRight
.For example,
div(5.0, constant(2.0))
returns 2.5.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- An expression that returns a number
-
div
Returns an expression that divides its parameters.The expression evaluates
aLeft
/aRight
.For example,
div(constant(5.0), 2.0)
returns 2.5.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- An expression that returns a number
-
dividePoint
public static <T extends ILcdPoint> ILcdExpression<T> dividePoint(ILcdExpression<T> aLeft, ILcdExpression<? extends Number> aRight) Returns an expression that divides a point with a number.The expression evaluates
aLeft
/aRight
.For example,
dividePoint(constant(new TLcdXYZPoint(2, 3, 4)), constant(2))
returnsnew TLcdXYZPoint(1, 1.5, 2)
.- Type Parameters:
T
- Type of the parameter expressions, must be aILcdPoint
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a point
- Since:
- 2018.0
-
modPoint
public static <T extends Number> ILcdExpression<ILcdPoint> modPoint(ILcdExpression<ILcdPoint> aLeft, ILcdExpression<T> aRight) Returns an expression that finds the modulus of its left parameter with respect to the right parameter.The expression evaluates
aLeft
%aRight
.For example,
modPoint(constant(new TLcdXYZPoint(7, 8, 9)), constant(3))
returnsnew TLcdXYZPoint(1, 2, 0)
.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns an
ILcdPoint
- Since:
- 2018.0
-
mod
public static <T extends Number> ILcdExpression<T> mod(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that finds the modulus of its left parameter with respect to the right parameter.The expression evaluates
aLeft
%aRight
.For example,
mod(constant(7.0), constant(3.0))
returns 1.0.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a number
- Since:
- 2018.0
-
mod
Returns an expression that finds the modulus of its left parameter with respect to the right parameter.The expression evaluates
aLeft
%aRight
.For example,
mod(7.0, constant(3.0))
returns 1.0.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- An expression that returns a number
- Since:
- 2018.0
-
mod
Returns an expression that finds the modulus of its left parameter with respect to the right parameter.The expression evaluates
aLeft
%aRight
.For example,
mod(constant(7.0), 3.0)
returns 1.0.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- An expression that returns a number
- Since:
- 2018.0
-
dotProduct
public static <T extends ILcdPoint> ILcdExpression<Float> dotProduct(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that calculates the dot product of two points.The expression evaluates
aLeft
.aRight
.For example,
dotProduct(constant(new TLcdXYZPoint(10, 10, 10)), constant(new TLcdXYZPoint(1, 1, 1)))
returns 30.0.- Type Parameters:
T
- Type of the parameter expressions, must be aILcdPoint
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a number
- Since:
- 2018.0
-
crossProduct
public static <T extends ILcdPoint> ILcdExpression<T> crossProduct(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that calculates the cross product of two points.The expression evaluates
aLeft
XaRight
.For example,
crossProduct(constant(new TLcdXYZPoint(2, 3, 4)), constant(new TLcdXYZPoint(5, 6, 7)))
returnsnew TLcdXYZPoint(-3, 6, -3)
.- Type Parameters:
T
- Type of the parameter expressions, must be aILcdPoint
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a point
- Since:
- 2018.0
-
add
public static <T extends Number> ILcdExpression<T> add(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that adds up its parameters.The expression evaluates
aLeft
+aRight
.For example,
add(constant(2), constant(3))
returns 5.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a number
-
add
Returns an expression that adds up its parameters.The expression evaluates
aLeft
+aRight
.For example,
add(2, constant(3))
returns 5.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- An expression that returns a number
-
add
Returns an expression that adds up its parameters.The expression evaluates
aLeft
+aRight
.For example,
add(constant(2), 3)
returns 5.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- An expression that returns a number
-
addPoint
public static <T extends ILcdPoint> ILcdExpression<T> addPoint(ILcdExpression<T> aLeft, ILcdExpression<? extends Number> aRight) Returns an expression that adds a number to a point.The expression evaluates
aLeft
+aRight
.For example,
addPoint(constant(new TLcdXYZPoint(2, 3, 4)), constant(5))
returnsnew TLcdXYZPoint(7, 8, 9)
.- Type Parameters:
T
- Type of the parameter expressions, must be aILcdPoint
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a point
- Since:
- 2018.0
-
addPoints
public static <T extends ILcdPoint> ILcdExpression<T> addPoints(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that adds two points.The expression evaluates
aLeft
+aRight
.For example,
addPoint(constant(new TLcdXYZPoint(2, 3, 4)), constant(new TLcdXYZPoint(1, 2, 3)))
returnsnew TLcdXYZPoint(3, 5, 7)
.- Type Parameters:
T
- Type of the parameter expressions, must be aILcdPoint
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a point
- Since:
- 2018.0
-
sub
public static <T extends Number> ILcdExpression<T> sub(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that subtracts its parameters.The expression evaluates
aLeft
-aRight
.For example,
sub(constant(2), constant(3))
returns -1.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a number
-
sub
Returns an expression that subtracts its parameters.The expression evaluates
aLeft
-aRight
.For example,
sub(2, constant(3))
returns -1.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- An expression that returns a number
-
sub
Returns an expression that subtracts its parameters.The expression evaluates
aLeft
-aRight
.For example,
sub(constant(2), 3)
returns -1.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- An expression that returns a number
-
subtractPoint
public static <T extends ILcdPoint> ILcdExpression<T> subtractPoint(ILcdExpression<T> aLeft, ILcdExpression<? extends Number> aRight) Returns an expression that subtracts a number from a point.The expression evaluates
aLeft
-aRight
.For example,
subtractPoint(constant(new TLcdXYZPoint(2, 3, 4)), constant(5))
returnsnew TLcdXYZPoint(-3, -2, -1)
.- Type Parameters:
T
- Type of the parameter expressions, must be aILcdPoint
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a point
- Since:
- 2018.0
-
subtractPoints
public static <T extends ILcdPoint> ILcdExpression<T> subtractPoints(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that subtracts two points.The expression evaluates
aLeft
-aRight
.For example,
subtractPoint(constant(new TLcdXYZPoint(2, 3, 4)), constant(new TLcdXYZPoint(1, 1, 1))
returnsnew TLcdXYZPoint(1, 2, 3)
.- Type Parameters:
T
- Type of the parameter expressions, must be aILcdPoint
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a point
- Since:
- 2018.0
-
min
public static <T extends Number> ILcdExpression<T> min(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that returns the minimum of its parameters.The expression evaluates to
aLeft
ifaLeft < aRight
,aRight
otherwise.For example,
min(constant(2), constant(3))
returns 2.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a number
-
min
Returns an expression that returns the minimum of its parameters.The expression evaluates to
aLeft
ifaLeft < aRight
,aRight
otherwise.For example,
min(2, constant(3))
returns 2.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- An expression that returns a number
-
min
Returns an expression that returns the minimum of its parameters.The expression evaluates to
aLeft
ifaLeft < aRight
,aRight
otherwise.For example,
min(constant(2), 3)
returns 2.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- An expression that returns a number
-
max
public static <T extends Number> ILcdExpression<T> max(ILcdExpression<T> aLeft, ILcdExpression<T> aRight) Returns an expression that returns the maximum of its parameters.The expression evaluates to
aLeft
ifaLeft > aRight
,aRight
otherwise.For example,
max(constant(2), constant(3))
returns 3.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side expression- Returns:
- An expression that returns a number
-
max
Returns an expression that returns the maximum of its parameters.The expression evaluates to
aLeft
ifaLeft > aRight
,aRight
otherwise.For example,
max(2, constant(3))
returns 3.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side constantaRight
- Right-side expression- Returns:
- An expression that returns a number
-
max
Returns an expression that returns the maximum of its parameters.The expression evaluates to
aLeft
ifaLeft > aRight
,aRight
otherwise.For example,
max(constant(2), 3)
returns 3.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aLeft
- Left-side expressionaRight
- Right-side constant- Returns:
- An expression that returns a number
-
clamp
public static <T extends Number> ILcdExpression<T> clamp(ILcdExpression<T> aValue, ILcdExpression<T> aMin, ILcdExpression<T> aMax) Returns an expression that limits a value to the given range.The expression evaluates to
max(aMin, min(aMax, aValue))
.For example,
clamp(constant(5), constant(10), constant(20))
returns 10.- Type Parameters:
T
- The type, must be a number- Parameters:
aValue
- The value to clampaMin
- The lower boundaMax
- The upper bound- Returns:
- An expression
-
clamp
Returns an expression that limits a value to the given range.The expression evaluates to
max(aMin, min(aMax, aValue))
.For example,
clamp(constant(5), 10, 20)
returns 10.- Type Parameters:
T
- The type, must be a number- Parameters:
aValue
- The value to clampaMin
- The lower boundaMax
- The upper bound- Returns:
- An expression
-
mix
public static <R,T extends Number> ILcdExpression<R> mix(ILcdExpression<R> aFrom, ILcdExpression<R> aTo, ILcdExpression<T> aFraction) Returns an expression that calculates an interpolated or extrapolated result betweenaFrom
andaTo
based on the given fraction.This expression is not limited to numbers, but can also be used to interpolate
ILcdPoint
orColor
objects.For example,
mix(constant(Color.black), constant(Color.white), constant(0.5))
results in a grey color.- Type Parameters:
R
- Type of the input and output expressionsT
- Type of the fraction expression, must be aNumber
- Parameters:
aFrom
- The value corresponding to fraction 0aTo
- The value corresponding to fraction 1aFraction
- The fraction, in range [0,1] for interpolation,< 0
or> 1
for extrapolation- Returns:
- An expression that returns an object corresponding to the input types
-
mix
public static <R,T extends Number> ILcdExpression<R> mix(R aFrom, R aTo, ILcdExpression<T> aFraction) Returns an expression that calculates an interpolated or extrapolated result betweenaFrom
andaTo
based on the given fraction.This expression is not limited to numbers, but can also be used to interpolate
ILcdPoint
orColor
objects.For example,
mix(constant(Color.black), constant(Color.white), constant(0.5))
results in a grey color.- Type Parameters:
R
- Type of the input and output expressionsT
- Type of the fraction expression, must be aNumber
- Parameters:
aFrom
- The value corresponding to fraction 0aTo
- The value corresponding to fraction 1aFraction
- The fraction, in range [0,1] for interpolation,< 0
or> 1
for extrapolation- Returns:
- An expression that returns an object corresponding to the input types
-
scale
public static <R,T extends Number> ILcdExpression<R> scale(ILcdExpression<R> aValue, ILcdExpression<T> aScale) Returns an expression that scales a given value by a factor.The expression evaluates to
aValue * aScale
.For example,
scale(constant(Color.WHITE), constant(0.5f)
results in a gray color.- Type Parameters:
R
- Type of the parameter expressionsT
- Type of the scale expressions, must be aNumber
- Parameters:
aValue
- Value the value to scaleaScale
- Lower the scale factor- Returns:
- An expression that returns the scaled value
-
fraction
public static <T extends Number> ILcdExpression<T> fraction(ILcdExpression<T> aValue, ILcdExpression<T> aLowerBound, ILcdExpression<T> aUpperBound) Returns an expression that calculates the percentage of the given value in the range [aLowerBound, aUpperBound].The expression evaluates to
aValue-aLowerBound / aUpperBound-aLowerBound
.For example,
fraction(constant(15), constant(10), constant(20))
results in0.5
.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aValue
- Value to testaLowerBound
- Lower bound expressionaUpperBound
- Upper bound expression- Returns:
- An expression that returns a number in range [0,1]
-
fraction
public static <T extends Number> ILcdExpression<T> fraction(ILcdExpression<T> aValue, T aLowerBound, T aUpperBound) Returns an expression that calculates the percentage of the given value in the range [aLowerBound, aUpperBound].The expression evaluates to
aValue-aLowerBound / aUpperBound-aLowerBound
.For example,
fraction(constant(15), 10, 20)
results in0.5
.- Type Parameters:
T
- Type of the parameter expressions, must be aNumber
- Parameters:
aValue
- Value to testaLowerBound
- Lower bound constantaUpperBound
- Upper bound constant- Returns:
- An expression that returns a number in range [0,1]
- Since:
- 2014.0
-
ifThenElse
public static <T> ILcdExpression<T> ifThenElse(ILcdExpression<Boolean> aIf, ILcdExpression<T> aThen, ILcdExpression<T> aElse) Returns an expression that corresponds to an if-then-else structure.The expression evaluates
aThen
ifaIf
returns true, otherwise it evaluatesaThen
.For example,
ifThenElse(lt(3, 5), constant(Color.black), constant(Color.white))
returns black.- Type Parameters:
T
- Type of the expressions- Parameters:
aIf
- a boolean expressionaThen
- the expression evaluated ifaIf
returns trueaElse
- the expression evaluated ifaIf
return false- Returns:
- An expression
-
map
public static <T,I extends Number> ILcdExpression<T> map(ILcdExpression<I> aIndex, ILcdExpression<T>[] aValues, ILcdExpression<T> aDefault) Returns an expression that maps an index onto an expression.The expression first determines an index, then evaluates the expression corresponding to the index.
For example:
map(constant(2), new ILcdExpression<Color>[] {constant(red), constant(green), constant(blue)}, constant(black))
returns bluemap(constant(6), new ILcdExpression<Color>[] {constant(red), constant(green), constant(blue)}, constant(black))
returns black
Usually, the same method with constants is more convenient, see
map(ILcdExpression, Object[], Object)
.- Type Parameters:
T
- The type of the valuesI
- The type of the index in the values, must be a number- Parameters:
aIndex
- The expression that calculates the index to useaValues
- A list of value expressionsaDefault
- The expression used as default when the computed index is not valid- Returns:
- An expression
-
map
public static <T,I extends Number> ILcdExpression<T> map(ILcdExpression<I> aIndex, T[] aValues, T aDefault) Returns an expression that maps an index onto a value.The expression first determines an index, then returns the value corresponding to the index.
For example:
map(constant(2), new Color[] {red, green, blue}, black)
returns bluemap(constant(6), new Color[] {red, green, blue}, black)
returns black
- Type Parameters:
T
- The type of the valuesI
- The type of the index in the values, must be a number- Parameters:
aIndex
- The expression that calculates the index to useaValues
- A list of constant valuesaDefault
- The default value when the computed index is not valid- Returns:
- An expression
-
mixmap
Returns an expression that creates in interpolated value (mix
) based on two table lookups (map
).This expression is not limited to numbers, but can also be used to interpolate
ILcdPoint
orColor
objects.For example,
mixmap(constant(0.75), new Color[] {orange, yellow, red})
results in a color between yellow and red.- Type Parameters:
R
- Type of the input and output expressions- Parameters:
aFraction
- The fraction, in range [0,1].aValues
- A list of value expressions- Returns:
- An expression that returns an object corresponding to the input types
-
mixmap
public static <R> ILcdExpression<R> mixmap(ILcdExpression<Float> aValue, float[] aThresholds, R[] aValues) Returns an expression that creates in interpolated value (mix
) based on two table lookups (map
).The input value is in the same unit as the thresholds.
This expression is not limited to numbers, but can also be used to interpolate
ILcdPoint
orColor
objects.For example,
mixmap(constant(1.5), new float[] {1, 2, 3}, new Color[] {orange, yellow, red})
results in a color between orange and yellow:- [-inf, 1] = orange
- ]1, 2[ = from orange to yellow
- 2 = yellow
- ]2, 3[ = from yellow to red
- [3, +inf] = red
- Type Parameters:
R
- Type of the input and output expressions- Parameters:
aValue
- The input value, in the same unit as the thresholdsaThresholds
- A list of thresholdsaValues
- A list of resulting value expressions- Returns:
- An expression that returns an object corresponding to the input types
-
mixmap
Returns an expression that behaves as acolor map
.For example,
mixmap(constant(15), new TLcdColorMap(new TLcdInterval(10, 30), new double[] {10, 20, 30}, new Color[] {orange, yellow, red}))
results in a color between orange and yellow.- Parameters:
aValue
- The value to use in the color map lookupaColorMap
- The color map- Returns:
- An expression that returns an object corresponding to the input types
-
toFloat
Returns an expression that converts (casts) to floating point number.For example,
Note: FortoFloat(constant(1))
returns 1.0.attribute(java.lang.String, java.lang.Class<T>, com.luciad.util.expression.TLcdExpressionFactory.AttributeValueProvider<T>)
expressions, only those that have the type Float, Double, Integer, Short or Byte as type are supported.- Parameters:
aValue
- A number expression- Returns:
- An expression that returns a floating point number
- Since:
- 2018.0
-
sin
Returns an expression that is the trigonometric sine of the input value.For example,
sin(constant(Math.PI/6))
returns 0.5.- Parameters:
aValue
- An angle, in radians.- Returns:
- An expression that returns a number
- Since:
- 2018.0
- See Also:
-
cos
Returns an expression that is the trigonometric cosine of the input value.For example,
cos(constant(Math.PI/3))
returns 0.5.- Parameters:
aValue
- An angle, in radians.- Returns:
- An expression that returns a number
- Since:
- 2018.0
- See Also:
-
tan
Returns an expression that is the trigonometric tangent of the input value.For example,
tan(constant(Math.PI/4))
returns 1.0.- Parameters:
aValue
- An angle, in radians.- Returns:
- An expression that returns a number
- Since:
- 2018.0
- See Also:
-
asin
Returns an expression that is the arc sine of the input value; the returned angle is in the range -pi/2 through pi/2.For example,
asin(constant(0.5))
returns 0.5235 (Math.PI/6).- Parameters:
aValue
- Expression parameter- Returns:
- An expression that returns a number
- Since:
- 2018.0
- See Also:
-
acos
Returns an expression that is the arc cosine of the input value; the returned angle is in the range 0.0 through pi.For example,
acos(constant(0.5))
returns 1.0471 (Math.PI/3).- Parameters:
aValue
- Expression parameter- Returns:
- An expression that returns a number
- Since:
- 2018.0
- See Also:
-
atan
Returns an expression that is the arc tangent of the input value; the returned angle is in the range -pi/2 through pi/2.For example,
atan(constant(1.0))
returns 0.7853 (Math.PI/4).- Parameters:
aValue
- Expression parameter- Returns:
- An expression that returns a number
- Since:
- 2018.0
- See Also:
-
viewPositionAttribute
Returns an expression that represents the swing view position of the object. Coordinates are from (0,0) to (width, height), starting from the top left.- Returns:
- The view position
- Since:
- 2018.0
-
distance
public static <T extends ILcdPoint> ILcdExpression<Float> distance(ILcdExpression<T> aFirst, ILcdExpression<T> aSecond) Returns an expression that is the Euclidean distance between two points.For example,
distance(constant(new TLcdXYPoint(20, 10)), constant(new TLcdXYPoint(10,10)))
returns 10.0.- Parameters:
aFirst
- Expression parameteraSecond
- Expression parameter- Returns:
- The distance
- Since:
- 2018.0
-
log
Returns an expression that is the natural logarithm of the parameter. The result is undefined ifx <= 0
.For example,
log(constant(100.0))
returns 4.60517.- Parameters:
aValue
- Expression parameter- Returns:
- An expression that returns a number
- Since:
- 2021.0
- See Also:
-
cases
Returns an expression that can be used to chain multiple if-then statements together.For example,
cases(constant(Color.black)).when(constant(true), Color.red).when(constant(false), Color.green)
returns red.- Type Parameters:
T
- The result type of the 'case' expression- Parameters:
aDefault
- The expression evaluated if no if-then statement is met- Returns:
- A case expression, that can be used to add more if-then statements
-
cases
Returns an expression that can be used to chain multiple if-then statements together.For example,
cases(Color.black).when(constant(true), Color.red).when(constant(false), Color.green)
returns red.- Type Parameters:
T
- The result type of the 'case' expression- Parameters:
aDefault
- The expression evaluated if no if-then statement is met- Returns:
- A case expression, that can be used to add more if-then statements
-
constant
Returns an expression that always evaluates to the same constant value.For example,
constant(Color.red)
always returns red.- Type Parameters:
T
- The type of the constant- Parameters:
aValue
- The constant value- Returns:
- An expression that returns the constant
-
attribute
public static <T> ILcdExpression<T> attribute(String aName, Class<T> aType, TLcdExpressionFactory.AttributeValueProvider<T> aProvider) Creates a new attribute expression that can retrieve values from domain objects.Note that you should create the attributes once, up front, and re-use them in expressions later.
For example,
attribute("x", Float.class, fMyFloatProvider)
returns float numbers retrieved byfMyFloatProvider
.- Type Parameters:
T
- The type of the values of the attribute, must correspond toaType
- Parameters:
aName
- The name of the attributeaType
- The type of the attribute, must correspond toaProvider
- The provider that will actually retrieve the values from domain objects- Returns:
- An expression that retrieves the value from a domain object
-
attribute
public static <T> ILcdExpression<T> attribute(String aName, Class<T> aType, ILcdDataObjectExpression aExpression) Creates a new attribute expression that can retrieve values from domain objects.Note that you should create the attributes once, up front, and re-use them in expressions later.
For example,
attribute("x", Float.class, fSomeExpression)
returns float numbers retrieved byfSomeExpression
.- Type Parameters:
T
- The type of the values of the attribute, must correspond toaType
- Parameters:
aName
- The name of the attributeaType
- The type of the attribute, must correspond toaExpression
- The provider that will actually retrieve the values from domain objects- Returns:
- An expression that retrieves the value from a domain object
-
attribute
Creates a new attribute expression that can retrieve values from data properties.Note that you should create the attributes once, up front, and re-use them in expressions later.
For example,
attribute(Float.class, fDataType.getProperty("p"))
returns the content of that data property.- Type Parameters:
T
- The type of the values of the attribute, must correspond toaType
- Parameters:
aType
- The type of the attribute, must correspond toaProperty
- The data property whose values are used- Returns:
- An expression that retrieves the value from a domain object
-
parameter
Creates a new parameter expression. You can vary parameters over time without having to re-create the expression they are used in.Note that you should create the parameters once, up front, and re-use them in expressions later.
Use
ILcdParameter#setValue
to change the value of the parameter. Note that the users of your expressions will automatically re-evaluate. You do not have to notify them. In particular for painters and layers, you no not have to fire style change events.- Type Parameters:
T
- The type of the parameter- Parameters:
aName
- The name of the parameteraStartingValue
- The initial value- Returns:
- A parameter
-