Java Code Examples for com.google.common.collect.Table.Cell#getRowKey()

The following examples show how to use com.google.common.collect.Table.Cell#getRowKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JimpleIDESolver.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void dumpResults() {
	try {
		PrintWriter out = new PrintWriter(new FileOutputStream("ideSolverDump"+System.currentTimeMillis()+".csv"));
		List<String> res = new ArrayList<String>();
		for(Cell<Unit, D, V> entry: val.cellSet()) {
			SootMethod methodOf = (SootMethod) icfg.getMethodOf(entry.getRowKey());
			PatchingChain<Unit> units = methodOf.getActiveBody().getUnits();
			int i=0;
			for (Unit unit : units) {
				if(unit==entry.getRowKey())
					break;
				i++;
			}

			res.add(methodOf+";"+entry.getRowKey()+"@"+i+";"+entry.getColumnKey()+";"+entry.getValue());
		}
		Collections.sort(res);
		for (String string : res) {
			out.println(string);
		}
		out.flush();
		out.close();
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	}
}
 
Example 2
Source File: IDESolver.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
public void run() {
	int sectionSize = (int) Math.floor(values.length / numThreads) + numThreads;
	for(int i = sectionSize * num; i < Math.min(sectionSize * (num+1),values.length); i++) {
		N n = values[i];
		for(N sP: icfg.getStartPointsOf(icfg.getMethodOf(n))) {					
			Set<Cell<D, D, EdgeFunction<V>>> lookupByTarget;
			lookupByTarget = jumpFn.lookupByTarget(n);
			for(Cell<D, D, EdgeFunction<V>> sourceValTargetValAndFunction : lookupByTarget) {
				D dPrime = sourceValTargetValAndFunction.getRowKey();
				D d = sourceValTargetValAndFunction.getColumnKey();
				EdgeFunction<V> fPrime = sourceValTargetValAndFunction.getValue();
				synchronized (val) {
					setVal(n,d,valueLattice.join(val(n,d),fPrime.computeTarget(val(sP,dPrime))));
				}
				flowFunctionApplicationCount++;
			}
		}
	}
}
 
Example 3
Source File: JimpleIFDSSolver.java    From JAADAS with GNU General Public License v3.0 5 votes vote down vote up
public void dumpResults() {
	try {
		PrintWriter out = new PrintWriter(new FileOutputStream("ideSolverDump" + System.currentTimeMillis() + ".csv"));
		List<SortableCSVString> res = new ArrayList<SortableCSVString>();
		for (Cell<Unit, D, ?> entry : val.cellSet()) {
			SootMethod methodOf = (SootMethod) icfg.getMethodOf(entry.getRowKey());
			PatchingChain<Unit> units = methodOf.getActiveBody().getUnits();
			int i = 0;
			for (Unit unit : units) {
				if (unit == entry.getRowKey())
					break;
				i++;
			}
			
			res.add(new SortableCSVString(methodOf + ";" + entry.getRowKey() + "@" + i + ";" + entry.getColumnKey() + ";" + entry.getValue(), i));
		}
		Collections.sort(res);
		// replacement is bugfix for excel view:
		for (SortableCSVString string : res) {
			out.println(string.value.replace("\"", "'"));
		}
		out.flush();
		out.close();
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	}
}
 
Example 4
Source File: SimpleFileProviderBackend.java    From incubator-sentry with Apache License 2.0 5 votes vote down vote up
private void mergeResult(Table<String, String, Set<String>> groupRolePrivilegeTableTemp) {
  for (Cell<String, String, Set<String>> cell : groupRolePrivilegeTableTemp.cellSet()) {
    String groupName = cell.getRowKey();
    String roleName = cell.getColumnKey();
    Set<String> privileges = groupRolePrivilegeTable.get(groupName, roleName);
    if (privileges == null) {
      privileges = new HashSet<String>();
      groupRolePrivilegeTable.put(groupName, roleName, privileges);
    }
    privileges.addAll(cell.getValue());
  }
}