本文整理汇总了Java中com.google.common.collect.Table.Cell.getRowKey方法的典型用法代码示例。如果您正苦于以下问题:Java Cell.getRowKey方法的具体用法?Java Cell.getRowKey怎么用?Java Cell.getRowKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Table.Cell
的用法示例。
在下文中一共展示了Cell.getRowKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dumpResults
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
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();
}
}
示例2: run
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
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++;
}
}
}
}
示例3: populateFromFlows
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
private void populateFromFlows(DynamicFlowGraph flowGraph) {
int eid = 0;
for(Cell<Integer, Integer, Integer> edge : flowGraph.getEdges()) {
int from = edge.getRowKey();
int to = edge.getColumnKey();
if(!jungGraph.containsVertex(from)) {
jungGraph.addVertex(from);
}
if(!jungGraph.containsVertex(to)) {
jungGraph.addVertex(to);
}
int edgeCount = edge.getValue();
for(int i = 0; i < edgeCount; i += 1) {
jungGraph.addEdge(eid, from, to, EdgeType.DIRECTED);
eid += 1;
}
}
}
示例4: readAll
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
public DynamicFlowGraph readAll(File ... rossalCsvs) {
DynamicFlowGraph graph = new DynamicFlowGraph();
for(File csv : rossalCsvs) {
if(csv == null || !csv.exists() || !csv.isFile()
|| !csv.getName().endsWith(".csv")) {
continue;
}
DynamicFlowGraph tempGraph = read(csv);
for(Cell<Integer, Integer, Integer> edge : tempGraph.getEdges()) {
int fromId = edge.getRowKey();
SourceLineNode from = tempGraph.getNode(fromId);
from = graph.addNode(SourceLineNode.clone(from));
int toId = edge.getColumnKey();
SourceLineNode to = tempGraph.getNode(toId);
to = graph.addNode(SourceLineNode.clone(to));
int count = edge.getValue();
graph.addEdge(from, to, count);
}
}
return graph;
}
示例5: modify
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
@Override
public void modify(Object o, String property, Object value) {
// int columnIndex = Arrays.asList(columnNames).indexOf(property);
if (property.equals(columnNames[SIZE])) {
String intString = (String) value;
if (intString.matches("[+]?\\d+")) {
TableItem item = (TableItem) o;
@SuppressWarnings("unchecked")
Cell<Pair<String, String>, Pair<String, String>, Integer> element = (Cell<Pair<String, String>, Pair<String, String>, Integer>) item
.getData();
int oldValue = element.getValue();
int newValue = Integer.parseInt(intString);
if (oldValue != newValue) {
Pair<String, String> src = element.getRowKey();
Pair<String, String> tgt = element.getColumnKey();
bufferSize.setSize(src.v1, src.v2, tgt.v1, tgt.v2, newValue);
setDirty(true);
}
viewer.refresh();
}
}
}
示例6: AverageTraceWeighter
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
/**
* Create a weighter (average values) given the network weights
*
* @param networkWeights
*/
public AverageTraceWeighter(NetworkWeight networkWeights) {
this.networkWeights = networkWeights;
weightTable = HashBasedTable.create();
varianceTable = HashBasedTable.create();
for (Cell<String, String, ClockCycles> cell : networkWeights.asTable().cellSet()) {
String actor = cell.getRowKey();
String action = cell.getColumnKey();
ClockCycles w = cell.getValue();
double avg = w.getMeanClockCycles();
double min = Math.min(w.getMinClockCycles(), avg);
double max = Math.max(avg, w.getMaxClockCycles());
double variance = Math.pow(((max - min) / 6.0), 2);
weightTable.put(actor, action, avg);
varianceTable.put(actor, action, variance);
}
}
示例7: NormalDistributionTraceWeighter
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
/**
* Create a normal distribution weighter given the network weights
*
* @param networkWeights
*/
public NormalDistributionTraceWeighter(NetworkWeight networkWeights) {
this.networkWeights = networkWeights;
weightTable = HashBasedTable.create();
varianceTable = HashBasedTable.create();
for (Cell<String, String, ClockCycles> cell : networkWeights.asTable().cellSet()) {
String actor = cell.getRowKey();
String action = cell.getColumnKey();
ClockCycles w = cell.getValue();
double avg = w.getMeanClockCycles();
double min = Math.min(w.getMinClockCycles(), avg);
double max = Math.max(avg, w.getMaxClockCycles());
double weight = (min + 4 * avg + max) / 6.0;
double variance = Math.pow(((max - min) / 6.0), 2);
weightTable.put(actor, action, weight);
varianceTable.put(actor, action, variance);
}
}
示例8: testKnownUtf8Hashing
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
public void testKnownUtf8Hashing() {
for (Cell<HashFunction, String, String> cell : KNOWN_HASHES.cellSet()) {
HashFunction func = cell.getRowKey();
String input = cell.getColumnKey();
String expected = cell.getValue();
assertEquals(
String.format(Locale.ROOT, "Known hash for hash(%s, UTF_8) failed", input),
expected,
func.hashString(input, UTF_8).toString());
}
}
示例9: dumpResults
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
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();
}
}
示例10: main
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
public static void main(String[] args) throws
IOException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
System.out.println("Reading dynamic graph...");
DynamicFlowGraph dynamicFlowGraph = Cerebro.getDynamicFlowGraph(args);
final String subject = args[args.length - 1];
System.out.println(subject);
System.out.println("Computing layout, visual clusters, and communities...");
Cerebro.analyzeDynamicFlow(subject, dynamicFlowGraph);
dynamicFlowGraph.spitDynamicFlowGraph(System.out);
DynamicDisplay display = init(DEFAULT_TITLE, dynamicFlowGraph);
for(Cell<Integer, Integer, Integer> edge : dynamicFlowGraph.getEdges()) {
int fromId = edge.getRowKey();
int toId = edge.getColumnKey();
SourceLineNode from = dynamicFlowGraph.getNode(fromId);
SourceLineNode to = dynamicFlowGraph.getNode(toId);
double weight = edge.getValue();
System.out.format("%s %s %s\n", fromId, toId, weight);
if(Double.isNaN(from.x)) {
display.showDependence(fromId, toId, weight);
} else {
display.showDependence(fromId, from.x, from.y, toId, to.x, to.y, weight);
}
}
display.colorNodes();
display.showEdges();
startCli(display);
System.exit(0);
}
示例11: getValue
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
@Override
public Object getValue(Object o, String property) {
// Find the index of the column
int columnIndex = Arrays.asList(columnNames).indexOf(property);
Object result = "";
@SuppressWarnings("unchecked")
Cell<Pair<String, String>, Pair<String, String>, Integer> element = (Cell<Pair<String, String>, Pair<String, String>, Integer>) o;
switch (columnIndex) {
case SRC_ACTOR:
result = element.getRowKey().v1;
break;
case SRC_PORT:
result = element.getRowKey().v2;
break;
case TGT_ACTOR:
result = element.getColumnKey().v1;
break;
case TGT_PORT:
result = element.getColumnKey().v2;
break;
case SIZE:
result = Integer.toString(element.getValue());
break;
default:
break;
}
return result;
}
示例12: getColumnText
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
@Override
public String getColumnText(Object o, int columnIndex) {
String result = "";
@SuppressWarnings("unchecked")
Cell<Pair<String, String>, Pair<String, String>, Integer> element = (Cell<Pair<String, String>, Pair<String, String>, Integer>) o;
switch (columnIndex) {
case SRC_ACTOR:
result = element.getRowKey().v1;
break;
case SRC_PORT:
result = element.getRowKey().v2;
break;
case TGT_ACTOR:
result = element.getColumnKey().v1;
break;
case TGT_PORT:
result = element.getColumnKey().v2;
break;
case SIZE:
result = Integer.toString(element.getValue());
break;
default:
break;
}
return result;
}
示例13: asTable
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
public Table<String, String, Map<String, ClockCycles>> asTable() {
Table<String, String, Map<String, ClockCycles>> table = HashBasedTable.create();
for (Cell<String, String, Map<String, ClockCycles>> cell : actionSelectionTable.cellSet()) {
String actor = cell.getRowKey();
String action = cell.getColumnKey();
Map<String, ClockCycles> map = new HashMap<>();
table.put(actor, action, map);
for (Entry<String, ClockCycles> emap : cell.getValue().entrySet()) {
map.put(emap.getKey(), emap.getValue().clone());
}
}
return table;
}
示例14: asTable
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
public Table<String, String, ClockCycles> asTable() {
Table<String, String, ClockCycles> table = HashBasedTable.create();
for (Cell<String, String, ClockCycles> cell : weightsTable.cellSet()) {
String actor = cell.getRowKey();
String action = cell.getColumnKey();
table.put(actor, action, cell.getValue().clone());
}
return table;
}
示例15: testKnownUtf8Hashing
import com.google.common.collect.Table.Cell; //导入方法依赖的package包/类
public void testKnownUtf8Hashing() {
for (Cell<HashFunction, String, String> cell : KNOWN_HASHES.cellSet()) {
HashFunction func = cell.getRowKey();
String input = cell.getColumnKey();
String expected = cell.getValue();
assertEquals(
String.format("Known hash for hash(%s, UTF_8) failed", input),
expected,
func.hashString(input, Charsets.UTF_8).toString());
}
}