public class SimulationManager
extends java.lang.Object
Constructor and Description |
---|
SimulationManager(Model m)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
SubNet |
buildSubNet(AbstractCpsObject cps,
java.util.ArrayList<java.lang.Integer> visited,
SubNet sN)
recursivly generates a subnet of all objects, that one specific object is
connected to.
|
float |
calculateEnergy(java.lang.String type,
SubNet sN,
int x)
calculates the energy of either all producers or consumers.
|
float |
calculateMinimumEnergy(SubNet sN,
int x)
Calculate the Minimum Energy.
|
void |
calculateStateForTimeStep(int x)
calculates the flow of the edges and the supply for objects.
|
void |
cleanObjectsToHandle()
ensures that objectsToHandle only contains HolonObjects.
|
void |
copyObjects(java.util.ArrayList<AbstractCpsObject> toCopy)
copies the data of an array of Objects.
|
java.lang.String |
getString(java.util.ArrayList<java.lang.Integer> tags)
Get String.
|
java.util.ArrayList<SubNet> |
getSubNets()
Get all Subnets.
|
boolean |
legitState(AbstractCpsObject neighbor,
AbstractCpsObject current)
is the Switch in a legitimate State.
|
java.util.ArrayList<java.lang.Integer> |
mergeLists(java.util.ArrayList<java.lang.Integer> a,
java.util.ArrayList<java.lang.Integer> b)
Merge the Lists.
|
void |
printNet()
Prints the Components auf all subnets.
|
void |
printNodes(java.util.ArrayList<AbstractCpsObject> nodes)
Print the nodes.
|
void |
removeFromToHandle(int id)
removes an Object that already has been handled with.
|
void |
reset()
Reset all Data to the current state of the Model.
|
void |
resetConnections(AbstractCpsObject cps,
java.util.ArrayList<java.lang.Integer> visitedObj,
java.util.ArrayList<CpsEdge> visitedEdges)
Reset the Connection.
|
void |
searchForSubNets()
generates all subNets from all objectsToHandle.
|
void |
setCanvas(MyCanvas can)
Set the Canvas.
|
void |
setFlow(SubNet sN,
boolean simulation)
Sets the Flow.
|
void |
setFlowModelation(SubNet sN)
set the Flow Modelation.
|
void |
setFlowSimRec(java.util.ArrayList<AbstractCpsObject> nodes,
int iter)
Set Flow Rimulation Rec.
|
void |
setFlowSimulation(SubNet sN)
Set Flow Simulation.
|
void |
setPseudoTags(java.util.ArrayList<AbstractCpsObject> nodes)
Set the Pseudo Tags.
|
public SimulationManager(Model m)
m
- Modelpublic void calculateStateForTimeStep(int x)
x
- current Iterationpublic void setFlow(SubNet sN, boolean simulation)
sN
- Subnetsimulation
- boolean if Simulation is onpublic void setFlowModelation(SubNet sN)
sN
- Subnetpublic void setFlowSimulation(SubNet sN)
sN
- Subnetpublic void setFlowSimRec(java.util.ArrayList<AbstractCpsObject> nodes, int iter)
nodes
- the nodesiter
- the Iterationpublic void setPseudoTags(java.util.ArrayList<AbstractCpsObject> nodes)
nodes
- Array of AbstractCpsObjectspublic void printNodes(java.util.ArrayList<AbstractCpsObject> nodes)
nodes
- Array of AbstractCpsObjectpublic java.lang.String getString(java.util.ArrayList<java.lang.Integer> tags)
tags
- the tagspublic java.util.ArrayList<java.lang.Integer> mergeLists(java.util.ArrayList<java.lang.Integer> a, java.util.ArrayList<java.lang.Integer> b)
a
- first liustb
- second listpublic void resetConnections(AbstractCpsObject cps, java.util.ArrayList<java.lang.Integer> visitedObj, java.util.ArrayList<CpsEdge> visitedEdges)
cps
- CpsObjectvisitedObj
- the visited ObjectsvisitedEdges
- the visited Edgespublic float calculateEnergy(java.lang.String type, SubNet sN, int x)
type
- TypesN
- Subnetx
- Integerpublic float calculateMinimumEnergy(SubNet sN, int x)
sN
- Subnetx
- Integerpublic void searchForSubNets()
public SubNet buildSubNet(AbstractCpsObject cps, java.util.ArrayList<java.lang.Integer> visited, SubNet sN)
cps
- AbstractCpsObjectvisited
- visited Array of IntegersN
- Subnetspublic boolean legitState(AbstractCpsObject neighbor, AbstractCpsObject current)
neighbor
- AbstractCpsObjectcurrent
- AbstractCpsObjectpublic void removeFromToHandle(int id)
id
- the Object IDpublic void cleanObjectsToHandle()
public void copyObjects(java.util.ArrayList<AbstractCpsObject> toCopy)
toCopy
- the ArrayList of CpsObjects co Copypublic void printNet()
public void setCanvas(MyCanvas can)
can
- the Canvaspublic void reset()
public java.util.ArrayList<SubNet> getSubNets()