commit a8d86f8314005ca38135f62d829e5890b9c0998b
Author: Tomáš Šimandl <tomas.simandl@gmail.com>
Date:   Wed Aug 29 13:36:10 2018 +0200

    Removed vertex originalId

diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/api/BaseVertex.java b/sources/src/main/java/cz/zcu/kiv/offscreen/api/BaseVertex.java
index 06a57a9..ca5ca83 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/api/BaseVertex.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/api/BaseVertex.java
@@ -8,8 +8,6 @@ public class BaseVertex {
 
     /** New generated identification number. */
     private int id;
-    /** Identification number which is in input file. */
-    private int originalId;
     /** Name of vertex. */
     private String name;
     /** Index of vertex archetype. */
@@ -17,9 +15,8 @@ public class BaseVertex {
     /** Additional info. */
     private String text;
 
-    public BaseVertex(int id, int originalId, String name, int archetypeIndex, String text) {
+    public BaseVertex(int id, String name, int archetypeIndex, String text) {
         this.id = id;
-        this.originalId = originalId;
         this.name = name;
         this.archetypeIndex = archetypeIndex;
         this.text = text;
@@ -33,14 +30,6 @@ public class BaseVertex {
         this.id = id;
     }
 
-    public int getOriginalId() {
-        return originalId;
-    }
-
-    public void setOriginalId(int originalId) {
-        this.originalId = originalId;
-    }
-
     public String getName() {
         return name;
     }
@@ -71,17 +60,17 @@ public class BaseVertex {
      */
     @Override
     public int hashCode() {
-        return originalId;
+        return id;
     }
 
     /**
      * Two vertices are equals when their {@code originalId} is equals.
-     * @param edge which will be compared with this instance
+     * @param vertex which will be compared with this instance
      * @return true if vertices are equal, false otherwise
      */
     @Override
-    public boolean equals(Object edge) {
-        if (!(edge instanceof BaseVertex)) return false;
-        return originalId == ((BaseVertex) edge).originalId;
+    public boolean equals(Object vertex) {
+        if (!(vertex instanceof BaseVertex)) return false;
+        return id == ((BaseVertex) vertex).id;
     }
 }
\ No newline at end of file
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/api/GraphExport.java b/sources/src/main/java/cz/zcu/kiv/offscreen/api/GraphExport.java
index e0c9a29..96beab9 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/api/GraphExport.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/api/GraphExport.java
@@ -5,6 +5,7 @@ import cz.zcu.kiv.offscreen.graph.*;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.log4j.Logger;
 
@@ -14,7 +15,7 @@ import org.apache.log4j.Logger;
  */
 public class GraphExport {
 
-    private List<Vertex> vertices;
+    private Set<Vertex> vertices;
     private List<Edge> edges;
     private List<VertexArchetype> vertexArchetypes;
     private List<EdgeArchetype> edgeArchetypes;
@@ -30,11 +31,11 @@ public class GraphExport {
 
     public GraphExport(Graph graph) {
         logger.trace("ENTRY");
-        this.vertices = new ArrayList<>(graph.getVertices().values());
-        this.edges = new ArrayList<>(graph.getEdges());
-        this.vertexArchetypes = new ArrayList<>(graph.getVertexArchetypes());
-        this.edgeArchetypes = new ArrayList<>(graph.getEdgeArchetypes());
-        this.attributeTypes = new ArrayList<>(graph.getAttributeTypes());
+        this.vertices = graph.getVertices();
+        this.edges = graph.getEdges();
+        this.vertexArchetypes = graph.getVertexArchetypes();
+        this.edgeArchetypes = graph.getEdgeArchetypes();
+        this.attributeTypes = graph.getAttributeTypes();
         this.possibleEnumValues = graph.getPossibleEnumValues();
         this.groups = graph.getGraphState().getGroups();
         this.sideBar = graph.getGraphState().getSideBar();
@@ -49,7 +50,7 @@ public class GraphExport {
         return edges;
     }
 
-    public List<Vertex> getVertices() {
+    public Set<Vertex> getVertices() {
         logger.trace("ENTRY");
         logger.trace("EXIT");
         return vertices;
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/api/Group.java b/sources/src/main/java/cz/zcu/kiv/offscreen/api/Group.java
index 79b53bd..ead2178 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/api/Group.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/api/Group.java
@@ -8,9 +8,7 @@ import java.util.List;
  */
 public class Group {
 
-    /** Generated id of group which is unique only in groups. */
-    private int groupId;
-    /** Generated if of group which is unique in groups and vertexes. */
+    /** Generated id of group. */
     private int id;
     /** Name of group */
     private String name;
@@ -23,8 +21,7 @@ public class Group {
     /** Relative position in graph */
     private Position position;
 
-    public Group(int groupId, int id, String name){
-        this.groupId = groupId;
+    public Group(int id, String name){
         this.id = id;
         this.name = name;
         this.verticesId = new ArrayList<>();
@@ -33,8 +30,7 @@ public class Group {
         this.position = null;
     }
 
-    public Group(int groupId, int id, String name, List<Integer> verticesId, List<Integer> verticesEdgeFromId, List<Integer> verticesEdgeToId) {
-        this.groupId = groupId;
+    public Group(int id, String name, List<Integer> verticesId, List<Integer> verticesEdgeFromId, List<Integer> verticesEdgeToId) {
         this.id = id;
         this.name = name;
         this.verticesId = verticesId;
@@ -43,14 +39,6 @@ public class Group {
         this.position = null;
     }
 
-    public int getGroupId() {
-        return groupId;
-    }
-
-    public void setGroupId(int groupId) {
-        this.groupId = groupId;
-    }
-
     public int getId() {
         return id;
     }
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/api/Vertex.java b/sources/src/main/java/cz/zcu/kiv/offscreen/api/Vertex.java
index 9b3358f..f9c7b51 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/api/Vertex.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/api/Vertex.java
@@ -1,5 +1,7 @@
 package cz.zcu.kiv.offscreen.api;
 
+import cz.zcu.kiv.offscreen.graph.VertexImpl;
+
 import java.util.List;
 
 /**
@@ -14,19 +16,27 @@ public class Vertex extends BaseVertex {
 
     /**
      * Create new vertex.
-     * @param id new generated identification number.
-     * @param originalId original identification number from input file
+     * @param id original identification number from input file
      * @param name of vertex
      * @param archetypeIndex index of vertex archetype
      * @param text additional info
      * @param attributes List of all attributes. Every attribute is stored in String array in pair as {attribute name, attribute value}.
      */
-    public Vertex(int id, int originalId, String name, int archetypeIndex, String text, List<String[]> attributes) {
-        super(id, originalId, name, archetypeIndex, text);
+    public Vertex(int id, String name, int archetypeIndex, String text, List<String[]> attributes) {
+        super(id, name, archetypeIndex, text);
         this.attributes = attributes;
         this.position = null;
     }
 
+    /**
+     * Create new vertex.
+     * @param vertex instance of VertexImpl with set all parameters
+     * @param attributes ist of all attributes. Every attribute is stored in String array in pair as {attribute name, attribute value}.
+     */
+    public Vertex(VertexImpl vertex, List<String[]> attributes){
+        this(vertex.getId(), vertex.getName(), vertex.getArchetype(), vertex.getText(), attributes);
+    }
+
     public List<String[]> getAttributes() {
         return attributes;
     }
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/Graph.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/Graph.java
index fc637e6..0d66d34 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/Graph.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/Graph.java
@@ -4,17 +4,14 @@ import cz.zcu.kiv.offscreen.api.Edge;
 import cz.zcu.kiv.offscreen.api.Vertex;
 import org.apache.log4j.Logger;
 
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Class represents graph which is loaded from input JSON file.
  */
 public class Graph {
 
-    private Map<Integer, Vertex> vertices;
+    private Set<Vertex> vertices;
     private List<Edge> edges;
     private List<VertexArchetype> vertexArchetypes;
     private List<EdgeArchetype> edgeArchetypes;
@@ -28,8 +25,8 @@ public class Graph {
 
     public Graph() {
         logger.trace("ENTRY");
-        this.vertices = new HashMap<Integer, Vertex>();
-        this.edges = new LinkedList<Edge>();
+        this.vertices = new HashSet<>();
+        this.edges = new LinkedList<>();
         logger.trace("EXIT");
     }
 
@@ -82,7 +79,7 @@ public class Graph {
         return possibleEnumValues;
     }
 
-    public Map<Integer, Vertex> getVertices() {
+    public Set<Vertex> getVertices() {
         logger.trace("ENTRY");
         logger.trace("EXIT");
         return vertices;
@@ -94,9 +91,9 @@ public class Graph {
         logger.trace("EXIT");
     }
 
-    public void addVertex(int id, Vertex vertex) {
+    public void addVertex(Vertex vertex) {
         logger.trace("ENTRY");
-        this.vertices.put(id, vertex);
+        this.vertices.add(vertex);
         logger.trace("EXIT");
     }
 
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphManager.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphManager.java
index e62b8f9..843062f 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphManager.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/GraphManager.java
@@ -38,8 +38,6 @@ public class GraphManager {
         }
     }
 
-    private int lastVertexOrGroupId = 1;
-
     public List<VertexArchetype> vertexArchetypes = new ArrayList<>();
     public List<EdgeArchetype> edgeArchetypes = new ArrayList<>();
     public List<AttributeType> attributeTypes = new ArrayList<>();
@@ -151,7 +149,7 @@ public class GraphManager {
      * @param attributes     - Map of attributes associated with the vertex
      */
     public void addVertex(int id, String name, String text, int archetypeIndex, Map<Integer, Attribute> attributes) {
-        VertexImpl vertexToAdd = new VertexImpl(id, id, name, archetypeIndex, text);
+        VertexImpl vertexToAdd = new VertexImpl(id, name, archetypeIndex, text);
         if (vertices.containsKey(archetypeIndex)) {
             vertices.get(archetypeIndex).add(vertexToAdd);
         } else {
@@ -447,8 +445,8 @@ public class GraphManager {
         while (i.hasNext()) {
             EdgeImpl edge = i.next();
 
-            VertexImpl toDummy = new VertexImpl(edge.getTo(), edge.getTo(), null, -1,null);
-            VertexImpl fromDummy = new VertexImpl(edge.getFrom(), edge.getFrom(), null, -1, null);
+            VertexImpl toDummy = new VertexImpl(edge.getTo(), null, -1,null);
+            VertexImpl fromDummy = new VertexImpl(edge.getFrom(), null, -1, null);
 
             if (!resultVertices.contains(toDummy) || !resultVertices.contains(fromDummy)){
                 i.remove();
@@ -519,16 +517,8 @@ public class GraphManager {
         for (VertexImpl vertexImpl : resultVertices) {
 
             List<String[]> attributes = getAttributesAsArray(vertexImpl.getSortedAttributes());
-
-            Vertex vertex = new Vertex(
-                    lastVertexOrGroupId++,
-                    vertexImpl.getOriginalId(),
-                    vertexImpl.getName(),
-                    vertexImpl.getArchetype(),
-                    vertexImpl.getText(),
-                    attributes);
-
-            graph.addVertex(vertexImpl.getId(), vertex);
+            Vertex vertex = new Vertex(vertexImpl,attributes);
+            graph.addVertex(vertex);
         }
     }
 
@@ -610,15 +600,15 @@ public class GraphManager {
         int index = 0;
         for(VertexArchetype archetype : graph.getVertexArchetypes()){
             if(graph.getDefaultGroupArchetypes().contains(archetype.name)){
-                groups.put(index, new Group(groupId++, lastVertexOrGroupId++, archetype.name));
+                groups.put(index, new Group(groupId++, archetype.name));
             }
             index++;
         }
 
         // find vertices with founded vertex archetypes indices
-        for (Vertex vertex : graph.getVertices().values()){
+        for (Vertex vertex : graph.getVertices()){
             if(groups.keySet().contains(vertex.getArchetype())){
-                groups.get(vertex.getArchetype()).addVertexId(vertex.getOriginalId());
+                groups.get(vertex.getArchetype()).addVertexId(vertex.getId());
             }
         }
 
diff --git a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/VertexImpl.java b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/VertexImpl.java
index c72e10e..acf445b 100644
--- a/sources/src/main/java/cz/zcu/kiv/offscreen/graph/VertexImpl.java
+++ b/sources/src/main/java/cz/zcu/kiv/offscreen/graph/VertexImpl.java
@@ -13,14 +13,13 @@ public class VertexImpl extends BaseVertex {
 
     /**
      * Creates new vertex.
-     * @param id new generated identification number.
-     * @param originalId original identification number from input file
+     * @param id original identification number from input file
      * @param name of vertex
      * @param archetypeIndex index of vertex archetype
      * @param text additional info
      */
-    public VertexImpl(int id, int originalId, String name, int archetypeIndex, String text) {
-        super(id, originalId, name, archetypeIndex, text);
+    public VertexImpl(int id, String name, int archetypeIndex, String text) {
+        super(id, name, archetypeIndex, text);
         this.attributesMap = new HashMap<>();
     }
 
