public int compare(PairOfInts e1, PairOfInts e2) { if (e1.getRightElement() > e2.getRightElement()) { return 1; } if (e1.getRightElement() < e2.getRightElement()) { return -1; } if (e1.getLeftElement() == e2.getLeftElement()) { throw new RuntimeException("Event observed twice!"); } return e1.getLeftElement() < e2.getLeftElement() ? -1 : 1; } };
/** * Checks two pairs for equality. * * @param obj object for comparison * @return <code>true</code> if <code>obj</code> is equal to this object, <code>false</code> * otherwise */ public boolean equals(Object obj) { PairOfInts pair = (PairOfInts) obj; return leftElement == pair.getLeftElement() && rightElement == pair.getRightElement(); }
public int compare(PairOfInts e1, PairOfInts e2) { if (e1.getRightElement() > e2.getRightElement()) { return -1; } if (e1.getRightElement() < e2.getRightElement()) { return 1; } if (e1.getLeftElement() == e2.getLeftElement()) { throw new RuntimeException("Event observed twice!"); } return e1.getLeftElement() < e2.getLeftElement() ? -1 : 1; } };
public int compare(PairOfInts e1, PairOfInts e2) { if (e1.getRightElement() > e2.getRightElement()) { return 1; } if (e1.getRightElement() < e2.getRightElement()) { return -1; } if (e1.getLeftElement() == e2.getLeftElement()) { throw new RuntimeException("Event observed twice!"); } return e1.getLeftElement() < e2.getLeftElement() ? -1 : 1; } };
public int compare(PairOfInts e1, PairOfInts e2) { if (e1.getRightElement() > e2.getRightElement()) { return -1; } if (e1.getRightElement() < e2.getRightElement()) { return 1; } if (e1.getLeftElement() == e2.getLeftElement()) { throw new RuntimeException("Event observed twice!"); } return e1.getLeftElement() < e2.getLeftElement() ? -1 : 1; } };
/** * Defines a natural sort order for pairs. Pairs are sorted first by the left element, and then by * the right element. * * @return a value less than zero, a value greater than zero, or zero if this pair should be * sorted before, sorted after, or is equal to <code>obj</code>. */ public int compareTo(PairOfInts pair) { int pl = pair.getLeftElement(); int pr = pair.getRightElement(); if (leftElement == pl) { if (rightElement < pr) return -1; if (rightElement > pr) return 1; return 0; } if (leftElement < pl) return -1; return 1; }
hist.increment(pair.getRightElement()); System.out.print(pair); collection.seek(pair.getLeftElement()); System.out.println(pair.getLeftElement() + "\t" + pair.getRightElement());
postings = value.getRightElement(); for (PairOfInts pair : postings) { goldHist.increment(pair.getRightElement()); System.out.println(pair.getLeftElement() + "\t" + pair.getRightElement()); postings = value.getRightElement(); for (PairOfInts pair : postings) { silverHist.increment(pair.getRightElement()); System.out.println(pair.getLeftElement() + "\t" + pair.getRightElement());
@Override public void check() { Int2IntFrequencyDistribution m = new Int2IntFrequencyDistributionEntry(); long totalSum = 0; for (Int2IntFrequencyDistribution fd : distributions.values()) { long conditionalSum = 0; for (PairOfInts pair : fd) { conditionalSum += pair.getRightElement(); m.increment(pair.getLeftElement(), pair.getRightElement()); } if (conditionalSum != fd.getSumOfCounts()) { throw new RuntimeException("Internal Error!"); } totalSum += fd.getSumOfCounts(); } if (totalSum != getSumOfAllCounts()) { throw new RuntimeException("Internal Error! Got " + totalSum + ", Expected " + getSumOfAllCounts()); } for (PairOfInts e : m) { if (e.getRightElement() != marginals.get(e.getLeftElement())) { throw new RuntimeException("Internal Error!"); } } for (PairOfInts e : m) { if (e.getRightElement() != m.get(e.getLeftElement())) { throw new RuntimeException("Internal Error!"); } } }
@Override public void check() { Int2IntFrequencyDistributionFastutil m = new Int2IntFrequencyDistributionFastutil(); long totalSum = 0; for (Int2IntFrequencyDistributionFastutil fd : distributions.values()) { long conditionalSum = 0; for (PairOfInts pair : fd) { conditionalSum += pair.getRightElement(); m.increment(pair.getLeftElement(), pair.getRightElement()); } if (conditionalSum != fd.getSumOfCounts()) { throw new RuntimeException("Internal Error!"); } totalSum += fd.getSumOfCounts(); } if (totalSum != getSumOfAllCounts()) { throw new RuntimeException("Internal Error! Got " + totalSum + ", Expected " + getSumOfAllCounts()); } for (PairOfInts e : m) { if (e.getRightElement() != marginals.get(e.getLeftElement())) { throw new RuntimeException("Internal Error!"); } } for (PairOfInts e : m) { if (e.getRightElement() != m.get(e.getLeftElement())) { throw new RuntimeException("Internal Error!"); } } }
if(key.getRightElement() == DATA) {