Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
57fbb9ce
Commit
57fbb9ce
authored
Sep 29, 2017
by
apoorvnaik
Committed by
Sarath Subramanian
Sep 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2184: IS_NULL and NOT_NULL operator support
Signed-off-by:
Sarath Subramanian
<
ssubramanian@hortonworks.com
>
parent
f18555cd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
219 additions
and
132 deletions
+219
-132
SearchParameters.java
...va/org/apache/atlas/model/discovery/SearchParameters.java
+4
-2
SearchProcessor.java
...main/java/org/apache/atlas/discovery/SearchProcessor.java
+17
-2
SearchPredicateUtil.java
.../main/java/org/apache/atlas/util/SearchPredicateUtil.java
+198
-128
No files found.
intg/src/main/java/org/apache/atlas/model/discovery/SearchParameters.java
View file @
57fbb9ce
...
...
@@ -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"
,
"
BEGIN
S_WITH"
}),
ENDS_WITH
(
new
String
[]{
"endsWith"
,
"ENDSWITH"
,
"ends_with"
,
"
END
S_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
<>();
...
...
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
View file @
57fbb9ce
...
...
@@ -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
;
}
...
...
repository/src/main/java/org/apache/atlas/util/SearchPredicateUtil.java
View file @
57fbb9ce
...
...
@@ -326,8 +326,8 @@ public class SearchPredicateUtil {
}
else
{
ret
=
new
VertexAttributePredicate
(
attrName
,
attrClass
)
{
@Override
public
boolean
compareValue
(
final
Object
v
alue
)
{
return
CollectionUtils
.
containsAny
((
Collection
)
attrVal
,
(
Collection
)
v
alue
);
public
boolean
compareValue
(
final
Object
v
ertexAttrVal
)
{
return
CollectionUtils
.
containsAny
((
Collection
)
attrVal
,
(
Collection
)
v
ertexAttrVal
);
}
};
}
...
...
@@ -361,8 +361,8 @@ public class SearchPredicateUtil {
}
else
{
ret
=
new
VertexAttributePredicate
(
attrName
,
attrClass
)
{
@Override
public
boolean
compareValue
(
final
Object
v
alue
)
{
return
((
Collection
)
attrVal
).
containsAll
((
Collection
)
v
alue
);
public
boolean
compareValue
(
final
Object
v
ertexAttrVal
)
{
return
((
Collection
)
attrVal
).
containsAll
((
Collection
)
v
ertexAttrVal
);
}
};
}
...
...
@@ -396,8 +396,8 @@ public class SearchPredicateUtil {
}
else
{
ret
=
new
VertexAttributePredicate
(
attrName
,
attrClass
)
{
@Override
public
boolean
compareValue
(
final
Object
v
alue
)
{
return
((
Collection
)
attrVal
).
contains
(
v
alue
);
public
boolean
compareValue
(
final
Object
v
ertexAttrVal
)
{
return
((
Collection
)
attrVal
).
contains
(
v
ertexAttrVal
);
}
};
}
...
...
@@ -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
v
alue
)
{
return
((
Collection
)
v
alue
).
contains
(
attrVal
);
protected
boolean
compareValue
(
final
Object
v
ertexAttrVal
)
{
return
((
Collection
)
v
ertexAttrVal
).
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
v
alue
);
protected
abstract
boolean
compareValue
(
Object
v
ertexAttrVal
);
}
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
v
alue
)
{
return
((
Boolean
)
v
alue
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
return
((
Boolean
)
v
ertexAttrVal
).
compareTo
(
value
)
==
0
;
}
};
}
static
VertexAttributePredicate
getNEQPredicate
(
String
attrName
,
Class
attrClass
,
Boolean
value
)
{
return
new
SearchPredicateUtil
.
BooleanPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
v
alue
)
{
return
((
Boolean
)
v
alue
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
return
((
Boolean
)
v
ertexAttrVal
).
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
v
alue
)
{
return
((
Short
)
value
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Short
)
value
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Short
)
value
).
compareTo
(
this
.
value
)
<
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Short
)
value
).
compareTo
(
this
.
value
)
<=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Short
)
value
).
compareTo
(
this
.
value
)
>
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Short
)
value
).
compareTo
(
this
.
value
)
>=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Integer
)
value
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Integer
)
value
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Integer
)
value
).
compareTo
(
this
.
value
)
<
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Integer
)
value
).
compareTo
(
this
.
value
)
<=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Integer
)
value
).
compareTo
(
this
.
value
)
>
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Integer
)
value
).
compareTo
(
this
.
value
)
>=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Long
)
value
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Long
)
value
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Long
)
value
).
compareTo
(
this
.
value
)
<
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Long
)
value
).
compareTo
(
this
.
value
)
<=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Long
)
value
).
compareTo
(
this
.
value
)
>
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Long
)
value
).
compareTo
(
this
.
value
)
>=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Float
)
value
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Float
)
value
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Float
)
value
).
compareTo
(
this
.
value
)
<
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Float
)
value
).
compareTo
(
this
.
value
)
<=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Float
)
value
).
compareTo
(
this
.
value
)
>
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Float
)
value
).
compareTo
(
this
.
value
)
>=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Double
)
value
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Double
)
value
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Double
)
value
).
compareTo
(
this
.
value
)
<
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Double
)
value
).
compareTo
(
this
.
value
)
<=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Double
)
value
).
compareTo
(
this
.
value
)
>
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Double
)
value
).
compareTo
(
this
.
value
)
>=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Byte
)
value
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Byte
)
value
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Byte
)
value
).
compareTo
(
this
.
value
)
<
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Byte
)
value
).
compareTo
(
this
.
value
)
<=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Byte
)
value
).
compareTo
(
this
.
value
)
>
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
Byte
)
value
).
compareTo
(
this
.
value
)
>=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigInteger
)
value
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigInteger
)
value
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigInteger
)
value
).
compareTo
(
this
.
value
)
<
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigInteger
)
value
).
compareTo
(
this
.
value
)
<=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigInteger
)
value
).
compareTo
(
this
.
value
)
>
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigInteger
)
value
).
compareTo
(
this
.
value
)
>=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigDecimal
)
value
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigDecimal
)
value
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigDecimal
)
value
).
compareTo
(
this
.
value
)
<
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigDecimal
)
value
).
compareTo
(
this
.
value
)
<=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigDecimal
)
value
).
compareTo
(
this
.
value
)
>
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
BigDecimal
)
value
).
compareTo
(
this
.
value
)
>=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
String
)
value
).
compareTo
(
this
.
value
)
==
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
String
)
value
).
compareTo
(
this
.
value
)
!=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
String
)
value
).
compareTo
(
this
.
value
)
<
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
String
)
value
).
compareTo
(
this
.
value
)
<=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
String
)
value
).
compareTo
(
this
.
value
)
>
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
String
)
value
).
compareTo
(
this
.
value
)
>=
0
;
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
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
v
alue
)
{
return
((
String
)
value
).
contains
(
this
.
value
);
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
contains
(
value
);
}
};
}
static
VertexAttributePredicate
getStartsWithPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
v
alue
)
{
return
((
String
)
value
).
startsWith
(
this
.
value
);
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
startsWith
(
value
);
}
};
}
static
VertexAttributePredicate
getEndsWithPredicate
(
String
attrName
,
Class
attrClass
,
String
value
)
{
return
new
StringPredicate
(
attrName
,
attrClass
,
value
)
{
protected
boolean
compareValue
(
Object
v
alue
)
{
return
((
String
)
value
).
endsWith
(
this
.
value
);
protected
boolean
compareValue
(
Object
v
ertexAttrVal
)
{
return
((
String
)
vertexAttrVal
).
endsWith
(
value
);
}
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment