j3d.org Code

org.j3d.loaders.c3d
Class C3DParameterGroup

java.lang.Object
  extended by org.j3d.loaders.c3d.C3DParameterGroup

public class C3DParameterGroup
extends java.lang.Object

The representation of a single group of parameters.

A parameter group is described by a name and contains a set of individual parameter values. The definition of the file format can be found at: http://www.c3d.org/

Version:
$Revision: 1.2 $
Author:
Justin Couch

Constructor Summary
C3DParameterGroup(java.lang.String name, boolean locked, int id, java.lang.String desc)
          Construct a new group that represents the given name
 
Method Summary
 void addParameter(C3DParameter param)
          Add a new parameter to the group.
 java.lang.String getDescription()
          Get the description used for this group.
 int getId()
          Get the assigned ID of this parameter.
 java.lang.String getName()
          Get the name of the group
 C3DParameter getParameter(java.lang.String name)
          Get a parameter description based on the name string.
 C3DParameter[] getParameters()
          Get all of the parameters for this group.
 int hashCode()
          Generate a hashCode for this group.
 boolean isLocked()
          Check to see if this parameter is marked as being locked (not editable).
 void removeParameter(C3DParameter param)
          Remove the given parameter from this group.
 void setDescription(java.lang.String desc)
          Set the description string.
 void setLocked(boolean state)
          Changed the locked state of the object.
 java.lang.String toString()
          Generate a string representation of this header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

C3DParameterGroup

public C3DParameterGroup(java.lang.String name,
                         boolean locked,
                         int id,
                         java.lang.String desc)
Construct a new group that represents the given name

Parameters:
name - The name this group represents
locked - true if this is a locked group
id - The ID of this group
desc - The description used on the group. May be null
Method Detail

toString

public java.lang.String toString()
Generate a string representation of this header.

Overrides:
toString in class java.lang.Object
Returns:
Information about the header

hashCode

public int hashCode()
Generate a hashCode for this group. The hash is based on the hash of the group name.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash value based on the name of the group

getName

public java.lang.String getName()
Get the name of the group


isLocked

public boolean isLocked()
Check to see if this parameter is marked as being locked (not editable).

Returns:
true if this is locked

setLocked

public void setLocked(boolean state)
Changed the locked state of the object.

Parameters:
state - true to make the object locked

getId

public int getId()
Get the assigned ID of this parameter. The will only be positive because negative values indicate groups.

Returns:
An positive integer parameter ID

getDescription

public java.lang.String getDescription()
Get the description used for this group. If none is set, this returns null.

Returns:
The current description string, or null if none

setDescription

public void setDescription(java.lang.String desc)
                    throws java.lang.IllegalStateException
Set the description string. A value of null clears the string. An exception is generated if the user is attempting to write a locked group.

Parameters:
desc - The new description string to use
Throws:
java.lang.IllegalStateException - The object is locked and cannot be changed

addParameter

public void addParameter(C3DParameter param)
                  throws java.lang.IllegalStateException,
                         java.lang.IllegalArgumentException
Add a new parameter to the group. The id of the parameter must be the positive value of this group's ID (which is negative).

Parameters:
param - The new completely filled out parameter definition
Throws:
java.lang.IllegalStateException - The object is locked and cannot be changed
java.lang.IllegalArgumentException - The parameter ID indicates that it is not a child of this group or there is a parameter of this name already added

removeParameter

public void removeParameter(C3DParameter param)
                     throws java.lang.IllegalStateException
Remove the given parameter from this group. If the parameter was not a child of this group to start with, the request is ignored.

Parameters:
param - The parameter object to remove
Throws:
java.lang.IllegalStateException - The object is locked and cannot be changed

getParameter

public C3DParameter getParameter(java.lang.String name)
Get a parameter description based on the name string. If there is not a matching description, this returns null. All parameter names are capitalised, so make sure that this name matches.

Parameters:
name - The name string to go looking for
Returns:
The C3DParameter instance matching the name, or null

getParameters

public C3DParameter[] getParameters()
Get all of the parameters for this group.

Returns:
A new array containing all the parameter objects

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org