public class ChoicesSequence extends Object implements Iterable<Choice>
Constructor and Description |
---|
ChoicesSequence() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsChoiceWithNextValue()
Checks whether the sequence contains a choice that has a value not yet
explored.
|
Choice |
createNewChoice(int nPossibilities,
boolean exclusive) |
BitSet |
getBitSetNextInclusiveSelectionInList(int listSize,
int lengthSelection)
Gets the next possible
BitSet that represents a selection of
lengthSelection elements in a list. |
Choice |
getChoiceForSelectionInList(int listSize,
boolean exclusiveChoice,
boolean skipFirst)
Gets the next possible
Choice for selecting one or multiple elements
in a list. |
Integer |
getIndexNextExclusiveSelectionInList(int listSize)
Gets the next possible index of a list, i.e., a number between 0 and
listSize - 1 . |
Boolean |
getNextBooleanValue()
Gets the next Boolean value.
|
Choice |
getNextChoiceInExploration()
Gets the next choice for the current exploration and moves forward in the
sequence.
|
Integer |
getNextValueBetween(int minValue,
int maxValue)
Using a
Choice , gets the next possible value between minValue
and maxValue (both bounds are included). |
boolean |
hasNextChoiceInExploration()
Checks whether there is a choice already in the sequence for the current
exploration of the schema.
|
boolean |
hasUnseenValueFurtherInExploration()
Checks whether there is a choice with a next value below the current choice
in the exploration.
|
Iterator<Choice> |
iterator() |
void |
popLastChoice()
Remove the last choice in the sequence.
|
void |
removeAllChoicesAfterCurrentChoiceInExploration()
Removes all the choices that are strictly after the current choice in the
exploration.
|
void |
removeAllChoicesComingAfter(Choice choice)
Remove all the choices that are after the given choice.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Choice createNewChoice(int nPossibilities, boolean exclusive)
public void removeAllChoicesComingAfter(Choice choice)
IndexOutOfBoundsException
.choice
- The choice that must be the last in the sequence.public void popLastChoice()
IndexOutOfBoundsException
.public boolean containsChoiceWithNextValue()
public boolean hasNextChoiceInExploration()
getNextChoiceInExploration
to move forward in the exploration.public boolean hasUnseenValueFurtherInExploration()
getNextChoiceInExploration
to move forward in the exploration.public void removeAllChoicesAfterCurrentChoiceInExploration()
getNextChoiceInExploration
to move forward in the exploration.public Choice getNextChoiceInExploration()
IndexOutOfBoundsException
.public Integer getNextValueBetween(int minValue, int maxValue)
Choice
, gets the next possible value between minValue
and maxValue
(both bounds are included).
If there are no other possibilities, throws a RuntimeException
.minValue
- The minimal valuemaxValue
- The maximal valuepublic Integer getIndexNextExclusiveSelectionInList(int listSize)
listSize - 1
.listSize
- The size of the listpublic BitSet getBitSetNextInclusiveSelectionInList(int listSize, int lengthSelection)
BitSet
that represents a selection of
lengthSelection
elements in a list.listSize
- The size of the whole listlengthSelection
- The number of elements to selectBitSet
representing the selectionpublic Choice getChoiceForSelectionInList(int listSize, boolean exclusiveChoice, boolean skipFirst)
Choice
for selecting one or multiple elements
in a list.listSize
- The size of the listexclusiveChoice
- Whether one element or multiple elements can be
selected at any timeskipFirst
- If true, skips the first possible value (i.e., zero)Choice
public Boolean getNextBooleanValue()
Copyright © 2022. All rights reserved.