Package net.sf.saxon.s9api
Enum OccurrenceIndicator
- All Implemented Interfaces:
Serializable
,Comparable<OccurrenceIndicator>
,java.lang.constant.Constable
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionboolean
allows
(int size) Ask whether this occurrence indicator permits a sequence of a given sizeboolean
Ask whether this occurrence indicator permits a sequence containing more than one item.boolean
Ask whether this occurrence indicator permits an empty sequence.protected int
protected static OccurrenceIndicator
getOccurrenceIndicator
(int cardinality) boolean
subsumes
(OccurrenceIndicator other) Ask whether one occurrence indicator subsumes another.toString()
Return a string representation of the occurrence indicator: one of "*", "+", "?", "0" (exactly zero) or empty string (exactly one)static OccurrenceIndicator
Returns the enum constant of this type with the specified name.static OccurrenceIndicator[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
ZERO
-
ZERO_OR_ONE
-
ZERO_OR_MORE
-
ONE
-
ONE_OR_MORE
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getCardinality
protected int getCardinality() -
getOccurrenceIndicator
-
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
, orZERO_OR_MORE
- Since:
- 9.2
-
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
orONE_OR_MORE
- Since:
- 9.2
-
allows
public boolean allows(int size) Ask whether this occurrence indicator permits a sequence of a given size- Parameters:
size
- the number of items in the sequence- Returns:
- true if this number of items is permitted by the occurrence indicator
- Since:
- 12.0
-
subsumes
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
-
toString
Return a string representation of the occurrence indicator: one of "*", "+", "?", "0" (exactly zero) or empty string (exactly one)- Overrides:
toString
in classEnum<OccurrenceIndicator>
- Returns:
- a string representation of the occurrence indicator
- Since:
- 9.5
-