Class NameValue

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable

    public class NameValue
    extends Data
    implements java.lang.Comparable
    The object of this class holds the name value pair. At present to be used for environment variables. Will be used more after integration of Spitfire.
    Version:
    $Revision$
    Author:
    Karan Vahi, Gaurang Mehta
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String name
      stores the name of the pair.
      private java.lang.String value
      stores the corresponding value to the name in the pair.
    • Constructor Summary

      Constructors 
      Constructor Description
      NameValue()
      the default constructor which initialises the class member variables.
      NameValue​(java.lang.String name, java.lang.String value)
      Initialises the class member variables to the values passed in the arguments.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Returns a copy of this object
      int compareTo​(java.lang.Object o)
      Implementation of the Comparable interface.
      java.lang.String getKey()
      Returns the key associated with this tuple.
      java.lang.String getValue()
      Returns the value associated with this tuple.
      void setKey​(java.lang.String key)
      Sets the key associated with this tuple.
      void setValue​(java.lang.String value)
      Sets the value associated with this tuple.
      java.lang.String toString()
      Writes out the contents of the class to a String in form suitable for displaying.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        private java.lang.String name
        stores the name of the pair.
      • value

        private java.lang.String value
        stores the corresponding value to the name in the pair.
    • Constructor Detail

      • NameValue

        public NameValue()
        the default constructor which initialises the class member variables.
      • NameValue

        public NameValue​(java.lang.String name,
                         java.lang.String value)
        Initialises the class member variables to the values passed in the arguments.
        Parameters:
        name - corresponds to the name in the NameValue pair.
        value - corresponds to the value for the name in the NameValue pair.
    • Method Detail

      • setKey

        public void setKey​(java.lang.String key)
        Sets the key associated with this tuple.
        Parameters:
        key - the key associated with the tuple.
      • setValue

        public void setValue​(java.lang.String value)
        Sets the value associated with this tuple.
        Parameters:
        value - the value associated with the tuple.
      • getKey

        public java.lang.String getKey()
        Returns the key associated with this tuple.
        Returns:
        the key associated with the tuple.
      • getValue

        public java.lang.String getValue()
        Returns the value associated with this tuple.
        Returns:
        value associated with the tuple.
      • clone

        public java.lang.Object clone()
        Returns a copy of this object
        Overrides:
        clone in class java.lang.Object
        Returns:
        object containing a cloned copy of the tuple.
      • toString

        public java.lang.String toString()
        Writes out the contents of the class to a String in form suitable for displaying.
        Specified by:
        toString in class Data
        Returns:
        the textual description.
      • compareTo

        public int compareTo​(java.lang.Object o)
        Implementation of the Comparable interface. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The NameValue are compared by their keys.
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        o - is the object to be compared
        Returns:
        a negative number, zero, or a positive number, if the object compared against is less than, equals or greater than this object.
        Throws:
        java.lang.ClassCastException - if the specified object's type prevents it from being compared to this Object.