DMNv1.2 10.3.2.3.4 time, valuet(time), for use in this {@link EvalHelper#compare(Object, Object, EvaluationContext, BiPredicate)}
512522
private static long valuet(TemporalAccessor time) {
        long result = 0;
        result += time.get(ChronoField.HOUR_OF_DAY) * (60 * 60);
        result += time.get(ChronoField.MINUTE_OF_HOUR) * (60);
        result += time.get(ChronoField.SECOND_OF_MINUTE);
        result += Optional.ofNullable(time.query(TemporalQueries.offset())).map(ZoneOffset::getTotalSeconds).orElse(0);
        return result;
    }
887538
@Override
	public int compareTo(ValueArray<NullValue> o) {
		NullValueArray other = (NullValueArray) o;

		return Integer.compare(position, other.position);
	}
54764
public final int compareTo(final Dur arg0) {
        int result;
        if (isNegative() != arg0.isNegative()) {
            // return Boolean.valueOf(isNegative()).compareTo(Boolean.valueOf(arg0.isNegative()));
            // for pre-java 1.5 compatibility..
            if (isNegative()) {
                return Integer.MIN_VALUE;
            }
            else {
                return Integer.MAX_VALUE;
            }
        }
        else if (getWeeks() != arg0.getWeeks()) {
            result = getWeeks() - arg0.getWeeks();
        }
        else if (getDays() != arg0.getDays()) {
            result = getDays() - arg0.getDays();
        }
        else if (getHours() != arg0.getHours()) {
            result = getHours() - arg0.getHours();
        }
        else if (getMinutes() != arg0.getMinutes()) {
            result = getMinutes() - arg0.getMinutes();
        }
        else {
            result = getSeconds() - arg0.getSeconds();
        }
        // invert sense of all tests if both durations are negative
        if (isNegative()) {
            return -result;
        }
        else {
            return result;
        }
    }
137966
public int compare(NUMERICTYPE value1, NUMERICTYPE value2) {
        if (this.performCalculationsAsDoublePrimitive) {
            double v1 = value1.doubleValue();
            double v2 = value2.doubleValue();
            return Double.compare(v1, v2);
        } else {
            // evaluate as long
            long v1 = value1.longValue();
            long v2 = value2.longValue();
            return Long.compare(v1, v2);
        }

    }
212551
def _evalUnits(self, datetimeString, sourceTime):
        
        s = datetimeString.strip()
        sourceTime = self._evalDT(datetimeString, sourceTime)

        # Given string is a time string with units like "5 hrs 30 min"
        modifier = ''  # TODO

        m = self.ptc.CRE_UNITS.search(s)
        if m is not None:
            units = m.group('units')
            quantity = s[:m.start('units')]

        sourceTime = self._buildTime(sourceTime, quantity, modifier, units)
        return sourceTime
1030114
public static Boolean compare(Object left, Object right, EvaluationContext ctx, BiPredicate<Comparable, Comparable> op) {
        if ( left == null || right == null ) {
            return null;
        } else if ((left instanceof ChronoPeriod && right instanceof ChronoPeriod)) {
            // periods have special compare semantics in FEEL as it ignores "days". Only months and years are compared
            Long l = ComparablePeriod.toTotalMonths((ChronoPeriod) left);
            Long r = ComparablePeriod.toTotalMonths((ChronoPeriod) right);
            return op.test( l, r );
        } else if (left instanceof TemporalAccessor && right instanceof TemporalAccessor) {
            // Handle specific cases when both date / datetime
            TemporalAccessor l = (TemporalAccessor) left;
            TemporalAccessor r = (TemporalAccessor) right;
            if (BuiltInType.determineTypeFromInstance(left) == BuiltInType.TIME && BuiltInType.determineTypeFromInstance(right) == BuiltInType.TIME) {
                return op.test(valuet(l), valuet(r));
            } else if (BuiltInType.determineTypeFromInstance(left) == BuiltInType.DATE_TIME && BuiltInType.determineTypeFromInstance(right) == BuiltInType.DATE_TIME) {
                return op.test(valuedt(l, r.query(TemporalQueries.zone())), valuedt(r, l.query(TemporalQueries.zone())));
            } // fallback; continue:
        }
        // last fallback:
        if ((left instanceof String && right instanceof String) ||
            (left instanceof Number && right instanceof Number) ||
            (left instanceof Boolean && right instanceof Boolean) ||
            (left instanceof Comparable && left.getClass().isAssignableFrom(right.getClass()))) {
            Comparable l = (Comparable) left;
            Comparable r = (Comparable) right;
            return op.test(l, r);
        }
        return null;
    }
1120461
static long comparable(DateValue dv) {
        long comp = (((((long) dv.year()) << 4) + dv.month()) << 5) + dv.day();
        if (dv instanceof TimeValue) {
            TimeValue tv = (TimeValue) dv;
            // We add 1 to comparable for timed values to make sure that timed
            // events are distinct from all-day events, in keeping with
            // DateValue.compareTo.

            // It would be odd if an all day exclusion matched a midnight event on
            // the same day, but not one at another time of day.
            return (((((comp << 5) + tv.hour()) << 6) + tv.minute()) << 6)
                    + tv.second() + 1;
        } else {
            return comp << 17;
        }
    }
350919
function CompareTo( $obj )
	{
		if ( ! $obj instanceof TimeValue )
			throw new ArgumentException("$obj");

		/**
		 * @var TimeValue $other
		 */
		$other = $obj;
		return $this->Value == $other->Value
			? 0
			: ( $this->Value > $other->Value ? 1 : -1 );
	}
748075
<R> R getValue(TemporalQuery<R> query) {
        R result = temporal.query(query);
        if (result == null && optional == 0) {
            throw new DateTimeException("Unable to extract value: " + temporal.getClass());
        }
        return result;
    }
377864
def _evalQUnits(self, datetimeString, sourceTime):
        
        s = datetimeString.strip()
        sourceTime = self._evalDT(datetimeString, sourceTime)

        # Given string is a time string with single char units like "5 h 30 m"
        modifier = ''  # TODO

        m = self.ptc.CRE_QUNITS.search(s)
        if m is not None:
            units = m.group('qunits')
            quantity = s[:m.start('qunits')]

        sourceTime = self._buildTime(sourceTime, quantity, modifier, units)
        return sourceTime
911261
public static Pair<Object, Object> toSame(Object value1, Object value2, EvaluationContext ctx) {
        if (value1.getClass().equals(value2.getClass())) {
            return new ImmutablePair<>(value1, value2);
        }

        try {
            // try converting to two decimals
            return new ImmutablePair<Object, Object>(toDecimal(value1, ctx), toDecimal(value2, ctx));
        }
        catch (EvaluationError ex) {}

        try {
            // try converting to two dates
            Temporal d1 = toDateOrDateTime(value1, ctx);
            Temporal d2 = toDateOrDateTime(value2, ctx);
            if (!value1.getClass().equals(value2.getClass())) {
                d1 = toDateTime(d1, ctx);
                d2 = toDateTime(d2, ctx);
            }

            return new ImmutablePair<Object, Object>(d1, d2);
        }
        catch (EvaluationError ex) {}

        // try converting to two strings
        return new ImmutablePair<Object, Object>(toString(value1, ctx), toString(value2, ctx));
    }
1020587
public static Object _if(EvaluationContext ctx, Object logicalTest, @IntegerDefault(0) Object valueIfTrue, @BooleanDefault(false) Object valueIfFalse) {
        return Conversions.toBoolean(logicalTest, ctx) ? valueIfTrue : valueIfFalse;
    }
1335763
public static int compare(Object left, Object right) throws PageException {
	// print.dumpStack();
	if (left instanceof String) return compare((String) left, right);
	else if (left instanceof Number) return compare(((Number) left).doubleValue(), right);
	else if (left instanceof Boolean) return compare(((Boolean) left).booleanValue(), right);
	else if (left instanceof Date) return compare((Date) left, right);
	else if (left instanceof Castable) return compare(((Castable) left), right);
	else if (left instanceof Locale) return compare(((Locale) left), right);
	else if (left == null) return compare("", right);
	/*
	 * /NICE disabled at the moment left Comparable else if(left instanceof Comparable) { return
	 * ((Comparable)left).compareTo(right); }
	 */
	else if (left instanceof Character) return compare(((Character) left).toString(), right);
	else if (left instanceof Calendar) return compare(((Calendar) left).getTime(), right);
	else if (left instanceof TimeZone) return compare(((TimeZone) left), right);
	else {
	    return error(false, true);
	}
    }
341099
@Override
    public Object visitComparisonExpression(ExcellentParser.ComparisonExpressionContext ctx) {
        Pair<Object, Object> args = Conversions.toSame(visit(ctx.expression(0)), visit(ctx.expression(1)), m_evalContext);
        int compared;

        if (args.getLeft() instanceof String) {
            // string comparison is case-insensitive
            compared = ((String) args.getLeft()).compareToIgnoreCase((String) args.getRight());
        }
        else {
            compared = ((Comparable) args.getLeft()).compareTo(args.getRight());
        }

        if (ctx.LTE() != null) {
            return compared <= 0;
        } else if (ctx.LT() != null) {
            return compared < 0;
        } else if (ctx.GTE() != null) {
            return compared >= 0;
        } else { // GT
            return compared > 0;
        }
    }
257930
function CompareTo( $obj )
	{
		if ( ! $obj instanceof DayTimeDurationValue )
	        throw new ArgumentException("$obj");

		/**
		 * @var DayTimeDurationValue $other
		 */
	    $other = $obj;
	    /**
	     * @var DecimalValue $otherInterval
	     */
		$otherInterval = $other->getTotalSeconds();
		/**
		 * @var DecimalValue $valueInterval
		 */
		$valueInterval = $this->getTotalSeconds();

	    return $valueInterval->CompareTo( $otherInterval );
	}
68690
@Override
    public boolean evaluate() throws QueryEvaluationException {
        try {
            sync();
            return getMarkLogicClient().sendBooleanQuery(getQueryString(), getBindings(), getIncludeInferred(),getBaseURI());
        }catch (RepositoryException e) {
            throw new QueryEvaluationException(e.getMessage(), e);
        }catch (MalformedQueryException e) {
            throw new QueryEvaluationException(e.getMessage(), e);
        }catch (IOException e) {
            throw new QueryEvaluationException(e.getMessage(), e);
        }catch(FailedRequestException e){
            throw new QueryEvaluationException(e.getMessage(), e);
        }
    }
1066601
@Override
	public Object evaluate(Message message) throws JMSException
    {
        String leftValue = leftOperand.evaluateString(message);
        String[] rightValue = (String[])rightOperand.evaluate(message);
        if (leftValue == null)
        	return null; // [JMS Spec]

        // Look for a match
        for (int n = 0 ; n < rightValue.length ; n++)
        	if (rightValue[n] != null && leftValue.equals(rightValue[n]))
        		return Boolean.TRUE;
        
        return Boolean.FALSE;
    }