[FOray-commit] SF.net SVN: foray: [8433] trunk/foray/foray-fotree/src/java/org/foray/ fotree
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-10-27 01:16:18
|
Revision: 8433
http://svn.sourceforge.net/foray/?rev=8433&view=rev
Author: victormote
Date: 2006-10-26 18:16:09 -0700 (Thu, 26 Oct 2006)
Log Message:
-----------
Move numeric-related constants to ExprNumeric.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/parse/PropertyParser.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprMultiplicativeOper.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprNumeric.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/parse/PropertyParser.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/parse/PropertyParser.java 2006-10-27 01:10:40 UTC (rev 8432)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/parse/PropertyParser.java 2006-10-27 01:16:09 UTC (rev 8433)
@@ -44,6 +44,7 @@
import org.foray.fotree.value.ExprInner;
import org.foray.fotree.value.ExprMultiplicative;
import org.foray.fotree.value.ExprMultiplicativeOper;
+import org.foray.fotree.value.ExprNumeric;
import org.foray.fotree.value.ExprPrimary;
import org.foray.fotree.value.ExprUnary;
import org.foray.fotree.value.ExprUnaryOper;
@@ -324,7 +325,7 @@
if (op1 == null || op2 == null) {
throw new PropertyException("Missing parameter: addition.");
}
- return new ExprAdditiveOper(op1, op2, ExprAdditive.OPERATION_ADD);
+ return new ExprAdditiveOper(op1, op2, ExprNumeric.OPERATION_ADD);
}
/**
@@ -341,7 +342,7 @@
if (op1 == null || op2 == null) {
throw new PropertyException("Missing parameter: subtraction.");
}
- return new ExprAdditiveOper(op1, op2, ExprAdditive.OPERATION_SUBTRACT);
+ return new ExprAdditiveOper(op1, op2, ExprNumeric.OPERATION_SUBTRACT);
}
/**
@@ -357,7 +358,7 @@
if (op == null) {
throw new PropertyException("Negation: missing parameter.");
}
- return new ExprUnaryOper(op, ExprAdditive.OPERATION_NEGATION);
+ return new ExprUnaryOper(op, ExprNumeric.OPERATION_NEGATION);
}
/**
@@ -375,7 +376,7 @@
throw new PropertyException("Missing parameter: multiplication.");
}
return new ExprMultiplicativeOper(op1, op2,
- ExprAdditive.OPERATION_MULTIPLY);
+ ExprNumeric.OPERATION_MULTIPLY);
}
@@ -394,7 +395,7 @@
throw new PropertyException("Missing parameter: division.");
}
return new ExprMultiplicativeOper(op1, op2,
- ExprAdditive.OPERATION_DIVIDE);
+ ExprNumeric.OPERATION_DIVIDE);
}
/**
@@ -412,7 +413,7 @@
throw new PropertyException("Missing parameter: modulo.");
}
return new ExprMultiplicativeOper(op1, op2,
- ExprAdditive.OPERATION_MOD);
+ ExprNumeric.OPERATION_MOD);
}
public void pushFunction(final Function func) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java 2006-10-27 01:10:40 UTC (rev 8432)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/Expr.java 2006-10-27 01:16:09 UTC (rev 8433)
@@ -33,11 +33,4 @@
*/
public abstract class Expr extends PropertyValue {
- public static final byte OPERATION_ADD = '+';
- public static final byte OPERATION_SUBTRACT = '-';
- public static final byte OPERATION_MULTIPLY = '*';
- public static final byte OPERATION_DIVIDE = '/';
- public static final byte OPERATION_MOD = '%';
- public static final byte OPERATION_NEGATION = '-';
-
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java 2006-10-27 01:10:40 UTC (rev 8432)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprAdditiveOper.java 2006-10-27 01:16:09 UTC (rev 8433)
@@ -61,8 +61,8 @@
throw new PropertyException("AdditiveExpr: Unit powers differ: "
+ operand1.toString() + ", " + operand2.toString());
}
- if (operation != Expr.OPERATION_ADD
- && operation != Expr.OPERATION_SUBTRACT) {
+ if (operation != ExprNumeric.OPERATION_ADD
+ && operation != ExprNumeric.OPERATION_SUBTRACT) {
throw new PropertyException("AdditiveExpr: Illegal Operator: "
+ operation);
}
@@ -80,11 +80,11 @@
return 0;
}
switch (operation) {
- case Expr.OPERATION_ADD: {
+ case ExprNumeric.OPERATION_ADD: {
return getOperand1Length(pointSize, percentBase)
+ getOperand2Length(pointSize, percentBase);
}
- case Expr.OPERATION_SUBTRACT: {
+ case ExprNumeric.OPERATION_SUBTRACT: {
return getOperand1Length(pointSize, percentBase)
- getOperand2Length(pointSize, percentBase);
}
@@ -122,10 +122,10 @@
*/
public double getNumericValue() {
switch (operation) {
- case Expr.OPERATION_ADD: {
+ case ExprNumeric.OPERATION_ADD: {
return getOperand1Value() + getOperand2Value();
}
- case Expr.OPERATION_SUBTRACT: {
+ case ExprNumeric.OPERATION_SUBTRACT: {
return getOperand1Value() - getOperand2Value();
}
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprMultiplicativeOper.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2006-10-27 01:10:40 UTC (rev 8432)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2006-10-27 01:16:09 UTC (rev 8433)
@@ -57,15 +57,15 @@
* For Modulo Expressions, the unitPower of the two operands must
* be equal. See XSL-FO Specification 1.0, Section 5.9.6.
*/
- if (operation == Expr.OPERATION_MOD
+ if (operation == ExprNumeric.OPERATION_MOD
&& ((ExprNumeric) operand1).getLengthPower()
!= ((ExprNumeric) operand2).getLengthPower()) {
throw new PropertyException("Modulo Operator: Unit powers differ: "
+ operand1.toString() + ", " + operand2.toString());
}
- if (operation != Expr.OPERATION_MULTIPLY
- && operation != Expr.OPERATION_DIVIDE
- && operation != Expr.OPERATION_MOD) {
+ if (operation != ExprNumeric.OPERATION_MULTIPLY
+ && operation != ExprNumeric.OPERATION_DIVIDE
+ && operation != ExprNumeric.OPERATION_MOD) {
throw new PropertyException("MultiplicativeExpr: Illegal Operator: "
+ operation);
}
@@ -164,13 +164,13 @@
*/
public double getNumericValue() {
switch (operation) {
- case Expr.OPERATION_MULTIPLY: {
+ case ExprNumeric.OPERATION_MULTIPLY: {
return getOperand1Value() * getOperand2Value();
}
- case Expr.OPERATION_DIVIDE: {
+ case ExprNumeric.OPERATION_DIVIDE: {
return getOperand1Value() / getOperand2Value();
}
- case Expr.OPERATION_MOD: {
+ case ExprNumeric.OPERATION_MOD: {
return getOperand1Value() % getOperand2Value();
}
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprNumeric.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprNumeric.java 2006-10-27 01:10:40 UTC (rev 8432)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprNumeric.java 2006-10-27 01:16:09 UTC (rev 8433)
@@ -40,6 +40,13 @@
byte UNIT_POWER_LENGTH = 1;
byte UNIT_POWER_AREA = 2;
+ byte OPERATION_ADD = '+';
+ byte OPERATION_SUBTRACT = '-';
+ byte OPERATION_MULTIPLY = '*';
+ byte OPERATION_DIVIDE = '/';
+ byte OPERATION_MOD = '%';
+ byte OPERATION_NEGATION = '-';
+
/**
* Return the numeric value of "this".
* @return A double representation of the value of "this". Type "double" is
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java 2006-10-27 01:10:40 UTC (rev 8432)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/ExprUnaryOper.java 2006-10-27 01:16:09 UTC (rev 8433)
@@ -45,7 +45,7 @@
+ operand1.toString());
}
this.operand1 = operand1;
- if (operation != Expr.OPERATION_NEGATION) {
+ if (operation != ExprNumeric.OPERATION_NEGATION) {
throw new PropertyException("UnaryExpr: Illegal Operator: "
+ operation);
}
@@ -64,7 +64,7 @@
return 0;
}
switch (operation) {
- case ExprAdditive.OPERATION_NEGATION: {
+ case ExprNumeric.OPERATION_NEGATION: {
return ((ExprNumeric) operand1).evalUnitPower1(pointSize,
percentBase) * -1;
}
@@ -80,7 +80,7 @@
}
public double getNumericValue() {
- if (operation == Expr.OPERATION_NEGATION) {
+ if (operation == ExprNumeric.OPERATION_NEGATION) {
return ((ExprNumeric) this.operand1).getNumericValue() * -1;
}
return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|