Source Code Cross Referenced for Version.java in  » Content-Management-System » contineo » org » contineo » core » document » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » contineo » org.contineo.core.document 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.contineo.core.document;
002:
003:        /**
004:         * This class represents versions.
005:         * 
006:         * @author Michael Scholz
007:         * @version 1.0
008:         */
009:        public class Version implements  Comparable {
010:
011:            /**
012:             * specifies different version types
013:             */
014:            public enum VERSION_TYPE {
015:                NEW_RELEASE, NEW_SUBVERSION, OLD_VERSION;
016:            }
017:
018:            private String version;
019:
020:            private String versionUser = "";
021:
022:            private String versionDate = "";
023:
024:            private String versionComment = "";
025:
026:            public Version() {
027:            }
028:
029:            public String getVersion() {
030:                return version;
031:            }
032:
033:            public String getVersionUser() {
034:                return versionUser;
035:            }
036:
037:            public String getVersionDate() {
038:                return versionDate;
039:            }
040:
041:            public String getVersionComment() {
042:                return versionComment;
043:            }
044:
045:            public void setVersion(String version) {
046:                this .version = version;
047:            }
048:
049:            public void setVersionUser(String vuser) {
050:                versionUser = vuser;
051:            }
052:
053:            public void setVersionDate(String date) {
054:                versionDate = date;
055:            }
056:
057:            public void setVersionComment(String comment) {
058:                versionComment = comment;
059:            }
060:
061:            /**
062:             * returns a new version name
063:             * 
064:             * @param oldVersionName name of the old version, e.g. 1.5
065:             * @param versionType what kind of version, so if it should be 1.6, 2.0 or
066:             *        remain 1.5
067:             */
068:            public String getNewVersionName(String oldVersionName,
069:                    VERSION_TYPE versionType) {
070:                String release = oldVersionName.substring(0, oldVersionName
071:                        .indexOf("."));
072:                String version = oldVersionName.substring(oldVersionName
073:                        .lastIndexOf(".") + 1);
074:
075:                int number;
076:                switch (versionType) {
077:                case NEW_RELEASE:
078:                    number = Integer.parseInt(release);
079:                    release = String.valueOf(number + 1);
080:                    version = "0";
081:                    break;
082:                case NEW_SUBVERSION:
083:                    number = Integer.parseInt(version);
084:                    version = String.valueOf(number + 1);
085:                    break;
086:                case OLD_VERSION:
087:                    return oldVersionName;
088:                }
089:
090:                return release + "." + version;
091:            }
092:
093:            /** for sorting a list of Version objects by the version number */
094:            public int compareTo(Object obj) {
095:                if (!(obj instanceof  Version))
096:                    return 0;
097:
098:                return this .getVersion().toLowerCase().compareTo(
099:                        ((Version) obj).getVersion().toLowerCase());
100:            }
101:
102:            @Override
103:            public boolean equals(Object obj) {
104:                if (!(obj instanceof  Version))
105:                    return false;
106:                Version other = (Version) obj;
107:                return this .getVersion().equals(other.getVersion());
108:            }
109:
110:            @Override
111:            public int hashCode() {
112:                return version.hashCode();
113:            }
114:
115:            @Override
116:            public String toString() {
117:                return version.toString();
118:            }
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.