abstract class AbstractConfig<E> extends Object
AbstractCutConfig
holds a given number
of values and allows implementing classes to access them. It also
stores whether the configuration object is enabled.Modifier and Type | Field and Description |
---|---|
private boolean |
enabled |
private List<E> |
values |
Constructor and Description |
---|
AbstractConfig(int count)
Instantiates an
AbstractConfig with the indicated
number of values. |
Modifier and Type | Method and Description |
---|---|
protected E |
getValue(int valueIndex)
Gets the value of the cut with the associated value ID.
|
boolean |
isEnabled()
Indicates whether the object is enabled or not.
|
protected void |
setIsEnabled(boolean state)
Sets whether the configuration object is enabled.
|
protected void |
setValue(int valueIndex,
E value)
Sets the value corresponding to the argument value ID to a new
object.
|
private void |
validateValueIndex(int index)
Throws an exception if the argument index does not correspond to
any value.
|
AbstractConfig(int count)
AbstractConfig
with the indicated
number of values.count
- - The number of values that the object should store.protected E getValue(int valueIndex)
valueIndex
- - The ID corresponding to the desired value.E
object.public boolean isEnabled()
true
if the object is enabled and
false
otherwise.protected void setValue(int valueIndex, E value)
valueIndex
- - The ID corresponding to the desired value.value
- - The new value.protected void setIsEnabled(boolean state)
state
- true
means that the object is enabled
and false
that it is disabled.private final void validateValueIndex(int index)
index
- - The index to check.Copyright © 2019. All rights reserved.