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 booleanautoRedrawIf true, the algorithm should auto-update the view.booleanborderForceRand-Abstoßung verwenden, ja/neindoubleborderWidthRand-Abstoßung links und obenBoolean[]bValuesArray for storing Boolean parametersbooleandoCopyPatternLayoutInit parameter.booleandoFinishMoveToTopParameter which is evaluated by the springEmbedder layouter at the end of the run.booleandoFinishRemoveOverlappbooleandoMultiplyByNodeDegreebooleandoRandomInitInit parameter.booleandoRemoveAllBendsDouble[]dValuesArray for storing Double parametersdoublemaxBorderForceAbstoßungs-Kraft direkt am RandintmaxThreadsMaximale Anzahl an Threads, die vom Algorithmus verwendet werden sollenArrayListnodeArrayVecor node array, containspatternNodeStructobjects, which saves/caches the information about pattern type and number for all nodes of a graphHashMapnodeSearchUsed for search from Node to NodeCacheEntry (which includes the Node)booleanredrawIf set to true, a redraw should be done.booleanrespectNodeDimensionsForLayoutIf true, distances are calculated with respect to node dimensions.intrunStatusCan be interpreted by the algorithm like desired.doubletemp_alphaRun parameter.doubletemperature_max_moveRun parameter.booleanthreadSettingsChangedA second variable for changed settigns. -
Constructor Summary
Constructors Constructor Description ThreadSafeOptions() -
Method Summary
Modifier and Type Method Description voidaddDouble(double d)voidaddInt(int i)voidaddLong(long l)voidexecuteThreadSafe(Runnable runnable)booleangetBval(int index, boolean defaultValue)Returns a stored boolean parameter value.doublegetDouble()doublegetDval(int index, double defaultValue)DOCUMENT ME!GraphgetGraphInstance()DOCUMENT ME!intgetInt()longgetLong()longgetNextLong()ObjectgetParam(int index, Object defaultValue)Get a parameter objectStringgetRunStatus()SelectiongetSelection()booleanisAbortWanted()Check if the plugin should stop.voidsetAbortWanted(boolean value)Use this call to indicate that the plugin should stop it workvoidsetBval(int index, boolean value)Sets a boolean Parameter with a given Indexindexand a given value.voidsetDouble(double d)voidsetDval(int index, double value)DOCUMENT ME!voidsetGraphInstance(Graph newG)DOCUMENT ME!voidsetInt(int i)voidsetLong(long l)ObjectsetParam(int index, Object setValue)DOCUMENT ME!voidsetSelection(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 valueredrawis true. -
nodeArray
Vecor node array, containspatternNodeStructobjects, 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 overwritegetRunStatusso 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 Indexindexand 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 thedefaultValueis 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()
-