svn commit: r899833 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar: TemporalExpression.java TemporalExpressions.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r899833 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar: TemporalExpression.java TemporalExpressions.java

adrianc
Author: adrianc
Date: Fri Jan 15 22:26:04 2010
New Revision: 899833

URL: http://svn.apache.org/viewvc?rev=899833&view=rev
Log:
The start of some code cleanup and bug fixing in Temporal Expressions. Added a simplified constructor to the range expressions.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpression.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpression.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpression.java?rev=899833&r1=899832&r2=899833&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpression.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpression.java Fri Jan 15 22:26:04 2010
@@ -25,6 +25,7 @@
 import java.util.TreeSet;
 
 /** Temporal expression abstract class. */
+@SuppressWarnings("serial")
 public abstract class TemporalExpression implements Serializable, Comparable<TemporalExpression> {
     protected TemporalExpression() {}
 

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=899833&r1=899832&r2=899833&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 Fri Jan 15 22:26:04 2010
@@ -89,7 +89,7 @@
             }
             try {
                 return this.expressionSet.equals(((Union) obj).expressionSet);
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }
 
@@ -206,7 +206,7 @@
             }
             try {
                 return this.expressionSet.equals(((Intersection) obj).expressionSet);
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }
 
@@ -336,7 +336,7 @@
             try {
                 Difference that = (Difference) obj;
                 return this.included.equals(that.included) && this.excluded.equals(that.excluded);
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }
 
@@ -411,6 +411,10 @@
     public static class DateRange extends TemporalExpression {
         protected final org.ofbiz.base.util.DateRange range;
 
+        public DateRange(Date date) {
+            this(date, date);
+        }
+
         public DateRange(Date start, Date end) {
             this.sequence = 1000;
             this.range = new org.ofbiz.base.util.DateRange(start, end);
@@ -426,7 +430,7 @@
             }
             try {
                 return this.range.equals(((DateRange) obj).range);
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }
 
@@ -535,7 +539,7 @@
             try {
                 TimeOfDayRange that = (TimeOfDayRange) obj;
                 return this.startStr.equals(that.startStr) && this.endStr.equals(that.endStr);
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }
 
@@ -640,6 +644,10 @@
         protected final int start;
         protected final int end;
 
+        public DayOfWeekRange(int dow) {
+            this(dow, dow);
+        }
+
         /**
          * @param start An integer in the range of <code>Calendar.SUNDAY</code>
          * to <code>Calendar.SATURDAY</code>
@@ -670,7 +678,7 @@
             try {
                 DayOfWeekRange that = (DayOfWeekRange) obj;
                 return this.start == that.start && this.end == that.end;
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }
 
@@ -742,6 +750,10 @@
         protected final int start;
         protected final int end;
 
+        public MonthRange(int month) {
+            this(month, month);
+        }
+
         /**
          * @param start An integer in the range of <code>Calendar.JANUARY</code>
          * to <code>Calendar.UNDECIMBER</code>
@@ -772,7 +784,7 @@
             try {
                 MonthRange that = (MonthRange) obj;
                 return this.start == that.start && this.end == that.end;
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }
 
@@ -846,6 +858,10 @@
         protected final int start;
         protected final int end;
 
+        public DayOfMonthRange(int dom) {
+            this(dom, dom);
+        }
+
         /**
          * @param start An integer in the range of 1 to 31
          * @param end An integer in the range of 1 to 31
@@ -874,7 +890,7 @@
             try {
                 DayOfMonthRange that = (DayOfMonthRange) obj;
                 return this.start == that.start && this.end == that.end;
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }
 
@@ -962,7 +978,7 @@
             try {
                 DayInMonth that = (DayInMonth) obj;
                 return this.dayOfWeek == that.dayOfWeek && this.occurrence == that.occurrence;
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }
 
@@ -1093,7 +1109,7 @@
             try {
                 Frequency that = (Frequency) obj;
                 return this.start.equals(that.start) && this.freqType == that.freqType && this.freqCount == that.freqCount;
-            } catch (Exception e) {}
+            } catch (ClassCastException e) {}
             return false;
         }