org.xith3d.physics.simulation
Class SurfaceParameters

java.lang.Object
  extended by org.xith3d.physics.simulation.SurfaceParameters

public abstract class SurfaceParameters
extends java.lang.Object

This class contains parameters used when solving collision constraints. It's implemented using a HashMap, because not all physics engines use the same surface parameters :). Physics engine developer, if you implement the XPAL interfaces, you should tell in your documentation which surface parameters you accept, which type they are and what do they correspond to. PLEASE BE CLEAR ABOUT THAT. Think about your users. The supported parameters can also pe programmatically read through the getAvailableParameters() method and additional info is returned by the getParameterInfo(String) method.

See Also:
SimulationWorld.resolveCollision(org.xith3d.physics.collision.Collision, Body, Body, SurfaceParameters)

Constructor Summary
protected SurfaceParameters(java.util.HashMap<java.lang.String,java.lang.Object> defaultParamers, java.lang.String[] paramStrings, java.lang.Object[] paramValues)
          Creates a new SurfaceParameters with specified params.
 
Method Summary
 void dumpAvailableParameters()
          This method simply dumps all available parameter names.
 void dumpParameterInfo()
          This method dumps the result of getParameterInfo(String) for each available parameter.
 java.lang.String[] getAvailableParameters()
           
 boolean getBooleanParameter(java.lang.String paramName)
          Gets a boolean parameter from the HashMap.
 float getFloatParameter(java.lang.String paramName)
          Gets a float parameter from the HashMap.
 java.lang.Object getParameter(java.lang.String paramName)
          Gets a parameter as an Object.
abstract  java.lang.String getParameterInfo(java.lang.String paramName)
          This method returns info about the given parameter's type and supported values.
 boolean isParamAvailable(java.lang.String paramName)
           
 boolean isParameterSet(java.lang.String paramName)
           
 void resetParameter(java.lang.String paramName)
          Resets the given parameter to its default value.
 void setParameter(java.lang.String paramName, java.lang.Object paramValue)
          Sets a parameter's value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SurfaceParameters

protected SurfaceParameters(java.util.HashMap<java.lang.String,java.lang.Object> defaultParamers,
                            java.lang.String[] paramStrings,
                            java.lang.Object[] paramValues)
Creates a new SurfaceParameters with specified params.

Parameters:
defaultParamers - the default parameters set by teh implementation
paramStrings - the param strings to be specified, e.g. "mu" or "bounce"
paramValues - the values of the params to be specified, e.g. ".1f" or "true" In order to know which params are valid, you should consult the documentation of the XPAL implementation of your physic engine.
See Also:
setParameter(String, Object)
Method Detail

getAvailableParameters

public final java.lang.String[] getAvailableParameters()
Returns:
an array filled with all the available parameter names for the current implementation.
See Also:
getParameterInfo(String), dumpAvailableParameters()

dumpAvailableParameters

public final void dumpAvailableParameters()
This method simply dumps all available parameter names.

See Also:
getAvailableParameters(), getParameterInfo(String), dumpParameterInfo()

getParameterInfo

public abstract java.lang.String getParameterInfo(java.lang.String paramName)
This method returns info about the given parameter's type and supported values.

Parameters:
paramName -
Returns:
parameter info
See Also:
getAvailableParameters(), dumpParameterInfo()

dumpParameterInfo

public final void dumpParameterInfo()
This method dumps the result of getParameterInfo(String) for each available parameter.

See Also:
getAvailableParameters()

isParamAvailable

public final boolean isParamAvailable(java.lang.String paramName)
Parameters:
paramName -
Returns:
true, if the queried parameter is available.

setParameter

public void setParameter(java.lang.String paramName,
                         java.lang.Object paramValue)
Sets a parameter's value.

Parameters:
paramName - the parameter's name to be specified, e.g. "mu" or "bounce"
paramValue - the values of the params to be specified, e.g. "0.1f" or "true"
See Also:
getAvailableParameters()

resetParameter

public void resetParameter(java.lang.String paramName)
Resets the given parameter to its default value.

Parameters:
paramName - the parameter's name to be resetted
See Also:
getAvailableParameters()

getParameter

public final java.lang.Object getParameter(java.lang.String paramName)
Gets a parameter as an Object. (you should cast it to whatever it actually is.)

Parameters:
paramName - the name of the requested parameter
Returns:
The parameter value

isParameterSet

public final boolean isParameterSet(java.lang.String paramName)
Parameters:
paramName -
Returns:
true, if the erquested parameter has been set (and not been reset).

getFloatParameter

public final float getFloatParameter(java.lang.String paramName)
Gets a float parameter from the HashMap.

Parameters:
paramName - the name of the requested parameter
Returns:
The parameter value

getBooleanParameter

public final boolean getBooleanParameter(java.lang.String paramName)
Gets a boolean parameter from the HashMap.

Parameters:
paramName - the name of the requested parameter
Returns:
The parameter value