Skip to content

Latest commit

 

History

History
147 lines (124 loc) · 10.8 KB

File metadata and controls

147 lines (124 loc) · 10.8 KB

BlueJ-Chicago Documents

##DEUTSCH Um den Visualizer zu nutzen importiert man einfach die Jar als Bibliothek. Am beginn des Sourcecodes muss man noch osl2.Evanston.start(); ausführen. Von da aus kann man die Datenstrukturen VArray, VMap, VDoublyLinkedList, VSinglyLinkedList, VDirectedGraph, VUndirectedGraph und VTree nutzen.

###Datenstrukturen Für alle Datenstrukturen:

  • setName(String name):
    Setzt den Namen der Datenstruktur
  • getName()returns String:
    Gibt den Namen der Datenstruktur zurück.
  • getDatastructureType() return String:
    Gibt den Typ der Datenstruktur zurück.
  • size() returns int:
    Gibt die Größe der Datenstruktur zurück.
  • removeAll() returns boolean:
    Entfernt alle Elemente aus der Datenstruktur.
  • isEmpty() returns boolean:
    Gibt true zurück, falls die Datenstrucktur leer ist. Ansonsten flase.

VArray:

  • VArray(int size):
    Erstellt ein Array mit Größe size.
  • VArray(int size, String name):
    Erstellt ein Array mit Größe size mit dem Namen name.
  • setValue(int index, T value):
    Sets an Index index den Wert value.
  • getValue(int index) returns T:
    Gibt den Wert an der Stelle des Indizes zurück.
  • contains(T value)returns boolean:
    Gibt true zurück, falls der Wert value im Array enthalten ist. Ansonsten false.
  • contains(Collection values) returns boolean:
    Gibt true zurück, falls die Werte values im Array enthalten sind. Ansonsten false.

VSinglyLinkedList / VDoublyLinkedList:

  • VSinglyLinkedList ():
    Erstellt eine neue einfach verkettete Liste.
  • VDoublyLinkedList ():
    Erstellt eine neue doppelt verkettete Liste.
  • VSinglyLinkedList (String name):
    Erstellt eine neue einfach verkettete Liste mit dem Namen name.
  • VDoublyLinkedList (String name):
    Erstellt eine neue doppelt verkettete Liste mit dem Namen name.
  • Für die restlichen Methoden siehe:
    java.util.List

VMap<K, V>:

  • VMap<K, V>():
    Erstellt eine neue VMap.
  • VMap<K, V>(String name):
    Erstellt eine neue VMap mit dem Namen name.
  • Für die estlichen Methoden siehe:
    java.util.Map

VGraphNode:

  • setValues(T value):
    Setzt den Value des Knotens.

VDirectedGraph / VUndirectedGraph:

  • VDirectedGraph():
    Erstellt einen neuen gerichteten Graphen.
  • VUndirectedGraph():
    Erstellt einen neuen ungerichteten Graphen.
  • VDirectedGraph(String name):
    Erstellt einen neuen gerichteten Graphen mit dem Namen name.
  • VUndirectedGraph(String name):
    Erstellt einen neuen ungerichteten Graphen mit dem Namen name.
  • addNode() returns VGraphNode:
    addNode erstellt einen Knoten im Graphen. Nur so erstellte Knoten können im Graphen benutzt werden.
  • addNode(T value) returns VGraphNode:
    addNode erstellt einen Knoten im Graphen. Der Knoten bekommt den Wert value. Nur so erstellte Knoten können im Graphen benutzt werden.
  • addEdge(VGraphNode start, VGraphNode end) returns boolean:
    Fügt eine Kante von start zu end hinzu. Gibt true bei Erfolg zurück ansonsten false.
  • removeNode(VGraphNode node)returns boolean:
    Entfernt einen Knoten aus dem Graphen. Gibt true bei Erfolg zurück ansonsten false.
  • removeEdge(VGraphNode start, VGraphNode end) returns boolean:
    Entfernt eine Kante aus dem Graphen. Gibt true bei Erfolg zurück ansonsten false.
  • getEdges(VGraphNode node)returns Collection:
    Gibt eine Collection an Kanten zu einem Knoten zurück.
  • getAdjacents(VGraphNode node)returns Collection:
    Gibt alle benachbarten Knoten zu einem Knoten an.
  • containsNode(VGraphNode node) returns boolean:
    Gibt true aus, falls der Knoten im Graphen ist, ansonsten false.
  • containsEdge(VGraphNode node, VGraphNode node) returns boolean:
    Gibt true aus, falls die Kante im Graphen ist, ansonsten false.

VTree: (Nutzt auch VGraphNodes)

  • VTree():
    Erstellt einen neuen Baum.
  • VTree(String name):
    Erstellt einen neuen Baum mit dem Namen name.
  • addTreeNode(VGraphNode parent) returns VGraphNode:
    addNode erstellt einen Knoten im Tree. Dieser Knoten wird zu einem Parent im Tree hinzugefügt.
  • addTreeNode(VGraphNode parent, T value) returns VGraphNode:
    addNode erstellt einen Knoten im Tree. Dieser Knoten wird zu einem Parent im Tree hinzugefügt. Außerdem wird für ihn der Wert value gesetzt.
  • removeLeaf(VGraphNode node)returns boolean:
    Entfernt einen Knoten, falls er ein Blatt ist. Gibt true bei Erfolg zurück ansonsten false.
  • getChildren(VGraphNode parent)returns collection:
    Gibt alle Childknoten eines Parentknoten zurück.
  • getParent(VGraphNode child)returns VGraphNode:
    Gibt den Parentknoten eines Childknoten zurück.
  • getHeight()returns int:
    Gibt die Höhe des Baumes zurück. Also die Länge des längsten Pfades von Wurzel bis Blatt.
  • swap(VGraphNode child, VGraphNode parent)returns boolean:
    Tauscht Childknoten mit Parentknoten. Gibt true bei Erfolg zurück ansonsten false.
  • contains(VGraphNode node)returns boolean:
    Gibt true aus, wenn ein Knoten im Baum ist. Ansonsten false.
  • contains(Collection node) returns boolean:
    Gibt true aus, wenn die Menge an Knoten im Baum ist. Ansonsten galse.
  • getRootNode()returns VGraphNode:
    Gibt die Wurzel des Baumes zurück.

###GUI Mirror Nutzung
Der Mirror wird in der Seitenleiste durch das klicken auf den entsprechenden Button geöffnet. Den Mirror kann man innerhalb des Hauptbereichs verschieben. Man kann ihn schließen, sowie maximieren und minimieren. Außerdem lässt sich die Größe des Mirrors verändern.

Für das Verändern der Größe klicke man auf den Button der im folgenden Bild Rot umrandet ist.

Bild 1

##ENGLISH To use the visualizer import the jar as a library. At the start of your code u type osl2.Evanston.start();. Then you can use the Datastructures VArray, VMap, VDoublyLinkedList, VSinglyLinkedList, VDirectedGraph, VUndirectedGraph and VTree.

###Datastructures For all Datastructures:

  • setName(String name):
    Sets the name of the datastructure.
  • getName()returns String:
    Returns the name of the datastructure.
  • getDatastructureType() return String:
    Returns the type of the datastructure.
  • size() returns int:
    Returns the size of the datastructure.
  • removeAll() returns boolean:
    Removes all elements of the datastructure.
  • isEmpty() returns boolean:
    Returns true if the datastructure is empty. Else false.

VArray:

  • VArray(int size):
    Creates a new VArray with the size size.
  • VArray(int size, String name):
    Creates a new VArray with the size size and the name name.
  • setValue(int index, T value):
    Sets the value at index index.
  • getValue(int index) returns T:
    Returns the value at the index.
  • contains(T value)returns boolean:
    Returns true if the value is in the array. Else false.
  • contains(Collection values) returns boolean:
    Returns true if the collection of values is in the array. Else false.

VSinglyLinkedList / VDoublyLinkedList:

  • VSinglyLinkedList ():
    Creates a new singly linked list.
  • VDoublyLinkedList ():
    Creates a new doubly linked list.
  • VSinglyLinkedList (String name):
    Creates a new singly linked list with the name name.
  • VDoublyLinkedList (String name):
    Creates a new doubly linked list with the name name.
  • For all other methods look at:
    java.util.List

VMap<K, V>:

  • VMap<K, V>():
    Creates a new VMap.
  • VMap<K, V>(String name):
    Creates a new VMap with the name name.
  • For all other methods look at:
    java.util.Map

VGraphNode:

  • setValues(T value):
    Sets the value of the node..

VDirectedGraph / VUndirectedGraph:

  • VDirectedGraph():
    Creates a new directed graph.
  • VUndirectedGraph():
    Creates a new undirected graph.
  • VDirectedGraph(String name):
    Creates a new directed graph with the name name.
  • VUndirectedGraph(String name):
    Creates a new undirected graph with the name name.
  • addNode() returns VGraphNode:
    Creates a new node in the graph. Only nodes which are created by addNode can be used by the graph.
  • addEdge(VGraphNode start, VGraphNode end) returns boolean:
    Adds an edge from start to end. Returns true if added sucsessfully, else false.
  • removeNode(VGraphNode node)returns boolean:
    Removes a node from the graph. Returns true if removed sucsessfully, else false.
  • removeEdge(VGraphNode start, VGraphNode end) returns boolean:
    Removes an edge from the graph. Returns true if removed sucsessfully, else false.
  • getEdges(VGraphNode node)returns Collection:
    Returns a collection of all Edges.
  • getAdjacents(VGraphNode node)returns Collection:
    Returns a collection of all adjacent nodes.
  • containsNode(VGraphNode node) returns boolean:
    Returns true if the node is in the graph, else false.
  • containsEdge(VGraphNode node, VGraphNode node) returns boolean:
    Returns true if the edge is in the graph else false

VTree: (Nutzt auch VGraphNodes)

  • VTree():
    Creates a new tree.
  • VTree(String name):
    Creates a new tree with the name name.
  • addTreeNode() returns VGraphNode:
    Creates a new node in the tree. Only nodes which are created by addNode can be used by the tree.
  • addChild(VGraphNode: child, VGraphNode parent) returns boolean:
    Adds a child to a parentnode.
  • removeLeaf(VGraphNode node)returns boolean:
    Removes a node if it is a leaf. Returns true if removed sucsessfully, else false.
  • getChildren(VGraphNode parent)returns collection:
    Returns all children from one parent node.
  • getParent(VGraphNode child)returns VGraphNode:
    Returns the parent node from the child node.
  • getHeight()returns int:
    Returns the height of the tree. The height is the largest path from root to a leaf.
  • swap(VGraphNode child, VGraphNode parent)returns boolean:
    Swaps child and parent node.Returns true if swaped sucsessfully, else false.
  • contains(VGraphNode node)returns boolean:
    Returns true if a node is in the tree,else false.
  • contains(Collection node) returns boolean:
    Returns true if an edge is in the tree, else false.
  • getRootNode()returns VGraphNode:
    Returns the root of the tree.

###GUI Mirror Usage
You can open the mirror by clicking on the mirrorbutton in the sidebar of the visualiser. The mirror can be moved inside the mainregion. It can also be closed and minimized or maximizes. Also you can change the size.

For changing the size you click on the button which is red framed in the following picture and drag it.

Bild 1