コード例 #1
0
 DateValue selectDate(Org.Neo4j.Values.AnyValue date)
 {
     if (date is DateValue)
     {
         return(( DateValue )date);
     }
     return(Date(getDateOf(Date)));
 }
コード例 #2
0
 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));
 }
コード例 #3
0
ファイル: CypherBoolean.cs プロジェクト: Neo4Net/Neo4Net
        public static Value NotEquals(AnyValue lhs, AnyValue rhs)
        {
            bool?compare = lhs.TernaryEquals(rhs);

            if (compare == null)
            {
                return(NO_VALUE);
            }
            return(compare ? FALSE : TRUE);
        }
コード例 #4
0
//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));
        }
コード例 #5
0
 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);
 }
コード例 #6
0
        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));
        }
コード例 #7
0
ファイル: CypherBoolean.cs プロジェクト: Neo4Net/Neo4Net
 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);
     }
 }
コード例 #8
0
//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));
                }
            }
        }
コード例 #9
0
 public static DateValue Select(Org.Neo4j.Values.AnyValue from, System.Func <ZoneId> defaultZone)
 {
     return(Builder(defaultZone).selectDate(from));
 }
コード例 #10
0
ファイル: CypherBoolean.cs プロジェクト: Neo4Net/Neo4Net
 public static Value Not(AnyValue @in)
 {
     return(@in != TRUE ? TRUE : FALSE);
 }
コード例 #11
0
ファイル: CypherBoolean.cs プロジェクト: Neo4Net/Neo4Net
 public static Value Xor(AnyValue lhs, AnyValue rhs)
 {
     return((lhs == TRUE) ^ (rhs == TRUE) ? TRUE : FALSE);
 }
コード例 #12
0
ファイル: CypherBoolean.cs プロジェクト: Neo4Net/Neo4Net
 private static bool IsNan(AnyValue value)
 {
     return(value is FloatingPointValue && (( FloatingPointValue )value).NaN);
 }
コード例 #13
0
ファイル: CypherBoolean.cs プロジェクト: Neo4Net/Neo4Net
 public static Value CoerceToBoolean(AnyValue value)
 {
     return(value.Map(_booleanMapper));
 }
コード例 #14
0
 public abstract bool?TernaryEquals(AnyValue other);