Skip to content

Commit

Permalink
Remove LabelSet
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed Jun 19, 2017
1 parent 55978bf commit 9cf6746
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 347 deletions.
Expand Up @@ -21,7 +21,6 @@

import org.neo4j.values.virtual.CoordinateReferenceSystem;
import org.neo4j.values.virtual.EdgeValue;
import org.neo4j.values.virtual.LabelSet;
import org.neo4j.values.virtual.MapValue;
import org.neo4j.values.virtual.NodeValue;

Expand All @@ -33,11 +32,7 @@ public interface AnyValueWriter<E extends Exception> extends ValueWriter<E>

void writeNodeReference( long nodeId ) throws E;

void writeNode( long nodeId, LabelSet labels, MapValue properties ) throws E;

void beginLabels( int numberOfLabels ) throws E;

void endLabels() throws E;
void writeNode( long nodeId, TextValue[] labels, MapValue properties ) throws E;

void writeEdgeReference( long edgeId ) throws E;

Expand Down
Expand Up @@ -393,7 +393,7 @@ public static Value of( Object value, boolean allowNull )
/**
* Generic value factory method.
* <p>
* Converts an array of object values to the internal Value type. See @{Values.of}.
* Converts an array of object values to the internal Value type. See {@link Values#of}.
*/
public static Value[] values( Object... objects )
{
Expand Down
198 changes: 0 additions & 198 deletions community/values/src/main/java/org/neo4j/values/virtual/LabelSet.java

This file was deleted.

Expand Up @@ -20,16 +20,17 @@
package org.neo4j.values.virtual;

import org.neo4j.values.AnyValueWriter;
import org.neo4j.values.TextValue;

import static java.lang.String.format;

public class NodeValue extends VirtualNodeValue
{
private final long id;
private final LabelSet labels;
private final TextValue[] labels;
private final MapValue properties;

NodeValue( long id, LabelSet labels, MapValue properties )
NodeValue( long id, TextValue[] labels, MapValue properties )
{
assert labels != null;
assert properties != null;
Expand All @@ -39,7 +40,7 @@ public class NodeValue extends VirtualNodeValue
this.properties = properties;
}

LabelSet labels()
TextValue[] labels()
{
return labels;
}
Expand Down
Expand Up @@ -63,9 +63,9 @@ public static MapValue map( HashMap<String,AnyValue> map )
return new MapValue( map );
}

public static LabelSet labels( TextValue... labels )
public static TextValue[] labels( TextValue... labels )
{
return new LabelSet.ArrayBasedLabelSet( labels );
return labels;
}

public static NodeReference node( long id )
Expand Down Expand Up @@ -93,7 +93,7 @@ public static VirtualValue pointGeographic( double latitude, double longitude )
return new PointValue.GeographicPointValue( latitude, longitude );
}

public static NodeValue nodeValue( long id, LabelSet labels, MapValue properties )
public static NodeValue nodeValue( long id, TextValue[] labels, MapValue properties )
{
return new NodeValue( id, labels, properties );
}
Expand Down
Expand Up @@ -88,14 +88,6 @@ public class AnyValueComparatorTest
path( nodes( 1L, 2L, 3L, 4L ), edges( 1L, 3L, 4L ) ),
path( nodes( 1L, 2L, 3L, 4L ), edges( 1L, 4L, 2L ) ),

// LabelSet
labels(),
labels( stringValue( "L" ) ),
labels( stringValue( "M" ) ),
labels( stringValue( "L" ), stringValue( "M" ) ),
labels( stringValue( "L" ), stringValue( "M" ), stringValue( "N" ) ),
labels( stringValue( "L" ), stringValue( "M" ), stringValue( "O" ) ),

// Point
pointCartesian( -1.0, -1.0 ),
pointCartesian( 1.0, 1.0 ),
Expand Down
Expand Up @@ -99,23 +99,11 @@ public void writeNodeReference( long nodeId )
}

@Override
public void writeNode( long nodeId, LabelSet labels, MapValue properties ) throws RuntimeException
public void writeNode( long nodeId, TextValue[] labels, MapValue properties ) throws RuntimeException
{
buffer.add( Specials.writeNode( nodeId, labels, properties ) );
}

@Override
public void beginLabels( int numberOfLabels )
{
buffer.add( Specials.beginLabels( numberOfLabels ) );
}

@Override
public void endLabels()
{
buffer.add( Specials.endLabels() );
}

@Override
public void writeEdgeReference( long edgeId )
{
Expand Down Expand Up @@ -175,9 +163,10 @@ public void endPoint()
public static class Specials
{

public static Special writeNode( long nodeId, LabelSet labels, MapValue properties )
public static Special writeNode( long nodeId, TextValue[] labels, MapValue properties )
{
return new Special( SpecialKind.WriteNode, Arrays.hashCode( new Object[]{nodeId, labels, properties} ) );
return new Special( SpecialKind.WriteNode, Arrays.hashCode( new Object[]{nodeId, properties} ) +
31 * Arrays.hashCode( labels ) );
}

public static Special writeEdge( long edgeId, long startNodeId, long endNodeId, TextValue type,
Expand All @@ -197,16 +186,6 @@ public static Special writeNodeReference( long nodeId )
return new Special( SpecialKind.WriteNodeReference, (int) nodeId );
}

public static Special beginLabels( int numberOfLabels )
{
return new Special( SpecialKind.BeginLabels, numberOfLabels );
}

public static Special endLabels()
{
return new Special( SpecialKind.EndLabels, 0 );
}

public static Special writeEdgeReference( long edgeId )
{
return new Special( SpecialKind.WriteEdgeReference, (int) edgeId );
Expand Down

0 comments on commit 9cf6746

Please sign in to comment.