wyvern.lib.properties.materials
Class Material

java.lang.Object
  extended bywyvern.lib.properties.materials.Material
Direct Known Subclasses:
Fire, Metal, Organic, Plastic, Soil, Stone, Water

public class Material
extends java.lang.Object

Superclass of all physical materials.

Version:
1.0, Oct 17, 1999
Author:
Steve Yegge

Field Summary
protected  java.lang.String desc_
           
protected  int phase_
           
 
Constructor Summary
Material()
          Constructs a new Material
Material(java.lang.String name)
          Constructs a new Material with the specified name.
 
Method Summary
static Material createMaterial(java.lang.Class c, java.lang.String name)
          Creates a material of the specified class with the specified description.
 boolean equals(java.lang.Object ob)
          Returns true if the materials are considered equal.
 java.lang.String getDescription()
          Gets the sub-description of this material.
 int getPhase()
          Gets the phase (solid, liquid, gas).
 void setDescription(java.lang.String desc)
          Sets the short description for the object.
 void setPhase(int phase)
          Sets the phase (solid, liquid, gas).
 java.lang.String toString()
          Returns string name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

phase_

protected int phase_

desc_

protected java.lang.String desc_
Constructor Detail

Material

public Material()
Constructs a new Material


Material

public Material(java.lang.String name)
Constructs a new Material with the specified name.

Parameters:
name - the material name, e.g. "jello".
Method Detail

createMaterial

public static Material createMaterial(java.lang.Class c,
                                      java.lang.String name)
Creates a material of the specified class with the specified description.

Parameters:
c - the Material class
name - the description
Returns:
the new material
Throws:
java.lang.IllegalArgumentException - if class isn't derived from Material.class

getPhase

public int getPhase()
Gets the phase (solid, liquid, gas).


setPhase

public void setPhase(int phase)
Sets the phase (solid, liquid, gas).


getDescription

public java.lang.String getDescription()
Gets the sub-description of this material. For instance, Bamboo is just Wood with the description "bamboo".

Returns:
a short description or name for the material

setDescription

public void setDescription(java.lang.String desc)
Sets the short description for the object.

Parameters:
desc - the new short description.

equals

public boolean equals(java.lang.Object ob)
Returns true if the materials are considered equal. Note that this may cause strange behavior if materials are placed in a java.util.SortedMap or SortedSet.

Returns:
true if we're materially equal to ob

toString

public java.lang.String toString()
Returns string name.