public class OptionalBoolean extends Object
This class is used by GraphAlgorithm configuration options to set a
default value which can be overwritten. The default value is also used when
algorithm configurations are merged and conflict.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
OptionalBoolean.State
States for
OptionalBoolean. |
| Constructor and Description |
|---|
OptionalBoolean(boolean valueIfUnset,
boolean valueIfConflicting)
An
OptionalBoolean has three possible states: true, false, and
"unset". |
| Modifier and Type | Method and Description |
|---|---|
boolean |
conflictsWith(OptionalBoolean other)
The conflicting states are true with false and false with true.
|
boolean |
get()
Get the boolean state.
|
protected OptionalBoolean.State |
getState()
Get the actual state.
|
void |
mergeWith(OptionalBoolean other)
State transitions.
|
void |
set(boolean value)
Set the boolean state.
|
void |
unset()
Reset to the unset state.
|
public OptionalBoolean(boolean valueIfUnset,
boolean valueIfConflicting)
OptionalBoolean has three possible states: true, false, and
"unset". The value is set when merged with a value of true or false. The
state returns to unset either explicitly or when true is merged with false.valueIfUnset - the value to return when the object's state is unsetvalueIfConflicting - the value to return when the object's state is conflictingpublic boolean get()
public void set(boolean value)
value - boolean statepublic void unset()
protected OptionalBoolean.State getState()
public boolean conflictsWith(OptionalBoolean other)
other - object to test withpublic void mergeWith(OptionalBoolean other)
other - object from which to merge stateCopyright © 2014–2019 The Apache Software Foundation. All rights reserved.