public static ListValue makeTraversable( AnyValue collection ) { ListValue list; if ( collection == NO_VALUE ) { return VirtualValues.EMPTY_LIST; } else if ( collection instanceof ListValue ) { return (ListValue) collection; } else if ( collection instanceof ArrayValue ) { return VirtualValues.fromArray( (ArrayValue) collection ); } else { return VirtualValues.list( collection ); } }
private static ListValue extractKeys( DbAccess access, int[] keyIds ) { String[] keysNames = new String[keyIds.length]; for ( int i = 0; i < keyIds.length; i++ ) { keysNames[i] = access.getPropertyKeyName( keyIds[i] ); } return VirtualValues.fromArray( Values.stringArray( keysNames ) ); }
public static ListValue tail( AnyValue container ) { if ( container instanceof ListValue ) { return ((ListValue) container).tail(); } else if ( container instanceof ArrayValue ) { return VirtualValues.fromArray( (ArrayValue) container ).tail(); } else { return EMPTY_LIST; } }
private static ListValue fastListConversion( AnyValue value ) { if ( value instanceof ListValue ) { return (ListValue) value; } else if ( value instanceof ArrayValue ) { return VirtualValues.fromArray( (ArrayValue) value ); } else if ( value instanceof PathValue ) { return ((PathValue) value).asList(); } throw cantCoerce( value, "List" ); }
@Override public ListValue keys() { return VirtualValues.concat( map.keys(), VirtualValues.fromArray( Values.stringArray( updatedKeys ) ) ); }
@Override public ListValue split( String separator ) { assert separator != null; String asString = value(); //Cypher has different semantics for the case where the separator //is exactly the value, in cypher we expect two empty arrays //where as java returns an empty array if ( separator.equals( asString ) ) { return EMPTY_SPLIT; } else if ( separator.isEmpty() ) { return VirtualValues.fromArray( Values.charArray( asString.toCharArray() ) ); } List<AnyValue> split = splitNonRegex( asString, separator ); return VirtualValues.fromList( split ); }
public ListValue keys() { String[] keys = new String[size()]; int i = 0; for ( String key : keySet() ) { keys[i++] = key; } return VirtualValues.fromArray( Values.stringArray( keys ) ); }
public static ListValue makeTraversable( AnyValue collection ) { ListValue list; if ( collection == NO_VALUE ) { return VirtualValues.EMPTY_LIST; } else if ( collection instanceof ListValue ) { return (ListValue) collection; } else if ( collection instanceof ArrayValue ) { return VirtualValues.fromArray( (ArrayValue) collection ); } else { return VirtualValues.list( collection ); } }
private static ListValue extractKeys( DbAccess access, int[] keyIds ) { String[] keysNames = new String[keyIds.length]; for ( int i = 0; i < keyIds.length; i++ ) { keysNames[i] = access.getPropertyKeyName( keyIds[i] ); } return VirtualValues.fromArray( Values.stringArray( keysNames ) ); }
public static ListValue tail( AnyValue container ) { if ( container instanceof ListValue ) { return ((ListValue) container).tail(); } else if ( container instanceof ArrayValue ) { return VirtualValues.fromArray( (ArrayValue) container ).tail(); } else { return EMPTY_LIST; } }
private static ListValue fastListConversion( AnyValue value ) { if ( value instanceof ListValue ) { return (ListValue) value; } else if ( value instanceof ArrayValue ) { return VirtualValues.fromArray( (ArrayValue) value ); } else if ( value instanceof PathValue ) { return ((PathValue) value).asList(); } throw cantCoerce( value, "List" ); }
@Override public ListValue keys() { return VirtualValues.concat( map.keys(), VirtualValues.fromArray( Values.stringArray( updatedKeys ) ) ); }
public ListValue keys() { String[] keys = new String[size()]; int i = 0; for ( String key : keySet() ) { keys[i++] = key; } return VirtualValues.fromArray( Values.stringArray( keys ) ); }
@Override public ListValue split( String separator ) { assert separator != null; String asString = value(); //Cypher has different semantics for the case where the separator //is exactly the value, in cypher we expect two empty arrays //where as java returns an empty array if ( separator.equals( asString ) ) { return EMPTY_SPLIT; } else if ( separator.isEmpty() ) { return VirtualValues.fromArray( Values.charArray( asString.toCharArray() ) ); } List<AnyValue> split = splitNonRegex( asString, separator ); return VirtualValues.fromList( split ); }