Source Code Cross Referenced for TimeContainerRootSupport.java in  » 6.0-JDK-Modules » j2me » com » sun » perseus » model » 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 » 6.0 JDK Modules » j2me » com.sun.perseus.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:        package com.sun.perseus.model;
027:
028:        /**
029:         * 
030:         * @version $Id: TimeContainerRootSupport.java,v 1.2 2006/04/21 06:37:20 st125089 Exp $
031:         */
032:        public class TimeContainerRootSupport extends TimeContainerSupport {
033:            /**
034:             * The time at which the document started. This is
035:             * initially set when animation is started and then
036:             * modified when the document's timeline is seeked
037:             * to a particular time.
038:             */
039:            protected long beginWallClockTime = -1;
040:
041:            /**
042:             * The last sample time.
043:             */
044:            protected Time lastSampleTime = Time.UNRESOLVED;
045:
046:            /**
047:             * Flags that the seek is backwards
048:             */
049:            protected boolean seekingBack;
050:
051:            /**
052:             * There is no parent container for this root. The parent is this 
053:             * node itself.
054:             * Also, the root time container has a default 0-offset begin condition
055:             * added to it so that the first interval is created and is
056:             * [0, INDEFINITE[.
057:             */
058:            TimeContainerRootSupport() {
059:                timeContainer = this ;
060:
061:                // Add a new 0-offset begin condition.
062:                new OffsetCondition(this , true, 0);
063:            }
064:
065:            /**
066:             * Always throws an exception because a root container should not have
067:             * a parent container.
068:             *
069:             * @param timeContainer time container
070:             * @throws IllegalArgumentException always thrown for a root time 
071:             *         container which should not have a parent container.
072:             */
073:            protected void setTimeContainer(
074:                    final TimeContainerSupport timeContainer) {
075:                throw new IllegalArgumentException();
076:            }
077:
078:            /**
079:             * Helper method. 
080:             *
081:             * @return this timed element's root container.
082:             */
083:            TimeContainerRootSupport getRootContainer() {
084:                return this ;
085:            }
086:
087:            /**
088:             * Converts the input 'local' time to an absolute wallclock time.
089:             *
090:             * @param localTime the time to convert to wallclock time
091:             * @return the time, converted to wall clock time.
092:             */
093:            long toWallClockTime(final long localTime) {
094:                return beginWallClockTime + localTime;
095:            }
096:
097:            /**
098:             * Dispatches beginEvent. See the <code>TimedElementSupport</code> class
099:             * method implementation. This class also uses the opportunity to record
100:             * what the wallclock time is for the begin time so that localTimes can
101:             * be converted later.
102:             *
103:             * @param beginTime the interval begin time
104:             */
105:            void dispatchBeginEvent(final Time beginTime) {
106:                super .dispatchBeginEvent(beginTime);
107:
108:                beginWallClockTime = System.currentTimeMillis();
109:
110:                // With the following, beginTime will map to beginWallClockTime,
111:                // as expected.
112:                beginWallClockTime -= beginTime.value;
113:            }
114:
115:            /**
116:             * For the root container, there is no container simple duration, so we
117:             * retun INDEFINITE, no matter what the state is.
118:             *
119:             * @return the container's simple duration.
120:             */
121:            Time getContainerSimpleDuration() {
122:                return Time.INDEFINITE;
123:            }
124:
125:            /**
126:             * Converts the input simple time (i.e., a time in the parent container's
127:             * simple duration) to a root container simple time (i.e., a time
128:             * in the root time container's simple time interval).
129:             *
130:             * @param simpleTime the time in the parent container's simple duration
131:             * @return a time in the root time container's simple duration (i.e., in 
132:             *         the root container's simple time interval).
133:             */
134:            Time toRootContainerSimpleTime(final Time simpleTime) {
135:                return simpleTime;
136:            }
137:
138:            /**
139:             * Converts the input simple time (i.e., a time in the parent container's
140:             * simple duration) to a root container simple time (i.e., a time
141:             * in the root time container's simple time interval).
142:             *
143:             * @param simpleTime the time in the parent container's simple duration
144:             * @return a time in the root time container's simple duration (i.e., in 
145:             *         the root container's simple time interval).
146:             */
147:            Time toRootContainerSimpleTimeClamp(final Time simpleTime) {
148:                // Note that no clamping is necessary here because the clamping is
149:                // done in a timed element, relative to its container's simple time.
150:                // By the time this is called on the root, the child timed element has
151:                // already applied the root's constraints.
152:                return simpleTime;
153:            }
154:
155:            /**
156:             * Converts the input root container simple time (i.e., a time in the root
157:             * container's simple time interval) to a time in this element's time
158:             * container simple duration.
159:             *
160:             * @param rootSimpleTime the time in the root container's simple duration.
161:             * @return a simple time in the parent container's simple duration The
162:             * return value is in the [0, container simple duration] interval.
163:             *
164:             */
165:            Time toContainerSimpleTime(final Time rootSimpleTime) {
166:                return rootSimpleTime;
167:            }
168:
169:            /**
170:             * Seek to the requested time. The time is assumed to be in 
171:             * document simple time.
172:             *
173:             * @param seekToTime the time to seek to
174:             */
175:            void seekTo(final Time seekToTime) {
176:                if (!seekToTime.isResolved()) {
177:                    throw new IllegalStateException();
178:                }
179:
180:                seeking = true;
181:                seekingBack = !seekToTime.greaterThan(lastSampleTime);
182:                try {
183:                    sample(seekToTime);
184:                } finally {
185:                    seeking = false;
186:                }
187:            }
188:
189:            /**
190:             * Overrides the default sample time to capture the last sample time.
191:             *
192:             * @param currentTime the time at which this element should be 
193:             *        sampled. 
194:             */
195:            void sample(final Time currentTime) {
196:                super.sample(currentTime);
197:                lastSampleTime = currentTime;
198:            }
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.