public class Control
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
void |
addCategory(java.lang.String cat)
Adds New Category into Model.
|
void |
addEdgeOnCanvas(CpsEdge edge)
Add an edge to the Canvas.
|
void |
addElementCanvasObject(int id,
java.lang.String ele,
int amount,
float energy)
Add a new Element into a Object on the Canvas.
|
void |
addElementCategoryObject(java.lang.String catName,
java.lang.String objName,
java.lang.String eleName,
int amount,
float energy)
Add a new Element into a Object in Category.
|
void |
addObject(Category cat,
java.lang.String obj,
java.util.ArrayList<HolonElement> ele,
java.lang.String img)
Add new Holon Object to a Category.
|
void |
addObjectCanvas(AbstractCpsObject object)
Add a new Object.
|
void |
addSelectedObject(AbstractCpsObject obj)
add an Object to selectedObject.
|
void |
addSwitch(Category cat,
java.lang.String obj)
Add new Holon Switch to a Category.
|
void |
addTextToConsole(java.lang.String text)
Print Text on the console in black and font size 12.
|
void |
addTextToConsole(java.lang.String text,
java.awt.Color color,
int p,
boolean bold,
boolean italic,
boolean nl)
Getter for selected CpsObject.
|
void |
addTransformer(Category cat,
java.lang.String obj)
Add new Holon Transformer to a Category.
|
void |
autoSave()
make an autosave.
|
void |
calculateStateForCurrentTimeStep()
calculates the flow of the edges and the supply for objects for the
current Timestep.
|
void |
calculateStateForTimeStep(int x)
calculates the flow of the edges and the supply for objects.
|
void |
clearConsole()
Clears the console.
|
void |
copyObjects()
Copy all Selected Objects.
|
void |
cutObjects()
Cut all Selected Objects.
|
void |
delCanvasObject(AbstractCpsObject obj)
Deletes an CpsObject on the Canvas and its connections.
|
void |
deleteCategory(java.lang.String cat)
delete a given Category.
|
void |
deleteDirectory(java.io.File path)
Delete a Directory.
|
void |
deleteElementCanvas(HolonObject obj,
HolonElement ele)
deletes a Element from a given Object.
|
void |
deleteElementCanvas(int id,
int elementid)
deletes a Element from a given Canvas Object.
|
void |
deleteSelectedObject(AbstractCpsObject obj)
deletes a selectedObject.
|
void |
delObjectCategory(java.lang.String cat,
java.lang.String obj)
Delete an Object from a Category.
|
Model |
getModel()
Getter for Model.
|
java.lang.String |
getRedoSave()
Returns the redo save.
|
int |
getScale()
Returns SCALE.
|
int |
getScaleDiv2()
Returns SCALE Divided by 2.
|
SimulationManager |
getSimManager()
get the Simulation Manager.
|
java.lang.String |
getUndoSave()
Returns the undo save.
|
void |
initListener(CategoryListener catLis)
Init the CategoryListener.
|
void |
loadFile(java.lang.String path)
Reads the the JSON File and load the state into the Model.
|
void |
pasteObjects(java.awt.Point point)
Paste all Selected Objects.
|
void |
removeEdgesOnCanvas(CpsEdge edge)
Removes an Edge from the Canvas.
|
void |
resetCategorys()
init default category and objects.
|
void |
saveFile(java.lang.String path)
Writes the current State of the Modelling into a JSON File which can be
loaded.
|
AbstractCpsObject |
searchByID(int id)
Search for Object by ID.
|
Category |
searchCategory(java.lang.String cat)
search for category.
|
AbstractCpsObject |
searchCategoryObject(java.lang.String category,
java.lang.String object)
Search for Object in a Category.
|
void |
setCanvas(MyCanvas can)
Set the Canvas.
|
void |
setClipboardObjects(java.util.ArrayList<AbstractCpsObject> list)
Sets the ClipboardObjects.
|
void |
setCurIteration(int curit)
sets the current Iteration.
|
void |
setIsSimulation(boolean b)
Set if its simulating or not.
|
void |
setScale(int s)
Changes the value of SCALE and SCALEDIV2.
|
void |
setSelectedObjectID(int id)
Returns the ID of the selected Object 0 = no Object is selected.
|
void |
setSelecteEdge(CpsEdge edge)
Set the selected Edge.
|
void |
setTimerSpeed(int t)
Set the timerSpeed.
|
public Control(Model model)
model - the Modelpublic void deleteDirectory(java.io.File path)
path - to deletepublic AbstractCpsObject searchByID(int id)
id - the id of the Objectpublic AbstractCpsObject searchCategoryObject(java.lang.String category, java.lang.String object)
category - name of the Categoryobject - Name of the Objectpublic Category searchCategory(java.lang.String cat)
cat - name of the Categorypublic void resetCategorys()
public void addCategory(java.lang.String cat)
cat - name of the new Categorypublic void addObject(Category cat, java.lang.String obj, java.util.ArrayList<HolonElement> ele, java.lang.String img)
cat - Categoryobj - New Object Nameele - Array of Elementsimg - the image Pathpublic void addTransformer(Category cat, java.lang.String obj)
cat - Categoryobj - New Object Namepublic void addSwitch(Category cat, java.lang.String obj)
cat - Categoryobj - New Object Namepublic void deleteCategory(java.lang.String cat)
cat - the Categorypublic void delObjectCategory(java.lang.String cat,
java.lang.String obj)
cat - the Categoryobj - the Objectpublic void deleteSelectedObject(AbstractCpsObject obj)
obj - Cpsobjectpublic void addSelectedObject(AbstractCpsObject obj)
obj - AbstractCpsobjectpublic void addEdgeOnCanvas(CpsEdge edge)
edge - the edgepublic void removeEdgesOnCanvas(CpsEdge edge)
edge - the edge to removepublic void setSelecteEdge(CpsEdge edge)
edge - that is selectedpublic void addObjectCanvas(AbstractCpsObject object)
object - the Objectpublic void setSelectedObjectID(int id)
id - the ID of the selected Objectpublic void delCanvasObject(AbstractCpsObject obj)
obj - AbstractCpsObjectpublic void addElementCanvasObject(int id,
java.lang.String ele,
int amount,
float energy)
id - the Object IDele - the Name of the Elementamount - the Amountenergy - the Energypublic void addElementCategoryObject(java.lang.String catName,
java.lang.String objName,
java.lang.String eleName,
int amount,
float energy)
catName - the CategoryobjName - the ObjecteleName - the Element Nameamount - the amountenergy - the Energypublic void deleteElementCanvas(int id,
int elementid)
id - the IDelementid - the Element IDpublic void deleteElementCanvas(HolonObject obj, HolonElement ele)
obj - the Ojectele - the Elementpublic void setClipboardObjects(java.util.ArrayList<AbstractCpsObject> list)
list - Array of Objectspublic int getScale()
public int getScaleDiv2()
public void setScale(int s)
s - Scalepublic void setCurIteration(int curit)
curit - the current Iterationpublic void saveFile(java.lang.String path)
throws java.io.IOException
path - the Pathjava.io.IOException - exceptionpublic void loadFile(java.lang.String path)
throws java.io.IOException
path - the Pathjava.io.IOException - exceptionpublic void initListener(CategoryListener catLis)
catLis - the CategoryListenerpublic void calculateStateForCurrentTimeStep()
public void calculateStateForTimeStep(int x)
x - current Iterationpublic void setCanvas(MyCanvas can)
can - the Canvaspublic void autoSave()
throws java.io.IOException
java.io.IOException - Exceptionpublic java.lang.String getUndoSave()
public java.lang.String getRedoSave()
public void copyObjects()
public void pasteObjects(java.awt.Point point)
point - the mouse Positionpublic void cutObjects()
public Model getModel()
public SimulationManager getSimManager()
public void addTextToConsole(java.lang.String text,
java.awt.Color color,
int p,
boolean bold,
boolean italic,
boolean nl)
text - String the Textcolor - the color of the Textp - size of the Textbold - bold or notitalic - italic or notnl - new line or notpublic void addTextToConsole(java.lang.String text)
text - String the Textpublic void clearConsole()
public void setTimerSpeed(int t)
t - interval in mspublic void setIsSimulation(boolean b)
b - isSimulation