示例#1
0
 public static PointArray PointArray(Point[] points)
 {
     PointValue[] values = new PointValue[points.Length];
     for (int i = 0; i < points.Length; i++)
     {
         values[i] = Values.Point(points[i]);
     }
     return(new PointArray(values));
 }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static <E extends Exception> void writeTo(ValueWriter<E> writer, org.neo4j.graphdb.spatial.Point[] values) throws E
        public static void WriteTo <E>(ValueWriter <E> writer, Point[] values) where E : Exception
        {
            writer.BeginArray(values.Length, ValueWriter_ArrayType.Point);
            foreach (Point x in values)
            {
                PointValue value = Values.Point(x);
                writer.WritePoint(value.CoordinateReferenceSystem, value.Coordinate());
            }
            writer.EndArray();
        }
示例#3
0
        public static PointArray PointArray(Value[] maybePoints)
        {
            PointValue[] values = new PointValue[maybePoints.Length];
            for (int i = 0; i < maybePoints.Length; i++)
            {
                Value maybePoint = maybePoints[i];
                if (!(maybePoint is PointValue))
                {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                    throw new System.ArgumentException(format("[%s:%s] is not a supported point value", maybePoint, maybePoint.GetType().FullName));
                }
                values[i] = Values.Point(( PointValue )maybePoint);
            }
            return(PointArray(values));
        }
示例#4
0
 public override AnyValue Value(int offset)
 {
     return(Values.Point(_value[offset]));
 }
示例#5
0
        public static Value UnsafeOf(object value, bool allowNull)
        {
            if (value is string)
            {
                return(StringValue(( string )value));
            }
            if (value is object[])
            {
                return(ArrayValue(( object[] )value));
            }
            if (value is bool?)
            {
                return(BooleanValue(( bool? )value.Value));
            }
            if (value is Number)
            {
                return(NumberValue(( Number )value));
            }
            if (value is char?)
            {
                return(CharValue(( char? )value.Value));
            }
            if (value is Temporal)
            {
                return(TemporalValue(( Temporal )value));
            }
            if (value is TemporalAmount)
            {
                return(DurationValue(( TemporalAmount )value));
            }
            if (value is sbyte[])
            {
                return(ByteArray((( sbyte[] )value).Clone()));
            }
            if (value is long[])
            {
                return(LongArray((( long[] )value).Clone()));
            }
            if (value is int[])
            {
                return(IntArray((( int[] )value).Clone()));
            }
            if (value is double[])
            {
                return(DoubleArray((( double[] )value).Clone()));
            }
            if (value is float[])
            {
                return(FloatArray((( float[] )value).Clone()));
            }
            if (value is bool[])
            {
                return(BooleanArray((( bool[] )value).Clone()));
            }
            if (value is char[])
            {
                return(CharArray((( char[] )value).Clone()));
            }
            if (value is short[])
            {
                return(ShortArray((( short[] )value).Clone()));
            }
            if (value == null)
            {
                if (allowNull)
                {
                    return(NoValue.NoValueConflict);
                }
                throw new System.ArgumentException("[null] is not a supported property value");
            }
            if (value is Point)
            {
                return(Values.Point(( Point )value));
            }
            if (value is Value)
            {
                throw new System.NotSupportedException("Converting a Value to a Value using Values.of() is not supported.");
            }

            // otherwise fail
            return(null);
        }