krysalis-version/src/java/org/krysalis/version/impl/data VersionDataElement.java,1.1,1.2 VersionData.java,1.2,1.3 VersionDataElementSet.java,1.1,1.2

[email protected] Tue, 25 Mar 2003 13:26:50 -0800
Newsgroups gmane.comp.krysalis.sandbox
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/impl/data
In directory sc8-pr-cvs1:/tmp/cvs-serv30568/src/java/org/krysalis/version/impl/data

Modified Files:
	VersionDataElement.java VersionData.java 
	VersionDataElementSet.java 
Log Message:
buildDate

Index: VersionDataElement.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/impl/data/VersionDataElement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** VersionDataElement.java	24 Mar 2003 01:25:47 -0000	1.1
--- VersionDataElement.java	25 Mar 2003 21:26:13 -0000	1.2
***************
*** 57,64 ****
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  import org.krysalis.version.exception.VersionException;
- import org.krysalis.version.impl.data.ReleaseLevel;
  
  /**
--- 57,64 ----
  
  import java.util.ArrayList;
+ import java.util.Date;
  import java.util.HashMap;
  
  import org.krysalis.version.exception.VersionException;
  
  /**
***************
*** 80,83 ****
--- 80,84 ----
      public static final int MIN_RELEASE_QUALIFIER = 0;
      public static final int MIN_BUILD_NUMBER = 0;
+     public static final Date MIN_BUILD_DATE = new Date(0);
  
      public static final int UNSET_MAJOR = -1;
***************
*** 87,90 ****
--- 88,92 ----
      public static final int UNSET_RELEASE_QUALIFIER = -1;
      public static final int UNSET_BUILD_NUMBER = -1;
+     public static final Date UNSET_BUILD_DATE = null;
  
      public static final int DEFAULT_MAJOR = MIN_MAJOR;
***************
*** 95,130 ****
      public static final int DEFAULT_RELEASE_QUALIFIER = UNSET_RELEASE_QUALIFIER;
      public static final int DEFAULT_BUILD_NUMBER = UNSET_BUILD_NUMBER;
! 
      /** Unset */
      public static final int ELEMENT_UNSET = 0;
      public static final String UNSET_WORD = "unset";
  
!     /** Development */
!     public static final int ELEMENT_BUILD_NUMBER = 0x01;
      public static final String BUILD_NUMBER_WORD = "buildNumber";
  
      /** Release Qualifier */
!     public static final int ELEMENT_RELEASE_QUALIFIER = 0x02;
      public static final String RELEASE_QUALIFIER_WORD = "releaseQualifier";
  
      /** Release Level */
!     public static final int ELEMENT_RELEASE_LEVEL = 0x04;
      public static final String RELEASE_LEVEL_WORD = "releaseLevel";
  
      /** Point */
!     public static final int ELEMENT_POINT = 0x08;
      public static final String POINT_WORD = "point";
  
      /** Minor */
!     public static final int ELEMENT_MINOR = 0x10;
      public static final String MINOR_WORD = "minor";
  
      /** Major */
!     public static final int ELEMENT_MAJOR = 0x20;
      public static final String MAJOR_WORD = "major";
  
      /** MIN_ELEMENT */
!     public static final int MIN_ELEMENT =
!         VersionDataElement.ELEMENT_BUILD_NUMBER;
      /** MAX_ELEMENT */
      public static final int MAX_ELEMENT = VersionDataElement.ELEMENT_MAJOR;
--- 97,136 ----
      public static final int DEFAULT_RELEASE_QUALIFIER = UNSET_RELEASE_QUALIFIER;
      public static final int DEFAULT_BUILD_NUMBER = UNSET_BUILD_NUMBER;
!     public static final Date DEFAULT_BUILD_DATE = UNSET_BUILD_DATE;
!     
      /** Unset */
      public static final int ELEMENT_UNSET = 0;
      public static final String UNSET_WORD = "unset";
  
!     /** Build Number */
!     public static final int ELEMENT_BUILD_DATE = 0x01;
!     public static final String BUILD_DATE_WORD = "buildDate";
! 
!     /** Build Date */
!     public static final int ELEMENT_BUILD_NUMBER = 0x02;
      public static final String BUILD_NUMBER_WORD = "buildNumber";
  
      /** Release Qualifier */
!     public static final int ELEMENT_RELEASE_QUALIFIER = 0x04;
      public static final String RELEASE_QUALIFIER_WORD = "releaseQualifier";
  
      /** Release Level */
!     public static final int ELEMENT_RELEASE_LEVEL = 0x08;
      public static final String RELEASE_LEVEL_WORD = "releaseLevel";
  
      /** Point */
!     public static final int ELEMENT_POINT = 0x10;
      public static final String POINT_WORD = "point";
  
      /** Minor */
!     public static final int ELEMENT_MINOR = 0x20;
      public static final String MINOR_WORD = "minor";
  
      /** Major */
!     public static final int ELEMENT_MAJOR = 0x40;
      public static final String MAJOR_WORD = "major";
  
      /** MIN_ELEMENT */
!     public static final int MIN_ELEMENT = VersionDataElement.ELEMENT_BUILD_DATE;
      /** MAX_ELEMENT */
      public static final int MAX_ELEMENT = VersionDataElement.ELEMENT_MAJOR;
***************
*** 134,137 ****
--- 140,146 ----
          new VersionDataElement(ELEMENT_UNSET);
  
+     /** Build Date */
+     public static final VersionDataElement BUILD_DATE =
+         new VersionDataElement(ELEMENT_BUILD_DATE);
      /** Build Number */
      public static final VersionDataElement BUILD_NUMBER =
***************
*** 162,165 ****
--- 171,175 ----
  
      static {
+         ELEMENTS.add(VersionDataElement.BUILD_DATE);
          ELEMENTS.add(VersionDataElement.BUILD_NUMBER);
          ELEMENTS.add(VersionDataElement.RELEASE_QUALIFIER);
***************
*** 184,187 ****
--- 194,204 ----
  
          WORD_FOR_ELEMENT.put(
+             VersionDataElement.BUILD_DATE,
+             VersionDataElement.BUILD_DATE_WORD);
+         ELEMENT_FOR_WORD.put(
+             VersionDataElement.BUILD_DATE_WORD,
+             VersionDataElement.BUILD_DATE);
+ 
+         WORD_FOR_ELEMENT.put(
              VersionDataElement.RELEASE_QUALIFIER,
              VersionDataElement.RELEASE_QUALIFIER_WORD);
***************
*** 258,261 ****
--- 275,280 ----
          else if (ELEMENT_BUILD_NUMBER == elementNo)
              element = BUILD_NUMBER;
+         else if (ELEMENT_BUILD_DATE == elementNo)
+             element = BUILD_DATE;
  
          if (null == element)
***************
*** 273,277 ****
          if (other instanceof VersionDataElement) {
              VersionDataElement otherElement = (VersionDataElement) other;
- 
              equal = (otherElement.m_element == m_element);
          }
--- 292,295 ----
***************
*** 368,371 ****
--- 386,397 ----
      public static boolean isBuildNumber(int elementSet) {
          return (0 != (elementSet & ELEMENT_BUILD_NUMBER));
+     }
+     
+     public static boolean isBuildDate(VersionDataElement element) {
+         return isBuildDate(element.getElement());
+     }
+ 
+     public static boolean isBuildDate(int elementSet) {
+         return (0 != (elementSet & ELEMENT_BUILD_DATE));
      }
  }

Index: VersionData.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/impl/data/VersionData.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** VersionData.java	25 Mar 2003 16:01:12 -0000	1.2
--- VersionData.java	25 Mar 2003 21:26:13 -0000	1.3
***************
*** 59,62 ****
--- 59,63 ----
  import java.util.ArrayList;
  import java.util.Comparator;
+ import java.util.Date;
  import java.util.HashMap;
  import java.util.Iterator;
***************
*** 66,69 ****
--- 67,71 ----
  import org.krysalis.version.exception.VersionError;
  import org.krysalis.version.exception.VersionException;
+ import org.krysalis.version.impl.VersionImplementationConstants;
  import org.krysalis.version.util.debug.DebugUtils;
  import org.krysalis.version.util.logging.VersionLogger;
***************
*** 94,97 ****
--- 96,100 ----
      private int m_releaseQualifier = VersionDataElement.UNSET_RELEASE_QUALIFIER;
      private int m_buildNumber = VersionDataElement.UNSET_BUILD_NUMBER;
+     private Date m_buildDate = VersionDataElement.UNSET_BUILD_DATE;
  
      /** Extended Optional Settings... */
***************
*** 219,227 ****
          m_releaseQualifier = releaseQualifier;
          m_point = point;
!         
          m_buildNumber = buildNumber;
      }
  
      /**
        * Constructor for VersionData.
        */
--- 222,240 ----
          m_releaseQualifier = releaseQualifier;
          m_point = point;
! 
          m_buildNumber = buildNumber;
      }
  
      /**
+         * Constructor for VersionData.
+         */
+     public VersionData(Date buildDate) {
+         m_elements =
+             new VersionDataElementSet(VersionDataElement.ELEMENT_BUILD_DATE);
+ 
+         m_buildDate = buildDate;
+     }
+ 
+     /**
        * Constructor for VersionData.
        */
***************
*** 534,540 ****
  
      /**
!         * Returns the point.
!          * @return int
!          */
      public int getBuildNumber() {
          return m_buildNumber;
--- 547,553 ----
  
      /**
!      * Returns the BuildNumber.
!      * @return int
!      */
      public int getBuildNumber() {
          return m_buildNumber;
***************
*** 542,545 ****
--- 555,566 ----
  
      /**
+      * Returns the BuildDate.
+      * @return Date
+      */
+     public Date getBuildDate() {
+         return m_buildDate;
+     }
+ 
+     /**
       * Returns the releaseLevel.
       * @return ReleaseLevel
***************
*** 631,634 ****
--- 652,657 ----
                                      value,
                                      VersionDataElement.DEFAULT_BUILD_NUMBER);
+ 
+                         //:TODO: BUILD DATE
                          else
                              setAttribute(key, value);
***************
*** 719,722 ****
--- 742,749 ----
      }
  
+     public boolean isBuildDateUnset() {
+         return (VersionDataElement.UNSET_BUILD_DATE != m_buildDate);
+     }
+ 
      /**
       * Sets the major.
***************
*** 755,761 ****
  
      /**
!          * Sets the buildNumber.
!          * @param buildNumber The buildNumber to set
!          */
      public void setBuildNumber(int buildNumber) {
          m_buildNumber = buildNumber;
--- 782,788 ----
  
      /**
!      * Sets the buildNumber.
!      * @param buildNumber The buildNumber to set
!      */
      public void setBuildNumber(int buildNumber) {
          m_buildNumber = buildNumber;
***************
*** 767,770 ****
--- 794,809 ----
  
      /**
+      * Sets the buildDate.
+      * @param buildDate The buildDate to set
+      */
+     public void setBuildDate(Date buildDate) {
+         m_buildDate = buildDate;
+ 
+         m_elements.set(
+             VersionDataElement.BUILD_DATE,
+             (VersionDataElement.UNSET_BUILD_DATE != buildDate));
+     }
+ 
+     /**
       * Sets the releaseLevel.
       * @param releaseLevel The releaseLevel to set
***************
*** 807,815 ****
              equal &= (otherVersionData.getMinor() == getMinor());
  
!             equal
!                 &= (otherVersionData.getReleaseLevel().equals(getReleaseLevel()));
  
              equal
!                 &= (otherVersionData.getReleaseQualifier() == getReleaseQualifier());
  
              equal &= (otherVersionData.getPoint() == getPoint());
--- 846,861 ----
              equal &= (otherVersionData.getMinor() == getMinor());
  
!             if (null != otherVersionData.getReleaseLevel()) {
!                 equal
!                     &= (otherVersionData
!                         .getReleaseLevel()
!                         .equals(getReleaseLevel()));
!             }
!             else
!                 equal &= (null == getReleaseLevel());
  
              equal
!                 &= (otherVersionData.getReleaseQualifier()
!                     == getReleaseQualifier());
  
              equal &= (otherVersionData.getPoint() == getPoint());
***************
*** 817,820 ****
--- 863,873 ----
              equal &= (otherVersionData.getBuildNumber() == getBuildNumber());
  
+             if (null != otherVersionData.getBuildDate()) {
+                 equal
+                     &= (otherVersionData.getBuildDate().equals(getBuildDate()));
+             }
+             else
+                 equal &= (null == getBuildDate());
+ 
              // :TODO: Attributes/Annotations/Constraints/other
          }
***************
*** 831,841 ****
          // :TODO: Store this internally (persistently) via HEX parts?
          // :TODO: Make this sensible based upon part "priority"
!         return (getMajor() * 1000000)
!             + (getMinor() * 10000)
!             + (getReleaseLevel().hashCode() * 100)
!             + getPoint()
!             + getBuildNumber();
  
          //      :TODO: Attributes/Annotations/Constraints/other
      }
  
--- 884,901 ----
          // :TODO: Store this internally (persistently) via HEX parts?
          // :TODO: Make this sensible based upon part "priority"
!         int hash =
!             (getMajor() * 1000000)
!                 + (getMinor() * 10000)
!                 + getPoint()
!                 + getBuildNumber();
! 
!         if (null != getReleaseLevel())
!             hash += getReleaseLevel().hashCode();
!         if (null != getBuildDate())
!             hash += getBuildDate().hashCode();
  
          //      :TODO: Attributes/Annotations/Constraints/other
+ 
+         return hash;
      }
  
***************
*** 929,932 ****
--- 989,1001 ----
                  buffer.append(",");
              buffer.append(m_buildNumber);
+             needSeparator = true;
+         }
+ 
+         if (m_elements.hasBuildDate()
+             && (VersionDataElement.UNSET_BUILD_DATE != m_buildDate)) {
+             if (needSeparator)
+                 buffer.append(",");
+             buffer.append(VersionImplementationConstants.DATE_FORMAT.format(m_buildDate));
+             needSeparator = true;
          }
  
***************
*** 1028,1033 ****
          out.println("Minor:" + m_minor);
  
!         out.print(indent);
!         out.println("ReleaseLevel:" + m_releaseLevel);
  
          out.print(indent);
--- 1097,1104 ----
          out.println("Minor:" + m_minor);
  
!         if (null != m_releaseLevel) {
!             out.print(indent);
!             out.println("ReleaseLevel:" + m_releaseLevel);
!         }
  
          out.print(indent);
***************
*** 1035,1042 ****
  
          out.print(indent);
!         out.println("Point:" + m_point);
  
          out.print(indent);
!         out.println("BuildNumber:" + m_buildNumber);
  
          if (null != m_annotations) {
--- 1106,1118 ----
  
          out.print(indent);
!         out.println("Point:" + Integer.toString(m_point));
  
          out.print(indent);
!         out.println("BuildNumber:" + Integer.toString(m_buildNumber));
!         
!         if (null != m_buildDate) {
!             out.print(indent);
!             out.println("BuildDate:" + m_buildDate);
!         }
  
          if (null != m_annotations) {

Index: VersionDataElementSet.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-version/src/java/org/krysalis/version/impl/data/VersionDataElementSet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** VersionDataElementSet.java	24 Mar 2003 01:25:47 -0000	1.1
--- VersionDataElementSet.java	25 Mar 2003 21:26:14 -0000	1.2
***************
*** 132,135 ****
--- 132,139 ----
              add(VersionDataElement.BUILD_NUMBER);
          }
+ 
+         if (VersionDataElement.isBuildDate(elementValues)) {
+             add(VersionDataElement.BUILD_DATE);
+         }
      }
  
***************
*** 214,217 ****
--- 218,225 ----
      public boolean hasBuildNumber() {
          return VersionDataElement.isBuildNumber(m_elementMask);
+     }
+ 
+     public boolean hasBuildDate() {
+         return VersionDataElement.isBuildDate(m_elementMask);
      }
  




-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en