Package org.graffiti.plugin.algorithm
Class ThreadSafeOptions
java.lang.Object
org.graffiti.plugin.algorithm.ThreadSafeOptions
- All Implemented Interfaces:
HelperClass
public class ThreadSafeOptions extends Object implements HelperClass
This class can be used for thread safe communication between user interfaces
and plugins.
- Version:
- $Revision: 1.14 $
- Author:
- Christian Klukas, IPK Gatersleben
-
Field Summary
Fields Modifier and Type Field Description boolean
autoRedraw
If true, the algorithm should auto-update the view.boolean
borderForce
Rand-Abstoßung verwenden, ja/neindouble
borderWidth
Rand-Abstoßung links und obenBoolean[]
bValues
Array for storing Boolean parametersboolean
doCopyPatternLayout
Init parameter.boolean
doFinishMoveToTop
Parameter which is evaluated by the springEmbedder layouter at the end of the run.boolean
doFinishRemoveOverlapp
boolean
doMultiplyByNodeDegree
boolean
doRandomInit
Init parameter.boolean
doRemoveAllBends
Double[]
dValues
Array for storing Double parametersdouble
maxBorderForce
Abstoßungs-Kraft direkt am Randint
maxThreads
Maximale Anzahl an Threads, die vom Algorithmus verwendet werden sollenArrayList
nodeArray
Vecor node array, containspatternNodeStruct
objects, which saves/caches the information about pattern type and number for all nodes of a graphHashMap
nodeSearch
Used for search from Node to NodeCacheEntry (which includes the Node)boolean
redraw
If set to true, a redraw should be done.boolean
respectNodeDimensionsForLayout
If true, distances are calculated with respect to node dimensions.int
runStatus
Can be interpreted by the algorithm like desired.double
temp_alpha
Run parameter.double
temperature_max_move
Run parameter.boolean
threadSettingsChanged
A second variable for changed settigns. -
Constructor Summary
Constructors Constructor Description ThreadSafeOptions()
-
Method Summary
Modifier and Type Method Description void
addDouble(double d)
void
addInt(int i)
void
addLong(long l)
void
executeThreadSafe(Runnable runnable)
boolean
getBval(int index, boolean defaultValue)
Returns a stored boolean parameter value.double
getDouble()
double
getDval(int index, double defaultValue)
DOCUMENT ME!Graph
getGraphInstance()
DOCUMENT ME!int
getInt()
long
getLong()
long
getNextLong()
Object
getParam(int index, Object defaultValue)
Get a parameter objectString
getRunStatus()
Selection
getSelection()
boolean
isAbortWanted()
Check if the plugin should stop.void
setAbortWanted(boolean value)
Use this call to indicate that the plugin should stop it workvoid
setBval(int index, boolean value)
Sets a boolean Parameter with a given Indexindex
and a given value.void
setDouble(double d)
void
setDval(int index, double value)
DOCUMENT ME!void
setGraphInstance(Graph newG)
DOCUMENT ME!void
setInt(int i)
void
setLong(long l)
Object
setParam(int index, Object setValue)
DOCUMENT ME!void
setSelection(Selection selection)
Set selection for graph.
-
Field Details
-
doRandomInit
public boolean doRandomInitInit parameter. This parameter needs to be removed later to make this class more general. -
doCopyPatternLayout
public boolean doCopyPatternLayoutInit parameter. This parameter needs to be removed later to make this class more general. -
doMultiplyByNodeDegree
public boolean doMultiplyByNodeDegree -
doRemoveAllBends
public boolean doRemoveAllBends -
doFinishMoveToTop
public boolean doFinishMoveToTopParameter which is evaluated by the springEmbedder layouter at the end of the run. This parameter needs to be removed later to make this class more general. -
doFinishRemoveOverlapp
public boolean doFinishRemoveOverlapp -
borderWidth
public double borderWidthRand-Abstoßung links und oben -
maxBorderForce
public double maxBorderForceAbstoßungs-Kraft direkt am Rand -
temperature_max_move
public double temperature_max_moveRun parameter. This parameter needs to be removed later to make this class more general. -
temp_alpha
public double temp_alphaRun parameter. This parameter needs to be removed later to make this class more general. -
maxThreads
public int maxThreadsMaximale Anzahl an Threads, die vom Algorithmus verwendet werden sollen -
respectNodeDimensionsForLayout
public boolean respectNodeDimensionsForLayoutIf true, distances are calculated with respect to node dimensions. Intersections of Nodes in Layout should then be impossible. -
borderForce
public boolean borderForceRand-Abstoßung verwenden, ja/nein -
redraw
public boolean redrawIf set to true, a redraw should be done. -
autoRedraw
public boolean autoRedrawIf true, the algorithm should auto-update the view. If false, the algorithm should only redraw, if the valueredraw
is true. -
nodeArray
Vecor node array, containspatternNodeStruct
objects, which saves/caches the information about pattern type and number for all nodes of a graph -
nodeSearch
Used for search from Node to NodeCacheEntry (which includes the Node) -
runStatus
public int runStatusCan be interpreted by the algorithm like desired. 0 should be "not started", 1 should be "running", 2 should be "idle", 3 should be "finished". Check or overwritegetRunStatus
so that the descriptions match. -
threadSettingsChanged
public volatile boolean threadSettingsChangedA second variable for changed settigns. ToDo (CK): check purpose -
dValues
Array for storing Double parameters -
bValues
Array for storing Boolean parameters
-
-
Constructor Details
-
ThreadSafeOptions
public ThreadSafeOptions()
-
-
Method Details
-
setAbortWanted
public void setAbortWanted(boolean value)Use this call to indicate that the plugin should stop it work- Parameters:
value
- Set to True to indicate a wanted stop
-
isAbortWanted
public boolean isAbortWanted()Check if the plugin should stop.- Returns:
- True, in case the plugin should stop its run. False, if the plugin should continue its work.
-
setGraphInstance
DOCUMENT ME!- Parameters:
newG
- DOCUMENT ME!
-
getGraphInstance
DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getParam
Get a parameter object- Parameters:
index
- index number (GUI and Plugin should use the same indicies ;-)defaultValue
- In case the parameter is not yet set, this value will be returned.- Returns:
- The parameter object which was set before or if not yet set the defaultValue.
-
setParam
DOCUMENT ME!- Parameters:
index
- DOCUMENT ME!setValue
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
setDval
public void setDval(int index, double value)DOCUMENT ME!- Parameters:
index
- DOCUMENT ME!value
- DOCUMENT ME!
-
getDval
public double getDval(int index, double defaultValue)DOCUMENT ME!- Parameters:
index
- DOCUMENT ME!defaultValue
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
setBval
public void setBval(int index, boolean value)Sets a boolean Parameter with a given Indexindex
and a given value. It is up to the plugin that uses the options to make sure, that each time the right index for storing and restoring the parameter value is used.- Parameters:
index
- Index of the property. (self choosen from 0...x)value
- The new setting stored at indexindex
.
-
getBval
public boolean getBval(int index, boolean defaultValue)Returns a stored boolean parameter value. If the parameter has not yet been stored thedefaultValue
is returned.- Parameters:
index
- Index of the parameter to be retrieved.defaultValue
- The default value that is returned in case the parameter is yet unknown.- Returns:
- A boolean parameter value.
-
getSelection
- Returns:
- The selected nodes/edges for the graph.
-
setSelection
Set selection for graph.- Parameters:
selection
- The selection.
-
getRunStatus
-
addInt
public void addInt(int i) -
setInt
public void setInt(int i) -
getInt
public int getInt() -
addDouble
public void addDouble(double d) -
setDouble
public void setDouble(double d) -
getDouble
public double getDouble() -
executeThreadSafe
-
setLong
public void setLong(long l) -
addLong
public void addLong(long l) -
getLong
public long getLong() -
getNextLong
public long getNextLong()
-