public class SFRComponent extends java.lang.Object implements IReactorComponent, IDataProvider
The SFRComponent class represents all reactor components that can be stored in a SFRComposite. This class should be treated as an extension of the Java Object class where identifying pieces of information are stored on this object. This class also implements the IDataProvider interface in order to provide state point data capabilities for individual, unique instances of this extended class.
This class implements the ICE Component interface.
iComponentVisitor
iComponentListener
Constructor and Description |
---|
SFRComponent()
Nullary constructor.
|
SFRComponent(java.lang.String name)
Parameterized constructor with name specified.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(IComponentVisitor visitor)
Accepts an IComponentVisitor that can visit the
SFRComponent to ascertain its type and perform various type-specific
operations.
|
void |
accept(ISFRComponentVisitor visitor)
This method calls the ISFRComponentVisitor's visit
operation, passing itself as the argument.
SFRComponent is not represented with a visit(SFRComponent) operation in ISFRComponentVisitor, so this method does nothing. |
void |
addData(SFRData data,
double time)
Adds a IData piece, keyed on the feature and time, to the dataTree.
|
java.lang.Object |
clone()
Deep copies and returns a newly instantiated object.
|
void |
copy(SFRComponent component)
Deep copies the contents of the SFRComponent.
|
boolean |
equals(java.lang.Object otherObject)
Compares the contents of objects and returns true if they are identical,
otherwise returns false.
|
double |
getCurrentTime()
Returns the current time as a double.
|
java.util.ArrayList<IData> |
getDataAtCurrentTime(java.lang.String feature)
Returns all IData corresponding to the specified
features at the current time.
|
java.lang.String |
getDescription()
Returns the description of the SFRComponent as a String.
|
java.util.ArrayList<java.lang.String> |
getFeatureList()
Returns an ArrayList of strings representing the
names of all features contained in the SFRComponent's dataTree.
|
java.util.ArrayList<java.lang.String> |
getFeaturesAtCurrentTime()
Returns an ArrayList of strings representing all
features found in the SFRComponent's dataTree, at the current time.
|
int |
getId()
Returns the ID of the SFRComponent as an int.
|
java.lang.String |
getName()
Returns the name of the SFRComponent as a String.
|
int |
getNumberOfTimeSteps()
Returns the total number of time steps contained
in the SFRComponent's dataTree.
|
java.lang.String |
getSourceInfo()
Returns the source information as a string.
|
java.util.ArrayList<java.lang.Double> |
getTimes()
Returns an ArrayList of doubles representing all
times found in the SFRComponent's dataTree.
|
int |
getTimeStep(double time)
Returns an integer representing the time step
associated to the specified time.
|
java.lang.String |
getTimeUnits()
Returns the time units as a string.
|
int |
hashCode()
Returns the hashCode of the object.
|
void |
notifyListeners()
This operation notifies the listeners of the Component that its data
state has changed.
|
void |
register(IUpdateableListener listener)
This operation registers a listener that realizes the IComponentListener
interface with the Component so that it can receive notifications of
changes to the Component, if the Component publishes such information.
|
void |
removeDataFromFeature(java.lang.String feature)
Removes the feature and all associated IData from the dataTree at all
time steps.
|
void |
setDescription(java.lang.String description)
Sets the description of the SFRComponent.
|
void |
setId(int id)
Sets the ID of the SFRComponent.
|
void |
setName(java.lang.String name)
Sets the name of the SFRComponent.
|
void |
setSourceInfo(java.lang.String sourceInfo)
Sets the source information.
|
void |
setTime(double newTime)
Sets the current time.
|
void |
setTimeUnits(java.lang.String timeUnits)
Sets the time units.
|
java.lang.String |
toString()
Gets a String representation of the SFRComponent.
|
void |
unregister(IUpdateableListener listener)
This operation unregisters a listener that realizes the
IUpdateableListener interface with the IUpdateable so that it will no
longer receive notifications of changes to the IUpdateable if they are
published.
|
void |
update(java.lang.String updatedKey,
java.lang.String newValue)
This operation notifies a class that has implemented IUpdateable that the
value associated with the particular key has been updated.
|
public SFRComponent()
Nullary constructor.
public SFRComponent(java.lang.String name)
Parameterized constructor with name specified.
name
- Name of the SFRComponent. Cannot be an empty string or null.public void notifyListeners()
This operation notifies the listeners of the Component that its data state has changed.
public java.lang.String getName()
getName
in interface Identifiable
public java.lang.String getDescription()
Returns the description of the SFRComponent as a String.
getDescription
in interface Identifiable
Identifiable.getDescription()
public int getId()
Returns the ID of the SFRComponent as an int.
getId
in interface Identifiable
Identifiable.getId()
public void setSourceInfo(java.lang.String sourceInfo)
Sets the source information.
sourceInfo
- The source information of the SFRComponent. Cannot be an empty
string or null.public java.lang.String getSourceInfo()
Returns the source information as a string.
getSourceInfo
in interface IDataProvider
IDataProvider.getSourceInfo()
public double getCurrentTime()
Returns the current time as a double.
public void setTimeUnits(java.lang.String timeUnits)
Sets the time units.
timeUnits
- The time units. Cannot be an empty string or null.public void addData(SFRData data, double time)
Adds a IData piece, keyed on the feature and time, to the dataTree. If the feature exists in the tree, it will append to the end of the list.
data
- The piece of data to be added to the dataTree. Cannot be null.time
- The time at which the data will be added to the dataTree. If
the time does not exist, it will be created. Time cannot be
negative.public void removeDataFromFeature(java.lang.String feature)
Removes the feature and all associated IData from the dataTree at all time steps. If a user wishes to remove a single piece of IData from the tree, then use the appropriate getData operation on that feature and manipulate the data that way.
feature
- The name of the feature. Must be a valid feature, or not data
will be removed.public void setId(int id)
setId
in interface Identifiable
id
- The ID of the SFRComponent. Must be non-negative.Identifiable.setId(int id)
public void setName(java.lang.String name)
setName
in interface Identifiable
name
- The name of the SFRComponent. Cannot be null or an empty
string.Identifiable.setName(String name)
public void setDescription(java.lang.String description)
setDescription
in interface Identifiable
description
- The description of the SFRComponent. Cannot be an empty string
or null.Identifiable.setDescription(String description)
public boolean equals(java.lang.Object otherObject)
Compares the contents of objects and returns true if they are identical, otherwise returns false.
equals
in interface Identifiable
equals
in class java.lang.Object
otherObject
- The other object to compare against.Identifiable.equals(Object otherObject)
public int hashCode()
Returns the hashCode of the object.
hashCode
in interface Identifiable
hashCode
in class java.lang.Object
Identifiable.hashCode()
public java.lang.Object clone()
Deep copies and returns a newly instantiated object.
clone
in interface Identifiable
clone
in class java.lang.Object
public void copy(SFRComponent component)
component
- The other SFRComponent to copy the contents of.public void update(java.lang.String updatedKey, java.lang.String newValue)
This operation notifies a class that has implemented IUpdateable that the value associated with the particular key has been updated.
update
in interface IUpdateable
updatedKey
- A unique key that describes the value that is to be updated.newValue
- The updated value of the key.IUpdateable.update(String updatedKey, String newValue)
public void register(IUpdateableListener listener)
This operation registers a listener that realizes the IComponentListener interface with the Component so that it can receive notifications of changes to the Component, if the Component publishes such information.
register
in interface IUpdateable
listener
- The new listener that should be notified when the the
Component's state changes.IUpdateable.register(IUpdateableListener listener)
public void accept(IComponentVisitor visitor)
accept
in interface Component
visitor
- The SFRComponent's visitor.Component.accept(IComponentVisitor visitor)
public void accept(ISFRComponentVisitor visitor)
visitor
- An ISFRComponentVisitor that is visiting this SFRComponent.public java.lang.String toString()
toString
in interface IReactorComponent
toString
in class java.lang.Object
IReactorComponent.toString()
public java.util.ArrayList<java.lang.String> getFeatureList()
getFeatureList
in interface IDataProvider
IDataProvider.getFeatureList()
public int getNumberOfTimeSteps()
getNumberOfTimeSteps
in interface IDataProvider
IDataProvider.getNumberOfTimeSteps()
public void setTime(double newTime)
setTime
in interface IDataProvider
newTime
- The new time to set.IDataProvider.setTime(double step)
public java.util.ArrayList<IData> getDataAtCurrentTime(java.lang.String feature)
getDataAtCurrentTime
in interface IDataProvider
feature
- The feature of IData to be returned. Cannot be null.IDataProvider.getDataAtCurrentTime(String feature)
public java.util.ArrayList<java.lang.String> getFeaturesAtCurrentTime()
getFeaturesAtCurrentTime
in interface IDataProvider
IDataProvider.getFeaturesAtCurrentTime()
public java.util.ArrayList<java.lang.Double> getTimes()
getTimes
in interface IDataProvider
IDataProvider.getTimes()
public int getTimeStep(double time)
getTimeStep
in interface IDataProvider
time
- The time.IDataProvider.getTimeStep(double time)
public java.lang.String getTimeUnits()
getTimeUnits
in interface IDataProvider
IDataProvider.getTimeUnits()
public void unregister(IUpdateableListener listener)
IUpdateable
This operation unregisters a listener that realizes the IUpdateableListener interface with the IUpdateable so that it will no longer receive notifications of changes to the IUpdateable if they are published.
unregister
in interface IUpdateable
listener
- The listener that should no longer receive updates.