Class TLcdExpressionFactory

java.lang.Object
com.luciad.util.expression.TLcdExpressionFactory

public class TLcdExpressionFactory extends Object

This builder contains static methods to construct nested expressions.

Attributes are used to retrieve values from domain objects. The values can be retrieved in three ways:

  1. By implementing a simple AttributeValueProvider: see here
  2. From ILcdDataObjects by supplying a TLcdDataProperty: see here
  3. From ILcdDataObjects by supplying a ILcdDataObjectExpression: see here

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
  • 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 parameter
      aRight - 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 parameter
      aRight - Expression parameter
      Returns:
      A boolean expression
    • not

      public static ILcdExpression<Boolean> not(ILcdExpression<Boolean> aParameter)
      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 if aLeft < aRight.

      For example, lt(constant(3), constant(5)) returns true.

      Type Parameters:
      L - Type of the left-side expression, must be a Number
      R - Type of the left-side expression, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      A boolean expression
    • lt

      public static <T extends Number> ILcdExpression<Boolean> lt(T aLeft, ILcdExpression<T> aRight)
      Returns an expression that compares its parts using the less-than operator.

      The expression evaluates to true if aLeft < aRight.

      For example, lt(3, constant(5)) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      A boolean expression
    • lt

      public static <T extends Number> ILcdExpression<Boolean> lt(ILcdExpression<T> aLeft, T aRight)
      Returns an expression that compares its parts using the less-than operator.

      The expression evaluates to true if aLeft < aRight.

      For example, lt(constant(3), 5) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 if aLeft <= aRight.

      For example, lte(constant(3), constant(3)) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      A boolean expression
    • lte

      public 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.

      The expression evaluates to true if aLeft <= aRight.

      For example, lte(3, constant(3)) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      A boolean expression
    • lte

      public 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.

      The expression evaluates to true if aLeft <= aRight.

      For example, lte(constant(3), 3) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 if aLeft > aRight.

      For example, gt(constant(3), constant(3)) returns false.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      A boolean expression
    • gt

      public static <T extends Number> ILcdExpression<Boolean> gt(T aLeft, ILcdExpression<T> aRight)
      Returns an expression that compares its parts using the greater-than operator.

      The expression evaluates to true if aLeft > aRight.

      For example, gt(3, constant(3)) returns false.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      A boolean expression
    • gt

      public static <T extends Number> ILcdExpression<Boolean> gt(ILcdExpression<T> aLeft, T aRight)
      Returns an expression that compares its parts using the greater-than operator.

      The expression evaluates to true if aLeft > aRight.

      For example, gt(constant(3), 3) returns false.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 if aLeft >= aRight.

      For example, gte(constant(3), constant(3)) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      A boolean expression
    • gte

      public 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.

      The expression evaluates to true if aLeft >= aRight.

      For example, gte(3, constant(3)) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      A boolean expression
    • gte

      public 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.

      The expression evaluates to true if aLeft >= aRight.

      For example, gte(constant(3), 3) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 if aValue >= aLowerBound and aValue <= aUpperBound.

      For example, between(constant(4), constant(3), constant(5)) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aValue - Value to evaluate
      aLowerBound - Lower-bound expression
      aUpperBound - 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 if Math.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 expression
      aRight - Right-side expression
      aEpsilon - the allowed epsilon value for the equality check.
      Returns:
      A boolean expression
      Since:
      2021.1
    • eq

      public static <T> ILcdExpression<Boolean> eq(ILcdExpression<T> aLeft, ILcdExpression<T> aRight)
      Returns an expression that verifies if its parameters are equal.

      The expression evaluates to true if aLeft == aRight (for numbers), or aLeft.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 expression
      aRight - Right-side expression
      Returns:
      A boolean expression
    • eq

      public static <T extends Number> ILcdExpression<Boolean> eq(T aLeft, ILcdExpression<T> aRight)
      Returns an expression that verifies if its parameters are equal.

      The expression evaluates to true if aLeft == aRight.

      For example, eq(3, constant(4)) returns false.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      A boolean expression
    • eq

      public static <T extends Number> ILcdExpression<Boolean> eq(ILcdExpression<T> aLeft, T aRight)
      Returns an expression that verifies if its parameters are equal.

      The expression evaluates to true if aLeft == aRight.

      For example, eq(constant(3), 4) returns false.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 if Math.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 expression
      aRight - Right-side expression
      aEpsilon - the allowed epsilon value for the non-equality check.
      Returns:
      A boolean expression
      Since:
      2021.1
    • neq

      public static <T> ILcdExpression<Boolean> neq(ILcdExpression<T> aLeft, ILcdExpression<T> aRight)
      Returns an expression that verifies if its parameters are not equal.

      The expression evaluates to true if aLeft != 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 expression
      aRight - Right-side expression
      Returns:
      A boolean expression
    • neq

      public static <T extends Number> ILcdExpression<Boolean> neq(T aLeft, ILcdExpression<T> aRight)
      Returns an expression that verifies if its parameters are not equal.

      The expression evaluates to true if aLeft != aRight.

      For example, neq(3, constant(4)) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      A boolean expression
    • neq

      public static <T extends Number> ILcdExpression<Boolean> neq(ILcdExpression<T> aLeft, T aRight)
      Returns an expression that verifies if its parameters are not equal.

      The expression evaluates to true if aLeft != aRight.

      For example, neq(constant(3), 4) returns true.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • mul

      public static <T extends Number> ILcdExpression<T> mul(T aLeft, ILcdExpression<T> aRight)
      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 a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • mul

      public static <T extends Number> ILcdExpression<T> mul(ILcdExpression<T> aLeft, T aRight)
      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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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)) returns new TLcdXYZPoint(4, 6, 8).

      Type Parameters:
      T - Type of the parameter expressions, must be a ILcdPoint
      Parameters:
      aLeft - Left-side expression
      aRight - 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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • div

      public static <T extends Number> ILcdExpression<T> div(T aLeft, ILcdExpression<T> aRight)
      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 a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • div

      public static <T extends Number> ILcdExpression<T> div(ILcdExpression<T> aLeft, T aRight)
      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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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)) returns new TLcdXYZPoint(1, 1.5, 2).

      Type Parameters:
      T - Type of the parameter expressions, must be a ILcdPoint
      Parameters:
      aLeft - Left-side expression
      aRight - 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)) returns new TLcdXYZPoint(1, 2, 0).

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      An expression that returns a number
      Since:
      2018.0
    • mod

      public 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.

      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 a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      An expression that returns a number
      Since:
      2018.0
    • mod

      public 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.

      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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 a ILcdPoint
      Parameters:
      aLeft - Left-side expression
      aRight - 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 X aRight.

      For example, crossProduct(constant(new TLcdXYZPoint(2, 3, 4)), constant(new TLcdXYZPoint(5, 6, 7))) returns new TLcdXYZPoint(-3, 6, -3).

      Type Parameters:
      T - Type of the parameter expressions, must be a ILcdPoint
      Parameters:
      aLeft - Left-side expression
      aRight - 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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • add

      public static <T extends Number> ILcdExpression<T> add(T aLeft, ILcdExpression<T> aRight)
      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 a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • add

      public static <T extends Number> ILcdExpression<T> add(ILcdExpression<T> aLeft, T aRight)
      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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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)) returns new TLcdXYZPoint(7, 8, 9).

      Type Parameters:
      T - Type of the parameter expressions, must be a ILcdPoint
      Parameters:
      aLeft - Left-side expression
      aRight - 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))) returns new TLcdXYZPoint(3, 5, 7).

      Type Parameters:
      T - Type of the parameter expressions, must be a ILcdPoint
      Parameters:
      aLeft - Left-side expression
      aRight - 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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • sub

      public static <T extends Number> ILcdExpression<T> sub(T aLeft, ILcdExpression<T> aRight)
      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 a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • sub

      public static <T extends Number> ILcdExpression<T> sub(ILcdExpression<T> aLeft, T aRight)
      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 a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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)) returns new TLcdXYZPoint(-3, -2, -1).

      Type Parameters:
      T - Type of the parameter expressions, must be a ILcdPoint
      Parameters:
      aLeft - Left-side expression
      aRight - 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)) returns new TLcdXYZPoint(1, 2, 3).

      Type Parameters:
      T - Type of the parameter expressions, must be a ILcdPoint
      Parameters:
      aLeft - Left-side expression
      aRight - 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 if aLeft < aRight, aRight otherwise.

      For example, min(constant(2), constant(3)) returns 2.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • min

      public static <T extends Number> ILcdExpression<T> min(T aLeft, ILcdExpression<T> aRight)
      Returns an expression that returns the minimum of its parameters.

      The expression evaluates to aLeft if aLeft < aRight, aRight otherwise.

      For example, min(2, constant(3)) returns 2.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • min

      public static <T extends Number> ILcdExpression<T> min(ILcdExpression<T> aLeft, T aRight)
      Returns an expression that returns the minimum of its parameters.

      The expression evaluates to aLeft if aLeft < aRight, aRight otherwise.

      For example, min(constant(2), 3) returns 2.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 if aLeft > aRight, aRight otherwise.

      For example, max(constant(2), constant(3)) returns 3.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • max

      public static <T extends Number> ILcdExpression<T> max(T aLeft, ILcdExpression<T> aRight)
      Returns an expression that returns the maximum of its parameters.

      The expression evaluates to aLeft if aLeft > aRight, aRight otherwise.

      For example, max(2, constant(3)) returns 3.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side constant
      aRight - Right-side expression
      Returns:
      An expression that returns a number
    • max

      public static <T extends Number> ILcdExpression<T> max(ILcdExpression<T> aLeft, T aRight)
      Returns an expression that returns the maximum of its parameters.

      The expression evaluates to aLeft if aLeft > aRight, aRight otherwise.

      For example, max(constant(2), 3) returns 3.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aLeft - Left-side expression
      aRight - 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 clamp
      aMin - The lower bound
      aMax - The upper bound
      Returns:
      An expression
    • clamp

      public 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.

      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 clamp
      aMin - The lower bound
      aMax - 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 between aFrom and aTo based on the given fraction.

      This expression is not limited to numbers, but can also be used to interpolate ILcdPoint or Color 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 expressions
      T - Type of the fraction expression, must be a Number
      Parameters:
      aFrom - The value corresponding to fraction 0
      aTo - The value corresponding to fraction 1
      aFraction - 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 between aFrom and aTo based on the given fraction.

      This expression is not limited to numbers, but can also be used to interpolate ILcdPoint or Color 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 expressions
      T - Type of the fraction expression, must be a Number
      Parameters:
      aFrom - The value corresponding to fraction 0
      aTo - The value corresponding to fraction 1
      aFraction - 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 expressions
      T - Type of the scale expressions, must be a Number
      Parameters:
      aValue - Value the value to scale
      aScale - 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 in 0.5.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aValue - Value to test
      aLowerBound - Lower bound expression
      aUpperBound - 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 in 0.5.

      Type Parameters:
      T - Type of the parameter expressions, must be a Number
      Parameters:
      aValue - Value to test
      aLowerBound - Lower bound constant
      aUpperBound - 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 if aIf returns true, otherwise it evaluates aThen.

      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 expression
      aThen - the expression evaluated if aIf returns true
      aElse - the expression evaluated if aIf 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 blue
      • map(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 values
      I - The type of the index in the values, must be a number
      Parameters:
      aIndex - The expression that calculates the index to use
      aValues - A list of value expressions
      aDefault - 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 blue
      • map(constant(6), new Color[] {red, green, blue}, black) returns black

      Type Parameters:
      T - The type of the values
      I - The type of the index in the values, must be a number
      Parameters:
      aIndex - The expression that calculates the index to use
      aValues - A list of constant values
      aDefault - The default value when the computed index is not valid
      Returns:
      An expression
    • mixmap

      public static <R> ILcdExpression<R> mixmap(ILcdExpression<Float> aFraction, R[] aValues)
      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 or Color 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 or Color 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 thresholds
      aThresholds - A list of thresholds
      aValues - A list of resulting value expressions
      Returns:
      An expression that returns an object corresponding to the input types
    • mixmap

      public static ILcdExpression<Color> mixmap(ILcdExpression<Float> aValue, TLcdColorMap aColorMap)
      Returns an expression that behaves as a color 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 lookup
      aColorMap - The color map
      Returns:
      An expression that returns an object corresponding to the input types
    • toFloat

      public static ILcdExpression<Float> toFloat(ILcdExpression<? extends Number> aValue)
      Returns an expression that converts (casts) to floating point number.

      For example, toFloat(constant(1)) returns 1.0.

      Note: For 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

      public static <T extends Number> ILcdExpression<Float> sin(ILcdExpression<T> aValue)
      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

      public static <T extends Number> ILcdExpression<Float> cos(ILcdExpression<T> aValue)
      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

      public static <T extends Number> ILcdExpression<Float> tan(ILcdExpression<T> aValue)
      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

      public 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.

      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

      public static <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.

      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

      public 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.

      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

      public static ILcdExpression<ILcdPoint> 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 parameter
      aSecond - Expression parameter
      Returns:
      The distance
      Since:
      2018.0
    • log

      public static <T extends Number> ILcdExpression<Float> log(ILcdExpression<T> aValue)
      Returns an expression that is the natural logarithm of the parameter. The result is undefined if x <= 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

      public static <T> TLcdExpressionFactory.CaseExpression<T> cases(ILcdExpression<T> aDefault)
      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

      public static <T> TLcdExpressionFactory.CaseExpression<T> cases(T aDefault)
      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

      public static <T> ILcdExpression<T> constant(T aValue)
      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 by fMyFloatProvider.

      Type Parameters:
      T - The type of the values of the attribute, must correspond to aType
      Parameters:
      aName - The name of the attribute
      aType - The type of the attribute, must correspond to
      aProvider - 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 by fSomeExpression.

      Type Parameters:
      T - The type of the values of the attribute, must correspond to aType
      Parameters:
      aName - The name of the attribute
      aType - The type of the attribute, must correspond to
      aExpression - 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(Class<T> aType, TLcdDataProperty aProperty)
      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 to aType
      Parameters:
      aType - The type of the attribute, must correspond to
      aProperty - The data property whose values are used
      Returns:
      An expression that retrieves the value from a domain object
    • parameter

      public static <T> ILcdParameter<T> parameter(String aName, T aStartingValue)
      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 parameter
      aStartingValue - The initial value
      Returns:
      A parameter