2012-01-03 14:57:29 +00:00
|
|
|
package com.sk89q.worldedit.regions;
|
|
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
|
|
|
import com.sk89q.worldedit.BlockVector;
|
|
|
|
import com.sk89q.worldedit.LocalWorld;
|
2012-01-03 15:13:50 +00:00
|
|
|
import com.sk89q.worldedit.Vector;
|
2012-01-03 14:57:29 +00:00
|
|
|
|
|
|
|
public abstract class AbstractRegion implements Region {
|
|
|
|
/**
|
|
|
|
* Stores the world.
|
|
|
|
*/
|
|
|
|
protected LocalWorld world;
|
|
|
|
|
|
|
|
public AbstractRegion(LocalWorld world) {
|
|
|
|
this.world = world;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the iterator.
|
|
|
|
*
|
|
|
|
* @return iterator of points inside the region
|
|
|
|
*/
|
|
|
|
public Iterator<BlockVector> iterator() {
|
|
|
|
return new RegionIterator(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
public LocalWorld getWorld() {
|
|
|
|
return world;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setWorld(LocalWorld world) {
|
|
|
|
this.world = world;
|
|
|
|
}
|
2012-01-03 15:13:50 +00:00
|
|
|
|
2012-01-05 20:06:40 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-03 15:13:50 +00:00
|
|
|
public void shift(Vector change) throws RegionOperationException {
|
|
|
|
expand(change);
|
|
|
|
contract(change);
|
|
|
|
}
|
2012-01-03 14:57:29 +00:00
|
|
|
}
|