Parameter
- the class that defines the parameters of this tree logger. It must be a TreeLoggerParameters instance.public abstract class TreeLogger<Parameter extends TreeLoggerParameters<? extends LogCategory>,Tree extends LoggableTree> extends java.lang.Object implements GenericTask
MyTreeLogger treeLogger = new MyTreeLogger();
treeLogger.init(MyCollectionOfLoggableTreeInstances);
treeLogger.setTreeLoggerParameters(MyTreeLoggerParameters); // in script mode
ortreeLogger.setTreeLoggerParameters(); // in Gui mode, a dialog will come out
treeLogger.run();
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.beans.PropertyChangeListener> |
listeners |
protected repicea.simulation.treelogger.TreeLoggerTask<?> |
loggerTask |
protected java.awt.Window |
owner |
protected Parameter |
params |
protected boolean |
progressBarEnabled |
protected TreeLoggerWrapper |
wrapper
Deprecated.
|
Modifier | Constructor and Description |
---|---|
protected |
TreeLogger()
General construtor for all AbstractTreeLogger-derived classes.
|
Modifier and Type | Method and Description |
---|---|
void |
addTreeLoggerListener(java.beans.PropertyChangeListener listener)
This method adds the listener instance if it is not already contained in the listeners list.
|
protected void |
addWoodPiece(Tree tree,
WoodPiece pieceToAdd)
This method adds a WoodPiece instance in the set of WoodPiece associated to the LoggableTree tree.
|
void |
cancel()
This method is called to cancel a running task.
|
abstract Parameter |
createDefaultTreeLoggerParameters()
This method returns a set of default parameters to make sure the logger can work.
|
abstract Tree |
getEligible(LoggableTree t)
This method determines whether or not the tree is eligible for this tree logger.
|
protected java.util.Collection<Tree> |
getEligibleTreesFromACollection(java.util.Collection<?> trees)
This method extracts a collection of TreePetroLoggable objects from a collection of LoggableTree instances.
|
java.lang.Exception |
getFailureReason()
This method returns the exception that has caused the task to terminate incorrectly.
|
java.util.Collection<Tree> |
getLoggableTrees()
This method returns the collection of LoggableTree instances that the logger has to work on.
|
java.lang.String |
getName()
This method returns the name of the task.
|
Parameter |
getTreeLoggerParameters()
This method returns the parameters of the TreeLogger object.
|
java.util.Map<LoggableTree,java.util.Collection<WoodPiece>> |
getWoodPieces()
This method returns the SetMap object that contains the trees in keys and their
associated wood pieces once they are processed.
|
boolean |
hasBeenCancelled()
This method returns true if the method cancel() has been called.
|
void |
init(java.util.Collection<?> newtrees)
This method initializes the TreeLogger instance by setting the collection of LoggableTree objects
on which the logger has to work.
|
abstract boolean |
isCompatibleWith(TreeLoggerCompatibilityCheck check)
This method makes it possible to determine whether or not this TreeLogger
class is compatible with the reference object
|
boolean |
isCorrectlyTerminated()
This method returns true if the task is correctly terminated or false otherwise.
|
protected boolean |
isSaveMemoryEnabled()
This method checks if the logger is operating in safe memory mode.
|
boolean |
isVerbose()
This method returns true if the task displays messages.
|
protected abstract void |
logThisTree(Tree tree)
This method process the trees into logs.
|
protected void |
logTrees()
This method instantiate a TreeLoggerTask and run this task.
|
protected void |
posteriorToRunning()
This method is run just after launching the logger task.
|
protected void |
priorToRunning()
This method is run just before launching the logger task.
|
void |
removeTreeLoggerListener(java.beans.PropertyChangeListener listener)
This method removes the instance listener from the listeners.
|
void |
run() |
void |
setProgressBarEnabled(boolean bool,
java.awt.Window owner)
This method enables a progress bar related to window owner.
|
void |
setSaveMemoryEnabled(boolean saveMemory)
This method enables the save memory mode.
|
abstract void |
setTreeLoggerParameters()
This method is called in GUI mode.
|
void |
setTreeLoggerParameters(Parameter params)
This method sets the parameters in script mode.
|
@Deprecated protected TreeLoggerWrapper wrapper
protected Parameter extends TreeLoggerParameters<? extends LogCategory> params
protected repicea.simulation.treelogger.TreeLoggerTask<?> loggerTask
protected java.util.List<java.beans.PropertyChangeListener> listeners
protected java.awt.Window owner
protected boolean progressBarEnabled
protected TreeLogger()
public void addTreeLoggerListener(java.beans.PropertyChangeListener listener)
listener
- a PropertyChangeListenerpublic void removeTreeLoggerListener(java.beans.PropertyChangeListener listener)
listener
- a PropertyChangeListener instancepublic void init(java.util.Collection<?> newtrees)
newtrees
- a Collection of LoggableTree objects to be processedjava.security.InvalidParameterException
- if the collection trees is null or emptypublic java.util.Collection<Tree> getLoggableTrees()
public void setProgressBarEnabled(boolean bool, java.awt.Window owner)
bool
- true to enable the progress bar or false otherwise (which is the default value)owner
- a Window instance (can be null)protected void addWoodPiece(Tree tree, WoodPiece pieceToAdd)
tree
- a LoggableTreepieceToAdd
- a WoodPiece to addprotected abstract void logThisTree(Tree tree)
public final void run()
run
in interface java.lang.Runnable
protected void logTrees()
protected void priorToRunning()
protected void posteriorToRunning()
public java.util.Map<LoggableTree,java.util.Collection<WoodPiece>> getWoodPieces()
public Parameter getTreeLoggerParameters()
public void setSaveMemoryEnabled(boolean saveMemory)
saveMemory
- true to enable this modeprotected boolean isSaveMemoryEnabled()
public void setTreeLoggerParameters(Parameter params)
params
- a TreeLoggerParameters instancepublic abstract void setTreeLoggerParameters()
public abstract Parameter createDefaultTreeLoggerParameters()
public java.lang.String getName()
GenericTask
getName
in interface GenericTask
public void cancel()
GenericTask
cancel
in interface GenericTask
public boolean hasBeenCancelled()
GenericTask
hasBeenCancelled
in interface GenericTask
public boolean isCorrectlyTerminated()
Executable
isCorrectlyTerminated
in interface Executable
protected java.util.Collection<Tree> getEligibleTreesFromACollection(java.util.Collection<?> trees)
trees
- a Collection of LoggableTree-derived instancespublic java.lang.Exception getFailureReason()
Executable
getFailureReason
in interface Executable
public abstract Tree getEligible(LoggableTree t)
t
- a LoggableTree instancepublic abstract boolean isCompatibleWith(TreeLoggerCompatibilityCheck check)
check
- a TreeLoggerCompatibilityCheck instancepublic boolean isVerbose()
GenericTask
isVerbose
in interface GenericTask