Author: adrianc
Date: Tue Jan 19 16:47:34 2010
New Revision: 900839
URL:
http://svn.apache.org/viewvc?rev=900839&view=revLog:
Small fixup for previous commit plus additional documentation.
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java?rev=900839&r1=900838&r2=900839&view=diff==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java Tue Jan 19 16:47:34 2010
@@ -43,6 +43,10 @@
// since it is the most specific. Date range should always be last.
// The idea is to evaluate all other expressions, then check to see
// if the result falls within the date range.
+ // Difference: adopts the sequence of its include expression
+ // Intersection: aggregates member expression sequence values
+ // Substitution: adopts the sequence of its include expression
+ // Union: adopts the sequence of its first member expression
public static final int SEQUENCE_DATE_RANGE = 800;
public static final int SEQUENCE_DAY_IN_MONTH = 460;
public static final int SEQUENCE_DOM_RANGE = 400;
@@ -877,11 +881,13 @@
throw new IllegalArgumentException("recursive expression");
}
if (this.expressionSet.size() > 0) {
+ // Aggregate member expression sequences in a way that will
+ // ensure the proper evaluation sequence for the entire collection
int result = 0;
TemporalExpression[] exprArray = this.expressionSet.toArray(new TemporalExpression[this.expressionSet.size()]);
for (int i = exprArray.length - 1; i >= 0; i--) {
- result += exprArray[i].sequence;
result *= 10;
+ result += exprArray[i].sequence;
}
this.sequence = result;
}