Revize 5aeb7fe0
Přidáno uživatelem Pavel Fidranský před asi 6 roky(ů)
sources/imiger-spade-converter/pom.xml | ||
---|---|---|
42 | 42 |
</build> |
43 | 43 |
|
44 | 44 |
<dependencies> |
45 |
<dependency> |
|
46 |
<groupId>cz.zcu.kiv</groupId> |
|
47 |
<artifactId>imiger-vo</artifactId> |
|
48 |
<version>0.1.2-SNAPSHOT</version> |
|
49 |
</dependency> |
|
50 |
|
|
45 | 51 |
<!-- Libs for JSON handling --> |
46 | 52 |
<dependency> |
47 | 53 |
<groupId>com.google.code.gson</groupId> |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/Spade.java | ||
---|---|---|
1 | 1 |
package cz.zcu.kiv.imiger.plugin.spade; |
2 | 2 |
|
3 |
import cz.zcu.kiv.imiger.plugin.spade.api.Graph;
|
|
3 |
import cz.zcu.kiv.imiger.vo.Graph;
|
|
4 | 4 |
import cz.zcu.kiv.imiger.plugin.spade.graph.GraphManager; |
5 | 5 |
import cz.zcu.kiv.imiger.plugin.spade.graph.loader.GraphJSONDataLoader; |
6 | 6 |
import cz.zcu.kiv.imiger.plugin.spade.graph.loader.JSONConfigLoader; |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/AttributeDataType.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
public enum AttributeDataType { |
|
4 |
NUMBER { |
|
5 |
@Override |
|
6 |
public String toString() { |
|
7 |
return "number"; |
|
8 |
} |
|
9 |
}, |
|
10 |
DATE { |
|
11 |
@Override |
|
12 |
public String toString() { |
|
13 |
return "date"; |
|
14 |
} |
|
15 |
}, |
|
16 |
ENUM { |
|
17 |
@Override |
|
18 |
public String toString() { |
|
19 |
return "enum"; |
|
20 |
} |
|
21 |
}, |
|
22 |
STRING { |
|
23 |
@Override |
|
24 |
public String toString() { |
|
25 |
return "string"; |
|
26 |
} |
|
27 |
}; |
|
28 |
|
|
29 |
public static AttributeDataType getEnum(String value){ |
|
30 |
switch (value) { |
|
31 |
case "number": return AttributeDataType.NUMBER; |
|
32 |
case "date": return AttributeDataType.DATE; |
|
33 |
case "enum": return AttributeDataType.ENUM; |
|
34 |
default: return AttributeDataType.STRING; |
|
35 |
} |
|
36 |
} |
|
37 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/AttributeType.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
/** |
|
4 |
* Class represents one attribute type which is used in input JSON file and in output JSON file (file between frontend |
|
5 |
* and backend). |
|
6 |
*/ |
|
7 |
public class AttributeType { |
|
8 |
/** name of attribute */ |
|
9 |
public String name; |
|
10 |
/** data type of attribute */ |
|
11 |
public AttributeDataType dataType; |
|
12 |
/** additional info */ |
|
13 |
public String text; |
|
14 |
|
|
15 |
public AttributeType(String name, AttributeDataType dataType, String text) { |
|
16 |
this.name = name; |
|
17 |
this.dataType = dataType; |
|
18 |
this.text = text; |
|
19 |
} |
|
20 |
|
|
21 |
public String getName() { |
|
22 |
return name; |
|
23 |
} |
|
24 |
|
|
25 |
public AttributeDataType getDataType() { |
|
26 |
return dataType; |
|
27 |
} |
|
28 |
|
|
29 |
public String getText() { |
|
30 |
return text; |
|
31 |
} |
|
32 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/BaseEdge.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
/** |
|
4 |
* Class represents edge. Class contains attributes which are common for input JSON format and for |
|
5 |
* output JSON format (JSON between frontend and backend) |
|
6 |
*/ |
|
7 |
public class BaseEdge { |
|
8 |
/** identification number of edge */ |
|
9 |
private int id; |
|
10 |
/** original ID of vertex from edge leads */ |
|
11 |
private int from; |
|
12 |
/** original ID of vertex where edge leads */ |
|
13 |
private int to; |
|
14 |
/** additional info */ |
|
15 |
private String text; |
|
16 |
|
|
17 |
public BaseEdge(int id, int from, int to, String text) { |
|
18 |
this.id = id; |
|
19 |
this.from = from; |
|
20 |
this.to = to; |
|
21 |
this.text = text; |
|
22 |
} |
|
23 |
|
|
24 |
public int getId() { |
|
25 |
return id; |
|
26 |
} |
|
27 |
|
|
28 |
public void setId(int id) { |
|
29 |
this.id = id; |
|
30 |
} |
|
31 |
|
|
32 |
public int getFrom() { |
|
33 |
return from; |
|
34 |
} |
|
35 |
|
|
36 |
public void setFrom(int from) { |
|
37 |
this.from = from; |
|
38 |
} |
|
39 |
|
|
40 |
public int getTo() { |
|
41 |
return to; |
|
42 |
} |
|
43 |
|
|
44 |
public void setTo(int to) { |
|
45 |
this.to = to; |
|
46 |
} |
|
47 |
|
|
48 |
public String getText() { |
|
49 |
return text; |
|
50 |
} |
|
51 |
|
|
52 |
public void setText(String text) { |
|
53 |
this.text = text; |
|
54 |
} |
|
55 |
|
|
56 |
/** |
|
57 |
* Generate hash code based on attributes {@code from} and {@code to}. |
|
58 |
* @return generated hash code. |
|
59 |
*/ |
|
60 |
@Override |
|
61 |
public int hashCode() { |
|
62 |
return from * 100000 + to; |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* Two edges are equals where their {@code from} and {@code to} are equals. |
|
67 |
* |
|
68 |
* @param edge which will be compared with this instance |
|
69 |
* @return tru if edges are equal, false otherwise |
|
70 |
*/ |
|
71 |
@Override |
|
72 |
public boolean equals(Object edge) { |
|
73 |
if (!(edge instanceof BaseEdge)) return false; |
|
74 |
|
|
75 |
BaseEdge cmpEdge = (BaseEdge) edge; |
|
76 |
return from == cmpEdge.from && to == cmpEdge.to; |
|
77 |
} |
|
78 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/BaseVertex.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
/** |
|
4 |
* Class represents vertex. Class contains attributes which are common for input JSON format and for |
|
5 |
* output JSON format (JSON between frontend and backend) |
|
6 |
*/ |
|
7 |
public class BaseVertex { |
|
8 |
|
|
9 |
/** New generated identification number. */ |
|
10 |
private int id; |
|
11 |
/** Name of vertex. */ |
|
12 |
private String name; |
|
13 |
/** Index of vertex archetype. */ |
|
14 |
private int archetypeIndex; |
|
15 |
/** Additional info. */ |
|
16 |
private String text; |
|
17 |
|
|
18 |
public BaseVertex(int id, String name, int archetypeIndex, String text) { |
|
19 |
this.id = id; |
|
20 |
this.name = name; |
|
21 |
this.archetypeIndex = archetypeIndex; |
|
22 |
this.text = text; |
|
23 |
} |
|
24 |
|
|
25 |
public int getId() { |
|
26 |
return id; |
|
27 |
} |
|
28 |
|
|
29 |
public void setId(int id) { |
|
30 |
this.id = id; |
|
31 |
} |
|
32 |
|
|
33 |
public String getName() { |
|
34 |
return name; |
|
35 |
} |
|
36 |
|
|
37 |
public void setName(String name) { |
|
38 |
this.name = name; |
|
39 |
} |
|
40 |
|
|
41 |
public int getArchetype() { |
|
42 |
return archetypeIndex; |
|
43 |
} |
|
44 |
|
|
45 |
public void setArchetype(int archetypeIndex) { |
|
46 |
this.archetypeIndex = archetypeIndex; |
|
47 |
} |
|
48 |
|
|
49 |
public String getText() { |
|
50 |
return text; |
|
51 |
} |
|
52 |
|
|
53 |
public void setText(String text) { |
|
54 |
this.text = text; |
|
55 |
} |
|
56 |
|
|
57 |
/** |
|
58 |
* Generate hash code which is based on {@code originalId}. |
|
59 |
* @return generated has code |
|
60 |
*/ |
|
61 |
@Override |
|
62 |
public int hashCode() { |
|
63 |
return id; |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* Two vertices are equals when their {@code originalId} is equals. |
|
68 |
* @param vertex which will be compared with this instance |
|
69 |
* @return true if vertices are equal, false otherwise |
|
70 |
*/ |
|
71 |
@Override |
|
72 |
public boolean equals(Object vertex) { |
|
73 |
if (!(vertex instanceof BaseVertex)) return false; |
|
74 |
return id == ((BaseVertex) vertex).id; |
|
75 |
} |
|
76 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/Edge.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
/** |
|
6 |
* Class represents edge which is used for output JSON format (JSON between frontend and backend). |
|
7 |
*/ |
|
8 |
public class Edge extends BaseEdge { |
|
9 |
|
|
10 |
/** |
|
11 |
* List of subedgeInfo. |
|
12 |
* When two input edges are equals, in output their are in one record and their differences are in subedgeInfo. |
|
13 |
*/ |
|
14 |
private List<SubedgeInfo> subedgeInfo; |
|
15 |
|
|
16 |
/** |
|
17 |
* Create new edge. |
|
18 |
* @param id new generated identification number |
|
19 |
* @param from original ID of vertex from edge leads |
|
20 |
* @param to original ID of vertex where edge leads |
|
21 |
* @param text additional info |
|
22 |
* @param subedgeInfo list which contains differences between equals edges |
|
23 |
*/ |
|
24 |
public Edge(int id, int from, int to, String text, List<SubedgeInfo> subedgeInfo) { |
|
25 |
super(id, from, to, text); |
|
26 |
this.subedgeInfo = subedgeInfo; |
|
27 |
} |
|
28 |
|
|
29 |
public List<SubedgeInfo> getSubedgeInfo(){ |
|
30 |
return subedgeInfo; |
|
31 |
} |
|
32 |
|
|
33 |
public void setSubedgeInfo(List<SubedgeInfo> subedgeInfo) { |
|
34 |
this.subedgeInfo = subedgeInfo; |
|
35 |
} |
|
36 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/EdgeArchetype.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
public class EdgeArchetype { |
|
4 |
public String name; |
|
5 |
public String text; |
|
6 |
|
|
7 |
public EdgeArchetype(String name, String text) { |
|
8 |
this.name = name; |
|
9 |
this.text = text; |
|
10 |
} |
|
11 |
|
|
12 |
public String getName() { |
|
13 |
return name; |
|
14 |
} |
|
15 |
|
|
16 |
public String getText() { |
|
17 |
return text; |
|
18 |
} |
|
19 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/Graph.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
import org.apache.logging.log4j.LogManager; |
|
4 |
import org.apache.logging.log4j.Logger; |
|
5 |
|
|
6 |
import java.util.*; |
|
7 |
|
|
8 |
/** |
|
9 |
* Class represents graph with all information about graph plus information about state in which used store graph. |
|
10 |
* Class is used for creating of JSON which is send to frontend. |
|
11 |
*/ |
|
12 |
public class Graph { |
|
13 |
|
|
14 |
private Set<Vertex> vertices; |
|
15 |
private List<Edge> edges; |
|
16 |
private List<VertexArchetype> vertexArchetypes; |
|
17 |
private List<EdgeArchetype> edgeArchetypes; |
|
18 |
private List<AttributeType> attributeTypes; |
|
19 |
private Map<String, List<String>> possibleEnumValues; |
|
20 |
|
|
21 |
private List<Group> groups; |
|
22 |
private List<SideBar> sideBar; |
|
23 |
private String highlightedVertex; // group-ID, vertex-ID |
|
24 |
private String highlightedEdge; |
|
25 |
|
|
26 |
private static final Logger logger = LogManager.getLogger(); |
|
27 |
|
|
28 |
public Graph() { |
|
29 |
vertices = new HashSet<>(); |
|
30 |
edges = new LinkedList<>(); |
|
31 |
} |
|
32 |
|
|
33 |
public List<Edge> getEdges() { |
|
34 |
logger.trace("ENTRY"); |
|
35 |
logger.trace("EXIT"); |
|
36 |
return edges; |
|
37 |
} |
|
38 |
|
|
39 |
public Set<Vertex> getVertices() { |
|
40 |
logger.trace("ENTRY"); |
|
41 |
logger.trace("EXIT"); |
|
42 |
return vertices; |
|
43 |
} |
|
44 |
|
|
45 |
public List<VertexArchetype> getVertexArchetypes() { |
|
46 |
return vertexArchetypes; |
|
47 |
} |
|
48 |
|
|
49 |
public List<EdgeArchetype> getEdgeArchetypes() { |
|
50 |
return edgeArchetypes; |
|
51 |
} |
|
52 |
|
|
53 |
public List<AttributeType> getAttributeTypes() { |
|
54 |
return attributeTypes; |
|
55 |
} |
|
56 |
|
|
57 |
public Map<String, List<String>> getPossibleEnumValues() { |
|
58 |
return possibleEnumValues; |
|
59 |
} |
|
60 |
|
|
61 |
public List<Group> getGroups() { |
|
62 |
return groups; |
|
63 |
} |
|
64 |
|
|
65 |
public List<SideBar> getSideBar() { |
|
66 |
return sideBar; |
|
67 |
} |
|
68 |
|
|
69 |
public String getHighlightedVertex() { |
|
70 |
return highlightedVertex; |
|
71 |
} |
|
72 |
|
|
73 |
public String getHighlightedEdge() { |
|
74 |
return highlightedEdge; |
|
75 |
} |
|
76 |
|
|
77 |
public void setVertexArchetypes(List<VertexArchetype> vertexArchetypes) { |
|
78 |
this.vertexArchetypes = vertexArchetypes; |
|
79 |
} |
|
80 |
|
|
81 |
public void setEdgeArchetypes(List<EdgeArchetype> edgeArchetypes) { |
|
82 |
this.edgeArchetypes = edgeArchetypes; |
|
83 |
} |
|
84 |
|
|
85 |
public void setAttributeTypes(List<AttributeType> attributeTypes) { |
|
86 |
this.attributeTypes = attributeTypes; |
|
87 |
} |
|
88 |
|
|
89 |
public void setPossibleEnumValues(Map<Integer, List<String>> possibleEnumValues) { |
|
90 |
this.possibleEnumValues = new HashMap<>(); |
|
91 |
for (Map.Entry<Integer, List<String>> entry : possibleEnumValues.entrySet()) { |
|
92 |
this.possibleEnumValues.put("" + entry.getKey(), entry.getValue()); |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
public void setGroups(List<Group> groups) { |
|
97 |
this.groups = groups; |
|
98 |
} |
|
99 |
|
|
100 |
public void setSideBar(List<SideBar> sideBar) { |
|
101 |
this.sideBar = sideBar; |
|
102 |
} |
|
103 |
|
|
104 |
public void setHighlightedVertex(String highlightedVertex) { |
|
105 |
this.highlightedVertex = highlightedVertex; |
|
106 |
} |
|
107 |
|
|
108 |
public void setHighlightedEdge(String highlightedEdge) { |
|
109 |
this.highlightedEdge = highlightedEdge; |
|
110 |
} |
|
111 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/Group.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.List; |
|
5 |
|
|
6 |
/** |
|
7 |
* Class represents group of edges and their settings. Used in JSON between frontend and backend. |
|
8 |
*/ |
|
9 |
public class Group { |
|
10 |
|
|
11 |
/** Generated id of group. */ |
|
12 |
private int id; |
|
13 |
/** Name of group */ |
|
14 |
private String name; |
|
15 |
/** List of vertices id which belongs to this group */ |
|
16 |
private List<Integer> verticesId; |
|
17 |
/** List of vertices id whose outgoing edges are visible. */ |
|
18 |
private List<Integer> verticesEdgeFromId; |
|
19 |
/** List of vertices id whose incoming edges are visible. */ |
|
20 |
private List<Integer> verticesEdgeToId; |
|
21 |
/** Relative position in graph */ |
|
22 |
private Position position; |
|
23 |
|
|
24 |
public Group(int id, String name){ |
|
25 |
this.id = id; |
|
26 |
this.name = name; |
|
27 |
this.verticesId = new ArrayList<>(); |
|
28 |
this.verticesEdgeFromId = new ArrayList<>(); |
|
29 |
this.verticesEdgeToId = new ArrayList<>(); |
|
30 |
this.position = null; |
|
31 |
} |
|
32 |
|
|
33 |
public Group(int id, String name, List<Integer> verticesId, List<Integer> verticesEdgeFromId, List<Integer> verticesEdgeToId) { |
|
34 |
this.id = id; |
|
35 |
this.name = name; |
|
36 |
this.verticesId = verticesId; |
|
37 |
this.verticesEdgeFromId = verticesEdgeFromId; |
|
38 |
this.verticesEdgeToId = verticesEdgeToId; |
|
39 |
this.position = null; |
|
40 |
} |
|
41 |
|
|
42 |
public int getId() { |
|
43 |
return id; |
|
44 |
} |
|
45 |
|
|
46 |
public void setId(int id) { |
|
47 |
this.id = id; |
|
48 |
} |
|
49 |
|
|
50 |
public String getName() { |
|
51 |
return name; |
|
52 |
} |
|
53 |
|
|
54 |
public void setName(String name) { |
|
55 |
this.name = name; |
|
56 |
} |
|
57 |
|
|
58 |
public List<Integer> getVerticesId() { |
|
59 |
return verticesId; |
|
60 |
} |
|
61 |
|
|
62 |
public void setVerticesId(List<Integer> verticesId) { |
|
63 |
this.verticesId = verticesId; |
|
64 |
} |
|
65 |
|
|
66 |
public List<Integer> getVerticesEdgeFromId() { |
|
67 |
return verticesEdgeFromId; |
|
68 |
} |
|
69 |
|
|
70 |
public void setVerticesEdgeFromId(List<Integer> verticesEdgeFromId) { |
|
71 |
this.verticesEdgeFromId = verticesEdgeFromId; |
|
72 |
} |
|
73 |
|
|
74 |
public List<Integer> getVerticesEdgeToId() { |
|
75 |
return verticesEdgeToId; |
|
76 |
} |
|
77 |
|
|
78 |
public void setVerticesEdgeToId(List<Integer> verticesEdgeToId) { |
|
79 |
this.verticesEdgeToId = verticesEdgeToId; |
|
80 |
} |
|
81 |
|
|
82 |
public void addVertexId(int vertexId){ |
|
83 |
this.verticesId.add(vertexId); |
|
84 |
} |
|
85 |
|
|
86 |
public void addVetexEdgeToId(int vertexId){ |
|
87 |
this.verticesEdgeToId.add(vertexId); |
|
88 |
} |
|
89 |
|
|
90 |
public void addVetexEdgeFromId(int vertexId){ |
|
91 |
this.verticesEdgeFromId.add(vertexId); |
|
92 |
} |
|
93 |
|
|
94 |
public Position getPosition() { |
|
95 |
return position; |
|
96 |
} |
|
97 |
|
|
98 |
public void setPosition(Position position) { |
|
99 |
this.position = position; |
|
100 |
} |
|
101 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/Position.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
/** |
|
4 |
* Class is used for storing information about vertex/group relative position. |
|
5 |
*/ |
|
6 |
public class Position { |
|
7 |
|
|
8 |
/** Relative X position. */ |
|
9 |
private float x; |
|
10 |
/** Relative Y position */ |
|
11 |
private float y; |
|
12 |
|
|
13 |
public Position(float x, float y) { |
|
14 |
this.x = x; |
|
15 |
this.y = y; |
|
16 |
} |
|
17 |
|
|
18 |
public float getX() { |
|
19 |
return x; |
|
20 |
} |
|
21 |
|
|
22 |
public void setX(float x) { |
|
23 |
this.x = x; |
|
24 |
} |
|
25 |
|
|
26 |
public float getY() { |
|
27 |
return y; |
|
28 |
} |
|
29 |
|
|
30 |
public void setY(float y) { |
|
31 |
this.y = y; |
|
32 |
} |
|
33 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/SideBar.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
/** |
|
4 |
* Class store information about item in side bar. |
|
5 |
*/ |
|
6 |
public class SideBar { |
|
7 |
|
|
8 |
/** Identification number of vertex or group which was generated in application. */ |
|
9 |
private int vertexId; |
|
10 |
/** Indicates if related vertexes of this item have visible icon which shows relation with this item. */ |
|
11 |
private boolean isIconsDisplayed; |
|
12 |
|
|
13 |
public SideBar(int vertexId, boolean isIconsDisplayed) { |
|
14 |
this.vertexId = vertexId; |
|
15 |
this.isIconsDisplayed = isIconsDisplayed; |
|
16 |
} |
|
17 |
|
|
18 |
public int getVertexId() { |
|
19 |
return vertexId; |
|
20 |
} |
|
21 |
|
|
22 |
public void setVertexId(int vertexId) { |
|
23 |
this.vertexId = vertexId; |
|
24 |
} |
|
25 |
|
|
26 |
public boolean isIconsDisplayed() { |
|
27 |
return isIconsDisplayed; |
|
28 |
} |
|
29 |
|
|
30 |
public void setIconsDisplayed(boolean iconsDisplayed) { |
|
31 |
this.isIconsDisplayed = iconsDisplayed; |
|
32 |
} |
|
33 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/SubedgeInfo.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
public class SubedgeInfo { |
|
6 |
|
|
7 |
/** Edge archetype index. */ |
|
8 |
private int archetype; |
|
9 |
/** Original id of edge which is taken from input JSON file. */ |
|
10 |
private int id; |
|
11 |
/** List of all tributes. Every attribute is stored in String array in pair as {attribute name, attribute value}. */ |
|
12 |
private List<String[]> attributes; |
|
13 |
|
|
14 |
/** |
|
15 |
* Create new subedgeInfo |
|
16 |
* @param id Original id of edge which is taken from input JSON file. |
|
17 |
* @param archetype Edge archetype index. |
|
18 |
* @param attributes List of all tributes. Every attribute is stored in String array in pair as {attribute name, attribute value}. |
|
19 |
*/ |
|
20 |
public SubedgeInfo(int id, int archetype, List<String[]> attributes) { |
|
21 |
this.id = id; |
|
22 |
this.archetype = archetype; |
|
23 |
this.attributes = attributes; |
|
24 |
} |
|
25 |
|
|
26 |
public int getId() { |
|
27 |
return id; |
|
28 |
} |
|
29 |
|
|
30 |
public int getArchetype() { |
|
31 |
return archetype; |
|
32 |
} |
|
33 |
|
|
34 |
public List<String[]> getAttributes() { |
|
35 |
return attributes; |
|
36 |
} |
|
37 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/Vertex.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
import cz.zcu.kiv.imiger.plugin.spade.graph.VertexImpl; |
|
4 |
|
|
5 |
import java.util.List; |
|
6 |
|
|
7 |
/** |
|
8 |
* Class represents vertex which is used for output JSON format (JSON between frontend and backend) |
|
9 |
*/ |
|
10 |
public class Vertex extends BaseVertex { |
|
11 |
|
|
12 |
/** List of all tributes. Every attribute is stored in String array in pair as {attribute name, attribute value}. */ |
|
13 |
private List<String[]> attributes; |
|
14 |
/** Relative position in graph */ |
|
15 |
private Position position; |
|
16 |
|
|
17 |
/** |
|
18 |
* Create new vertex. |
|
19 |
* @param id original identification number from input file |
|
20 |
* @param name of vertex |
|
21 |
* @param archetypeIndex index of vertex archetype |
|
22 |
* @param text additional info |
|
23 |
* @param attributes List of all attributes. Every attribute is stored in String array in pair as {attribute name, attribute value}. |
|
24 |
*/ |
|
25 |
public Vertex(int id, String name, int archetypeIndex, String text, List<String[]> attributes) { |
|
26 |
super(id, name, archetypeIndex, text); |
|
27 |
this.attributes = attributes; |
|
28 |
this.position = null; |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* Create new vertex. |
|
33 |
* @param vertex instance of VertexImpl with set all parameters |
|
34 |
* @param attributes ist of all attributes. Every attribute is stored in String array in pair as {attribute name, attribute value}. |
|
35 |
*/ |
|
36 |
public Vertex(VertexImpl vertex, List<String[]> attributes){ |
|
37 |
this(vertex.getId(), vertex.getName(), vertex.getArchetype(), vertex.getText(), attributes); |
|
38 |
} |
|
39 |
|
|
40 |
public List<String[]> getAttributes() { |
|
41 |
return attributes; |
|
42 |
} |
|
43 |
|
|
44 |
public void setAttributes(List<String[]> attributes) { |
|
45 |
this.attributes = attributes; |
|
46 |
} |
|
47 |
|
|
48 |
public Position getPosition() { |
|
49 |
return position; |
|
50 |
} |
|
51 |
|
|
52 |
public void setPosition(Position position) { |
|
53 |
this.position = position; |
|
54 |
} |
|
55 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/api/VertexArchetype.java | ||
---|---|---|
1 |
package cz.zcu.kiv.imiger.plugin.spade.api; |
|
2 |
|
|
3 |
public class VertexArchetype { |
|
4 |
public String name; |
|
5 |
public String text; |
|
6 |
public String icon; |
|
7 |
|
|
8 |
public VertexArchetype(String name, String text, String icon) { |
|
9 |
this.name = name; |
|
10 |
this.text = text; |
|
11 |
this.icon = icon; |
|
12 |
} |
|
13 |
|
|
14 |
public VertexArchetype(String name, String text) { |
|
15 |
this(name, text, ""); |
|
16 |
} |
|
17 |
|
|
18 |
public String getName() { |
|
19 |
return name; |
|
20 |
} |
|
21 |
|
|
22 |
public String getText() { |
|
23 |
return text; |
|
24 |
} |
|
25 |
|
|
26 |
public String getIcon() { |
|
27 |
return icon; |
|
28 |
} |
|
29 |
} |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/graph/EdgeImpl.java | ||
---|---|---|
1 | 1 |
package cz.zcu.kiv.imiger.plugin.spade.graph; |
2 | 2 |
|
3 |
import cz.zcu.kiv.imiger.plugin.spade.api.BaseEdge;
|
|
3 |
import cz.zcu.kiv.imiger.vo.BaseEdge;
|
|
4 | 4 |
|
5 | 5 |
import java.util.*; |
6 | 6 |
|
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/graph/GraphManager.java | ||
---|---|---|
1 | 1 |
package cz.zcu.kiv.imiger.plugin.spade.graph; |
2 | 2 |
|
3 |
import cz.zcu.kiv.imiger.plugin.spade.api.*; |
|
4 | 3 |
import cz.zcu.kiv.imiger.plugin.spade.graph.filter.*; |
5 | 4 |
import cz.zcu.kiv.imiger.plugin.spade.graph.loader.JSONConfigLoader; |
5 |
import cz.zcu.kiv.imiger.vo.*; |
|
6 | 6 |
|
7 | 7 |
import java.util.*; |
8 | 8 |
|
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/graph/VertexImpl.java | ||
---|---|---|
1 | 1 |
package cz.zcu.kiv.imiger.plugin.spade.graph; |
2 | 2 |
|
3 |
import cz.zcu.kiv.imiger.plugin.spade.api.BaseVertex;
|
|
3 |
import cz.zcu.kiv.imiger.vo.BaseVertex;
|
|
4 | 4 |
|
5 | 5 |
import java.util.*; |
6 | 6 |
|
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/graph/loader/GraphJSONDataLoader.java | ||
---|---|---|
4 | 4 |
import com.google.gson.JsonElement; |
5 | 5 |
import com.google.gson.JsonObject; |
6 | 6 |
import com.google.gson.JsonParser; |
7 |
import cz.zcu.kiv.imiger.plugin.spade.api.AttributeDataType;
|
|
7 |
import cz.zcu.kiv.imiger.vo.AttributeDataType;
|
|
8 | 8 |
import cz.zcu.kiv.imiger.plugin.spade.graph.Attribute; |
9 | 9 |
import cz.zcu.kiv.imiger.plugin.spade.graph.EdgeArchetypeInfo; |
10 | 10 |
import cz.zcu.kiv.imiger.plugin.spade.graph.GraphManager; |
sources/imiger-spade-converter/src/main/java/cz/zcu/kiv/imiger/plugin/spade/graph/loader/JSONConfigLoader.java | ||
---|---|---|
1 | 1 |
package cz.zcu.kiv.imiger.plugin.spade.graph.loader; |
2 | 2 |
|
3 |
import cz.zcu.kiv.imiger.plugin.spade.api.AttributeDataType;
|
|
4 |
import cz.zcu.kiv.imiger.plugin.spade.api.AttributeType;
|
|
3 |
import cz.zcu.kiv.imiger.vo.AttributeDataType;
|
|
4 |
import cz.zcu.kiv.imiger.vo.AttributeType;
|
|
5 | 5 |
import cz.zcu.kiv.imiger.plugin.spade.graph.EdgeArchetypeInfo; |
6 | 6 |
import cz.zcu.kiv.imiger.plugin.spade.graph.GraphManager; |
7 | 7 |
import cz.zcu.kiv.imiger.plugin.spade.graph.filter.*; |
sources/imiger-spade-converter/src/test/java/cz/zcu/kiv/imiger/plugin/spade/backend/GraphFilterTest.java | ||
---|---|---|
1 | 1 |
package cz.zcu.kiv.imiger.plugin.spade.backend; |
2 | 2 |
|
3 |
import cz.zcu.kiv.imiger.plugin.spade.api.Edge;
|
|
4 |
import cz.zcu.kiv.imiger.plugin.spade.api.Graph;
|
|
5 |
import cz.zcu.kiv.imiger.plugin.spade.api.Vertex;
|
|
3 |
import cz.zcu.kiv.imiger.vo.Edge;
|
|
4 |
import cz.zcu.kiv.imiger.vo.Graph;
|
|
5 |
import cz.zcu.kiv.imiger.vo.Vertex;
|
|
6 | 6 |
import cz.zcu.kiv.imiger.plugin.spade.graph.GraphManager; |
7 | 7 |
import cz.zcu.kiv.imiger.plugin.spade.graph.loader.GraphJSONDataLoader; |
8 | 8 |
import cz.zcu.kiv.imiger.plugin.spade.graph.loader.JSONConfigLoader; |
9 |
import cz.zcu.kiv.imiger.plugin.spade.api.SubedgeInfo;
|
|
9 |
import cz.zcu.kiv.imiger.vo.SubedgeInfo;
|
|
10 | 10 |
import org.apache.commons.io.IOUtils; |
11 | 11 |
import org.junit.jupiter.api.Assertions; |
12 | 12 |
import org.junit.jupiter.api.BeforeAll; |
Také k dispozici: Unified diff
[imiger-spade-converter] use imiger-vo classes instead of own copies