use of org.neo4j.util.CalledFromGeneratedCode in project neo4j by neo4j.
the class CypherBoolean method in.
@CalledFromGeneratedCode
public static Value in(AnyValue lhs, AnyValue rhs) {
assert rhs != NO_VALUE;
ListValue anyValues = CypherFunctions.asList(rhs);
boolean seenUndefined = false;
for (AnyValue value : anyValues) {
switch(lhs.ternaryEquals(value)) {
case TRUE:
return Values.TRUE;
case UNDEFINED:
seenUndefined = true;
case FALSE:
break;
default:
throw new IllegalStateException("Unknown state");
}
}
return seenUndefined ? NO_VALUE : Values.FALSE;
}
use of org.neo4j.util.CalledFromGeneratedCode in project neo4j by neo4j.
the class CypherFunctions method last.
@CalledFromGeneratedCode
public static AnyValue last(AnyValue container) {
assert container != NO_VALUE : "NO_VALUE checks need to happen outside this call";
if (container instanceof SequenceValue) {
SequenceValue sequence = (SequenceValue) container;
int length = sequence.length();
if (length == 0) {
return NO_VALUE;
}
return sequence.value(length - 1);
} else {
throw new CypherTypeException(format("Invalid input for function 'last()': Expected %s to be a list", container));
}
}
use of org.neo4j.util.CalledFromGeneratedCode in project neo4j by neo4j.
the class PathValueBuilder method addMultipleIncoming.
/**
* Adds multiple incoming relationships to the path
*
* @param relationships the incoming relationships to add
* @param target the final target node of the path
*/
@CalledFromGeneratedCode
public void addMultipleIncoming(ListValue relationships, NodeValue target) {
if (relationships.isEmpty()) {
// nothing to do here
return;
}
int i;
for (i = 0; i < relationships.size() - 1; i++) {
AnyValue value = relationships.value(i);
if (notNoValue(value)) {
RelationshipValue relationship = (RelationshipValue) value;
nodes.add(relationship.startNode());
rels.add(relationship);
}
}
AnyValue last = relationships.value(i);
if (notNoValue(last)) {
rels.add((RelationshipValue) last);
nodes.add(target);
}
}
use of org.neo4j.util.CalledFromGeneratedCode in project neo4j by neo4j.
the class PathValueBuilder method addMultipleOutgoing.
/**
* Adds multiple outgoing relationships to the path
*
* @param relationships the outgoing relationships to add
*/
@CalledFromGeneratedCode
public void addMultipleOutgoing(ListValue relationships) {
for (AnyValue value : relationships) {
if (notNoValue(value)) {
// we know these relationships have already loaded start and end relationship
// so we should not use CypherFunctions::[start,end]Node to look them up
RelationshipValue relationship = (RelationshipValue) value;
nodes.add(relationship.endNode());
rels.add(relationship);
}
}
}
use of org.neo4j.util.CalledFromGeneratedCode in project neo4j by neo4j.
the class PathValueBuilder method addMultipleIncoming.
/**
* Adds multiple incoming relationships to the path
*
* @param relationships the incoming relationships to add
*/
@CalledFromGeneratedCode
public void addMultipleIncoming(ListValue relationships) {
for (AnyValue value : relationships) {
if (notNoValue(value)) {
// we know these relationships have already loaded start and end relationship
// so we should not use CypherFunctions::[start,end]Node to look them up
RelationshipValue relationship = (RelationshipValue) value;
nodes.add(relationship.startNode());
rels.add(relationship);
}
}
}
Aggregations