Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Jan 22, 2024
1 parent ae74697 commit a0a2641
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,23 @@ public void updateDimension(int locA, int locB, int dimension) {
return;

intMatrix.set(locA, locB, dimension);
//-- set value if evaluation is done for this predicate
if (isDone()) {
//-- set value if predicate value can be known
if (isDetermined()) {
setValue( valueIM());
}
}

protected boolean isDone() {
return false;
}
/**
* Tests whether predicate evaluation can be short-circuited
* due to the current state of the matrix providing
* enough information to determine the predicate value.
* <p>
* If this value is true it is expected that {@link valueIM()}
* provides the correct result of the predicate.
*
* @return true if the predicate value can be determined
*/
protected abstract boolean isDetermined();

protected void setRequireCovers(Envelope a, Envelope b) {
setRequire(a.covers(b));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ public RelatePredicate(String mask) {

public String name() { return "relate"; }

@Override
public boolean isDetermined() {
//-- always evaluate entire matrix
return false;
}

@Override
public boolean valueIM() {
if (mask == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void init(Envelope envA, Envelope envB) {
}

@Override
public boolean isDone() {
public boolean isDetermined() {
return intersectsExteriorOf(RelateGeometry.GEOM_A);
}

Expand Down Expand Up @@ -110,7 +110,7 @@ public void init(Envelope envA, Envelope envB) {
}

@Override
public boolean isDone() {
public boolean isDetermined() {
return intersectsExteriorOf(RelateGeometry.GEOM_A);
}

Expand Down Expand Up @@ -138,7 +138,7 @@ public void init(Envelope envA, Envelope envB) {
}

@Override
public boolean isDone() {
public boolean isDetermined() {
return intersectsExteriorOf(RelateGeometry.GEOM_B);
}

Expand All @@ -164,7 +164,7 @@ public void init(Envelope envA, Envelope envB) {
}

@Override
public boolean isDone() {
public boolean isDetermined() {
return intersectsExteriorOf(RelateGeometry.GEOM_B);
}

Expand All @@ -188,7 +188,7 @@ public void init(int dimA, int dimB) {
}

@Override
public boolean isDone() {
public boolean isDetermined() {
if (dimA == Dimension.L && dimB == Dimension.L) {
//-- L/L interaction can only be dim = P
if (getDimension(Location.INTERIOR, Location.INTERIOR) > Dimension.P)
Expand Down Expand Up @@ -232,7 +232,7 @@ public void init(Envelope envA, Envelope envB) {
}

@Override
public boolean isDone() {
public boolean isDetermined() {
boolean isEitherExteriorIntersects =
isIntersects(Location.INTERIOR, Location.EXTERIOR)
|| isIntersects(Location.BOUNDARY, Location.EXTERIOR)
Expand Down Expand Up @@ -260,7 +260,7 @@ public void init(int dimA, int dimB) {
}

@Override
public boolean isDone() {
public boolean isDetermined() {
if (dimA == Dimension.A || dimA == Dimension.P) {
if (isIntersects(Location.INTERIOR, Location.INTERIOR)
&& isIntersects(Location.INTERIOR, Location.EXTERIOR)
Expand Down Expand Up @@ -296,7 +296,7 @@ public void init(int dimA, int dimB) {
}

@Override
public boolean isDone() {
public boolean isDetermined() {
//-- for touches interiors cannot intersect
boolean isInteriorsIntersects = isIntersects(Location.INTERIOR, Location.INTERIOR);
return isInteriorsIntersects;
Expand Down

0 comments on commit a0a2641

Please sign in to comment.