Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 02:20:07 +01:00
Cleanup
Dieser Commit ist enthalten in:
Ursprung
8797d8ac3c
Commit
699807665d
@ -39,9 +39,9 @@ public class ConfigurationPermissionsResolver implements PermissionsResolver {
|
||||
"worldedit.reload",
|
||||
"worldedit.selection",
|
||||
"worlds.creative.worldedit.region"});
|
||||
section.setProperty("permissions.groups.admins.permissions", new String[]{"*"});
|
||||
section.setProperty("permissions.users.sk89q.permissions", new String[]{"worldedit"});
|
||||
section.setProperty("permissions.users.sk89q.groups", new String[]{"admins"});
|
||||
section.setProperty("permissions.groups.admins.permissions", new String[] {"*"});
|
||||
section.setProperty("permissions.users.sk89q.permissions", new String[] {"worldedit"});
|
||||
section.setProperty("permissions.users.sk89q.groups", new String[] {"admins"});
|
||||
return section;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ public class DinnerPermsResolver implements PermissionsResolver {
|
||||
}
|
||||
|
||||
public static PermissionsResolver factory(Server server, YAMLProcessor config) {
|
||||
|
||||
return new DinnerPermsResolver(server);
|
||||
}
|
||||
|
||||
|
@ -139,8 +139,7 @@ public class CommandContext {
|
||||
|
||||
// If it is a value flag, read another argument and add it
|
||||
this.valueFlags.put(flagName, argList.get(nextArg++));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
booleanFlags.add(flagName);
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +100,11 @@ public class EditSession {
|
||||
*/
|
||||
private boolean fastMode = false;
|
||||
|
||||
/**
|
||||
* Use fast lighting as well if using fast mode.
|
||||
*/
|
||||
private boolean fastLighting = false;
|
||||
|
||||
/**
|
||||
* Block bag to use for getting blocks.
|
||||
*/
|
||||
@ -209,13 +214,13 @@ public class EditSession {
|
||||
|
||||
if (BlockType.usesData(type)) {
|
||||
if (fastMode) {
|
||||
result = world.setTypeIdAndDataFast(pt, type, block.getData() > -1 ? block.getData() : 0);
|
||||
result = world.setTypeIdAndDataFast(pt, type, block.getData() > -1 ? block.getData() : 0, fastLighting);
|
||||
} else {
|
||||
result = world.setTypeIdAndData(pt, type, block.getData() > -1 ? block.getData() : 0);
|
||||
}
|
||||
} else {
|
||||
if (fastMode) {
|
||||
result = world.setBlockTypeFast(pt, type);
|
||||
result = world.setBlockTypeFast(pt, type, fastLighting);
|
||||
} else {
|
||||
result = world.setBlockType(pt, type);
|
||||
}
|
||||
@ -227,8 +232,7 @@ public class EditSession {
|
||||
if (blockBag == null) {
|
||||
world.copyToWorld(pt, block);
|
||||
}
|
||||
}
|
||||
else if (block instanceof TileEntityBlock) {
|
||||
} else if (block instanceof TileEntityBlock) {
|
||||
world.copyToWorld(pt, block);
|
||||
}
|
||||
}
|
||||
@ -522,12 +526,30 @@ public class EditSession {
|
||||
* Disable the queue. This will flush the queue.
|
||||
*/
|
||||
public void disableQueue() {
|
||||
if (queued != false) {
|
||||
if (queued) {
|
||||
flushQueue();
|
||||
}
|
||||
queued = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fast lighting.
|
||||
*
|
||||
* @param fastLighting
|
||||
*/
|
||||
public void setFastLighting(boolean fastLighting) {
|
||||
this.fastLighting = fastLighting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return fast lighting status.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasFastLighting() {
|
||||
return fastLighting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fast mode.
|
||||
*
|
||||
@ -561,7 +583,9 @@ public class EditSession {
|
||||
rawSetBlock(pt, (BaseBlock) entry.getValue());
|
||||
|
||||
// TODO: use ChunkStore.toChunk(pt) after optimizing it.
|
||||
if (fastMode) dirtyChunks.add(new BlockVector2D(pt.getBlockX() >> 4, pt.getBlockZ() >> 4));
|
||||
if (fastMode) {
|
||||
dirtyChunks.add(new BlockVector2D(pt.getBlockX() >> 4, pt.getBlockZ() >> 4));
|
||||
}
|
||||
}
|
||||
|
||||
// We don't want to place these blocks if other blocks were missing
|
||||
@ -629,7 +653,9 @@ public class EditSession {
|
||||
blocks.remove(pt);
|
||||
|
||||
// TODO: use ChunkStore.toChunk(pt) after optimizing it.
|
||||
if (fastMode) dirtyChunks.add(new BlockVector2D(pt.getBlockX() >> 4, pt.getBlockZ() >> 4));
|
||||
if (fastMode) {
|
||||
dirtyChunks.add(new BlockVector2D(pt.getBlockX() >> 4, pt.getBlockZ() >> 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1794,9 +1820,24 @@ public class EditSession {
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a sphere or ellipsoid.
|
||||
* Makes a cylinder.
|
||||
*
|
||||
* @param pos Center of the sphere or ellipsoid
|
||||
* @param pos Center of the cylinder
|
||||
* @param block The block pattern to use
|
||||
* @param radius The cylinder's radius
|
||||
* @param height The cylinder's up/down extent. If negative, extend downward.
|
||||
* @param filled If false, only a shell will be generated.
|
||||
* @return number of blocks changed
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
public int makeCylinder(Vector pos, Pattern block, double radius, int height, boolean filled) throws MaxChangedBlocksException {
|
||||
return makeCylinder(pos, block, radius, radius, height, filled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a cylinder.
|
||||
*
|
||||
* @param pos Center of the cylinder
|
||||
* @param block The block pattern to use
|
||||
* @param radiusX The cylinder's largest north/south extent
|
||||
* @param radiusZ The cylinder's largest east/west extent
|
||||
@ -1875,6 +1916,20 @@ public class EditSession {
|
||||
return affected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a sphere.
|
||||
*
|
||||
* @param pos Center of the sphere or ellipsoid
|
||||
* @param block The block pattern to use
|
||||
* @param radius The sphere's radius
|
||||
* @param filled If false, only a shell will be generated.
|
||||
* @return number of blocks changed
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
public int makeSphere(Vector pos, Pattern block, double radius, boolean filled) throws MaxChangedBlocksException {
|
||||
return makeSphere(pos, block, radius, radius, radius, filled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a sphere or ellipsoid.
|
||||
*
|
||||
@ -2538,8 +2593,7 @@ public class EditSession {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param blockBag
|
||||
* the blockBag to set
|
||||
* @param blockBag the blockBag to set
|
||||
*/
|
||||
public void setBlockBag(BlockBag blockBag) {
|
||||
this.blockBag = blockBag;
|
||||
|
@ -73,6 +73,7 @@ public class LocalSession {
|
||||
private boolean beenToldVersion = false;
|
||||
private boolean hasCUISupport = false;
|
||||
private boolean fastMode = false;
|
||||
private boolean fastLighting = false;
|
||||
private Mask mask;
|
||||
private TimeZone timezone = TimeZone.getDefault();
|
||||
private Boolean jumptoBlock = true;
|
||||
@ -644,6 +645,7 @@ public class LocalSession {
|
||||
new EditSession(player.getWorld(),
|
||||
getBlockChangeLimit(), blockBag);
|
||||
editSession.setFastMode(fastMode);
|
||||
editSession.setFastLighting(fastLighting);
|
||||
editSession.setMask(mask);
|
||||
|
||||
return editSession;
|
||||
@ -667,6 +669,24 @@ public class LocalSession {
|
||||
this.fastMode = fastMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the session has fast lighting enabled.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasFastLighting() {
|
||||
return fastLighting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fast lighting.
|
||||
*
|
||||
* @param fastLighting
|
||||
*/
|
||||
public void setFastLighting(boolean fastLighting) {
|
||||
this.fastLighting = fastLighting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mask.
|
||||
*
|
||||
|
@ -63,6 +63,10 @@ public abstract class LocalWorld {
|
||||
return setBlockType(pt, type);
|
||||
}
|
||||
|
||||
public boolean setBlockTypeFast(Vector pt, int type, boolean fastLighting) {
|
||||
return setBlockTypeFast(pt, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block type.
|
||||
*
|
||||
@ -114,6 +118,10 @@ public abstract class LocalWorld {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public boolean setTypeIdAndDataFast(Vector pt, int type, int data, boolean fastLighting) {
|
||||
return setTypeIdAndDataFast(pt, type, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get block data.
|
||||
*
|
||||
|
@ -34,8 +34,8 @@ public class BukkitServerInterface extends ServerInterface {
|
||||
|
||||
@Override
|
||||
public int resolveItem(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
Material mat = Material.matchMaterial(name);
|
||||
return mat == null ? 0 : mat.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,8 +111,21 @@ public class BukkitWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public boolean setBlockTypeFast(Vector pt, int type) {
|
||||
return setBlockTypeFast(pt, type, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set block type.
|
||||
*
|
||||
* @param pt
|
||||
* @param type
|
||||
* @param fastLighting
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean setBlockTypeFast(Vector pt, int type, boolean fastLighting) {
|
||||
final Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (fastLightingAvailable) {
|
||||
if (fastLightingAvailable && fastLighting) {
|
||||
type = type & 255;
|
||||
final int previousOpacity = Block_lightOpacity[type];
|
||||
Block_lightOpacity[type] = 0;
|
||||
@ -145,8 +158,13 @@ public class BukkitWorld extends LocalWorld {
|
||||
*/
|
||||
@Override
|
||||
public boolean setTypeIdAndDataFast(Vector pt, int type, int data){
|
||||
return setTypeIdAndDataFast(pt, type, data, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setTypeIdAndDataFast(Vector pt, int type, int data, boolean fastLighting) {
|
||||
final Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
|
||||
if (fastLightingAvailable) {
|
||||
if (fastLightingAvailable && fastLighting) {
|
||||
type = type & 255;
|
||||
final int previousOpacity = Block_lightOpacity[type];
|
||||
Block_lightOpacity[type] = 0;
|
||||
@ -788,8 +806,7 @@ public class BukkitWorld extends LocalWorld {
|
||||
lightEmitters.add(chunk.getBlock(x, y, z).getState());
|
||||
if (blockID == 20) {
|
||||
blocks[index] = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
blocks[index] = 20;
|
||||
}
|
||||
|
||||
@ -808,8 +825,7 @@ public class BukkitWorld extends LocalWorld {
|
||||
lightEmitter.update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
System.out.println("Fast Mode: Could not fix lighting. Probably an incompatible version of CraftBukkit.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -843,8 +859,7 @@ public class BukkitWorld extends LocalWorld {
|
||||
NibbleArray_ctor = Class.forName("net.minecraft.server.NibbleArray").getConstructor(int.class, int.class);
|
||||
|
||||
fastLightingAvailable = true;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ public class GeneralCommands {
|
||||
|
||||
@Command(
|
||||
aliases = { "/fast" },
|
||||
flags = "l",
|
||||
usage = "[on|off]",
|
||||
desc = "Toggle fast mode",
|
||||
min = 0,
|
||||
@ -73,25 +74,24 @@ public class GeneralCommands {
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
boolean light = args.hasFlag('f');
|
||||
String newState = args.getString(0, null);
|
||||
if (session.hasFastMode()) {
|
||||
if ("on".equals(newState)) {
|
||||
player.printError("Fast mode already enabled.");
|
||||
return;
|
||||
Boolean dir = newState.equals("on") ? true : newState.equals("off") ? false : null;
|
||||
|
||||
boolean hadFast = session.hasFastMode();
|
||||
boolean hadLight = session.hasFastLighting();
|
||||
|
||||
boolean setFast = dir == null ? !hadFast : dir;
|
||||
boolean setLight = dir == null ? !hadLight : dir;
|
||||
|
||||
session.setFastMode(setFast);
|
||||
if (light) {
|
||||
session.setFastLighting(setLight);
|
||||
}
|
||||
|
||||
session.setFastMode(false);
|
||||
player.print("Fast mode disabled.");
|
||||
}
|
||||
else {
|
||||
if ("off".equals(newState)) {
|
||||
player.printError("Fast mode already disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
session.setFastMode(true);
|
||||
player.print("Fast mode enabled. Lighting in the affected chunks may be wrong and/or you may need to rejoin to see changes.");
|
||||
}
|
||||
player.print("Fast mode " + (!setFast ? "disabled." :
|
||||
("enabled. You may need to rejoin to see changes"
|
||||
+ (setLight ? "and lighting in affected chunks may be wrong." : "."))));
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -322,8 +322,7 @@ public class GenerationCommands {
|
||||
try {
|
||||
expression = Expression.compile(args.getJoinedStrings(1), "x", "y", "z");
|
||||
expression.optimize();
|
||||
}
|
||||
catch (ExpressionException e) {
|
||||
} catch (ExpressionException e) {
|
||||
player.printError(e.getMessage());
|
||||
return;
|
||||
}
|
||||
@ -336,15 +335,13 @@ public class GenerationCommands {
|
||||
protected boolean isInside(double x, double y, double z) {
|
||||
try {
|
||||
return expression.evaluate(x, y, z) > 0;
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (args.hasFlag('o')) {
|
||||
} else if (args.hasFlag('o')) {
|
||||
final Vector placement = session.getPlacementPosition(player);
|
||||
|
||||
final double placementX = placement.getX();
|
||||
@ -356,15 +353,13 @@ public class GenerationCommands {
|
||||
protected boolean isInside(double x, double y, double z) {
|
||||
try {
|
||||
return expression.evaluate(x - placementX, y - placementY, z - placementZ) > 0;
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
final Vector min = region.getMinimumPoint();
|
||||
final Vector max = region.getMaximumPoint();
|
||||
final Vector center = max.add(min).multiply(0.5);
|
||||
@ -376,8 +371,7 @@ public class GenerationCommands {
|
||||
|
||||
try {
|
||||
return expression.evaluate(scaled.getX(), scaled.getY(), scaled.getZ()) > 0;
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
@ -194,8 +194,7 @@ public class SelectionCommands {
|
||||
player.print("Chunks selected: ("
|
||||
+ min2D.getBlockX() + ", " + min2D.getBlockZ() + ") - ("
|
||||
+ max2D.getBlockX() + ", " + max2D.getBlockZ() + ")");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
final Vector2D min2D = ChunkStore.toChunk(player.getBlockIn());
|
||||
|
||||
min = new Vector(min2D.getBlockX() * 16, 0, min2D.getBlockZ() * 16);
|
||||
|
@ -54,8 +54,7 @@ public class ToolUtilCommands {
|
||||
|
||||
session.disableSuperPickAxe();
|
||||
player.print("Super pick axe disabled.");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ("off".equals(newState)) {
|
||||
player.printError("Super pick axe already disabled.");
|
||||
return;
|
||||
|
@ -140,8 +140,7 @@ public class Lexer {
|
||||
if (!numberPart.isEmpty()) {
|
||||
try {
|
||||
tokens.add(new NumberToken(position, Double.parseDouble(numberPart)));
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException e) {
|
||||
throw new LexerException(position, "Number parsing failed", e);
|
||||
}
|
||||
|
||||
@ -156,8 +155,7 @@ public class Lexer {
|
||||
if (!identifierPart.isEmpty()) {
|
||||
if (keywords.contains(identifierPart)) {
|
||||
tokens.add(new KeywordToken(position, identifierPart));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tokens.add(new IdentifierToken(position, identifierPart));
|
||||
}
|
||||
|
||||
@ -167,8 +165,7 @@ public class Lexer {
|
||||
}
|
||||
|
||||
throw new LexerException(position, "Unknown character '" + ch + "'");
|
||||
}
|
||||
while (position < expression.length());
|
||||
} while (position < expression.length());
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ public class Parser {
|
||||
final Token next = peek();
|
||||
if (next.id() == '(') {
|
||||
halfProcessed.add(parseFunctionCall(identifierToken));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
RValue variable = variables.get(identifierToken.value);
|
||||
if (variable == null) {
|
||||
throw new ParserException(current.getPosition(), "Variable '" + identifierToken.value + "' not found");
|
||||
@ -130,8 +129,7 @@ public class Parser {
|
||||
case 'o':
|
||||
if (expressionStart) {
|
||||
halfProcessed.add(new PrefixOperator((OperatorToken) current));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
halfProcessed.add(current);
|
||||
}
|
||||
++position;
|
||||
@ -148,8 +146,7 @@ public class Parser {
|
||||
|
||||
if (isStatement) {
|
||||
return ParserProcessors.processStatement(halfProcessed);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return ParserProcessors.processExpression(halfProcessed);
|
||||
}
|
||||
}
|
||||
@ -195,8 +192,7 @@ public class Parser {
|
||||
}
|
||||
|
||||
return Functions.getFunction(identifierToken.getPosition(), identifierToken.value, args.toArray(new RValue[args.size()]));
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new ParserException(identifierToken.getPosition(), "Function not found", e);
|
||||
}
|
||||
}
|
||||
|
@ -134,12 +134,10 @@ public final class ParserProcessors {
|
||||
for (Identifiable identifiable : input) {
|
||||
if (semicolonFound) {
|
||||
rhs.addLast(identifiable);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (identifiable.id() == ';') {
|
||||
semicolonFound = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lhs.addLast(identifiable);
|
||||
}
|
||||
}
|
||||
@ -151,12 +149,10 @@ public final class ParserProcessors {
|
||||
}
|
||||
|
||||
return processExpression(lhs);
|
||||
}
|
||||
else if (lhs.isEmpty()) {
|
||||
} else if (lhs.isEmpty()) {
|
||||
return processStatement(rhs);
|
||||
}
|
||||
else {
|
||||
assert(semicolonFound);
|
||||
} else {
|
||||
assert (semicolonFound);
|
||||
|
||||
RValue lhsInvokable = processExpression(lhs);
|
||||
RValue rhsInvokable = processStatement(rhs);
|
||||
@ -193,8 +189,7 @@ public final class ParserProcessors {
|
||||
}
|
||||
|
||||
rhs.removeFirst();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lhs.addFirst(identifiable);
|
||||
}
|
||||
}
|
||||
@ -206,8 +201,7 @@ public final class ParserProcessors {
|
||||
|
||||
try {
|
||||
return Operators.getOperator(input.get(0).getPosition(), operator, lhsInvokable, rhsInvokable);
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
final Token operatorToken = (Token) input.get(lhs.size());
|
||||
throw new ParserException(operatorToken.getPosition(), "Couldn't find operator '" + operator + "'");
|
||||
}
|
||||
@ -236,8 +230,7 @@ public final class ParserProcessors {
|
||||
}
|
||||
|
||||
lhs.removeLast();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
rhs.addLast(identifiable);
|
||||
}
|
||||
}
|
||||
@ -249,8 +242,7 @@ public final class ParserProcessors {
|
||||
|
||||
try {
|
||||
return Operators.getOperator(input.get(0).getPosition(), operator, lhsInvokable, rhsInvokable);
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
final Token operatorToken = (Token) input.get(lhs.size());
|
||||
throw new ParserException(operatorToken.getPosition(), "Couldn't find operator '" + operator + "'");
|
||||
}
|
||||
@ -280,19 +272,16 @@ public final class ParserProcessors {
|
||||
try {
|
||||
ret = Operators.getOperator(lastPosition, opName, ret);
|
||||
continue;
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new ParserException(lastPosition, "No such prefix operator: " + operator);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (last instanceof Token) {
|
||||
throw new ParserException(lastPosition, "Extra token found in expression: " + last);
|
||||
}
|
||||
else if (last instanceof RValue) {
|
||||
} else if (last instanceof RValue) {
|
||||
throw new ParserException(lastPosition, "Extra expression found: " + last);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new ParserException(lastPosition, "Extra element found: " + last);
|
||||
}
|
||||
}
|
||||
|
@ -49,14 +49,12 @@ public class Function extends RValue {
|
||||
public final double getValue() throws EvaluationException {
|
||||
try {
|
||||
return (Double) method.invoke(null, (Object[]) args);
|
||||
}
|
||||
catch (InvocationTargetException e) {
|
||||
} catch (InvocationTargetException e) {
|
||||
if (e.getTargetException() instanceof EvaluationException) {
|
||||
throw (EvaluationException) e.getTargetException();
|
||||
}
|
||||
throw new EvaluationException(-1, "Exception caught while evaluating expression", e.getTargetException());
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new EvaluationException(-1, "Internal error while evaluating expression", e);
|
||||
}
|
||||
}
|
||||
@ -99,8 +97,7 @@ public class Function extends RValue {
|
||||
|
||||
if (optimizable) {
|
||||
return new Constant(position, getValue());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return new Function(position, method, optimizedArgs);
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ public final class Operators {
|
||||
if (lhs instanceof LValue) {
|
||||
try {
|
||||
return new Function(position, Operators.class.getMethod(name, LValue.class, RValue.class), lhs, rhs);
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
catch (NoSuchMethodException e) {}
|
||||
}
|
||||
return new Function(position, Operators.class.getMethod(name, RValue.class, RValue.class), lhs, rhs);
|
||||
}
|
||||
@ -39,8 +39,8 @@ public final class Operators {
|
||||
if (argument instanceof LValue) {
|
||||
try {
|
||||
return new Function(position, Operators.class.getMethod(name, LValue.class), argument);
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
catch (NoSuchMethodException e) {}
|
||||
}
|
||||
return new Function(position, Operators.class.getMethod(name, RValue.class), argument);
|
||||
}
|
||||
|
@ -75,8 +75,7 @@ public class Sequence extends RValue {
|
||||
for (RValue subInvokable : ((Sequence) invokable).sequence) {
|
||||
newSequence.add(subInvokable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
newSequence.add(invokable);
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren