Skip to content

Commit

Permalink
[SEDONA-623] Simplify Java if statements (#1516)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbampton committed Jul 9, 2024
1 parent 493ec74 commit eb043a3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public RangeFilterUsingIndex(
*/
@Override
public Iterator<T> call(Iterator<SpatialIndex> treeIndexes) throws Exception {
assert treeIndexes.hasNext() == true;
assert treeIndexes.hasNext();
SpatialIndex treeIndex = treeIndexes.next();
List<T> results = new ArrayList<T>();
List<T> tempResults = treeIndex.query(this.queryGeometry.getEnvelopeInternal());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static <U extends Geometry, T extends Geometry> JavaRDD<T> SpatialRangeQu
spatialRDD.getTargetEpgsgCode());
}

if (useIndex == true) {
if (useIndex) {
if (spatialRDD.indexedRawRDD == null) {
throw new Exception(
"[RangeQuery][SpatialRangeQuery] Index doesn't exist. Please build index on rawSpatialRDD.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public long countWithoutDuplicatesSPRDD() {
*/
public void buildIndex(final IndexType indexType, boolean buildIndexOnSpatialPartitionedRDD)
throws Exception {
if (buildIndexOnSpatialPartitionedRDD == false) {
if (!buildIndexOnSpatialPartitionedRDD) {
// This index is built on top of unpartitioned SRDD
this.indexedRawRDD = this.rawSpatialRDD.mapPartitions(new IndexBuilder(indexType));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public static GlobalParameter getGlobalParameter(

private boolean updateIndirectParameters() {
this.partitionsOnSingleAxis = (int) Math.sqrt(Math.pow(4, this.minTreeLevel));
if (this.useUserSuppliedResolution == false) {
if (!this.useUserSuppliedResolution) {
this.partitionIntervalX = 256;
this.partitionIntervalY = 256;
this.resolutionX = partitionsOnSingleAxis * 256;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public RasterOverlayOperator(
public boolean JoinImage(JavaPairRDD<Integer, ImageSerializableWrapper> distributedFontImage)
throws Exception {
logger.info("[Sedona-Viz][JoinImage][Start]");
if (this.generateDistributedImage == false) {
if (!this.generateDistributedImage) {
throw new Exception(
"[OverlayOperator][JoinImage] The back image is not distributed. Please don't use distributed format.");
}
Expand Down Expand Up @@ -101,11 +101,11 @@ public Tuple2<Integer, ImageSerializableWrapper> call(
imagePair._2._1.iterator();
Iterator<ImageSerializableWrapper> frontImageIterator =
imagePair._2._2.iterator();
if (backImageIterator.hasNext() == false) {
if (!backImageIterator.hasNext()) {
throw new Exception(
"[OverlayOperator][JoinImage] The back image iterator didn't get any image partitions.");
}
if (frontImageIterator.hasNext() == false) {
if (!frontImageIterator.hasNext()) {
throw new Exception(
"[OverlayOperator][JoinImage] The front image iterator didn't get any image partitions.");
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public Tuple2<Integer, ImageSerializableWrapper> call(
* @throws Exception the exception
*/
public boolean JoinImage(BufferedImage frontRasterImage) throws Exception {
if (this.generateDistributedImage == true) {
if (this.generateDistributedImage) {
throw new Exception(
"[OverlayOperator][JoinImage] The back image is distributed. Please don't use centralized format.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public VectorOverlayOperator(List<String> backVectorImage) {
*/
public boolean JoinImage(JavaPairRDD<Integer, String> distributedFontImage) throws Exception {
logger.info("[Sedona-Viz][JoinImage][Start]");
if (this.generateDistributedImage == false) {
if (!this.generateDistributedImage) {
throw new Exception(
"[OverlayOperator][JoinImage] The back image is not distributed. Please don't use distributed format.");
}
Expand Down Expand Up @@ -101,7 +101,7 @@ public Boolean call(Tuple2<Integer, String> vectorObject) throws Exception {
*/
public boolean JoinImage(List<String> frontVectorImage) throws Exception {
logger.info("[Sedona-VizViz][JoinImage][Start]");
if (this.generateDistributedImage == true) {
if (this.generateDistributedImage) {
throw new Exception(
"[OverlayOperator][JoinImage] The back image is distributed. Please don't use centralized format.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ protected JavaPairRDD<Pixel, Double> ApplyPhotoFilter(JavaSparkContext sparkCont
throws Exception {
logger.info("[Sedona-VizViz][ApplyPhotoFilter][Start]");
if (this.parallelPhotoFilter) {
if (this.hasBeenSpatialPartitioned == false) {
if (!this.hasBeenSpatialPartitioned) {
this.spatialPartitioningWithDuplicates();
this.hasBeenSpatialPartitioned = true;
}
Expand Down Expand Up @@ -568,8 +568,8 @@ public Integer call(Double pixelCount) throws Exception {
*/
protected boolean RenderImage(JavaSparkContext sparkContext) throws Exception {
logger.info("[Sedona-VizViz][RenderImage][Start]");
if (this.parallelRenderImage == true) {
if (this.hasBeenSpatialPartitioned == false) {
if (this.parallelRenderImage) {
if (!this.hasBeenSpatialPartitioned) {
this.spatialPartitioningWithoutDuplicates();
this.hasBeenSpatialPartitioned = true;
}
Expand Down Expand Up @@ -618,7 +618,7 @@ public Iterator<Tuple2<Integer, ImageSerializableWrapper>> call(
}
});
// logger.debug("[Sedona-VizViz][Render]output count "+this.distributedRasterImage.count());
} else if (this.parallelRenderImage == false) {
} else if (!this.parallelRenderImage) {
// Draw full size image in parallel
this.distributedRasterImage =
this.distributedRasterColorMatrix.mapPartitionsToPair(
Expand Down

0 comments on commit eb043a3

Please sign in to comment.