edu.byu.phun
Class GroupObj

java.lang.Object
  extended by edu.byu.phun.PropertyContainer
      extended by edu.byu.phun.Obj3D
          extended by edu.byu.phun.GroupObj
Direct Known Subclasses:
Axes, BodyPart, Eye

public class GroupObj
extends Obj3D

This is a group of parts. There can be any number of parts. Each part can be accessed by its name or the parts can be extracted by index.


Constructor Summary
GroupObj()
          This creates an empty group object that has no parts.
 
Method Summary
 void addPart(Obj3D obj)
          This will add a new part to the end of this group.
 Obj3D getPart(int index)
          This will retrieve a given part from the group based upon its index.
 Obj3D getPart(java.lang.String name)
          Every object can have a name ( Obj3D.setName(String) ).
 int nParts()
          Returns the number of parts that have been added to this group.
 java.lang.String[] partNames()
          For all parts that have names, this will return an array of those names.
 void removePart(int index)
          This will remove the part at the specified index.
 void removePart(java.lang.String name)
          Every object can have a name ( Obj3D.setName(String) ).
 void setColor(double red, double green, double blue)
          This sets the color of the object.
 void setPart(int index, Obj3D child)
          This will change the part at the specified index.
 
Methods inherited from class edu.byu.phun.Obj3D
getBounds, getColor, getLocation, getName, getRotX, getRotY, getRotZ, getScaleX, getScaleY, getScaleZ, getShininess, setColor, setLocation, setLocation, setName, setRotX, setRotY, setRotZ, setScale, setScale, setScaleX, setScaleY, setScaleZ, setShininess, toString
 
Methods inherited from class edu.byu.phun.PropertyContainer
getPropertyC, getPropertyD, getPropertyP, getPropertyS, propertyIsColor, propertyIsDouble, propertyIsPoint, propertyIsSettable, propertyIsString, propertyNames, setProperty, setProperty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupObj

public GroupObj()
This creates an empty group object that has no parts.

Method Detail

getPart

public Obj3D getPart(int index)
This will retrieve a given part from the group based upon its index. Parts are added starting at index 0.

Parameters:
index - must be between 0 and nParts()-1.
Returns:
The part at the specified index.

setPart

public void setPart(int index,
                    Obj3D child)
This will change the part at the specified index. This is for modifying the group.

Parameters:
index - must be between 0 and nParts()-1.
child - the new child object to be placed at the specified index.

nParts

public int nParts()
Returns the number of parts that have been added to this group.

Returns:
the number of parts.

getPart

public Obj3D getPart(java.lang.String name)
Every object can have a name ( Obj3D.setName(String) ). This will retrieve the object that has the specified name.

Parameters:
name - the name of the object to be removed. Names are not case sensitive.
Returns:
the object with the specified name or null if there is no such object.

removePart

public void removePart(int index)
This will remove the part at the specified index. Parts at higher indices will be moved down to fill in.

Parameters:
index - must be between 0 and nParts()-1.

removePart

public void removePart(java.lang.String name)
Every object can have a name ( Obj3D.setName(String) ). This will remove the part with the specified name. If there is no such part, then this does nothing.

Parameters:
name - The name of the part to be removed. Names are not case sensitive.

addPart

public void addPart(Obj3D obj)
This will add a new part to the end of this group.

Parameters:
obj - the part to be added.

partNames

public java.lang.String[] partNames()
For all parts that have names, this will return an array of those names.

Returns:
an array of part names.

setColor

public void setColor(double red,
                     double green,
                     double blue)
Description copied from class: Obj3D
This sets the color of the object. Colors are specified between 0.0 (dark) and 1.0 (fully lighted) in red, green and blue.

Examples.

Overrides:
setColor in class Obj3D
Parameters:
red - the red component
green - the green component
blue - the blue component
See Also:
Obj3D.setColor(double, double, double)