Skip to content

Commit

Permalink
Fixed #159, change types to general set as much as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
CheShianHung committed Oct 12, 2017
1 parent 970890b commit b3f0fb4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/java/boa/aggregators/SetAggregator.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package boa.aggregators;

import java.io.IOException;
import java.util.Set;
import java.util.LinkedHashSet;

import boa.io.EmitKey;
Expand All @@ -28,7 +29,7 @@
*/
@AggregatorSpec(name = "set", canCombine = true)
public class SetAggregator extends Aggregator {
private LinkedHashSet<String> set;
private Set<String> set;
private final long max;

/**
Expand Down
25 changes: 13 additions & 12 deletions src/java/boa/graphs/cfg/CFGNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package boa.graphs.cfg;

import java.util.HashMap;
import java.util.Set;
import java.util.LinkedHashSet;

import boa.types.Ast.Expression;
Expand All @@ -41,7 +42,7 @@ public class CFGNode implements Comparable<CFGNode> {
private int objectNameId;
private int classNameId;
private int numOfParameters = 0;
private LinkedHashSet<Integer> parameters;
private Set<Integer> parameters;
private int kind = TYPE_OTHER;
private String pid;
private Statement stmt;
Expand All @@ -52,8 +53,8 @@ public class CFGNode implements Comparable<CFGNode> {
public static HashMap<String, Integer> idOfLabel = new HashMap<String, Integer>();
public static HashMap<Integer, String> labelOfID = new HashMap<Integer, String>();

public LinkedHashSet<CFGEdge> inEdges = new LinkedHashSet<CFGEdge>();
public LinkedHashSet<CFGEdge> outEdges = new LinkedHashSet<CFGEdge>();
public Set<CFGEdge> inEdges = new LinkedHashSet<CFGEdge>();
public Set<CFGEdge> outEdges = new LinkedHashSet<CFGEdge>();

public java.util.ArrayList<CFGNode> predecessors = new java.util.ArrayList<CFGNode>();
public java.util.ArrayList<CFGNode> successors = new java.util.ArrayList<CFGNode>();
Expand Down Expand Up @@ -84,7 +85,7 @@ public CFGNode(String methodName, int kind, String className,
}

public CFGNode(String methodName, int kind, String className,
String objectName, int numOfParameters, LinkedHashSet<Integer> datas) {
String objectName, int numOfParameters, Set<Integer> datas) {
this.id = ++numOfNodes;
this.methodId = convertLabel(methodName);
this.kind = kind;
Expand Down Expand Up @@ -114,8 +115,8 @@ public Statement getStmt() {
return this.stmt;
}

public LinkedHashSet<String> getDefUse() {
LinkedHashSet<String> defUse = new LinkedHashSet<String>(useVariables);
public Set<String> getDefUse() {
Set<String> defUse = new LinkedHashSet<String>(useVariables);
defUse.add(defVariables);
return defUse;
}
Expand Down Expand Up @@ -182,11 +183,11 @@ public int getNumOfParameters() {
return numOfParameters;
}

public void setParameters(LinkedHashSet<Integer> parameters) {
public void setParameters(Set<Integer> parameters) {
this.parameters = parameters;
}

public LinkedHashSet<Integer> getParameters() {
public Set<Integer> getParameters() {
return parameters;
}

Expand Down Expand Up @@ -230,11 +231,11 @@ public boolean hasFalseBranch() {
return false;
}

public LinkedHashSet<CFGEdge> getInEdges() {
public Set<CFGEdge> getInEdges() {
return inEdges;
}

public LinkedHashSet<CFGEdge> getOutEdges() {
public Set<CFGEdge> getOutEdges() {
return outEdges;
}

Expand All @@ -255,7 +256,7 @@ public void setSuccessors(java.util.ArrayList<CFGNode> successors) {
}

public java.util.ArrayList<CFGNode> getInNodes() {
LinkedHashSet<CFGNode> nodes = new LinkedHashSet<CFGNode>();
Set<CFGNode> nodes = new LinkedHashSet<CFGNode>();
for (CFGEdge e : inEdges)
nodes.add(e.getSrc());
java.util.ArrayList<CFGNode> pred = new java.util.ArrayList<CFGNode>(nodes);
Expand All @@ -264,7 +265,7 @@ public java.util.ArrayList<CFGNode> getInNodes() {
}

public java.util.ArrayList<CFGNode> getOutNodes() {
LinkedHashSet<CFGNode> nodes = new LinkedHashSet<CFGNode>();
Set<CFGNode> nodes = new LinkedHashSet<CFGNode>();
for (CFGEdge e : outEdges)
nodes.add(e.getDest());
java.util.ArrayList<CFGNode> succ = new java.util.ArrayList<CFGNode>(nodes);
Expand Down

0 comments on commit b3f0fb4

Please sign in to comment.