Package adams.gui.flow.tree.record.add
Class MostCommon
- java.lang.Object
-
- adams.core.logging.ConsoleLoggingObject
-
- adams.gui.flow.tree.record.add.AbstractRecordActorAdded
-
- adams.gui.flow.tree.record.add.MostCommon
-
- All Implemented Interfaces:
CleanUpHandler
,Serializable
public class MostCommon extends AbstractRecordActorAdded
Maintains a top X list of actors that were added.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
FILENAME
the file to write the "add" history to .protected static NamedCounter
m_Counter
the count per actor.protected static DelayedActionRunnable
m_SaveRunnable
for delaying the saving.protected static Thread
m_SaveThread
the threading for saving.-
Fields inherited from class adams.gui.flow.tree.record.add.AbstractRecordActorAdded
m_Recorders
-
Fields inherited from class adams.core.logging.ConsoleLoggingObject
m_Logger
-
-
Constructor Summary
Constructors Constructor Description MostCommon()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.protected static String
getFilename()
Returns the filename for storing the data.static List<String>
getMostCommon(int max)
Returns the X most common actors.protected static void
initCounter()
Initializes the counter.boolean
isEnabled(Node added)
Returns whether the recording is active.protected void
record(Actor added, Actor parent, Actor before, Actor after, TreeOperations.InsertPosition position)
Records the actor that was added.protected static String
save()
Performs the actual save operation.protected static void
saveCounter()
Saves the counter as CSV file.-
Methods inherited from class adams.gui.flow.tree.record.add.AbstractRecordActorAdded
cleanUpAll, record, recordAll
-
Methods inherited from class adams.core.logging.ConsoleLoggingObject
getLogger, initializeLogger, isLoggingEnabled
-
-
-
-
Field Detail
-
FILENAME
public static final String FILENAME
the file to write the "add" history to .- See Also:
- Constant Field Values
-
m_SaveRunnable
protected static DelayedActionRunnable m_SaveRunnable
for delaying the saving.
-
m_SaveThread
protected static Thread m_SaveThread
the threading for saving.
-
m_Counter
protected static NamedCounter m_Counter
the count per actor.
-
-
Method Detail
-
isEnabled
public boolean isEnabled(Node added)
Returns whether the recording is active.- Specified by:
isEnabled
in classAbstractRecordActorAdded
- Parameters:
added
- the node that got added (for context)- Returns:
- true if active
-
getFilename
protected static String getFilename()
Returns the filename for storing the data.- Returns:
- the filename
-
initCounter
protected static void initCounter()
Initializes the counter.
-
save
protected static String save()
Performs the actual save operation.
-
saveCounter
protected static void saveCounter()
Saves the counter as CSV file.
-
record
protected void record(Actor added, Actor parent, Actor before, Actor after, TreeOperations.InsertPosition position)
Records the actor that was added.- Specified by:
record
in classAbstractRecordActorAdded
- Parameters:
added
- the actor that was addedparent
- the parent of the added actorbefore
- the immediate actor before the added actor, can be nullafter
- the immediate actor after the added actor, can be nullposition
- how the actor was added
-
getMostCommon
public static List<String> getMostCommon(int max)
Returns the X most common actors.- Parameters:
max
- the maximum number of actors, <= 0 for all- Returns:
- the list of actor names
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractRecordActorAdded
-
-