net.sf.magicproject.clickable.ability
Enum Optimization

java.lang.Object
  extended by java.lang.Enum<Optimization>
      extended by net.sf.magicproject.clickable.ability.Optimization
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Optimization>

public enum Optimization
extends java.lang.Enum<Optimization>

Since:
0.91
Author:
Fabrice Daugan

Enum Constant Summary
action
          Same ability is added only once per action.
choice
          Ability is added to the TBZ but during the resolution a prompt asks to controller only one ability to be added to the stack.
context
          An ability is not added in the TBZ if the last ability is the same.
event
          Same ability is added only once per ability triggering this event.
first
          The ability would not be added if it already exists in the TBZ.
follow
          An ability is not added in the TBZ if the last ability is the same.
last
          The ability would replace any existing ability in the TBZ.
none
          no optimization is done.
 
Method Summary
 boolean addTo(Ability ability, ContextEventListener context, java.util.List<TriggeredCard> where)
          Add the specified ability to the TBZ.
static Optimization valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Optimization[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 void write(java.io.OutputStream out)
          Wrtite this enum to the given outputstream.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

none

public static final Optimization none
no optimization is done.


follow

public static final Optimization follow
An ability is not added in the TBZ if the last ability is the same. Only ability is compared, the context is ignored.


first

public static final Optimization first
The ability would not be added if it already exists in the TBZ.


last

public static final Optimization last
The ability would replace any existing ability in the TBZ.


action

public static final Optimization action
Same ability is added only once per action. This important for LoopingAction.


choice

public static final Optimization choice
Ability is added to the TBZ but during the resolution a prompt asks to controller only one ability to be added to the stack.


event

public static final Optimization event
Same ability is added only once per ability triggering this event.


context

public static final Optimization context
An ability is not added in the TBZ if the last ability is the same. Ability and context are compared.

Method Detail

values

public static Optimization[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Optimization c : Optimization.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Optimization valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

addTo

public boolean addTo(Ability ability,
                     ContextEventListener context,
                     java.util.List<TriggeredCard> where)
Add the specified ability to the TBZ.

Parameters:
ability - the ability to add
context - the attached context
where - the list where the constructed triggered card would be added
Returns:
true if the specified ability has been added

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Wrtite this enum to the given outputstream.

Parameters:
out - the stream ths enum would be written.
Throws:
java.io.IOException


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