Source Code Cross Referenced for MFColor.java in  » 6.0-JDK-Modules » java-3d » org » jdesktop » j3d » loaders » vrml97 » impl » 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 3d » org.jdesktop.j3d.loaders.vrml97.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: MFColor.java,v $
003:         *
004:         *      @(#)MFColor.java 1.12 98/11/05 20:34:38
005:         *
006:         * Copyright (c) 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
007:         *
008:         * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
009:         * modify and redistribute this software in source and binary code form,
010:         * provided that i) this copyright notice and license appear on all copies of
011:         * the software; and ii) Licensee does not utilize the software in a manner
012:         * which is disparaging to Sun.
013:         *
014:         * This software is provided "AS IS," without a warranty of any kind. ALL
015:         * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
016:         * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
017:         * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
018:         * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
019:         * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
020:         * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
021:         * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
022:         * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
023:         * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
024:         * POSSIBILITY OF SUCH DAMAGES.
025:         *
026:         * This software is not designed or intended for use in on-line control of
027:         * aircraft, air traffic, aircraft navigation or aircraft communications; or in
028:         * the design, construction, operation or maintenance of any nuclear
029:         * facility. Licensee represents and warrants that it will not use or
030:         * redistribute the Software for such purposes.
031:         * $Revision: 1.2 $
032:         * $Date: 2005/02/03 23:06:57 $
033:         * $State: Exp $
034:         */
035:        /*
036:         * @Author: Rick Goldberg
037:         * @Author: Doug Gehringer
038:         *
039:         */
040:        package org.jdesktop.j3d.loaders.vrml97.impl;
041:
042:        import java.util.Observable;
043:        import java.util.Observer;
044:        import java.util.Vector;
045:
046:        /**  Description of the Class */
047:        public class MFColor extends MField {
048:
049:            float[] vals;
050:
051:            /**Constructor for the MFColor object */
052:            public MFColor() {
053:                float[] dummy = new float[0];
054:                setValue(dummy);
055:            }
056:
057:            /**
058:             *Constructor for the MFColor object
059:             *
060:             *@param  values Description of the Parameter
061:             */
062:            public MFColor(float[][] values) {
063:                setValue(values);
064:            }
065:
066:            // What is the size doing here?
067:            /**
068:             *Constructor for the MFColor object
069:             *
070:             *@param  size Description of the Parameter
071:             *@param  values Description of the Parameter
072:             */
073:            public MFColor(int size, float[] values) {
074:                setValue(values);
075:            }
076:
077:            /**
078:             *Constructor for the MFColor object
079:             *
080:             *@param  values Description of the Parameter
081:             */
082:            public MFColor(float[] values) {
083:                setValue(values);
084:            }
085:
086:            /**
087:             *  Gets the value attribute of the MFColor object
088:             *
089:             *@param  values Description of the Parameter
090:             */
091:            public void getValue(float[][] values) {
092:                int numVecs = vals.length / 3;
093:                for (int i = 0; i < numVecs; i++) {
094:                    System.arraycopy(vals, i * 3, values[i], 0, 3);
095:                }
096:            }
097:
098:            /**
099:             *  Gets the value attribute of the MFColor object
100:             *
101:             *@param  values Description of the Parameter
102:             */
103:            public void getValue(float[] values) {
104:                System.arraycopy(vals, 0, values, 0, vals.length);
105:            }
106:
107:            /**
108:             *  Description of the Method
109:             *
110:             *@param  index Description of the Parameter
111:             *@param  values Description of the Parameter
112:             */
113:            public void get1Value(int index, float[] values) {
114:                System.arraycopy(vals, index * 3, values, 0, 3);
115:            }
116:
117:            /**
118:             *  Description of the Method
119:             *
120:             *@param  index Description of the Parameter
121:             *@param  vec Description of the Parameter
122:             */
123:            public void get1Value(int index, SFColor vec) {
124:                vec.setValue(vals[index], vals[index + 1], vals[index + 2]);
125:            }
126:
127:            /**
128:             *  Sets the value attribute of the MFColor object
129:             *
130:             *@param  values The new value value
131:             */
132:            public void setValue(float[][] values) {
133:                vals = new float[values.length * 3];
134:                for (int i = 0; i < values.length; i++) {
135:                    System.arraycopy(values, 0, vals, i * 3, i * 3 + 3);
136:                }
137:                route();
138:
139:            }
140:
141:            /**
142:             *  Sets the value attribute of the MFColor object
143:             *
144:             *@param  values The new value value
145:             */
146:            public void setValue(float[] values) {
147:                vals = new float[values.length];
148:                System.arraycopy(values, 0, vals, 0, values.length);
149:                route();
150:            }
151:
152:            /**
153:             *  Sets the value attribute of the MFColor object
154:             *
155:             *@param  color The new value value
156:             */
157:            public void setValue(MFColor color) {
158:                setValue(color.vals);
159:            }
160:
161:            /**
162:             *  Sets the value attribute of the MFColor object
163:             *
164:             *@param  size The new value value
165:             *@param  values The new value value
166:             */
167:            public void setValue(int size, float[] values) {
168:                setValue(values);
169:            }
170:
171:            /**
172:             *  Sets the value attribute of the MFColor object
173:             *
174:             *@param  cf The new value value
175:             */
176:            public void setValue(ConstMFColor cf) {
177:                setValue((MFColor) cf.ownerField);
178:            }
179:
180:            /**
181:             *  Description of the Method
182:             *
183:             *@param  index Description of the Parameter
184:             *@param  constvec Description of the Parameter
185:             */
186:            public void set1Value(int index, ConstSFColor constvec) {
187:                set1Value(index, (SFColor) constvec.ownerField);
188:            }
189:
190:            /**
191:             *  Description of the Method
192:             *
193:             *@param  index Description of the Parameter
194:             *@param  vec Description of the Parameter
195:             */
196:            public void set1Value(int index, SFColor vec) {
197:                set1Value(index, vec.color[0], vec.color[1], vec.color[2]);
198:            }
199:
200:            /**
201:             *  Description of the Method
202:             *
203:             *@param  index Description of the Parameter
204:             *@param  x Description of the Parameter
205:             *@param  y Description of the Parameter
206:             *@param  z Description of the Parameter
207:             */
208:            public void set1Value(int index, float x, float y, float z) {
209:                try {
210:                    vals[index * 3 + 0] = x;
211:                    vals[index * 3 + 1] = y;
212:                    vals[index * 3 + 2] = z;
213:
214:                } catch (IndexOutOfBoundsException e) {
215:                    System.err
216:                            .println("MFColor.set1Value(index,float,float,float): "
217:                                    + "exception " + e);
218:                }
219:                route();
220:            }
221:
222:            /**
223:             *  Description of the Method
224:             *
225:             *@param  index Description of the Parameter
226:             *@param  constvec Description of the Parameter
227:             */
228:            public void insertValue(int index, ConstSFColor constvec) {
229:                insertValue(index, (SFColor) constvec.ownerField);
230:            }
231:
232:            /**
233:             *  Description of the Method
234:             *
235:             *@param  index Description of the Parameter
236:             *@param  vec Description of the Parameter
237:             */
238:            public void insertValue(int index, SFColor vec) {
239:                insertValue(index, vec.color[0], vec.color[1], vec.color[2]);
240:            }
241:
242:            /**
243:             *  Description of the Method
244:             *
245:             *@param  index Description of the Parameter
246:             *@param  x Description of the Parameter
247:             *@param  y Description of the Parameter
248:             *@param  z Description of the Parameter
249:             */
250:            public void insertValue(int index, float x, float y, float z) {
251:                try {
252:                    int i;
253:                    float[] temp = new float[vals.length + 3];
254:                    for (i = 0; i < index * 3; i++) {
255:                        temp[i] = vals[i];
256:                    }
257:                    temp[i++] = x;
258:                    temp[i++] = y;
259:                    temp[i++] = z;
260:                    for (; i < temp.length; i++) {
261:                        temp[i] = vals[i - 3];
262:                    }
263:                    vals = temp;
264:                } catch (IndexOutOfBoundsException e) {
265:                    System.err
266:                            .println("MFColor.insertValue(index,float,float,float): "
267:                                    + "exception " + e);
268:                }
269:                route();
270:            }
271:
272:            /**
273:             *  Description of the Method
274:             *
275:             *@param  field Description of the Parameter
276:             */
277:            public void update(Field field) {
278:                setValue((MFColor) field);
279:            }
280:
281:            /**
282:             *  Description of the Method
283:             *
284:             *@return  Description of the Return Value
285:             */
286:            public synchronized Object clone() {
287:                MFColor ref = new MFColor();
288:                ref.vals = new float[vals.length];
289:                try {
290:                    System.arraycopy(vals, 0, ref.vals, 0, vals.length);
291:                } catch (Exception e) {
292:                    System.err.println("MFColor.clone(): exception " + e);
293:                }
294:
295:                return ref;
296:            }
297:
298:            /**
299:             *  Gets the size attribute of the MFColor object
300:             *
301:             *@return  The size value
302:             */
303:            public int getSize() {
304:                return vals.length / 3;
305:            }
306:
307:            /**  Description of the Method */
308:            public void clear() {
309:                vals = new float[1];
310:                route();
311:            }
312:
313:            /**
314:             *  Description of the Method
315:             *
316:             *@param  index Description of the Parameter
317:             */
318:            public void delete(int index) {
319:                int i;
320:                float[] temp = new float[vals.length - 3];
321:                for (i = 0; i < index * 3; i++) {
322:                    temp[i] = vals[i];
323:                }
324:                for (; i < temp.length; i++) {
325:                    temp[i] = vals[i + 3];
326:                }
327:                vals = temp;
328:                route();
329:            }
330:
331:            /**
332:             *  Description of the Method
333:             *
334:             *@return  Description of the Return Value
335:             */
336:            public synchronized ConstField constify() {
337:                if (constField == null) {
338:                    constField = new ConstMFColor(this );
339:                }
340:                return constField;
341:            }
342:
343:            /**
344:             *  Description of the Method
345:             *
346:             *@return  Description of the Return Value
347:             */
348:            public vrml.Field wrap() {
349:                return new vrml.field.MFColor(this);
350:            }
351:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.