net.sf.magicproject.modifier
Class Modifier

java.lang.Object
  extended by net.sf.magicproject.modifier.Modifier
All Implemented Interfaces:
ObjectModifier, Unregisterable
Direct Known Subclasses:
AbilityModifier, AdditionalCostModifier, ColorModifier, ControllerModifier, IdCardModifier, PlayableZoneModifier, PropertyModifier, RegisterIndirection, RegisterModifier, StaticModifier

public abstract class Modifier
extends java.lang.Object
implements Unregisterable, ObjectModifier

Author:
Fabrice Daugan

Field Summary
 int layer
          is the strategy used to add this modifier within the existing chain.
 Modifier next
          The next modifier
 
Method Summary
 Modifier addModifier(Modifier modifier)
          Add a modifier to the end of the modifier chain.
 MCard getCard()
          Return the card creating or owning this object.
 int getNbObjects(java.lang.String objectName, Test objectTest)
          Return occurences number of the given object with the given name.
 int paintObject(java.awt.Graphics g, int startX, int startY)
          Paint all objects of the given MCard component.
abstract  void refresh()
          Refresh this modifier following the whileCondition.
 void removeFromManager()
          Remove from the event manager this listener.
 Modifier removeObject(java.lang.String objectName, Test objectTest)
          remove from the manager a occurence of object with the specified name
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

next

public Modifier next
The next modifier


layer

public int layer
is the strategy used to add this modifier within the existing chain.

Method Detail

paintObject

public int paintObject(java.awt.Graphics g,
                       int startX,
                       int startY)
Description copied from interface: ObjectModifier
Paint all objects of the given MCard component.

Specified by:
paintObject in interface ObjectModifier
Parameters:
g - the graphics used ot paint this object.
startX - the x position where this object can be paint.
startY - the y position where this object can be paint.
Returns:
the next free object position.

addModifier

public final Modifier addModifier(Modifier modifier)
Add a modifier to the end of the modifier chain. The current modifier stays the first modifier of this chain.

Parameters:
modifier - the property modifier to add.
Returns:
the new chain.

refresh

public abstract void refresh()
Refresh this modifier following the whileCondition.


getNbObjects

public int getNbObjects(java.lang.String objectName,
                        Test objectTest)
Description copied from interface: ObjectModifier
Return occurences number of the given object with the given name.

Specified by:
getNbObjects in interface ObjectModifier
Parameters:
objectName - the object's name to find within this chain.
objectTest - The test applied on specific modifier to be removed.
Returns:
occurences number of the given object with the given name.

removeObject

public Modifier removeObject(java.lang.String objectName,
                             Test objectTest)
Description copied from interface: ObjectModifier
remove from the manager a occurence of object with the specified name

Specified by:
removeObject in interface ObjectModifier
Parameters:
objectName - the object's name to remove
objectTest - The test applied on specific modifier to be removed.
Returns:
the new chain

removeFromManager

public void removeFromManager()
Description copied from interface: Unregisterable
Remove from the event manager this listener.

Specified by:
removeFromManager in interface Unregisterable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getCard

public MCard getCard()
Description copied from interface: Unregisterable
Return the card creating or owning this object.

Specified by:
getCard in interface Unregisterable
Returns:
the card creating or owning this object.


Copyright © 2003-2007 Magic-Project. All Rights Reserved.