Package adams.flow.container
Class AbstractContainer
- java.lang.Object
-
- adams.flow.container.AbstractContainer
-
- All Implemented Interfaces:
CloneHandler<Container>,GlobalInfoSupporter,SpreadSheetSupporter,Container,Serializable
- Direct Known Subclasses:
AbstractFilterContainer,ControlChartContainer,EncapsulatedActorsContainer,FeatureConverterContainer,FileBasedDatasetContainer,HttpRequestResult,ImageSegmentationContainer,OutlierContainer,OutlierDetectorContainer,PredictionEccentricityContainer,ProcessActorContainer,RemoteCommandContainer,SequencePlotterContainer,SpreadSheetCellSelectionContainer,TimingContainer,TrainTestSetContainer,WekaAttributeSelectionContainer,WekaClusterEvaluationContainer,WekaClusteringContainer,WekaEvaluationContainer,WekaExperimentContainer,WekaFilterContainer,WekaForecastContainer,WekaGeneticAlgorithmContainer,WekaGeneticAlgorithmInitializationContainer,WekaModelContainer,WekaNearestNeighborSearchContainer,WekaPredictionContainer,WekaTrainTestSetContainer
public abstract class AbstractContainer extends Object implements Container
Ancestor of all containers. A container allows the access to the stored values via their names.
NB: containers need to declare a default constructor. The default constructor is used to generate help information.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractContainer()Initializes the container.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanaddAdditionalName(String name)Adds the specified name as valid name for a value.voidaddHelp(String name, String desc)Stores the help for the given name if valid name.voidaddHelp(String name, String desc, Class type)Stores the help for the given name if valid name.voidaddHelp(String name, String desc, Class[] types)Stores the help for the given name if valid name.protected voidcheckDefaultConstructor()Checks whether a default constructor is available - necessary for generating HTML help.AbstractContainergetClone()Returns a clone of itself using serialization.StringgetHelp(String name)Returns the help associated with the given name.ObjectgetValue(String name)Returns the value associated with the given name.<T> TgetValue(String name, Class<T> cls)Returns the value associated with the given name.StringglobalInfo()Returns a short info on the container, namely the value names.booleanhasHelp(String name)Checks whether a given help is non-null.booleanhasValue(String name)Checks whether a given value is non-null.protected voidinitHelp()Initializes the help strings.abstract booleanisValid()Checks whether the setup of the container is valid.protected booleanisValidName(String name)Checks whether the name of the object is valid.abstract Iterator<String>names()Returns all value names that can be used (theoretically).booleanremoveAdditionalName(String name)Removes the additional name again.booleansetValue(String name, Object value)Sets the named value.protected booleanstore(String name, Object value)Stores the value under the name.Iterator<String>stored()Returns all available stored value names.SpreadSheettoSpreadSheet()Returns the content as spreadsheet.StringtoString()Returns a short description of the stored data.
-
-
-
Method Detail
-
checkDefaultConstructor
protected void checkDefaultConstructor()
Checks whether a default constructor is available - necessary for generating HTML help.
-
getClone
public AbstractContainer getClone()
Returns a clone of itself using serialization.- Specified by:
getClonein interfaceCloneHandler<Container>- Specified by:
getClonein interfaceContainer- Returns:
- the clone
-
globalInfo
public String globalInfo()
Returns a short info on the container, namely the value names.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Returns:
- the info
-
addHelp
public void addHelp(String name, String desc)
Stores the help for the given name if valid name.- Specified by:
addHelpin interfaceContainer- Parameters:
name- the name to store the help underdesc- the help description- See Also:
isValidName(String)
-
addHelp
public void addHelp(String name, String desc, Class type)
Stores the help for the given name if valid name.- Specified by:
addHelpin interfaceContainer- Parameters:
name- the name to store the help underdesc- the help descriptiontype- the type of the data- See Also:
isValidName(String)
-
addHelp
public void addHelp(String name, String desc, Class[] types)
Stores the help for the given name if valid name.- Specified by:
addHelpin interfaceContainer- Parameters:
name- the name to store the help underdesc- the help descriptiontypes- the types of the data- See Also:
isValidName(String)
-
initHelp
protected void initHelp()
Initializes the help strings.
Default implementation does nothing.
-
names
public abstract Iterator<String> names()
Returns all value names that can be used (theoretically).
-
hasValue
public boolean hasValue(String name)
Checks whether a given value is non-null.
-
getValue
public <T> T getValue(String name, Class<T> cls)
Returns the value associated with the given name.
-
hasHelp
public boolean hasHelp(String name)
Checks whether a given help is non-null.
-
isValidName
protected boolean isValidName(String name)
Checks whether the name of the object is valid.- Parameters:
name- the name to check- Returns:
- true if valid
- See Also:
names()
-
store
protected boolean store(String name, Object value)
Stores the value under the name.- Parameters:
name- the name of the valuevalue- the value to store- Returns:
- true if successfully stored, i.e., value is not null
-
isValid
public abstract boolean isValid()
Checks whether the setup of the container is valid.
-
addAdditionalName
public boolean addAdditionalName(String name)
Adds the specified name as valid name for a value.- Specified by:
addAdditionalNamein interfaceContainer- Parameters:
name- the name to add- Returns:
- true if the additional names list changed
-
removeAdditionalName
public boolean removeAdditionalName(String name)
Removes the additional name again.- Specified by:
removeAdditionalNamein interfaceContainer- Parameters:
name- the name to remove- Returns:
- true if the name was present and got removed
-
toString
public String toString()
Returns a short description of the stored data.
-
toSpreadSheet
public SpreadSheet toSpreadSheet()
Returns the content as spreadsheet.- Specified by:
toSpreadSheetin interfaceContainer- Specified by:
toSpreadSheetin interfaceSpreadSheetSupporter- Returns:
- the content
-
-