Commit 57fbb9ce by apoorvnaik Committed by Sarath Subramanian

ATLAS-2184: IS_NULL and NOT_NULL operator support

parent f18555cd
......@@ -346,10 +346,12 @@ public class SearchParameters implements Serializable {
IN(new String[]{"in", "IN"}),
LIKE(new String[]{"like", "LIKE"}),
STARTS_WITH(new String[]{"startsWith", "STARTSWITH", "begins_with", "BEGINS_WITH"}),
ENDS_WITH(new String[]{"endsWith", "ENDSWITH", "ends_with", "BEGINS_WITH"}),
ENDS_WITH(new String[]{"endsWith", "ENDSWITH", "ends_with", "ENDS_WITH"}),
CONTAINS(new String[]{"contains", "CONTAINS"}),
CONTAINS_ANY(new String[]{"containsAny", "CONTAINSANY", "contains_any", "CONTAINS_ANY"}),
CONTAINS_ALL(new String[]{"containsAll", "CONTAINSALL", "contains_all", "CONTAINS_ALL"})
CONTAINS_ALL(new String[]{"containsAll", "CONTAINSALL", "contains_all", "CONTAINS_ALL"}),
IS_NULL(new String[]{"isNull", "ISNULL", "is_null", "IS_NULL"}),
NOT_NULL(new String[]{"notNull", "NOTNULL", "not_null", "NOT_NULL"}),
;
static final Map<String, Operator> operatorsMap = new HashMap<>();
......
......@@ -103,6 +103,14 @@ public abstract class SearchProcessor {
OPERATOR_MAP.put(SearchParameters.Operator.CONTAINS, "v.\"%s\": (*%s*)");
OPERATOR_PREDICATE_MAP.put(SearchParameters.Operator.CONTAINS, getContainsPredicateGenerator());
// TODO: Add contains any, contains all mappings here
OPERATOR_MAP.put(SearchParameters.Operator.IS_NULL, "(*:* NOT v.\"%s\":[* TO *])");
OPERATOR_PREDICATE_MAP.put(SearchParameters.Operator.IS_NULL, getIsNullPredicateGenerator());
OPERATOR_MAP.put(SearchParameters.Operator.NOT_NULL, "v.\"%s\":[* TO *]");
OPERATOR_PREDICATE_MAP.put(SearchParameters.Operator.NOT_NULL, getNotNullPredicateGenerator());
}
protected final SearchContext context;
......@@ -429,8 +437,9 @@ public abstract class SearchProcessor {
try {
if (OPERATOR_MAP.get(op) != null) {
String qualifiedName = type.getQualifiedAttributeName(attrName);
String escapeIndexQueryValue = AtlasAttribute.escapeIndexQueryValue(attrVal);
ret = String.format(OPERATOR_MAP.get(op), qualifiedName, AtlasStructType.AtlasAttribute.escapeIndexQueryValue(attrVal));
ret = String.format(OPERATOR_MAP.get(op), qualifiedName, escapeIndexQueryValue);
}
} catch (AtlasBaseException ex) {
LOG.warn(ex.getMessage());
......@@ -572,7 +581,13 @@ public abstract class SearchProcessor {
case ENDS_WITH:
query.has(qualifiedName, AtlasGraphQuery.MatchingOperator.REGEX, getSuffixRegex(attrValue));
break;
case IN:
case IS_NULL:
query.has(qualifiedName, AtlasGraphQuery.ComparisionOperator.EQUAL, null);
break;
case NOT_NULL:
query.has(qualifiedName, AtlasGraphQuery.ComparisionOperator.NOT_EQUAL, null);
break;
default:
LOG.warn("{}: unsupported operator. Ignored", operator);
break;
}
......
......@@ -326,8 +326,8 @@ public class SearchPredicateUtil {
} else {
ret = new VertexAttributePredicate(attrName, attrClass) {
@Override
public boolean compareValue(final Object value) {
return CollectionUtils.containsAny((Collection) attrVal, (Collection) value);
public boolean compareValue(final Object vertexAttrVal) {
return CollectionUtils.containsAny((Collection) attrVal, (Collection) vertexAttrVal);
}
};
}
......@@ -361,8 +361,8 @@ public class SearchPredicateUtil {
} else {
ret = new VertexAttributePredicate(attrName, attrClass) {
@Override
public boolean compareValue(final Object value) {
return ((Collection) attrVal).containsAll((Collection) value);
public boolean compareValue(final Object vertexAttrVal) {
return ((Collection) attrVal).containsAll((Collection) vertexAttrVal);
}
};
}
......@@ -396,8 +396,8 @@ public class SearchPredicateUtil {
} else {
ret = new VertexAttributePredicate(attrName, attrClass) {
@Override
public boolean compareValue(final Object value) {
return ((Collection)attrVal).contains(value);
public boolean compareValue(final Object vertexAttrVal) {
return ((Collection)attrVal).contains(vertexAttrVal);
}
};
}
......@@ -522,8 +522,8 @@ public class SearchPredicateUtil {
// Check if the provided value is present in the list of stored values
ret = new VertexAttributePredicate(attrName, attrClass) {
@Override
protected boolean compareValue(final Object value) {
return ((Collection) value).contains(attrVal);
protected boolean compareValue(final Object vertexAttrVal) {
return ((Collection) vertexAttrVal).contains(attrVal);
}
};
} else {
......@@ -541,6 +541,70 @@ public class SearchPredicateUtil {
return ret;
}
public static VertexAttributePredicateGenerator getIsNullPredicateGenerator() {
if (LOG.isDebugEnabled()) {
LOG.debug("==> getIsNullPredicateGenerator");
}
VertexAttributePredicateGenerator ret = new VertexAttributePredicateGenerator() {
@Override
public Predicate generatePredicate(final String attrName, final Object attrVal, final Class attrClass) {
final Predicate ret;
if (attrName == null || attrClass == null) {
ret = ALWAYS_FALSE;
} else {
ret = new VertexAttributePredicate(attrName, attrClass, true) {
@Override
protected boolean compareValue(final Object vertexAttrVal) {
return vertexAttrVal == null;
}
};
}
return ret;
}
};
if (LOG.isDebugEnabled()) {
LOG.debug("<== getIsNullPredicateGenerator");
}
return ret;
}
public static VertexAttributePredicateGenerator getNotNullPredicateGenerator() {
if (LOG.isDebugEnabled()) {
LOG.debug("==> getNotNullPredicateGenerator");
}
VertexAttributePredicateGenerator ret = new VertexAttributePredicateGenerator() {
@Override
public Predicate generatePredicate(final String attrName, final Object attrVal, final Class attrClass) {
final Predicate ret;
if (attrName == null || attrClass == null) {
ret = ALWAYS_FALSE;
} else {
ret = new VertexAttributePredicate(attrName, attrClass, true) {
@Override
protected boolean compareValue(final Object vertexAttrVal) {
return vertexAttrVal != null;
}
};
}
return ret;
}
};
if (LOG.isDebugEnabled()) {
LOG.debug("<== getNotNullPredicateGenerator");
}
return ret;
}
public interface VertexAttributePredicateGenerator {
Predicate generatePredicate(String attrName, Object attrVal, Class attrClass);
}
......@@ -548,10 +612,16 @@ public class SearchPredicateUtil {
static abstract class VertexAttributePredicate implements Predicate {
final String attrName;
final Class attrClass;
final boolean isNullValid;
VertexAttributePredicate(String attrName, Class attrClass) {
this(attrName, attrClass, false);
}
VertexAttributePredicate(String attrName, Class attrClass, boolean isNullValid) {
this.attrName = attrName;
this.attrClass = attrClass;
this.isNullValid = isNullValid;
}
@Override
......@@ -568,7 +638,7 @@ public class SearchPredicateUtil {
attrValue = AtlasGraphUtilsV1.getProperty(vertex, attrName, attrClass);
}
ret = attrValue != null && compareValue(attrValue);
ret = (isNullValid || attrValue != null) && compareValue(attrValue);
} else {
ret = false;
}
......@@ -576,7 +646,7 @@ public class SearchPredicateUtil {
return ret;
}
protected abstract boolean compareValue(Object value);
protected abstract boolean compareValue(Object vertexAttrVal);
}
static abstract class BooleanPredicate extends VertexAttributePredicate {
......@@ -590,16 +660,16 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, Boolean value) {
return new SearchPredicateUtil.BooleanPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Boolean) value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Boolean) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, Boolean value) {
return new SearchPredicateUtil.BooleanPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Boolean) value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Boolean) vertexAttrVal).compareTo(value) != 0;
}
};
}
......@@ -616,48 +686,48 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, Short value) {
return new ShortPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Short)value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Short) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, Short value) {
return new ShortPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Short)value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Short) vertexAttrVal).compareTo(value) != 0;
}
};
}
static VertexAttributePredicate getLTPredicate(String attrName, Class attrClass, Short value) {
return new ShortPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Short)value).compareTo(this.value) < 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Short) vertexAttrVal).compareTo(value) < 0;
}
};
}
static VertexAttributePredicate getLTEPredicate(String attrName, Class attrClass, Short value) {
return new ShortPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Short)value).compareTo(this.value) <= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Short) vertexAttrVal).compareTo(value) <= 0;
}
};
}
static VertexAttributePredicate getGTPredicate(String attrName, Class attrClass, Short value) {
return new ShortPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Short)value).compareTo(this.value) > 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Short) vertexAttrVal).compareTo(value) > 0;
}
};
}
static VertexAttributePredicate getGTEPredicate(String attrName, Class attrClass, Short value) {
return new ShortPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Short)value).compareTo(this.value) >= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Short) vertexAttrVal).compareTo(value) >= 0;
}
};
}
......@@ -674,48 +744,48 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, Integer value) {
return new IntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Integer)value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Integer) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, Integer value) {
return new IntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Integer)value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Integer) vertexAttrVal).compareTo(value) != 0;
}
};
}
static VertexAttributePredicate getLTPredicate(String attrName, Class attrClass, Integer value) {
return new IntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Integer)value).compareTo(this.value) < 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Integer) vertexAttrVal).compareTo(value) < 0;
}
};
}
static VertexAttributePredicate getLTEPredicate(String attrName, Class attrClass, Integer value) {
return new IntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Integer)value).compareTo(this.value) <= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Integer) vertexAttrVal).compareTo(value) <= 0;
}
};
}
static VertexAttributePredicate getGTPredicate(String attrName, Class attrClass, Integer value) {
return new IntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Integer)value).compareTo(this.value) > 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Integer) vertexAttrVal).compareTo(value) > 0;
}
};
}
static VertexAttributePredicate getGTEPredicate(String attrName, Class attrClass, Integer value) {
return new IntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Integer)value).compareTo(this.value) >= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Integer) vertexAttrVal).compareTo(value) >= 0;
}
};
}
......@@ -732,48 +802,48 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, Long value) {
return new LongPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Long)value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Long) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, Long value) {
return new LongPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Long)value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Long) vertexAttrVal).compareTo(value) != 0;
}
};
}
static VertexAttributePredicate getLTPredicate(String attrName, Class attrClass, Long value) {
return new LongPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Long)value).compareTo(this.value) < 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Long) vertexAttrVal).compareTo(value) < 0;
}
};
}
static VertexAttributePredicate getLTEPredicate(String attrName, Class attrClass, Long value) {
return new LongPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Long)value).compareTo(this.value) <= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Long) vertexAttrVal).compareTo(value) <= 0;
}
};
}
static VertexAttributePredicate getGTPredicate(String attrName, Class attrClass, Long value) {
return new LongPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Long)value).compareTo(this.value) > 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Long) vertexAttrVal).compareTo(value) > 0;
}
};
}
static VertexAttributePredicate getGTEPredicate(String attrName, Class attrClass, Long value) {
return new LongPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Long)value).compareTo(this.value) >= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Long) vertexAttrVal).compareTo(value) >= 0;
}
};
}
......@@ -790,48 +860,48 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, Float value) {
return new FloatPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Float)value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Float) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, Float value) {
return new FloatPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Float)value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Float) vertexAttrVal).compareTo(value) != 0;
}
};
}
static VertexAttributePredicate getLTPredicate(String attrName, Class attrClass, Float value) {
return new FloatPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Float)value).compareTo(this.value) < 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Float) vertexAttrVal).compareTo(value) < 0;
}
};
}
static VertexAttributePredicate getLTEPredicate(String attrName, Class attrClass, Float value) {
return new FloatPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Float)value).compareTo(this.value) <= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Float) vertexAttrVal).compareTo(value) <= 0;
}
};
}
static VertexAttributePredicate getGTPredicate(String attrName, Class attrClass, Float value) {
return new FloatPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Float)value).compareTo(this.value) > 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Float) vertexAttrVal).compareTo(value) > 0;
}
};
}
static VertexAttributePredicate getGTEPredicate(String attrName, Class attrClass, Float value) {
return new FloatPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Float)value).compareTo(this.value) >= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Float) vertexAttrVal).compareTo(value) >= 0;
}
};
}
......@@ -848,48 +918,48 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, Double value) {
return new DoublePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Double)value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Double) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, Double value) {
return new DoublePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Double)value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Double) vertexAttrVal).compareTo(value) != 0;
}
};
}
static VertexAttributePredicate getLTPredicate(String attrName, Class attrClass, Double value) {
return new DoublePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Double)value).compareTo(this.value) < 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Double) vertexAttrVal).compareTo(value) < 0;
}
};
}
static VertexAttributePredicate getLTEPredicate(String attrName, Class attrClass, Double value) {
return new DoublePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Double)value).compareTo(this.value) <= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Double) vertexAttrVal).compareTo(value) <= 0;
}
};
}
static VertexAttributePredicate getGTPredicate(String attrName, Class attrClass, Double value) {
return new DoublePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Double)value).compareTo(this.value) > 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Double) vertexAttrVal).compareTo(value) > 0;
}
};
}
static VertexAttributePredicate getGTEPredicate(String attrName, Class attrClass, Double value) {
return new DoublePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Double)value).compareTo(this.value) >= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Double) vertexAttrVal).compareTo(value) >= 0;
}
};
}
......@@ -906,48 +976,48 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, Byte value) {
return new BytePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Byte)value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Byte) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, Byte value) {
return new BytePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Byte)value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Byte) vertexAttrVal).compareTo(value) != 0;
}
};
}
static VertexAttributePredicate getLTPredicate(String attrName, Class attrClass, Byte value) {
return new BytePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Byte)value).compareTo(this.value) < 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Byte) vertexAttrVal).compareTo(value) < 0;
}
};
}
static VertexAttributePredicate getLTEPredicate(String attrName, Class attrClass, Byte value) {
return new BytePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Byte)value).compareTo(this.value) <= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Byte) vertexAttrVal).compareTo(value) <= 0;
}
};
}
static VertexAttributePredicate getGTPredicate(String attrName, Class attrClass, Byte value) {
return new BytePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Byte)value).compareTo(this.value) > 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Byte) vertexAttrVal).compareTo(value) > 0;
}
};
}
static VertexAttributePredicate getGTEPredicate(String attrName, Class attrClass, Byte value) {
return new BytePredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((Byte)value).compareTo(this.value) >= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((Byte) vertexAttrVal).compareTo(value) >= 0;
}
};
}
......@@ -964,48 +1034,48 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, BigInteger value) {
return new BigIntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigInteger)value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigInteger) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, BigInteger value) {
return new BigIntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigInteger)value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigInteger) vertexAttrVal).compareTo(value) != 0;
}
};
}
static VertexAttributePredicate getLTPredicate(String attrName, Class attrClass, BigInteger value) {
return new BigIntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigInteger)value).compareTo(this.value) < 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigInteger) vertexAttrVal).compareTo(value) < 0;
}
};
}
static VertexAttributePredicate getLTEPredicate(String attrName, Class attrClass, BigInteger value) {
return new BigIntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigInteger)value).compareTo(this.value) <= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigInteger) vertexAttrVal).compareTo(value) <= 0;
}
};
}
static VertexAttributePredicate getGTPredicate(String attrName, Class attrClass, BigInteger value) {
return new BigIntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigInteger)value).compareTo(this.value) > 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigInteger) vertexAttrVal).compareTo(value) > 0;
}
};
}
static VertexAttributePredicate getGTEPredicate(String attrName, Class attrClass, BigInteger value) {
return new BigIntegerPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigInteger)value).compareTo(this.value) >= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigInteger) vertexAttrVal).compareTo(value) >= 0;
}
};
}
......@@ -1022,48 +1092,48 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, BigDecimal value) {
return new BigDecimalPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigDecimal)value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigDecimal) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, BigDecimal value) {
return new BigDecimalPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigDecimal)value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigDecimal) vertexAttrVal).compareTo(value) != 0;
}
};
}
static VertexAttributePredicate getLTPredicate(String attrName, Class attrClass, BigDecimal value) {
return new BigDecimalPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigDecimal)value).compareTo(this.value) < 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigDecimal) vertexAttrVal).compareTo(value) < 0;
}
};
}
static VertexAttributePredicate getLTEPredicate(String attrName, Class attrClass, BigDecimal value) {
return new BigDecimalPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigDecimal)value).compareTo(this.value) <= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigDecimal) vertexAttrVal).compareTo(value) <= 0;
}
};
}
static VertexAttributePredicate getGTPredicate(String attrName, Class attrClass, BigDecimal value) {
return new BigDecimalPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigDecimal)value).compareTo(this.value) > 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigDecimal) vertexAttrVal).compareTo(value) > 0;
}
};
}
static VertexAttributePredicate getGTEPredicate(String attrName, Class attrClass, BigDecimal value) {
return new BigDecimalPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((BigDecimal)value).compareTo(this.value) >= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((BigDecimal) vertexAttrVal).compareTo(value) >= 0;
}
};
}
......@@ -1080,72 +1150,72 @@ public class SearchPredicateUtil {
static VertexAttributePredicate getEQPredicate(String attrName, Class attrClass, String value) {
return new StringPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((String)value).compareTo(this.value) == 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((String) vertexAttrVal).compareTo(value) == 0;
}
};
}
static VertexAttributePredicate getNEQPredicate(String attrName, Class attrClass, String value) {
return new StringPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((String)value).compareTo(this.value) != 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((String) vertexAttrVal).compareTo(value) != 0;
}
};
}
static VertexAttributePredicate getLTPredicate(String attrName, Class attrClass, String value) {
return new StringPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((String)value).compareTo(this.value) < 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((String) vertexAttrVal).compareTo(value) < 0;
}
};
}
static VertexAttributePredicate getLTEPredicate(String attrName, Class attrClass, String value) {
return new StringPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((String)value).compareTo(this.value) <= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((String) vertexAttrVal).compareTo(value) <= 0;
}
};
}
static VertexAttributePredicate getGTPredicate(String attrName, Class attrClass, String value) {
return new StringPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((String)value).compareTo(this.value) > 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((String) vertexAttrVal).compareTo(value) > 0;
}
};
}
static VertexAttributePredicate getGTEPredicate(String attrName, Class attrClass, String value) {
return new StringPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((String)value).compareTo(this.value) >= 0;
protected boolean compareValue(Object vertexAttrVal) {
return ((String) vertexAttrVal).compareTo(value) >= 0;
}
};
}
static VertexAttributePredicate getContainsPredicate(String attrName, Class attrClass, String value) {
return new StringPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((String)value).contains(this.value);
protected boolean compareValue(Object vertexAttrVal) {
return ((String) vertexAttrVal).contains(value);
}
};
}
static VertexAttributePredicate getStartsWithPredicate(String attrName, Class attrClass, String value) {
return new StringPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((String)value).startsWith(this.value);
protected boolean compareValue(Object vertexAttrVal) {
return ((String) vertexAttrVal).startsWith(value);
}
};
}
static VertexAttributePredicate getEndsWithPredicate(String attrName, Class attrClass, String value) {
return new StringPredicate(attrName, attrClass, value) {
protected boolean compareValue(Object value) {
return ((String)value).endsWith(this.value);
protected boolean compareValue(Object vertexAttrVal) {
return ((String) vertexAttrVal).endsWith(value);
}
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment