All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dlib.NamedObject

java.lang.Object
   |
   +----dlib.BaseObject
           |
           +----dlib.NamedObject

public class NamedObject
extends BaseObject
NamedObject is a simple extension to BaseObject, it has a user-supplied name. That name will appear whenever the object is printed, so you'll see # instead of # You will thank yourself if you use static variables derived from NamedObject instead of integers as "Enum" replacements

for example:

 	class Cases extends NamedObject
 	{ public static final NormalCase = new Cases("normal");
 	  public static final Othercase = new Cases("unusual");
 	  public Cases(String name) { super(name); }
 	}
 

then, in your code
 	class Foo implements Cases
 	{
 	 public test(Cases thiscase)
 	 { if(thiscase == NormalCase) return(true) else return(false);
 	 }
 	}
 

the only downside of this is that you can't use "switch" statements on Cases


Variable Index

 o name

Constructor Index

 o NamedObject()
 o NamedObject(String)

Method Index

 o getName()
implement the getName method for all objects based on BaseObject, so other methods can use getName without worrying if the target implements the method.

Variables

 o name
 public String name

Constructors

 o NamedObject
 public NamedObject()
 o NamedObject
 public NamedObject(String name)

Methods

 o getName
 public String getName()
implement the getName method for all objects based on BaseObject, so other methods can use getName without worrying if the target implements the method.

Overrides:
getName in class BaseObject

All Packages  Class Hierarchy  This Package  Previous  Next  Index