Revize 918e91a9
Přidáno uživatelem Tomáš Šimandl před téměř 6 roky(ů)
sources/src/main/java/cz/zcu/kiv/offscreen/graph/filter/GraphFilter.java | ||
---|---|---|
3 | 3 |
import cz.zcu.kiv.offscreen.graph.EdgeArchetypeInfo; |
4 | 4 |
|
5 | 5 |
import java.math.BigDecimal; |
6 |
import java.util.ArrayList; |
|
6 | 7 |
import java.util.Date; |
7 | 8 |
import java.util.HashMap; |
8 | 9 |
import java.util.List; |
... | ... | |
88 | 89 |
REGULAR_EXPRESSION |
89 | 90 |
} |
90 | 91 |
|
91 |
private VertexArchetypeFilter vertexArchetypeFilter; |
|
92 |
private EdgeArchetypeFilter edgeArchetypeFilter; |
|
92 |
private VertexArchetypeFilter vertexArchetypeFilter = new VertexArchetypeFilter(new ArrayList<>(), ArchetypeMatchType.NON_MATCHING);
|
|
93 |
private EdgeArchetypeFilter edgeArchetypeFilter = new EdgeArchetypeFilter(new ArrayList<>(), ArchetypeMatchType.NON_MATCHING);
|
|
93 | 94 |
|
94 | 95 |
/** |
95 | 96 |
* key is the vertex archetype index, value is the filter object |
... | ... | |
118 | 119 |
} |
119 | 120 |
|
120 | 121 |
public void setVertexArchetypeFilter(List<Integer> archetypeIndices, ArchetypeMatchType matchType) { |
121 |
vertexArchetypeFilter = new VertexArchetypeFilter(archetypeIndices, matchType); |
|
122 |
vertexArchetypeFilter.archetypeIndeces.clear(); |
|
123 |
vertexArchetypeFilter.archetypeIndeces.addAll(archetypeIndices); |
|
124 |
vertexArchetypeFilter.matchType = matchType; |
|
122 | 125 |
} |
123 | 126 |
|
124 | 127 |
public void setEdgeArchetypeFilter(List<EdgeArchetypeInfo> archetypeIndices, ArchetypeMatchType matchType) { |
125 |
edgeArchetypeFilter = new EdgeArchetypeFilter(archetypeIndices, matchType); |
|
128 |
edgeArchetypeFilter.archetypeIndeces.clear(); |
|
129 |
edgeArchetypeFilter.archetypeIndeces.addAll(archetypeIndices); |
|
130 |
edgeArchetypeFilter.matchType = matchType; |
|
126 | 131 |
} |
127 | 132 |
|
128 | 133 |
public void setVertexNumberAttributeFilter(int archetypeIndex, int attributeTypeIndex, BigDecimal min, BigDecimal max, boolean minInclusive, boolean maxInclusive, NumberMatchType matchType) { |
sources/src/main/java/cz/zcu/kiv/offscreen/graph/loader/JSONConfigLoader.java | ||
---|---|---|
67 | 67 |
|
68 | 68 |
createEdgeAttributeFilters(filter, edgeAttributeFilterStrings); |
69 | 69 |
|
70 |
} catch (IOException e) { |
|
70 |
} catch (IOException | NullPointerException e) {
|
|
71 | 71 |
e.printStackTrace(); |
72 | 72 |
} |
73 | 73 |
|
... | ... | |
347 | 347 |
public Map<String, String> loadArchetypeIcons() { |
348 | 348 |
Map<String, String> archetypeIcons = new HashMap<>(); |
349 | 349 |
|
350 |
JSONArray archetypeIconsJson = json.getJSONArray("archetypeIcons"); |
|
351 |
for (int i = 0; i < archetypeIconsJson.size(); i++) { |
|
352 |
JSONObject icon = archetypeIconsJson.getJSONObject(i); |
|
353 |
String archetypeName = icon.getString("name"); |
|
354 |
String iconSvg = icon.getString("value"); |
|
350 |
if (json != null){ |
|
351 |
JSONArray archetypeIconsJson = json.getJSONArray("archetypeIcons"); |
|
352 |
for (int i = 0; i < archetypeIconsJson.size(); i++) { |
|
353 |
JSONObject icon = archetypeIconsJson.getJSONObject(i); |
|
354 |
String archetypeName = icon.getString("name"); |
|
355 |
String iconSvg = icon.getString("value"); |
|
355 | 356 |
|
356 |
archetypeIcons.put(archetypeName, iconSvg); |
|
357 |
archetypeIcons.put(archetypeName, iconSvg); |
|
358 |
} |
|
357 | 359 |
} |
358 |
|
|
359 | 360 |
return archetypeIcons; |
360 | 361 |
} |
361 | 362 |
|
... | ... | |
366 | 367 |
public List<Integer> loadGroupArchetypes() { |
367 | 368 |
List<Integer> defaultGroupArchetypes = new ArrayList<>(); |
368 | 369 |
|
369 |
JSONArray defaultGroupArchetypesJson = json.getJSONArray("defaultGroupArchetypes"); |
|
370 |
for (int i = 0; i < defaultGroupArchetypesJson.size(); i++) { |
|
371 |
String archetype = defaultGroupArchetypesJson.get(i).toString(); |
|
372 |
defaultGroupArchetypes.add(graphManager.getVertexArchetypeIndex(archetype)); |
|
370 |
if(json != null) { |
|
371 |
JSONArray defaultGroupArchetypesJson = json.getJSONArray("defaultGroupArchetypes"); |
|
372 |
for (int i = 0; i < defaultGroupArchetypesJson.size(); i++) { |
|
373 |
String archetype = defaultGroupArchetypesJson.get(i).toString(); |
|
374 |
defaultGroupArchetypes.add(graphManager.getVertexArchetypeIndex(archetype)); |
|
375 |
} |
|
373 | 376 |
} |
374 | 377 |
|
375 | 378 |
return defaultGroupArchetypes; |
... | ... | |
382 | 385 |
public List<String> loadGroupArchetypesStrings(){ |
383 | 386 |
List<String> groupArchetypes = new ArrayList<>(); |
384 | 387 |
|
385 |
JSONArray defaultGroupArchetypesJson = json.getJSONArray("defaultGroupArchetypes"); |
|
386 |
for (Object jsonItem : defaultGroupArchetypesJson) { |
|
387 |
groupArchetypes.add(jsonItem.toString()); |
|
388 |
if (json != null) { |
|
389 |
JSONArray defaultGroupArchetypesJson = json.getJSONArray("defaultGroupArchetypes"); |
|
390 |
for (Object jsonItem : defaultGroupArchetypesJson) { |
|
391 |
groupArchetypes.add(jsonItem.toString()); |
|
392 |
} |
|
388 | 393 |
} |
389 | 394 |
return groupArchetypes; |
390 | 395 |
} |
Také k dispozici: Unified diff
Resolve exceptions when config file is not defined