add anyRelated() method to IBinaryNaturalRelation. use to optimize getResult() in LocalPathEdges
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3153 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
dc6c273925
commit
c186b63222
|
@ -423,7 +423,7 @@ public class LocalPathEdges {
|
|||
for (IntIterator it = paths.iterateIndices(); it.hasNext();) {
|
||||
int d2 = it.next();
|
||||
IBinaryNaturalRelation R = (IBinaryNaturalRelation) contents.next();
|
||||
if (R != null && R.getRelatedCount(n) > 0) {
|
||||
if (R != null && R.anyRelated(n)) {
|
||||
result.add(d2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ public final class BasicNaturalRelation implements IBinaryNaturalRelation {
|
|||
private void advanceX() {
|
||||
delegateIterator = null;
|
||||
for (int i = nextX + 1; i <= maxX; i++) {
|
||||
if (anyRelationWithX(i)) {
|
||||
if (anyRelated(i)) {
|
||||
nextX = i;
|
||||
nextIndex = getFirstIndex(i);
|
||||
if (nextIndex == smallStore.length) {
|
||||
|
@ -285,7 +285,7 @@ public final class BasicNaturalRelation implements IBinaryNaturalRelation {
|
|||
* @param x
|
||||
* @return true iff there exists pair (x,y) for some y
|
||||
*/
|
||||
private boolean anyRelationWithX(int x) {
|
||||
public boolean anyRelated(int x) {
|
||||
return smallStore[0].get(x) != EMPTY_CODE;
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ public final class BasicNaturalRelation implements IBinaryNaturalRelation {
|
|||
if (Assertions.verifyAssertions) {
|
||||
Assertions._assert(x >= 0);
|
||||
}
|
||||
if (!anyRelationWithX(x)) {
|
||||
if (!anyRelated(x)) {
|
||||
return 0;
|
||||
} else {
|
||||
if (usingDelegate(x)) {
|
||||
|
|
|
@ -39,6 +39,12 @@ public interface IBinaryNaturalRelation extends VerboseAction, Iterable<IntPair>
|
|||
*/
|
||||
public abstract int getRelatedCount(int x);
|
||||
|
||||
/**
|
||||
* @param x
|
||||
* @return true iff there exists pair (x,y) for some y
|
||||
*/
|
||||
public abstract boolean anyRelated(int x);
|
||||
|
||||
/**
|
||||
* @param x
|
||||
* @param y
|
||||
|
|
Loading…
Reference in New Issue