Class Utils

  • All Implemented Interfaces:

    
    public final class Utils
    
                        
    • Constructor Detail

    • Method Detail

      • and

         final static Boolean and(Boolean a, Boolean b)
        Parameters:
        a - first condition
        b - second condition
        Returns:

        true if both the conditions are true

      • canSee

         final static <T extends Any> Boolean canSee(T a)

        Line-of-sight detector.

        Parameters:
        a - value
        Returns:

        true if there is at least a neighbor respect to x, false otherwise

      • denormalize

         final static Number denormalize(Number x, Number oldmin, Number oldmax, Number newmin, Number newmax)
        Parameters:
        x - value to be denormalized
        oldmin - oldmin
        oldmax - oldmax
        newmin - newmin
        newmax - newmax
        Returns:

        denormalized value

      • diff

         final static Number diff(Number a, Number b)
        Parameters:
        a - first field
        b - second field
        Returns:

        difference between two fields

      • equal

         final static <T extends Any> Boolean equal(T a, T b)
        Parameters:
        a - first field
        b - second field
        Returns:

        true if a is equal to b, false otherwise

      • greaterThan

         final static <T extends Any> Boolean greaterThan(T a, T b)
        Parameters:
        a - first field
        b - second field
        Returns:

        true if a is greater than b, false otherwise

      • greaterEqual

         final static <T extends Any> Boolean greaterEqual(T a, T b)
        Parameters:
        a - first field
        b - second field
        Returns:

        true if a is greater than or equal to b, false otherwise

      • hoodW

         final static <T extends Any> T hoodW(T local, Function2<T, T, T> aggregator, T default, Function1<Unit, T> fieldBuilder)

        -hood wrapper.

        Parameters:
        local - local value
        aggregator - how to reduce information
        default - default value in case the field returned by fieldBuilder is empty
        fieldBuilder - return which field should be reduced
        Returns:

        reduced value

      • hoodWstateful

         final static <T extends Any> T hoodWstateful(T local, Function2<T, T, T> aggregator, T default, Function1<T, T> fieldBuilder)

        Stateful-hood wrapper.

        Parameters:
        local - local value
        aggregator - how to reduce information
        default - default value in case the field returned by fieldBuilder is empty
        fieldBuilder - return which field should be reduced
        Returns:

        reduced value

      • identity

         final static <T extends Any> T identity(T a)
        Parameters:
        a - value to be returned
        Returns:

        the same value

      • isEdge

         final static Boolean isEdge(Boolean condition)

        Verify if a device is on the edge of a spatial region.

        Parameters:
        condition - how to discriminate a region
        Returns:

        true if the device is on the edge, false otherwise

      • lessThan

         final static <T extends Any> Boolean lessThan(T a, T b)
        Parameters:
        a - first field
        b - second field
        Returns:

        true if a is less than b, false otherwise

      • lessEqual

         final static <T extends Any> Boolean lessEqual(T a, T b)
        Parameters:
        a - first field
        b - second field
        Returns:

        true if a is less than or equal to b, false otherwise

      • max

         final static <T extends Any> T max(T a, T b)
        Parameters:
        a - first field
        b - second field
        Returns:

        maximum between the two fields

      • min

         final static Number min(Number a, Number b)
        Parameters:
        a - first field
        b - second field
        Returns:

        minimum between the two fields

      • norm

         final static Number ,java.lang.Number)>norm(<Error class: unknown class> tuple, Number p)

        Norm of a numeric tuple.

        Parameters:
        tuple - tuple
        p - pow
        Returns:

        norm of a numeric tuple

      • not

         final static Boolean not(Boolean a)
        Parameters:
        a - first condition
        Returns:

        negated condition

      • notEqual

         final static <T extends Any> Boolean notEqual(T a, T b)
        Parameters:
        a - first field
        b - second field
        Returns:

        true if a is not equal to b, false otherwise

      • or

         final static Boolean or(Boolean a, Boolean b)
        Parameters:
        a - first condition
        b - second condition
        Returns:

        true if one of the conditions is true

      • range

         final static Number range(Number x, Number min, Number max)
        Parameters:
        x - value
        min - lower bound
        max - upper bound
        Returns:

        scale x with respect to the range

      • sum

         final static Number sum(Number a, Number b)
        Parameters:
        a - summand
        b - summand
        Returns:

        sum of two fields

      • union

         final static <T extends Any> <Error class: unknown class> ,.)>union(<Error class: unknown class> a, <Error class: unknown class> b)
        Parameters:
        a - tuple
        b - tuple
        Returns:

        concatenation of two tuples