csli.util.collections
Class DefaultSlotString

java.lang.Object
  extended by csli.util.collections.DefaultSlotString
All Implemented Interfaces:
SlotString

public class DefaultSlotString
extends Object
implements SlotString

Author:
Danilo Mirkovic

Constructor Summary
DefaultSlotString(String outputString)
           
 
Method Summary
 String get(int i)
          Returns the value for the i-th slot, null if none.
 String get(String slot)
          Returns the value for the slot with the given name.
 String getFilledString()
          Returns the string with slot values substituted in.
 String getOriginalString()
          Returns the original string with slot names, but no slot values.
 List getSlots()
           
 boolean isFilled()
           
 int numSlots()
           
 void set(int i, String value)
           
 void set(String slot, String value)
          Set the slot with the specific name to the value.
 void setAll(List valuesList)
          Set the values of all slots at once.
 String toString()
          Must be the same as getFilledString();
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultSlotString

public DefaultSlotString(String outputString)
Method Detail

getOriginalString

public String getOriginalString()
Description copied from interface: SlotString
Returns the original string with slot names, but no slot values. It is recommended that slot names are withing square brackets, but not required (may be inconvenient for some representations). e.g. "play [song]"

Specified by:
getOriginalString in interface SlotString

getFilledString

public String getFilledString()
Description copied from interface: SlotString
Returns the string with slot values substituted in. If some of the slot values are not specified, just returns [slotName] s instead. ([] brackets are recommended but not required).

Specified by:
getFilledString in interface SlotString

toString

public String toString()
Description copied from interface: SlotString
Must be the same as getFilledString();

Specified by:
toString in interface SlotString
Overrides:
toString in class Object

isFilled

public boolean isFilled()
Specified by:
isFilled in interface SlotString
Returns:
true if all slots are filled, false otherwise.

set

public void set(int i,
                String value)
Specified by:
set in interface SlotString

set

public void set(String slot,
                String value)
Description copied from interface: SlotString
Set the slot with the specific name to the value.

Specified by:
set in interface SlotString

get

public String get(int i)
Description copied from interface: SlotString
Returns the value for the i-th slot, null if none.

Specified by:
get in interface SlotString

get

public String get(String slot)
Description copied from interface: SlotString
Returns the value for the slot with the given name.

Specified by:
get in interface SlotString

setAll

public void setAll(List valuesList)
Description copied from interface: SlotString
Set the values of all slots at once.

Specified by:
setAll in interface SlotString

getSlots

public List getSlots()
Specified by:
getSlots in interface SlotString
Returns:
a list of slot names, in the same order as in originalString

numSlots

public int numSlots()
Specified by:
numSlots in interface SlotString
Returns:
number of slots in the slotString