Source Code Cross Referenced for ImageSequence.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » javax » media » jai » 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 » Java Advanced Imaging » javax.media.jai 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: ImageSequence.java,v $
003:         *
004:         * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * Use is subject to license terms.
007:         *
008:         * $Revision: 1.1 $
009:         * $Date: 2005/02/11 04:57:09 $
010:         * $State: Exp $
011:         */
012:        package javax.media.jai;
013:
014:        import java.util.Collection;
015:        import java.util.Iterator;
016:
017:        /**
018:         * A class representing a sequence of images, each associated with a
019:         * time stamp and a camera position.  The images are of the type
020:         * <code>javax.media.jai.PlanarImage</code>; the time stamps are of the
021:         * type <code>float</code>; the camera positions are of the type
022:         * <code>java.lang.Object</code>.  The tuple (image, time stamp, camera
023:         * position) is represented by class
024:         * <code>javax.media.jai.SequentialImage</code>.
025:         *
026:         * <p> This class can be used to represent video or time-lapse photography.
027:         *
028:         * @see PlanarImage
029:         * @see SequentialImage
030:         *
031:         * @deprecated as of JAI 1.1. Use
032:         * <code>AttributedImageCollection</code> instead.
033:         */
034:
035:        public class ImageSequence extends CollectionImage {
036:
037:            /** The default constrctor. */
038:            protected ImageSequence() {
039:            }
040:
041:            /**
042:             * Constructs a class that represents a sequence of images.
043:             *
044:             * @param images  A collection of <code>SequentialImage</code>.
045:             *
046:             * @throws IllegalArgumentException if <code>images</code> is <code>null</code>.
047:             */
048:            public ImageSequence(Collection images) {
049:                super (images);
050:            }
051:
052:            /**
053:             * Returns the image associated with the specified time stamp,
054:             * or <code>null</code> if no match is found.
055:             */
056:            public PlanarImage getImage(float ts) {
057:                Iterator iter = iterator();
058:
059:                while (iter.hasNext()) {
060:                    SequentialImage si = (SequentialImage) iter.next();
061:                    if (si.timeStamp == ts) {
062:                        return si.image;
063:                    }
064:                }
065:
066:                return null;
067:            }
068:
069:            /**
070:             * Returns the image associated with the specified camera position,
071:             * or <code>null</code> if <code>cp</code> is <code>null</code> or
072:             * if no match is found.
073:             */
074:            public PlanarImage getImage(Object cp) {
075:                if (cp != null) {
076:                    Iterator iter = iterator();
077:
078:                    while (iter.hasNext()) {
079:                        SequentialImage si = (SequentialImage) iter.next();
080:                        if (si.cameraPosition.equals(cp)) {
081:                            return si.image;
082:                        }
083:                    }
084:                }
085:
086:                return null;
087:            }
088:
089:            /**
090:             * Returns the time stamp associated with the specified image, or
091:             * <code>-Float.MAX_VALUE</code> if <code>pi</code> is <code>null</code>
092:             * or if no match is found.
093:             */
094:            public float getTimeStamp(PlanarImage pi) {
095:                if (pi != null) {
096:                    Iterator iter = iterator();
097:
098:                    while (iter.hasNext()) {
099:                        SequentialImage si = (SequentialImage) iter.next();
100:                        if (si.image.equals(pi)) {
101:                            return si.timeStamp;
102:                        }
103:                    }
104:                }
105:
106:                return -Float.MAX_VALUE;
107:            }
108:
109:            /**
110:             * Returns the camera position associated with the specified image,
111:             * or <code>null</code> if <code>pi</code> is <code>null</code> or
112:             * if no match is found.
113:             */
114:            public Object getCameraPosition(PlanarImage pi) {
115:                if (pi != null) {
116:                    Iterator iter = iterator();
117:
118:                    while (iter.hasNext()) {
119:                        SequentialImage si = (SequentialImage) iter.next();
120:                        if (si.image.equals(pi)) {
121:                            return si.cameraPosition;
122:                        }
123:                    }
124:                }
125:
126:                return null;
127:            }
128:
129:            /**
130:             * Adds a <code>SequentialImage</code> to this collection.  If the
131:             * specified image is <code>null</code>, it is not added to the
132:             * collection.
133:             *
134:             * @return <code>true</code> if and only if the
135:             *         <code>SequentialImage</code> is added to the collection.
136:             */
137:            public boolean add(Object o) {
138:                if (o != null && o instanceof  SequentialImage) {
139:                    return super .add(o);
140:                } else {
141:                    return false;
142:                }
143:            }
144:
145:            /**
146:             * Removes the <code>SequentialImage</code> that contains the
147:             * specified image from this collection.
148:             *
149:             * @return <code>true</code> if and only if a
150:             *         <code>SequentialImage</code> with the
151:             *         specified image is removed from the collection.
152:             */
153:            public boolean remove(PlanarImage pi) {
154:                if (pi != null) {
155:                    Iterator iter = iterator();
156:
157:                    while (iter.hasNext()) {
158:                        SequentialImage si = (SequentialImage) iter.next();
159:                        if (si.image.equals(pi)) {
160:                            return super .remove(si);
161:                        }
162:                    }
163:                }
164:
165:                return false;
166:            }
167:
168:            /**
169:             * Removes the <code>SequentialImage</code> that contains the
170:             * specified time stamp from this collection.
171:             *
172:             * @return <code>true</code> if and only if a
173:             *         <code>SequentialImage</code> with the
174:             *         specified time stamp is removed from the collection.
175:             */
176:            public boolean remove(float ts) {
177:                Iterator iter = iterator();
178:
179:                while (iter.hasNext()) {
180:                    SequentialImage si = (SequentialImage) iter.next();
181:                    if (si.timeStamp == ts) {
182:                        return super .remove(si);
183:                    }
184:                }
185:
186:                return false;
187:            }
188:
189:            /**
190:             * Removes the <code>SequentialImage</code> that contains the
191:             * specified camera position from this collection.
192:             *
193:             * @return <code>true</code> if and only if a
194:             *         <code>SequentialImage</code> with the
195:             *         specified camera position is removed from the collection.
196:             */
197:            public boolean remove(Object cp) {
198:                if (cp != null) {
199:                    Iterator iter = iterator();
200:
201:                    while (iter.hasNext()) {
202:                        SequentialImage si = (SequentialImage) iter.next();
203:                        if (si.cameraPosition.equals(cp)) {
204:                            return super .remove(si);
205:                        }
206:                    }
207:                }
208:
209:                return false;
210:            }
211:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.