001: /*
002: * $RCSfile: SFFloat.java,v $
003: *
004: * @(#)SFFloat.java 1.13 98/11/05 20:35:00
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: *
032: * $Revision: 1.2 $
033: * $Date: 2005/02/03 23:07:01 $
034: * $State: Exp $
035: */
036: /*
037: * @Author: Rick Goldberg
038: * @Author: Doug Gehringer
039: *
040: */
041: package org.jdesktop.j3d.loaders.vrml97.impl;
042:
043: import java.util.Observable;
044: import java.util.Observer;
045:
046: // SF as opposed to a SJFloat?
047:
048: // Single Java float seeks eventIn, for
049: // dinner, dancing, and el camino real big numbers.
050: // no clones or children.
051:
052: /** Description of the Class */
053: public class SFFloat extends Field {
054:
055: float value;
056: float initValue;
057:
058: /**
059: *Constructor for the SFFloat object
060: *
061: *@param f Description of the Parameter
062: */
063: public SFFloat(float f) {
064: value = f;
065: initValue = f;
066: }
067:
068: /** Description of the Method */
069: void reset() {
070: value = initValue;
071: }
072:
073: /**
074: * Gets the value attribute of the SFFloat object
075: *
076: *@return The value value
077: */
078: public float getValue() {
079: return value;
080: }
081:
082: /**
083: * Sets the value attribute of the SFFloat object
084: *
085: *@param f The new value value
086: */
087: public void setValue(float f) {
088: value = f;
089: route();
090: }
091:
092: /**
093: * Sets the value attribute of the SFFloat object
094: *
095: *@param f The new value value
096: */
097: public void setValue(ConstSFFloat f) {
098: value = f.getValue();
099: route();
100: }
101:
102: /**
103: * Sets the value attribute of the SFFloat object
104: *
105: *@param f The new value value
106: */
107: public void setValue(SFFloat f) {
108: value = f.value;
109: route();
110: }
111:
112: /**
113: * Description of the Method
114: *
115: *@return Description of the Return Value
116: */
117: public synchronized Object clone() {
118: return new SFFloat(value);
119: }
120:
121: /**
122: * Description of the Method
123: *
124: *@param field Description of the Parameter
125: */
126: public void update(Field field) {
127: setValue((SFFloat) field);
128: }
129:
130: /**
131: * Description of the Method
132: *
133: *@return Description of the Return Value
134: */
135: public synchronized ConstField constify() {
136: if (constField == null) {
137: constField = new ConstSFFloat(this );
138: }
139: return constField;
140: }
141:
142: /**
143: * Description of the Method
144: *
145: *@return Description of the Return Value
146: */
147: public vrml.Field wrap() {
148: return new vrml.field.SFFloat(this);
149: }
150:
151: }
|