|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.data.trees.patterns.Patterns
public class Patterns
Defines a simple EDSL for Patterns and other related facilities.
| Field Summary | |
|---|---|
static QName |
any
A wildcard for labels. |
static AnyValue |
anyval
The null constraint. |
static boolean |
C
A marker for condition edges. |
| Constructor Summary | |
|---|---|
Patterns()
|
|
| Method Summary | ||
|---|---|---|
static After |
after(Calendar c)
Returns a After constraint for a given calendar. |
|
static AfterDate |
afterDate(Date d)
Returns an AfterDate constraint for a given date. |
|
static
|
all(Constraint<T> constraint1,
Constraint<T> constraint2)
Returns an All constraint that combines two or more Constraints. |
|
static AnyPattern |
any()
The AnyPattern. |
|
static AtLeastPattern |
atleast(QName label,
Pattern pattern)
Returns an AtLeastPattern for a given label and a given Pattern. |
|
static AtLeastPattern |
atleast(String label,
Pattern pattern)
Returns an AtLeastPattern for a given label and a given Pattern. |
|
static Before |
before(Calendar c)
Returns a Before constraint for a given calendar. |
|
static BeforeDate |
before(Date d)
Returns a BeforeDate constraint for a given date. |
|
static BoolPattern |
bool()
Returns an unconstrained BoolPattern predicate. |
|
static BoolPattern |
bool(Constraint<? super Boolean> c)
Returns a BoolPattern with a given constraint. |
|
static CalendarPattern |
calendar()
Returns an unconstrained CalendarPattern. |
|
static CalendarPattern |
calendar(Constraint<? super Calendar> c)
Returns a CalendarPatternwith a given constraint. |
|
static EdgePattern |
clone(EdgePattern pattern)
Clones an EdgePattern. |
|
static Pattern |
clone(Pattern pattern)
Clones a Pattern. |
|
static EdgePattern |
cond(EdgePattern p)
Marks an EdgePattern as a condition. |
|
static CutTreePattern |
cut(TreePattern pattern)
Returns a CutTreePattern with the EdgePatterns of a given TreePattern but removes all
the edges of a matching node under pruning |
|
static DatePattern |
date()
Returns an unconstrained DatePattern. |
|
static DatePattern |
date(Constraint<? super Date> c)
Returns a DatePattern with a given constraint. |
|
static
|
either(Constraint<T> constraint1,
Constraint<T> constraint2)
Returns an Either constraint that combines two or more Constraints. |
|
static After |
future()
Returns an After constraint for the current date. |
|
static AfterDate |
futureDate()
Returns an AfterDate constraint for the current date. |
|
static Marshaller |
getMarshaller()
Returns a Marshaller for Patterns. |
|
static Unmarshaller |
getUnMarshaller()
Returns an Unmarshaller for Patterns. |
|
static TreePattern |
hasLabelPath(QName... labels)
Returns a TreePattern that matches InnerNodes with a path of one or more edge labels. |
|
static TreePattern |
hasLabelPath(String... labels)
Returns a TreePattern that matches InnerNodes with a path of one or more edge labels. |
|
static Pattern |
hasPath(String... ids)
Returns a Pattern that matches InnerNodes with a path of one or more node identifiers. |
|
static
|
id(LeafPattern<?,?> idp,
T p)
Adds a LeafPattern over the identifier of nodes matched by an AbstractPattern. |
|
static
|
id(String identifier,
T pattern)
Adds a LeafPattern for text equality over the identifier of nodes matched by a AbstractPattern. |
|
static
|
is(T v)
Returns a Same constraint for a given value. |
|
static Less |
less(double than)
Returns a Less constraint for a given value. |
|
static ManyPattern |
many(QName label,
Pattern pattern)
Returns a ManyPattern for a given label and a given Pattern. |
|
static ManyPattern |
many(String label,
Pattern pattern)
Returns a ManyPattern for a given label and a given Pattern. |
|
static Match |
matches(String regex)
Returns a Match constraint for a given regular expression. |
|
static More |
more(double than)
Returns a More constraint for a given value. |
|
static
|
not(Constraint<T> constraint)
Returns an Not constraint for a given constraint. |
|
static NumPattern |
num()
Returns an unconstrained NumPattern. |
|
static NumPattern |
num(Constraint<? super Double> c)
Returns a NumPattern with a given constraint. |
|
static OnePattern |
one(QName label,
Pattern pattern)
Returns a OnePattern for a given label and a given Pattern. |
|
static OnePattern |
one(String label,
Pattern pattern)
Returns a OnePattern for a given label and a given Pattern. |
|
static OnlyPattern |
only(QName label,
Pattern pattern)
Returns an OnlyPattern for a given label and a given Pattern. |
|
static OnlyPattern |
only(String label,
Pattern pattern)
Returns an OnlyPattern for a given label and a given Pattern. |
|
static OptPattern |
opt(QName label,
Pattern pattern)
Returns an OptPattern for a given label and a given Pattern. |
|
static OptPattern |
opt(String label,
Pattern pattern)
Returns an OptPattern for a given label and a given Pattern. |
|
static Before |
past()
Returns an Before constraint for the current date. |
|
static BeforeDate |
pastDate()
Returns a BeforeDate constraint for the current date. |
|
static ManyPattern |
tail()
Returns a ManyPattern that matches all the children of a node not previously matched by the EdgePatterns of a TreePattern. |
|
static TextPattern |
text()
Returns an unconstrained TextPattern. |
|
static TextPattern |
text(Constraint<? super String> constraint)
Returns a TextPattern with a given constraint. |
|
static TreePattern |
tree(EdgePattern... patterns)
Returns a TreePattern with one or more EdgePatterns. |
|
static URIPattern |
uri()
Returns an unconstrained URIPattern. |
|
static URIPattern |
uri(Constraint<? super URI> c)
Returns a URIPattern with a given constraint. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final QName any
public static final boolean C
public static final AnyValue anyval
| Constructor Detail |
|---|
public Patterns()
| Method Detail |
|---|
public static Marshaller getMarshaller()
throws JAXBException
Marshaller for Patterns.
Marshaller
JAXBException - if the Marshaller could not be returned.
public static Unmarshaller getUnMarshaller()
throws JAXBException
Unmarshaller for Patterns.
Unmarshaller
JAXBException - if the Unmarshaller could not be returned.public static final AnyPattern any()
AnyPattern.
public static final Pattern clone(Pattern pattern)
throws Exception
Pattern.
pattern - the pattern to clone
Exception - if the pattern could not be cloned
public static final EdgePattern clone(EdgePattern pattern)
throws Exception
EdgePattern.
pattern - the pattern to clone
Exception - if the pattern could not be clonedpublic static final TreePattern tree(EdgePattern... patterns)
TreePattern with one or more EdgePatterns.
patterns - the EdgePatterns
TreePattern
public static final Pattern hasPath(String... ids)
throws IllegalArgumentException
Pattern that matches InnerNodes with a path of one or more node identifiers.
ids - the identifiers
IllegalArgumentException - if it is invoked with null or no input
public static final TreePattern hasLabelPath(String... labels)
throws IllegalArgumentException
TreePattern that matches InnerNodes with a path of one or more edge labels.
labels - the local names of the labels.
IllegalArgumentException - if it is invoked with null or no input.
public static final TreePattern hasLabelPath(QName... labels)
throws IllegalArgumentException
TreePattern that matches InnerNodes with a path of one or more edge labels.
labels - the local names of the labels.
IllegalArgumentException - if it is invoked with null or no input.public static EdgePattern cond(EdgePattern p)
EdgePattern as a condition.
p - the pattern
public static final <T extends AbstractPattern> T id(LeafPattern<?,?> idp,
T p)
LeafPattern over the identifier of nodes matched by an AbstractPattern.
idp - the LeafPatternp - the AbstractPattern
AbstractPattern obtained from the original AbstractPattern by adding the LeafPattern
public static final <T extends AbstractPattern> T id(String identifier,
T pattern)
LeafPattern for text equality over the identifier of nodes matched by a AbstractPattern.
identifier - the string to compare with node identifierspattern - the AbstractPattern
AbstractPattern obtained from the original TreePattern by adding the AbstractPattern
public static final OnePattern one(QName label,
Pattern pattern)
OnePattern for a given label and a given Pattern.
label - the labelpattern - the pattern
OnePattern
public static final OnePattern one(String label,
Pattern pattern)
OnePattern for a given label and a given Pattern.
label - the labelpattern - the pattern
OnePattern
public static final OptPattern opt(QName label,
Pattern pattern)
OptPattern for a given label and a given Pattern.
label - the labelpattern - the pattern
OptPattern
public static final OptPattern opt(String label,
Pattern pattern)
OptPattern for a given label and a given Pattern.
label - the labelpattern - the pattern
OptPattern
public static final AtLeastPattern atleast(QName label,
Pattern pattern)
AtLeastPattern for a given label and a given Pattern.
label - the labelpattern - the Pattern
AtLeastPattern
public static final AtLeastPattern atleast(String label,
Pattern pattern)
AtLeastPattern for a given label and a given Pattern.
label - the labelpattern - the Pattern
AtLeastPattern
public static final ManyPattern many(QName label,
Pattern pattern)
ManyPattern for a given label and a given Pattern.
label - the labelpattern - the Pattern.
ManyPattern.
public static final ManyPattern many(String label,
Pattern pattern)
ManyPattern for a given label and a given Pattern.
label - the labelpattern - the Pattern.
ManyPattern.
public static final OnlyPattern only(QName label,
Pattern pattern)
OnlyPattern for a given label and a given Pattern.
label - the labelpattern - the Pattern
OnlyPattern
public static final OnlyPattern only(String label,
Pattern pattern)
OnlyPattern for a given label and a given Pattern.
label - the labelpattern - the Pattern
OnlyPatternpublic static ManyPattern tail()
ManyPattern that matches all the children of a node not previously matched by the EdgePatterns of a TreePattern.
public static CutTreePattern cut(TreePattern pattern)
CutTreePattern with the EdgePatterns of a given TreePattern but removes all
the edges of a matching node under pruning
pattern - the Pattern
CutTreePatternpublic static TextPattern text(Constraint<? super String> constraint)
TextPattern with a given constraint.
constraint - the constraint
TextPatternpublic static TextPattern text()
TextPattern.
TextPatternpublic static NumPattern num(Constraint<? super Double> c)
NumPattern with a given constraint.
c - the constraint
NumPatternpublic static NumPattern num()
NumPattern.
NumPatternpublic static BoolPattern bool(Constraint<? super Boolean> c)
BoolPattern with a given constraint.
c - the constraint
BoolPatternpublic static BoolPattern bool()
BoolPattern predicate.
BoolPatternpublic static DatePattern date(Constraint<? super Date> c)
DatePattern with a given constraint.
c - the constraint
DatePatternpublic static DatePattern date()
DatePattern.
DatePatternpublic static URIPattern uri(Constraint<? super URI> c)
URIPattern with a given constraint.
c - the constraint
URIPatternpublic static URIPattern uri()
URIPattern.
URIPatternpublic static CalendarPattern calendar(Constraint<? super Calendar> c)
CalendarPatternwith a given constraint.
c - the constraint
CalendarPatternpublic static CalendarPattern calendar()
CalendarPattern.
CalendarPatternpublic static <T> Same<T> is(T v)
Same constraint for a given value.
v - the value
public static Match matches(String regex)
Match constraint for a given regular expression.
regex - the expression
public static <T> All<T> all(Constraint<T> constraint1,
Constraint<T> constraint2)
All constraint that combines two or more Constraints.
T - the type of constrained valuesconstraint1 - the first constraintconstraint2 - the second constraint
All constraint
public static <T> Either<T> either(Constraint<T> constraint1,
Constraint<T> constraint2)
Either constraint that combines two or more Constraints.
T - the type of constrained valuesconstraint1 - the first constraintconstraint2 - the second constraint
Either constraintpublic static <T> Not<T> not(Constraint<T> constraint)
Not constraint for a given constraint.
T - the type of constrained valuesconstraint - the constraint
Not constraintpublic static More more(double than)
More constraint for a given value.
than - the value
public static Less less(double than)
Less constraint for a given value.
than - the value
public static BeforeDate before(Date d)
BeforeDate constraint for a given date.
d - the date
public static AfterDate afterDate(Date d)
AfterDate constraint for a given date.
d - the date
public static AfterDate futureDate()
AfterDate constraint for the current date.
public static BeforeDate pastDate()
BeforeDate constraint for the current date.
public static Before before(Calendar c)
Before constraint for a given calendar.
c - the calendar
public static After after(Calendar c)
After constraint for a given calendar.
c - the calendar
public static After future()
After constraint for the current date.
public static Before past()
Before constraint for the current date.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||