public abstract class SetOperator extends Object implements Serializable, Comparable<SetOperator>
Modifier and Type | Field and Description |
---|---|
static SetOperator |
DIFFERENCE
Set difference.
|
static SetOperator |
DIFFERENCE_MULTISET
Multiset difference.
|
static SetOperator |
INTERSECTION
Set intersection.
|
static SetOperator |
INTERSECTION_MULTISET
Multiset intersection.
|
static SetOperator |
SUM_MULTISET
Multiset sum (a.k.a.
|
static SetOperator |
SYMMETRIC_DIFFERENCE
Set symmetric difference.
|
static SetOperator |
SYMMETRIC_DIFFERENCE_MULTISET
Multiset symmetric difference.
|
static SetOperator |
UNION
Set union.
|
static SetOperator |
UNION_MULTISET
Multiset union.
|
Modifier and Type | Method and Description |
---|---|
abstract int |
apply(int[] multiplicities)
Applies the operator.
|
static SetOperator |
atLeast(int n)
At least N occurrences.
|
static SetOperator |
atMost(int n)
At most N occurrences.
|
int |
compareTo(SetOperator other)
Comparison is based on the textual representation of set operators.
|
boolean |
equals(Object object)
Equality is implemented based on the textual representation of set operators.
|
int |
hashCode()
The hash code is computed based on the textual representation of the set
operator.
|
String |
toString()
Returns the textual representation of the set operator that uniquely
identifies it.
|
static SetOperator |
valueOf(String string)
Returns the
SetOperator for the textual representation supplied. |
public static final SetOperator UNION
SetOperator
ignores duplicates and returns a unique copy of an
element only if it occurs at least in one of the arguments of the operation. The
corresponding textual representation is "u".public static final SetOperator UNION_MULTISET
SetOperator
returns an element if it occurs in at least one
argument of the operation, with a multiplicity equal to the one of the argument it occurs
the most. The corresponding textual representation is "U". See this page for more information.public static final SetOperator SUM_MULTISET
SetOperator
returns an element if it occurs
at least in one argument of the operation, with a multiplicity that is the sum of the
multiplicities of the element in the multisets coming from the operation arguments. The
corresponding textual representation is "a". See this page for more information.public static final SetOperator INTERSECTION
SetOperator
ignores duplicates and returns an element only
if it occurs in all the arguments of the operation. In that case, exactly one copy of the
element is emitted. The corresponding textual representation is "i".public static final SetOperator INTERSECTION_MULTISET
SetOperator
returns an element if it occurs in all the
arguments of the operation, with a multiplicity equal to the one of the argument it occurs
the least. The corresponding textual representation is "I". See this page for more information.public static final SetOperator DIFFERENCE
SetOperator
ignores duplicates and returns the set difference
between the first argument (index 0) on one side, and all the other arguments on the other
side (i.e., A0 \ A1 ... \An
or equivalently A0 \ (A1 U ... U An)
). At most
a copy of a given element is returned. The corresponding textual representation is "d".public static final SetOperator DIFFERENCE_MULTISET
SetOperator
returns the multiset difference between the
first argument (index 0) on one side, and all the other arguments on the other side (i.e.,
A0 \ A1 ... \An
or equivalently A0 \ (A1 + ... + An)
where +
denotes multiset sum). The multiplicity of a returned element is equal to its multiplicity
in the first argument minus the sum of its multiplicities in the other arguments (rounded
to 0 if negative). The corresponding textual representation is "D". See this page for more information.public static final SetOperator SYMMETRIC_DIFFERENCE
SetOperator
ignores duplicates and returns all the
elements that are present in at least one argument of the operator but not in all of them.
For two arguments, this corresponds to evaluating (A0 \ A1) U (A1 \ A0)
. At most a
copy of an element is returned. The corresponding textual representation is "s".public static final SetOperator SYMMETRIC_DIFFERENCE_MULTISET
SetOperator
returns the elements that are
present in at least one argument of the operator, with a multiplicity that is the
difference between the multiplicity in the argument it occurs the most and the multiplicity
in the argument it occurs the least. For two arguments, this corresponds to evaluating (the
multiset version of) (A0 \ A1) U (A1 \ A0)
. The corresponding textual
representation is "S". See this page
for more information.public static SetOperator atLeast(int n)
SetOperator
that checks that the total
number of occurrences of a certain element, summed over all the operation arguments and
counting duplicates, is AT LEAST N. In that case a single copy of the element is emitted.
The corresponding textual representation is "N+".n
- the threshold, greater or equal to 1SetOperator
objectpublic static SetOperator atMost(int n)
SetOperator
that checks that the total
number of occurrences of a certain element, summed over all the operation arguments and
counting duplicates, is AT MOST N. In that case a single copy of the element is emitted.
The corresponding textual representation is "N-".n
- the threshold, greater or equal to 1SetOperator
objectpublic abstract int apply(int[] multiplicities)
multiplicities
- the multiplicities of the element in the operation arguments (non-null,
non-empty array)public final int compareTo(SetOperator other)
compareTo
in interface Comparable<SetOperator>
public final boolean equals(Object object)
public final int hashCode()
public final String toString()
public static SetOperator valueOf(String string)
SetOperator
for the textual representation supplied.string
- the textual representation, not nullSetOperator
, upon successCopyright © 2015–2016 FBK-irst. All rights reserved.