GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add EDS graph and model classes, not implemented yet · RepGraph/RepGraph@88f92f4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/main/java/com/RepGraph
    • AbstractGraph.java
    • AbstractModel.java
    • DMRSGraph.java
    • DMRSModel.java
    • EDSGraph.java
    • EDSModel.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/main/java/com/RepGraph/AbstractGraph.java‎

Copy file name to clipboardExpand all lines: src/main/java/com/RepGraph/AbstractGraph.java
+37-1Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,42 @@ public void setNodes(HashMap<String, Node> nodes) {
248248
this.nodes = nodes;
249249
}
250250

251+
public void populateTokens(){
252+
if (tokens.size()==0){
253+
setTokens(extractTokensFromNodes());}
254+
}
255+
/**
256+
* Creates a list of tokens in a range starting at "from" and ending at "end"
257+
*
258+
* @param from The start of the range of tokens
259+
* @param end The End of the range of tokens
260+
* @return ArrayList<Token> Returns a list of Token objects
261+
*/
262+
public ArrayList<Token> getTokenSpan(int from, int end) {
263+
ArrayList<Token> returnTokens = new ArrayList<>();
264+
for (int i = from; i < end + 1; i++) {
265+
returnTokens.add(tokens.get(i));
266+
}
267+
return returnTokens;
268+
}
269+
270+
/**
271+
* gets the "form" of tokens and turns them into a string
272+
*
273+
* @param tokenIn List of tokens to become a string
274+
* @return String This is the string of all Token's form.
275+
*/
276+
public String getTokenInput(ArrayList<Token> tokenIn) {
277+
String output = "";
278+
279+
for (Token t : tokenIn) {
280+
output += " " + t.getForm();
281+
282+
}
283+
284+
return output.trim();
285+
}
286+
251287
/**
252288
* This method checks to see if a Graph has a dangling Edge i.e an Edge that doesnt connect to any Node
253289
*
@@ -293,8 +329,8 @@ public void setNodeNeighbours() {
293329
Node sourceNode = nodes.get(source);
294330
sourceNode.addDirectedNeighbour(nodes.get(target));
295331
nodes.get(target).addUndirectedNeighbour(sourceNode);
332+
if (!sourceNode.getDirectedEdgeNeighbours().contains(currentEdge)){sourceNode.addDirectedEdgeNeighbour(currentEdge);}
296333

297-
sourceNode.addDirectedEdgeNeighbour(currentEdge);
298334
nodes.get(target).addUndirectedEdgeNeighbour(currentEdge);
299335

300336
}
Collapse file

‎src/main/java/com/RepGraph/AbstractModel.java‎

Copy file name to clipboardExpand all lines: src/main/java/com/RepGraph/AbstractModel.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void clearGraphs() {
5959
graphs.clear();
6060
}
6161

62-
public void populateTokens() {
62+
public void populateAllTokens() {
6363
AbstractGraph t = this.graphs.values().iterator().next();
6464
if (t.tokens.size() == 0) {
6565

Collapse file

‎src/main/java/com/RepGraph/DMRSGraph.java‎

Copy file name to clipboardExpand all lines: src/main/java/com/RepGraph/DMRSGraph.java
-76Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -45,44 +45,6 @@ public DMRSGraph(String id, String source, String input, HashMap<String, Node> n
4545

4646

4747

48-
@JsonGetter("nodes")
49-
public ArrayList<Node> returnNodeInArrayList() {
50-
ArrayList<Node> returnNodes = new ArrayList<Node>();
51-
for (Node n : this.nodes.values()) {
52-
returnNodes.add(n);
53-
}
54-
return returnNodes;
55-
}
56-
57-
@JsonIgnore
58-
/**
59-
* Getter method for the Graph's nodes HashMap.
60-
*
61-
* @return HashMap<Integer, Node> The Graph's nodes HashMap.
62-
*/
63-
public HashMap<String, Node> getNodes() {
64-
return this.nodes;
65-
}
66-
67-
@JsonSetter("nodes")
68-
/**
69-
* Setter method for the Graph's nodes HashMap. This setter also resets and populates the linear list of nodes "nodeslist"
70-
*
71-
* @param nodes The Graph's nodes HashMap.
72-
*/
73-
public void setNodes(ArrayList<Node> nodelist) {
74-
75-
for (Node n : nodelist) {
76-
this.nodes.put(n.getId(), n);
77-
}
78-
}
79-
80-
@JsonIgnore
81-
public void setNodes(HashMap<String, Node> nodes) {
82-
83-
this.nodes = nodes;
84-
}
85-
8648

8749
/**
8850
* Analysis Tool for finding the longest paths in the Graph.
@@ -401,11 +363,6 @@ public ArrayList<ArrayList<String>> traverseLongestPath(HashMap<String, Integer>
401363
}
402364

403365
@JsonIgnore
404-
/**
405-
* Method to check if a Graph is planar
406-
*
407-
* @return boolean returns true if the Graph is planar
408-
*/
409366
public boolean isPlanar() {
410367

411368
ArrayList<Node> ordered = new ArrayList<>();
@@ -473,7 +430,6 @@ public int compare(Node o1, Node o2) {
473430
return true;
474431
}
475432

476-
477433
/**
478434
* Returns a Graph object in it's Planar format i.e
479435
* Orders the nodes linearly based on their anchor's "from" positions
@@ -556,38 +512,6 @@ public int compare(Node o1, Node o2) {
556512

557513
}
558514

559-
/**
560-
* Creates a list of tokens in a range starting at "from" and ending at "end"
561-
*
562-
* @param from The start of the range of tokens
563-
* @param end The End of the range of tokens
564-
* @return ArrayList<Token> Returns a list of Token objects
565-
*/
566-
public ArrayList<Token> getTokenSpan(int from, int end) {
567-
ArrayList<Token> returnTokens = new ArrayList<>();
568-
for (int i = from; i < end + 1; i++) {
569-
returnTokens.add(tokens.get(i));
570-
}
571-
return returnTokens;
572-
}
573-
574-
/**
575-
* gets the "form" of tokens and turns them into a string
576-
*
577-
* @param tokenIn List of tokens to become a string
578-
* @return String This is the string of all Token's form.
579-
*/
580-
public String getTokenInput(ArrayList<Token> tokenIn) {
581-
String output = "";
582-
583-
for (Token t : tokenIn) {
584-
output += " " + t.getForm();
585-
586-
}
587-
588-
return output.trim();
589-
}
590-
591515
/**
592516
* Equals method for the Graph class.
593517
*
Collapse file

‎src/main/java/com/RepGraph/DMRSModel.java‎

Copy file name to clipboardExpand all lines: src/main/java/com/RepGraph/DMRSModel.java
+2-14Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -374,19 +374,6 @@ public HashMap<String, Object> searchSubgraphNodeSet(ArrayList<String> labels) {
374374
return returninfo;
375375
}
376376

377-
/**
378-
* Checks if all values in boolean array are true
379-
*
380-
* @param array an array of boolean values
381-
* @return boolean True if all values are true and false if there is at least one false value
382-
*/
383-
public boolean areAllTrue(boolean[] array) {
384-
for (boolean b : array) {
385-
if (!b) return false;
386-
}
387-
388-
return true;
389-
}
390377

391378
/**
392379
* Compares two graphs and searches for similarities and differences.
@@ -529,8 +516,9 @@ public HashMap<String, Object> runFormalTests(String graphID, boolean planar, bo
529516
* @return HashMap<String, Object> This is the visualisation information that is used to display the visualisation on the front-end
530517
*/
531518
public HashMap<String, Object> Visualise(String graphID, int format) {
532-
populateTokens();
519+
533520
DMRSGraph graph = (DMRSGraph) graphs.get(graphID);
521+
graph.populateTokens();
534522

535523
if (format == 1) {
536524
return VisualiseHierarchy(graph);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.