Skip to content

Commit

Permalink
Added vararg expand and contract overload to Region and AbstractRegion.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomyLobo committed Jan 5, 2012
1 parent e4d3f70 commit ef3aeda
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ public void setWorld(LocalWorld world) {
this.world = world;
}

public void expand(Vector... changes) throws RegionOperationException {
for (Vector change : changes) {
expand(change);
}
}

public void contract(Vector... changes) throws RegionOperationException {
for (Vector change : changes) {
contract(change);
}
}

public void shift(Vector change) throws RegionOperationException {
expand(change);
contract(change);
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/sk89q/worldedit/regions/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ public interface Region extends Iterable<BlockVector> {
*/
public void expand(Vector change) throws RegionOperationException;

/**
* Expand the region.
*
* @param changes array/arguments with multiple related changes
* @throws RegionOperationException
*/
public void expand(Vector... changes) throws RegionOperationException;

/**
* Contract the region.
*
Expand All @@ -88,6 +96,14 @@ public interface Region extends Iterable<BlockVector> {
*/
public void contract(Vector change) throws RegionOperationException;

/**
* Contract the region.
*
* @param changes array/arguments with multiple related changes
* @throws RegionOperationException
*/
public void contract(Vector... changes) throws RegionOperationException;

/**
* Shift the region.
*
Expand Down

0 comments on commit ef3aeda

Please sign in to comment.