DateValue selectDate(Org.Neo4j.Values.AnyValue date) { if (date is DateValue) { return(( DateValue )date); } return(Date(getDateOf(Date))); }
private LocalDate getDateOf(Org.Neo4j.Values.AnyValue temporal) { if (temporal is TemporalValue) { TemporalValue v = ( TemporalValue )temporal; return(v.DatePart); } throw new InvalidValuesArgumentException(string.Format("Cannot construct date from: {0}", temporal)); }
public static Value NotEquals(AnyValue lhs, AnyValue rhs) { bool?compare = lhs.TernaryEquals(rhs); if (compare == null) { return(NO_VALUE); } return(compare ? FALSE : TRUE); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ParameterizedTest @MethodSource("parameters") void shouldMapToJavaObject(AnyValue value) internal virtual void ShouldMapToJavaObject(AnyValue value) { // given ValueMapper <object> mapper = new Mapper(); // when object mapped = value.Map(mapper); // then assertEquals(value, ValueOf(mapped)); }
public override bool?TernaryEquals(AnyValue other) { if (other == null || other == NO_VALUE) { return(null); } if (other is SequenceValue && this.SequenceValue) { return((( SequenceValue )this).TernaryEquality(( SequenceValue )other)); } if (other is VirtualValue && (( VirtualValue )other).ValueGroup() == ValueGroup()) { return(Equals(( VirtualValue )other)); } return(false); }
private static MapValue TruncateParameters(MapValue parameters) { string[] keys = new string[parameters.Size()]; AnyValue[] values = new AnyValue[keys.Length]; int i = 0; foreach (string key in parameters.Keys) { keys[i] = key.Length <= _maxParameterKeyLength ? key : key.Substring(0, _maxParameterKeyLength); values[i] = parameters.Get(key).map(_valueTruncater); i++; } return(VirtualValues.map(keys, values)); }
public static Value GreaterThanOrEqual(AnyValue lhs, AnyValue rhs) { if (IsNan(lhs) || IsNan(rhs)) { return(NO_VALUE); } else if (lhs is NumberValue && rhs is NumberValue) { return(GreaterThanOrEqual(AnyValues.TERNARY_COMPARATOR.ternaryCompare(lhs, rhs))); } else if (lhs is TextValue && rhs is TextValue) { return(GreaterThanOrEqual(AnyValues.TERNARY_COMPARATOR.ternaryCompare(lhs, rhs))); } else if (lhs is BooleanValue && rhs is BooleanValue) { return(GreaterThanOrEqual(AnyValues.TERNARY_COMPARATOR.ternaryCompare(lhs, rhs))); } else if (lhs is PointValue && rhs is PointValue) { return(GreaterThanOrEqual(AnyValues.TERNARY_COMPARATOR.ternaryCompare(lhs, rhs))); } else if (lhs is DateValue && rhs is DateValue) { return(GreaterThanOrEqual(AnyValues.TERNARY_COMPARATOR.ternaryCompare(lhs, rhs))); } else if (lhs is LocalTimeValue && rhs is LocalTimeValue) { return(GreaterThanOrEqual(AnyValues.TERNARY_COMPARATOR.ternaryCompare(lhs, rhs))); } else if (lhs is TimeValue && rhs is TimeValue) { return(GreaterThanOrEqual(AnyValues.TERNARY_COMPARATOR.ternaryCompare(lhs, rhs))); } else if (lhs is LocalDateTimeValue && rhs is LocalDateTimeValue) { return(GreaterThanOrEqual(AnyValues.TERNARY_COMPARATOR.ternaryCompare(lhs, rhs))); } else if (lhs is DateTimeValue && rhs is DateTimeValue) { return(GreaterThanOrEqual(AnyValues.TERNARY_COMPARATOR.ternaryCompare(lhs, rhs))); } else { return(NO_VALUE); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldOrderValuesCorrectly() internal virtual void ShouldOrderValuesCorrectly() { IList <AnyValue> values = java.util.objs.Select(VirtualValueTestUtil.toAnyValue).ToList(); for (int i = 0; i < values.Count; i++) { for (int j = 0; j < values.Count; j++) { AnyValue left = values[i]; AnyValue right = values[j]; int cmpPos = signum(i - j); int cmpVal = signum(Compare(_comparator, left, right)); assertEquals(cmpPos, cmpVal, format("Comparing %s against %s does not agree with their positions in the sorted list (%d and %d)", left, right, i, j)); } } }
public static DateValue Select(Org.Neo4j.Values.AnyValue from, System.Func <ZoneId> defaultZone) { return(Builder(defaultZone).selectDate(from)); }
public static Value Not(AnyValue @in) { return(@in != TRUE ? TRUE : FALSE); }
public static Value Xor(AnyValue lhs, AnyValue rhs) { return((lhs == TRUE) ^ (rhs == TRUE) ? TRUE : FALSE); }
private static bool IsNan(AnyValue value) { return(value is FloatingPointValue && (( FloatingPointValue )value).NaN); }
public static Value CoerceToBoolean(AnyValue value) { return(value.Map(_booleanMapper)); }
public abstract bool?TernaryEquals(AnyValue other);