edu.byu.phun
Class PropertyContainer

java.lang.Object
  extended by edu.byu.phun.PropertyContainer
Direct Known Subclasses:
Obj3D, Win3D

public class PropertyContainer
extends java.lang.Object

This is the super class for objects that have properties. This class uses reflection to obtain a list of properties supported by various subclasses of this class. A property is defined by a pair of methods "getPropertyName()" and "setPropertyName()". The set method is optional. Properties can only be double, color, point or string. Property names are case sensitive.


Constructor Summary
PropertyContainer()
           
 
Method Summary
 Color getPropertyC(java.lang.String name)
          This will get the value of a color property.
 double getPropertyD(java.lang.String name)
          This will get the value of a double property.
 Point3d getPropertyP(java.lang.String name)
          This will get the value of a point property.
 java.lang.String getPropertyS(java.lang.String name)
          This will get the value of a String property.
 boolean propertyIsColor(java.lang.String name)
          Tests to see if a given property is a color.
 boolean propertyIsDouble(java.lang.String name)
          Tests to see if a given property is a double.
 boolean propertyIsPoint(java.lang.String name)
          Tests to see if a given property is a point.
 boolean propertyIsSettable(java.lang.String name)
          Returns true if the property exists and has a "set" method.
 boolean propertyIsString(java.lang.String name)
          Tests to see if a given property is a string.
 java.lang.String[] propertyNames()
          Returns a list of the property names associated with this object.
 void setProperty(java.lang.String name, Color color)
          This will set the value of a Color property.
 void setProperty(java.lang.String name, double d)
          This will set the value of a double property.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyContainer

public PropertyContainer()
Method Detail

propertyNames

public java.lang.String[] propertyNames()
Returns a list of the property names associated with this object.

Returns:
an array of property names.

propertyIsColor

public boolean propertyIsColor(java.lang.String name)
Tests to see if a given property is a color.

Parameters:
name - the case sensitive name of the property.
Returns:
true if the property exists and is a color, false otherwise.

propertyIsPoint

public boolean propertyIsPoint(java.lang.String name)
Tests to see if a given property is a point.

Parameters:
name - the case sensitive name of the property.
Returns:
true if the property exists and is a point, false otherwise.

propertyIsDouble

public boolean propertyIsDouble(java.lang.String name)
Tests to see if a given property is a double.

Parameters:
name - the case sensitive name of the property.
Returns:
true if the property exists and is a double, false otherwise.

propertyIsString

public boolean propertyIsString(java.lang.String name)
Tests to see if a given property is a string.

Parameters:
name - the case sensitive name of the property.
Returns:
true if the property exists and is a string, false otherwise.

getPropertyC

public Color getPropertyC(java.lang.String name)
This will get the value of a color property.

Parameters:
name - the case sensitive name of the property.
Returns:
A color value or null if the property is not a color.

getPropertyD

public double getPropertyD(java.lang.String name)
This will get the value of a double property.

Parameters:
name - the case sensitive name of the property.
Returns:
A double value or Double.NaN if the property is not a double.

getPropertyP

public Point3d getPropertyP(java.lang.String name)
This will get the value of a point property.

Parameters:
name - the case sensitive name of the property.
Returns:
A point value or null if the property is not a point.

getPropertyS

public java.lang.String getPropertyS(java.lang.String name)
This will get the value of a String property.

Parameters:
name - the case sensitive name of the property.
Returns:
A String value or null if the property is not a String.

setProperty

public void setProperty(java.lang.String name,
                        Color color)
This will set the value of a Color property. If the property does not exist or is not a Color, this will do nothing.

Parameters:
name - the case sensitive name of the property.
color - the color to be set into the property.

setProperty

public void setProperty(java.lang.String name,
                        double d)
This will set the value of a double property. If the property does not exist or is not a double, this will do nothing.

Parameters:
name - the case sensitive name of the property.
d - the number to be set into the property.

propertyIsSettable

public boolean propertyIsSettable(java.lang.String name)
Returns true if the property exists and has a "set" method.

Parameters:
name - the case sensitive name of the property.
Returns:
true if the property exists and can be set.