net.sf.saxon.s9api

Class OccurrenceIndicator

public class OccurrenceIndicator extends Enum<OccurrenceIndicator>

Represents one of the possible occurrence indicators in a SequenceType. The four standard values are ONE (no occurrence indicator), ZERO_OR_ONE (?), ZERO_OR_MORE (*), ONE_OR_MORE (+). In addition the value ZERO is supported, this is used only in the type empty-sequence() which matches an empty sequence and nothing else.
Field Summary
static OccurrenceIndicatorONE
static OccurrenceIndicatorONE_OR_MORE
static List<OccurrenceIndicator>VALUES
An immutable list containing the values comprising this enum class in the order they're declared.
static OccurrenceIndicatorZERO
static OccurrenceIndicatorZERO_OR_MORE
static OccurrenceIndicatorZERO_OR_ONE
Method Summary
booleanallowsMany()
Ask whether this occurrence indicator permits a sequence containing more than one item.
booleanallowsZero()
Ask whether this occurrence indicator permits an empty sequence.
List<OccurrenceIndicator>family()
Returns an immutable list containing the values comprising this enum class in the order they're declared.
protected intgetCardinality()
protected static OccurrenceIndicatorgetOccurrenceIndicator(int cardinality)
booleansubsumes(OccurrenceIndicator other)
Ask whether one occurrence indicator subsumes another.
static OccurrenceIndicatorvalueOf(String name)
Static factory to return the enum constant pertaining to the given string name.

Field Detail

ONE

public static final OccurrenceIndicator ONE

ONE_OR_MORE

public static final OccurrenceIndicator ONE_OR_MORE

VALUES

public static final List<OccurrenceIndicator> VALUES
An immutable list containing the values comprising this enum class in the order they're declared. This field may be used to iterate over the constants as follows:
for(OccurrenceIndicator c : OccurrenceIndicator.VALUES)
    System.out.println(c);

ZERO

public static final OccurrenceIndicator ZERO

ZERO_OR_MORE

public static final OccurrenceIndicator ZERO_OR_MORE

ZERO_OR_ONE

public static final OccurrenceIndicator ZERO_OR_ONE

Method Detail

allowsMany

public boolean allowsMany()
Ask whether this occurrence indicator permits a sequence containing more than one item.

Returns: true if the occurrence indicator is one of ZERO_OR_MORE or ONE_OR_MORE

Since: 9.2

allowsZero

public boolean allowsZero()
Ask whether this occurrence indicator permits an empty sequence.

Returns: true if the occurrence indicator is one of ZERO, ZERO_OR_ONE, or ZERO_OR_MORE

Since: 9.2

family

public final List<OccurrenceIndicator> family()
Returns an immutable list containing the values comprising this enum class in the order they're declared. This instance method simply returns VALUES. Few programmers should have any need to use this method. It is provided for use by sophisticated enum-based data structures to prevent the need for reflective access to VALUES.

Returns: an immutable list containing the values comprising this enum class, in the order they're declared.

getCardinality

protected int getCardinality()

getOccurrenceIndicator

protected static OccurrenceIndicator getOccurrenceIndicator(int cardinality)

subsumes

public boolean subsumes(OccurrenceIndicator other)
Ask whether one occurrence indicator subsumes another. Specifically, A.subsumes(B) is true if every sequence that satisfies the occurrence indicator B also satisfies the occurrence indicator A.

Parameters: other The other occurrence indicator

Returns: true if this occurrence indicator subsumes the other occurrence indicator

Since: 9.1

valueOf

public static final OccurrenceIndicator valueOf(String name)
Static factory to return the enum constant pertaining to the given string name. The string must match exactly an identifier used to declare an enum constant in this type.

Throws: IllegalArgumentException if this enum class has no constant with the specified name.