@Override int unsafeCompareTo( Value otherValue ) { BooleanValue other = (BooleanValue) otherValue; return !other.booleanValue() ? 0 : -1; }
@Override public boolean eq( Object other ) { return other instanceof Value && equals( (Value) other ); }
@Override public long updateHash( HashFunction hashFunction, long hash ) { return hashFunction.update( hash, hashCode() ); }
public static TextValue toString( AnyValue in ) { if ( in instanceof TextValue ) { return (TextValue) in; } else if ( in instanceof NumberValue ) { return stringValue( ((NumberValue) in).prettyPrint() ); } else if ( in instanceof BooleanValue ) { return stringValue( ((BooleanValue) in).prettyPrint() ); } else if ( in instanceof TemporalValue || in instanceof DurationValue || in instanceof PointValue ) { return stringValue( in.toString() ); } else { throw new ParameterWrongTypeException( "Expected a String, Number, Boolean, Temporal or Duration, got: " + in.toString(), null ); } }
public static TextValue toString( AnyValue in ) { if ( in instanceof TextValue ) { return (TextValue) in; } else if ( in instanceof NumberValue ) { return stringValue( ((NumberValue) in).prettyPrint() ); } else if ( in instanceof BooleanValue ) { return stringValue( ((BooleanValue) in).prettyPrint() ); } else if ( in instanceof TemporalValue || in instanceof DurationValue || in instanceof PointValue ) { return stringValue( in.toString() ); } else { throw new ParameterWrongTypeException( "Expected a String, Number, Boolean, Temporal or Duration, got: " + in.toString(), null ); } }
@Override public Boolean mapBoolean( BooleanValue value ) { return value.booleanValue(); }
@Override public long updateHash( HashFunction hashFunction, long hash ) { return hashFunction.update( hash, hashCode() ); }
@Override public boolean eq( Object other ) { return other instanceof Value && equals( (Value) other ); }
@Override int unsafeCompareTo( Value otherValue ) { BooleanValue other = (BooleanValue) otherValue; return other.booleanValue() ? 0 : 1; }
private static Boolean toBooleanOrNull( Object o ) { if ( o == null || o == NO_VALUE ) { return null; } else if ( o instanceof Boolean ) { return (Boolean) o; } else if ( o instanceof BooleanValue ) { return ((BooleanValue) o).booleanValue(); } throw new CypherTypeException( "Don't know how to treat that as a boolean: " + o.toString(), null ); }
public static boolean coerceToPredicate( Object value ) { if ( value == null || value == Values.NO_VALUE ) { return false; } if ( value instanceof BooleanValue ) { return ((BooleanValue) value).booleanValue(); } if ( value instanceof Boolean ) { return (boolean) value; } if ( value instanceof ArrayValue ) { return ((ArrayValue) value).length() > 0; } if ( value.getClass().isArray() ) { return Array.getLength( value ) > 0; } throw new CypherTypeException( "Don't know how to treat that as a predicate: " + value.toString(), null ); }
@Override int unsafeCompareTo( Value otherValue ) { BooleanValue other = (BooleanValue) otherValue; return other.booleanValue() ? 0 : 1; }
@Override public Boolean mapBoolean( BooleanValue value ) { return value.booleanValue(); }
@Override int unsafeCompareTo( Value otherValue ) { BooleanValue other = (BooleanValue) otherValue; return !other.booleanValue() ? 0 : -1; }
private static Boolean toBooleanOrNull( Object o ) { if ( o == null || o == NO_VALUE ) { return null; } else if ( o instanceof Boolean ) { return (Boolean) o; } else if ( o instanceof BooleanValue ) { return ((BooleanValue) o).booleanValue(); } throw new CypherTypeException( "Don't know how to treat that as a boolean: " + o.toString(), null ); }
public static boolean coerceToPredicate( Object value ) { if ( value == null || value == Values.NO_VALUE ) { return false; } if ( value instanceof BooleanValue ) { return ((BooleanValue) value).booleanValue(); } if ( value instanceof Boolean ) { return (boolean) value; } if ( value instanceof ArrayValue ) { return ((ArrayValue) value).length() > 0; } if ( value.getClass().isArray() ) { return Array.getLength( value ) > 0; } throw new CypherTypeException( "Don't know how to treat that as a predicate: " + value.toString(), null ); }