Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-27 03:12:37 +01:00
Added preconditions to BreadthFirstSearch and subclasses.
Dieser Commit ist enthalten in:
Ursprung
25021b4a30
Commit
7dc81f8350
@ -27,6 +27,8 @@ import com.sk89q.worldedit.function.RegionFunction;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Performs a breadth-first search starting from points added with
|
||||
* {@link #visit(com.sk89q.worldedit.Vector)}. The search continues
|
||||
@ -51,7 +53,8 @@ public abstract class BreadthFirstSearch implements Operation {
|
||||
*
|
||||
* @param function the function to apply to visited blocks
|
||||
*/
|
||||
public BreadthFirstSearch(RegionFunction function) {
|
||||
protected BreadthFirstSearch(RegionFunction function) {
|
||||
checkNotNull(function);
|
||||
this.function = function;
|
||||
addAxes();
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ import com.sk89q.worldedit.function.mask.Mask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Visits adjacent points on the same X-Z plane as long as the points
|
||||
* pass the given mask, and then executes the provided region
|
||||
@ -45,6 +47,7 @@ public class DownwardVisitor extends RecursiveVisitor {
|
||||
*/
|
||||
public DownwardVisitor(Mask mask, RegionFunction function, int baseY) {
|
||||
super(mask, function);
|
||||
checkNotNull(mask);
|
||||
|
||||
this.baseY = baseY;
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.function.visitor;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
|
@ -23,6 +23,8 @@ import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.RegionFunction;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* An implementation of an {@link BreadthFirstSearch} that uses a mask to
|
||||
* determine where a block should be visited.
|
||||
@ -31,8 +33,15 @@ public class RecursiveVisitor extends BreadthFirstSearch {
|
||||
|
||||
private final Mask mask;
|
||||
|
||||
/**
|
||||
* Create a new recursive visitor.
|
||||
*
|
||||
* @param mask the mask
|
||||
* @param function the function
|
||||
*/
|
||||
public RecursiveVisitor(Mask mask, RegionFunction function) {
|
||||
super(function);
|
||||
checkNotNull(mask);
|
||||
this.mask = mask;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren