OGS Java API Spec

ogs.core
Class Feature

java.lang.Object
  |
  +--ogs.support.Object
        |
        +--ogs.core.Feature
All Implemented Interfaces:
EventListener
Direct Known Subclasses:
Alignment, Description, Domain, Feat, Gender, Quantity, Skill

public abstract class Feature
extends Object

A feature is an object that can be attached to another object. While attached, a feature may modify the object that it is attached to. These modifications must be reversible if and when the feature is detached from the object.


Field Summary
 
Fields inherited from class ogs.support.Object
listeners
 
Constructor Summary
protected Feature()
          Create a new feature.
 
Method Summary
 boolean attachObject(Object object)
          Attach this feature to an object.
protected  boolean canAttach(Object object)
          Determine if this feature can be attached to an object.
protected  boolean canDetach()
          Determine if this feature can be detached to an object.
 boolean detachObject()
          Detach this feature from an object.
 Object getObject()
          Determine the object that this feature is currently attached to.
 
Methods inherited from class ogs.support.Object
addListener, handleEvent, notifyListeners, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Feature

protected Feature()
Create a new feature. This constructor creates a feature that is not attached to any object.

Method Detail

canAttach

protected boolean canAttach(Object object)
Determine if this feature can be attached to an object. A feature can not be attached to itself or if it is already attached.

Parameters:
object - Object to attach this feature to.
Returns:
True if the feature is attached to the object.

attachObject

public boolean attachObject(Object object)
Attach this feature to an object. This method should always be called first by derived classes that override this method.

Parameters:
object - Object to attach this feature to.
Returns:
True if the feature is attached to the object.

canDetach

protected boolean canDetach()
Determine if this feature can be detached to an object.

Returns:
True if the feature is detached from the object.

detachObject

public boolean detachObject()
Detach this feature from an object. This method should always be called by derived classes that override this method.

Returns:
True if the feature is detached from the object.

getObject

public Object getObject()
Determine the object that this feature is currently attached to. If the feature is not currently attached to any object, this method returns null.

Returns:
Attached object or null if not attached.

OGS Java API Spec