Source Code Cross Referenced for DayAndPosition.java in  » Portal » liferay-portal-4.4.2 » com » liferay » util » cal » 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 » Portal » liferay portal 4.4.2 » com.liferay.util.cal 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2000, Columbia University.  All rights reserved.
003:         *
004:         * Redistribution and use in source and binary forms, with or without
005:         * modification, are permitted provided that the following conditions are met:
006:         *
007:         * 1. Redistributions of source code must retain the above copyright
008:         *    notice, this list of conditions and the following disclaimer.
009:         *
010:         * 2. Redistributions in binary form must reproduce the above copyright
011:         *    notice, this list of conditions and the following disclaimer in the
012:         *    documentation and/or other materials provided with the distribution.
013:         *
014:         * 3. Neither the name of the University nor the names of its contributors
015:         *    may be used to endorse or promote products derived from this software
016:         *    without specific prior written permission.
017:         *
018:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
019:         * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
020:         * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
021:         * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
022:         * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
025:         * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
026:         * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
027:         * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
028:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029:         */
030:
031:        package com.liferay.util.cal;
032:
033:        import com.liferay.portal.kernel.util.StringMaker;
034:
035:        import java.io.Serializable;
036:
037:        import java.util.Calendar;
038:
039:        /**
040:         * <a href="DayAndPosition.java.html"><b><i>View Source</i></b></a>
041:         *
042:         * @author Jonathan Lennox
043:         *
044:         * @deprecated This class has been repackaged at
045:         * <code>com.liferay.portal.kernel.cal</code>.
046:         *
047:         */
048:        public class DayAndPosition implements  Cloneable, Serializable {
049:
050:            /**
051:             * Field day
052:             */
053:            private int day;
054:
055:            /**
056:             * Field position
057:             */
058:            private int position;
059:
060:            /**
061:             * Field NO_WEEKDAY
062:             */
063:            public final static int NO_WEEKDAY = 0;
064:
065:            /**
066:             * Constructor DayAndPosition
067:             *
068:             *
069:             */
070:            public DayAndPosition() {
071:                day = NO_WEEKDAY;
072:                position = 0;
073:            }
074:
075:            /**
076:             * Constructor DayAndPosition
077:             *
078:             *
079:             * @param	d
080:             * @param	p
081:             *
082:             */
083:            public DayAndPosition(int d, int p) {
084:                if (!isValidDayOfWeek(d)) {
085:                    throw new IllegalArgumentException("Invalid day of week");
086:                }
087:
088:                if (!isValidDayPosition(p)) {
089:                    throw new IllegalArgumentException("Invalid day position");
090:                }
091:
092:                day = d;
093:                position = p;
094:            }
095:
096:            /**
097:             * Method getDayOfWeek
098:             *
099:             *
100:             * @return	int
101:             *
102:             */
103:            public int getDayOfWeek() {
104:                return day;
105:            }
106:
107:            /**
108:             * Method setDayOfWeek
109:             *
110:             *
111:             * @param	d
112:             *
113:             */
114:            public void setDayOfWeek(int d) {
115:                if (!isValidDayOfWeek(d)) {
116:                    throw new IllegalArgumentException("Invalid day of week");
117:                }
118:
119:                day = d;
120:            }
121:
122:            /**
123:             * Method getDayPosition
124:             *
125:             *
126:             * @return	int
127:             *
128:             */
129:            public int getDayPosition() {
130:                return position;
131:            }
132:
133:            /**
134:             * Method setDayPosition
135:             *
136:             *
137:             * @param	p
138:             *
139:             */
140:            public void setDayPosition(int p) {
141:                if (!isValidDayPosition(p)) {
142:                    throw new IllegalArgumentException();
143:                }
144:
145:                position = p;
146:            }
147:
148:            /**
149:             * Method equals
150:             *
151:             *
152:             * @param	obj
153:             *
154:             * @return	boolean
155:             *
156:             */
157:            public boolean equals(Object obj) {
158:                if (obj == null) {
159:                    return false;
160:                }
161:
162:                if (this  == obj) {
163:                    return true;
164:                }
165:
166:                if (!(obj instanceof  DayAndPosition)) {
167:                    return false;
168:                }
169:
170:                DayAndPosition that = (DayAndPosition) obj;
171:
172:                return (getDayOfWeek() == that.getDayOfWeek())
173:                        && (getDayPosition() == that.getDayPosition());
174:            }
175:
176:            /**
177:             * Method isValidDayOfWeek
178:             *
179:             *
180:             * @param	d
181:             *
182:             * @return	boolean
183:             *
184:             */
185:            public static boolean isValidDayOfWeek(int d) {
186:                switch (d) {
187:
188:                case NO_WEEKDAY:
189:                case Calendar.SUNDAY:
190:                case Calendar.MONDAY:
191:                case Calendar.TUESDAY:
192:                case Calendar.WEDNESDAY:
193:                case Calendar.THURSDAY:
194:                case Calendar.FRIDAY:
195:                case Calendar.SATURDAY:
196:                    return true;
197:
198:                default:
199:                    return false;
200:                }
201:            }
202:
203:            /**
204:             * Method isValidDayPosition
205:             *
206:             *
207:             * @param	p
208:             *
209:             * @return	boolean
210:             *
211:             */
212:            public static boolean isValidDayPosition(int p) {
213:                return ((p >= -53) && (p <= 53));
214:            }
215:
216:            /**
217:             * Method clone
218:             *
219:             *
220:             * @return	Object
221:             *
222:             */
223:            public Object clone() {
224:                try {
225:                    DayAndPosition other = (DayAndPosition) super .clone();
226:
227:                    other.day = day;
228:                    other.position = position;
229:
230:                    return other;
231:                } catch (CloneNotSupportedException e) {
232:                    throw new InternalError();
233:                }
234:            }
235:
236:            /**
237:             * Method toString
238:             *
239:             *
240:             * @return	String
241:             *
242:             */
243:            public String toString() {
244:                StringMaker sm = new StringMaker();
245:
246:                sm.append(getClass().getName());
247:                sm.append("[day=");
248:                sm.append(day);
249:                sm.append(",position=");
250:                sm.append(position);
251:                sm.append("]");
252:
253:                return sm.toString();
254:            }
255:
256:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.