edu.isi.pegasus.planner.partitioner.graph
Class LabelBag

java.lang.Object
  extended by edu.isi.pegasus.planner.partitioner.graph.LabelBag
All Implemented Interfaces:
Bag

public class LabelBag
extends Object
implements Bag

A bag implementation that just holds a particular value for the label key. This bag implements just contains one object, and a null value is associated by default with the label.

Version:
$Revision: 2576 $
Author:
Karan Vahi

Field Summary
static String LABEL_KEY
          The default key that is associated with label.
private  Object mPartitionID
          The value for the partition key.
private  Object mValue
          The value for the Label.
static String PARTITION_KEY
          The key that designates the partition to which a node belongs to.
 
Constructor Summary
LabelBag()
          The default constructor.
 
Method Summary
 boolean add(Object key, Object value)
          Adds an object to the underlying bag corresponding to a particular key.
 boolean containsKey(Object key)
          Returns true if the namespace contains a mapping for the specified key.
 Object get(Object key)
          Returns an objects corresponding to the key passed.
static void setLabelKey(String key)
          Sets the label key that is to be associated with the bag.
 String toString()
          Returns a textual description of the Bag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LABEL_KEY

public static String LABEL_KEY
The default key that is associated with label.


PARTITION_KEY

public static final String PARTITION_KEY
The key that designates the partition to which a node belongs to.

See Also:
Constant Field Values

mValue

private Object mValue
The value for the Label.


mPartitionID

private Object mPartitionID
The value for the partition key.

Constructor Detail

LabelBag

public LabelBag()
The default constructor.

Method Detail

setLabelKey

public static void setLabelKey(String key)
Sets the label key that is to be associated with the bag.


get

public Object get(Object key)
Returns an objects corresponding to the key passed.

Specified by:
get in interface Bag
Parameters:
key - the key corresponding to which the objects need to be returned.
Returns:
the object that is found corresponding to the key or null.

add

public boolean add(Object key,
                   Object value)
Adds an object to the underlying bag corresponding to a particular key.

Specified by:
add in interface Bag
Parameters:
key - the key with which the value has to be associated.
value - the value to be associated with the key.
Returns:
boolean indicating if insertion was successful.

containsKey

public boolean containsKey(Object key)
Returns true if the namespace contains a mapping for the specified key. More formally, returns true if and only if this map contains at a mapping for a key k such that (key==null ? k==null : key.equals(k)). (There can be at most one such mapping.)

Specified by:
containsKey in interface Bag
Parameters:
key - The key that you want to search for in the bag.

toString

public String toString()
Returns a textual description of the Bag.

Overrides:
toString in class Object
Returns:
String


Copyright © 2011 The University of Southern California. All Rights Reserved.