ankitp      2005/03/10 08:19:48

  Modified:    java/src/org/apache/xerces/xs/datatypes XSDateTime.java
               java/src/org/apache/xerces/impl/dv/xs
                        AbstractDateTimeDV.java DurationDV.java
  Log:
  minor actual value interface changes
  
  Revision  Changes    Path
  1.9       +1 -1      
xml-xerces/java/src/org/apache/xerces/xs/datatypes/XSDateTime.java
  
  Index: XSDateTime.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/xs/datatypes/XSDateTime.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XSDateTime.java   2 Mar 2005 21:16:00 -0000       1.8
  +++ XSDateTime.java   10 Mar 2005 16:19:47 -0000      1.9
  @@ -96,7 +96,7 @@
       
       /**
        * @return whether a date-time related object is normalized or not
  -     *         (value is not useful for durations)
  +     *         (value is not useful for durations or types where timezone is 
not specified)
        */
       public boolean isNormalized();
   }
  
  
  
  1.36      +59 -57    
xml-xerces/java/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java
  
  Index: AbstractDateTimeDV.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/AbstractDateTimeDV.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- AbstractDateTimeDV.java   8 Mar 2005 05:40:16 -0000       1.35
  +++ AbstractDateTimeDV.java   10 Mar 2005 16:19:48 -0000      1.36
  @@ -369,6 +369,8 @@
                        if ( stop+2!=end ) {
                                throw new RuntimeException("Error in parsing 
time zone");
                        }
  +            if(data.timezoneHr != 0 || data.timezoneMin != 0)
  +                data.normalized = false;
                }
                else {
                        throw new RuntimeException("Error in parsing time 
zone");
  @@ -818,7 +820,7 @@
                double second;
                int timezoneHr, timezoneMin;
           private String originalValue;
  -        boolean normalized = false;
  +        boolean normalized = true;
           
           int unNormYear;
           int unNormMonth;
  @@ -862,74 +864,74 @@
                        }
                        return canonical;
                }
  -        /* (non-Javadoc)
  -         * @see org.apache.xerces.xs.datatypes.XSDateTime#getYear()
  -         */
  -        public int getYears() {
  +             /* (non-Javadoc)
  +              * @see org.apache.xerces.xs.datatypes.XSDateTime#getYear()
  +              */
  +             public int getYears() {
               if(type instanceof DurationDV)
                   return 0;
  -            return normalized?year:unNormYear;
  -        }
  -        /* (non-Javadoc)
  -         * @see org.apache.xerces.xs.datatypes.XSDateTime#getMonth()
  -         */
  -        public int getMonths() {
  +                     return normalized?year:unNormYear;
  +             }
  +             /* (non-Javadoc)
  +              * @see org.apache.xerces.xs.datatypes.XSDateTime#getMonth()
  +              */
  +             public int getMonths() {
               if(type instanceof DurationDV) {
                   return year*12 + month;
               }
  -            return normalized?month:unNormMonth;
  -        }
  -        /* (non-Javadoc)
  -         * @see org.apache.xerces.xs.datatypes.XSDateTime#getDay()
  -         */
  -        public int getDays() {
  +                     return normalized?month:unNormMonth;
  +             }
  +             /* (non-Javadoc)
  +              * @see org.apache.xerces.xs.datatypes.XSDateTime#getDay()
  +              */
  +             public int getDays() {
               if(type instanceof DurationDV)
                   return 0;
  -            return normalized?day:unNormDay;
  -        }
  -        /* (non-Javadoc)
  -         * @see org.apache.xerces.xs.datatypes.XSDateTime#getHour()
  -         */
  -        public int getHours() {
  +                     return normalized?day:unNormDay;
  +             }
  +             /* (non-Javadoc)
  +              * @see org.apache.xerces.xs.datatypes.XSDateTime#getHour()
  +              */
  +             public int getHours() {
               if(type instanceof DurationDV)
                   return 0;
  -            return normalized?hour:unNormHour;
  -        }
  -        /* (non-Javadoc)
  -         * @see org.apache.xerces.xs.datatypes.XSDateTime#getMinutes()
  -         */
  -        public int getMinutes() {
  +                     return normalized?hour:unNormHour;
  +             }
  +             /* (non-Javadoc)
  +              * @see org.apache.xerces.xs.datatypes.XSDateTime#getMinutes()
  +              */
  +             public int getMinutes() {
               if(type instanceof DurationDV)
                   return 0;
  -            return normalized?minute:unNormMinute;
  -        }
  -        /* (non-Javadoc)
  -         * @see org.apache.xerces.xs.datatypes.XSDateTime#getSeconds()
  -         */
  -        public double getSeconds() {
  +                     return normalized?minute:unNormMinute;
  +             }
  +             /* (non-Javadoc)
  +              * @see org.apache.xerces.xs.datatypes.XSDateTime#getSeconds()
  +              */
  +             public double getSeconds() {
               if(type instanceof DurationDV) {
                   return day*24*60*60 + hour*60*60 + minute*60 + second;
               }
  -            return normalized?second:unNormSecond;
  -        }
  -        /* (non-Javadoc)
  -         * @see org.apache.xerces.xs.datatypes.XSDateTime#hasTimeZone()
  -         */
  -        public boolean hasTimeZone() {
  -            return utc != 0;
  -        }
  -        /* (non-Javadoc)
  -         * @see org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneHours()
  -         */
  -        public int getTimeZoneHours() {
  -            return timezoneHr;
  -        }
  -        /* (non-Javadoc)
  -         * @see 
org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneMinutes()
  -         */
  -        public int getTimeZoneMinutes() {
  -            return timezoneMin;
  -        }
  +                     return normalized?second:unNormSecond;
  +             }
  +             /* (non-Javadoc)
  +              * @see org.apache.xerces.xs.datatypes.XSDateTime#hasTimeZone()
  +              */
  +             public boolean hasTimeZone() {
  +                     return utc != 0;
  +             }
  +             /* (non-Javadoc)
  +              * @see 
org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneHours()
  +              */
  +             public int getTimeZoneHours() {
  +                     return timezoneHr;
  +             }
  +             /* (non-Javadoc)
  +              * @see 
org.apache.xerces.xs.datatypes.XSDateTime#getTimeZoneMinutes()
  +              */
  +             public int getTimeZoneMinutes() {
  +                     return timezoneMin;
  +             }
           /* (non-Javadoc)
            * @see org.apache.xerces.xs.datatypes.XSDateTime#getLexicalValue()
            */
  @@ -956,7 +958,7 @@
           
           public Object clone() {
               DateTimeData dt = new DateTimeData(this.year, this.month, 
this.day, this.hour, 
  -                    this.minute, this.second, this.utc, this.originalValue, 
this.normalized, this.type);
  +                        this.minute, this.second, this.utc, 
this.originalValue, this.normalized, this.type);
               dt.canonical = this.canonical;
               dt.position = position;
               dt.timezoneHr = this.timezoneHr;
  
  
  
  1.19      +1 -2      
xml-xerces/java/src/org/apache/xerces/impl/dv/xs/DurationDV.java
  
  Index: DurationDV.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/dv/xs/DurationDV.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DurationDV.java   8 Mar 2005 05:40:16 -0000       1.18
  +++ DurationDV.java   10 Mar 2005 16:19:48 -0000      1.19
  @@ -64,7 +64,6 @@
       protected DateTimeData parse(String str, int durationType) throws 
SchemaDateTimeException{
           int len = str.length();
           DateTimeData date= new DateTimeData(str, this);
  -        date.normalized = true;
           
           int start = 0;
           char c=str.charAt(start++);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to