public class PatternBuilder
extends java.lang.Object
| Constructor and Description |
|---|
PatternBuilder() |
PatternBuilder(java.lang.String packageName)
Deprecated.
since 1.2, use
PatternBuilder() instead |
| Modifier and Type | Method and Description |
|---|---|
PatternBuilder |
buildAttibuteConstraint(java.util.function.Predicate<? super java.lang.Object> predicate,
PatternObject object)
Deprecated.
since 1.2; use
buildAttributeConstraint(PatternObject, Predicate) instead (typo "Att_ibute") |
<T> PatternBuilder |
buildAttributeConstraint(PatternObject object,
java.lang.Class<T> type,
java.util.function.Predicate<? super T> predicate)
Creates a new, type-safe predicate/attribute constraint on the given pattern object that additionally does an
instanceof check.
|
<T> PatternBuilder |
buildAttributeConstraint(PatternObject object,
java.util.function.Predicate<? super T> predicate)
Creates a new predicate/attribute constraint on the given pattern object.
|
PatternBuilder |
buildDistinctConstraint(PatternObject... objects)
Constrains the given objects to be distinct.
|
PatternBuilder |
buildEqualityConstraint(PatternObject object,
java.lang.Object value)
Constrains the given pattern object to be equal to the given value.
|
PatternBuilder |
buildInstanceOfConstraint(PatternObject object,
java.lang.Class<?> type)
Constrains the given pattern object to be an instance of the given type.
|
PatternBuilder |
buildMatchConstraint(java.util.function.Predicate<? super java.util.Map<java.lang.String,java.lang.Object>> predicate,
PatternObject... objects)
Creates a new match constraint on the given pattern object.
|
PatternBuilder |
buildPatternLink(PatternObject src,
PatternObject tgt)
Creates a new link constraint between the given pattern objects with any link or attribute name in both directions.
|
PatternBuilder |
buildPatternLink(PatternObject src,
java.lang.String attrName,
PatternObject tgt)
Creates a new link constraint between the given pattern objects and with the expected attribute name.
|
PatternBuilder |
buildPatternLink(PatternObject src,
java.lang.String srcRoleName,
java.lang.String tgtRoleName,
PatternObject tgt)
Creates a new link constraint between the given pattern objects and with the expected attribute name.
|
PatternObject |
buildPatternObject(java.lang.String name)
Creates a new pattern object with the given name.
|
PatternObject |
buildPatternObject(java.lang.String name,
java.lang.Class<?> type)
Creates a new pattern object with the given name and adds an
instance constraint for the given type.
|
Pattern |
getPattern() |
PatternMatcher |
matcher() |
public PatternBuilder()
@Deprecated public PatternBuilder(java.lang.String packageName)
PatternBuilder() insteadpackageName - unusedpublic Pattern getPattern()
public PatternObject buildPatternObject(java.lang.String name)
name - the name of the pattern objectpublic PatternObject buildPatternObject(java.lang.String name, java.lang.Class<?> type)
name - the name of the pattern objecttype - the type the pattern object is constraint to havebuildPatternObject(String),
buildInstanceOfConstraint(PatternObject, Class)public PatternBuilder buildPatternLink(PatternObject src, PatternObject tgt)
Equivalent to:
this.buildPatternLink(src, "*", "*", tgt);
src - the source pattern objecttgt - the target pattern objectpublic PatternBuilder buildPatternLink(PatternObject src, java.lang.String attrName, PatternObject tgt)
src - the source pattern objectattrName - the name of the attribute of the src object that should have the tgt valuetgt - the target pattern objectpublic PatternBuilder buildPatternLink(PatternObject src, java.lang.String srcRoleName, java.lang.String tgtRoleName, PatternObject tgt)
src - the source pattern objectsrcRoleName - the name of the property of the src object that should have the tgt valuetgtRoleName - the name of the property of the tgt object that should have the src valuetgt - the target pattern object@Deprecated public PatternBuilder buildAttibuteConstraint(java.util.function.Predicate<? super java.lang.Object> predicate, PatternObject object)
buildAttributeConstraint(PatternObject, Predicate) instead (typo "Att_ibute")predicate - the predicate on the value assigned to the pattern objectobject - the pattern objectpublic <T> PatternBuilder buildAttributeConstraint(PatternObject object, java.util.function.Predicate<? super T> predicate)
T - the type of objects expected to be passed to the predicateobject - the pattern objectpredicate - the predicate on the value assigned to the pattern objectpublic <T> PatternBuilder buildAttributeConstraint(PatternObject object, java.lang.Class<T> type, java.util.function.Predicate<? super T> predicate)
T - the type of objects expected to be passed to the predicateobject - the pattern objecttype - the type of objects expected to be passed to the predicatepredicate - the predicate on the value assigned to the pattern objectpublic PatternBuilder buildEqualityConstraint(PatternObject object, java.lang.Object value)
Equivalent to:
this.buildAttributeConstraint(object, it -> Objects.equals(value, it));
object - the pattern objectvalue - the valuepublic PatternBuilder buildInstanceOfConstraint(PatternObject object, java.lang.Class<?> type)
Equivalent to:
this.buildAttributeConstraint(object, it -> superClass.isInstance(it));
object - the pattern objecttype - the typepublic PatternBuilder buildMatchConstraint(java.util.function.Predicate<? super java.util.Map<java.lang.String,java.lang.Object>> predicate, PatternObject... objects)
predicate - the predicate on the values assigned to the pattern objectsobjects - the pattern objects the constraint applies topublic PatternBuilder buildDistinctConstraint(PatternObject... objects)
n pattern objects must match n distinct objects,
where equality is determined via equals and hashCode.objects - the pattern objects that are constrained to be distinctpublic PatternMatcher matcher()