public abstract class BaseSimParamsNode extends BaseParamsNode implements SimParams, sim.portrayal.inspector.ProvidesInspector
SimParams
node. Provides an inspector
that gets populated from added definitions. Added definitions are checked
against allowed classes that can be specified by implementing classes.DEFAULT_FILENAME
Constructor and Description |
---|
BaseSimParamsNode() |
Modifier and Type | Method and Description |
---|---|
<T extends ParamDefinition> |
addDefinition(Class<T> definitionClass)
Adds a
ParamDefinition if allowed internally and to the
inspector. |
protected abstract boolean |
addDefinitionInternal(ParamDefinition definition)
Implementing classes need to handle adding an allowed definition here.
|
protected Set<Class<? extends ParamDefinition>> |
getAllowedDefinitionTypes()
Returns allowed types which definitions are checked on when added.
|
protected <T extends ParamDefinition> |
instantiateDefinition(Class<T> definitionClass)
Instantiates given
ParamDefinition class by calling its default
constructor. |
Inspector |
provideInspector(GUIState state,
String name) |
boolean |
removeDefinition(ParamDefinition definition)
Removes a
ParamDefinition internally and from inspector if
present. |
protected abstract boolean |
removeDefinitionInternal(ParamDefinition definition)
Implementing classes need to handle removing a definition here.
|
String |
toString() |
equals, hashCode
hideTitle
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
accessor, getTitle
getDefinitions
protected <T extends ParamDefinition> T instantiateDefinition(Class<T> definitionClass)
ParamDefinition
class by calling its default
constructor. Only called with allowed types. Implementing classes may
override this method, e.g. if a definition must be instantiated with
specific parameters.definitionClass
- the ParamDefinition
class to be instantiatedgetAllowedDefinitionTypes()
protected abstract boolean addDefinitionInternal(ParamDefinition definition)
definition
- the definitiontrue
if definition could be addedprotected abstract boolean removeDefinitionInternal(ParamDefinition definition)
definition
- the definitiontrue
if definition could be removedprotected Set<Class<? extends ParamDefinition>> getAllowedDefinitionTypes()
public final <T extends ParamDefinition> T addDefinition(Class<T> definitionClass)
ParamDefinition
if allowed internally and to the
inspector.addDefinition
in interface SimParams
definitionClass
- the Class
of the ParamDefinition
to be addedParamDefinition
objectIllegalArgumentException
- if the definition's type is not allowedpublic final boolean removeDefinition(ParamDefinition definition)
ParamDefinition
internally and from inspector if
present.removeDefinition
in interface SimParams
true
if removal succeededpublic Inspector provideInspector(GUIState state, String name)
provideInspector
in interface sim.portrayal.inspector.ProvidesInspector
public String toString()
toString
in class BaseParamDefinition