edu.isi.pegasus.planner.partitioner.graph

## Class LabelBag

- java.lang.Object
- - edu.isi.pegasus.planner.partitioner.graph.LabelBag

All Implemented Interfaces:
  Bag

    public class LabelBag
    extends java.lang.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$
Author:
  Karan Vahi

### Field Summary

Fields
`static java.lang.String` `LABEL_KEY` The default key that is associated with label.
`private java.lang.Object` `mPartitionID` The value for the partition key.
`private java.lang.Object` `mValue` The value for the Label.
`static java.lang.String` `PARTITION_KEY` The key that designates the partition to which a node belongs to.

### Constructor Summary

Constructors
Constructor and Description
`LabelBag()` The default constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`boolean` `add(java.lang.Object key, java.lang.Object value)` Adds an object to the underlying bag corresponding to a particular key.
`boolean` `containsKey(java.lang.Object key)` Returns true if the namespace contains a mapping for the specified key.
`java.lang.Object` `get(java.lang.Object key)` Returns an objects corresponding to the key passed.
`static void` `setLabelKey(java.lang.String key)` Sets the label key that is to be associated with the bag.
`java.lang.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 java.lang.String LABEL_KEY

The default key that is associated with label.

#### PARTITION_KEY

    public static final java.lang.String PARTITION_KEY

The key that designates the partition to which a node belongs to.

See Also:
  Constant Field Values

#### mValue

    private java.lang.Object mValue

The value for the Label.

#### mPartitionID

    private java.lang.Object mPartitionID

The value for the partition key.

### Constructor Detail

#### LabelBag

    public LabelBag()

The default constructor.

### Method Detail

#### setLabelKey

    public static void setLabelKey(java.lang.String key)

Sets the label key that is to be associated with the bag.

#### get

    public java.lang.Object get(java.lang.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(java.lang.Object key,
                       java.lang.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(java.lang.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 java.lang.String toString()

Returns a textual description of the Bag.

Overrides:
  `toString` in class `java.lang.Object`
Returns:
  String