Class AiRequiresEntry
java.lang.Object
tools.pantheum.gaia.gs1.registry.AiRequiresEntry
Represents one OR option in an AI's requires list.
Three forms:
- Single — one exact AI code must be present.
- Group — all AI codes in the list must be present (AND).
- Range — at least one AI whose code falls within
[
rangeStart,rangeEnd] must be present.
The outer list of AiRequiresEntry on an AiDefinition is OR:
at least one entry must be satisfied for the requires constraint to pass.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the exact AI.getGroup()Returns the group.Returns the range end.Returns the range start.booleanisGroup()Returnstrueif this element is group.booleanisRange()Returnstrueif this element is range.booleanisSatisfiedBy(Set<String> presentAis) Returnstrueif this requires option is satisfied by the given set of present AI codes.booleanisSingle()Returnstrueif this element is single.static AiRequiresEntryOf group.static AiRequiresEntryOf range.static AiRequiresEntryOf single.toString()
-
Method Details
-
ofSingle
Of single.- Parameters:
ai- the AI- Returns:
- a new
AiRequiresEntry
-
ofGroup
Of group.- Parameters:
ais- the AIs- Returns:
- a new
AiRequiresEntry
-
ofRange
Of range.- Parameters:
start- the startend- the end- Returns:
- a new
AiRequiresEntry
-
isRange
public boolean isRange()Returnstrueif this element is range.- Returns:
trueif this element is range.
-
isGroup
public boolean isGroup()Returnstrueif this element is group.- Returns:
trueif this element is group.
-
isSingle
public boolean isSingle()Returnstrueif this element is single.- Returns:
trueif this element is single.
-
getExactAi
-
getGroup
-
getRangeStart
-
getRangeEnd
-
isSatisfiedBy
Returnstrueif this requires option is satisfied by the given set of present AI codes.- Single — the exact AI is present.
- Group — all AIs in the group are present.
- Range — at least one present AI falls within the range.
- Parameters:
presentAis- the present AIs- Returns:
trueif is satisfied by.
-
toString
-