use of org.neo4j.values.storable.TextArray in project neo4j by neo4j.
the class GenericIndexKeyValidator method worstCaseLength.
private static int worstCaseLength(AnyValue value) {
if (value.isSequenceValue()) {
SequenceValue sequenceValue = (SequenceValue) value;
if (sequenceValue instanceof TextArray) {
TextArray textArray = (TextArray) sequenceValue;
int length = 0;
for (int i = 0; i < textArray.length(); i++) {
length += stringWorstCaseLength(textArray.stringValue(i).length());
}
return length;
}
return sequenceValue.length() * BIGGEST_STATIC_SIZE;
} else {
if (((Value) value).valueGroup().category() == ValueCategory.TEXT) {
// For text, which is very dynamic in its nature do a worst-case off of number of characters in it
return stringWorstCaseLength(((TextValue) value).length());
}
// For all else then use the biggest possible value for a non-dynamic, non-array value a state can occupy
return BIGGEST_STATIC_SIZE;
}
}
Aggregations