/*****************************************************************************/
/* File name: DirPathHashtable.java                                          */
/* Purpose: to keep HostNameHashtable objects according                      */
/*          to the dirPath key of their mountEntries                         */
/*                                                                           */
/* Last modified: 23.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General */
/* Public License for more details.                                          */
/*                                                                           */
/* This software is distributed under the terms                              */
/* of the GNU General Public License as published                            */
/* by the Free Software Foundation; either version 2, or (at your option)    */
/* any later version.                                                        */
/* See file COPYING for your rights (GNU GPL)                                */
/*****************************************************************************/


package mount;


import java.util.*;


public
class

DirPathHashtable
                  extends Hashtable
{

  private final static String RCSID = "$Header: /d/NFS/mount/RCS/DirPathHashtable.java,v 1.2 1999/06/23 17:37:03 vklimov Exp $";


  public

  DirPathHashtable()
/*****************************************************************************/
/* Function name: DirPathHashtable                                           */
/* File name: DirPathHashtable.java                                          */
/* Purpose: constructor for the DirPathHashtable class                       */
/* Parameters:                                                               */
/* Returns:                                                                  */
/* Last modified: 14.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
                                                    /* DirPathHashtable */
/*---------------------------------------------------------------------------*/

    }
/*end of DirPathHashtable*/


  public
  int

  hashCode()
/*****************************************************************************/
/* Function name: hashCode                                                   */
/* File name: DirPathHashtable.java                                          */
/* Purpose: to return hash code (based on dirPath of mountEntry contained    */
/*          in HostNameHashtable object)                                     */
/* Parameters:                                                               */
/* Returns: the hash code                                                    */
/* Last modified: 14.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
      int result;
      Enumeration elements;
      HostNameHashtable hostNameHashtable;
      Entry mountEntry;
                                                           /* hashCode */
/*---------------------------------------------------------------------------*/

      if (isEmpty())
        return Constants.HASHCODE_FOR_EMPTY;                /* return ! */
      else
        ;
    /*end of if*/

      elements = elements();

      hostNameHashtable = (HostNameHashtable) elements.nextElement();
      elements = hostNameHashtable.elements();

      mountEntry = (Entry) elements.nextElement();

      result = mountEntry.hashCode();

      return result;

    }
/*end of hashCode*/


  public
  boolean

  equals( DirPathHashtable dirPathHashtable )
/*****************************************************************************/
/* Function name: equals                                                     */
/* File name: DirPathHashtable.java                                          */
/* Purpose: to check whether this hashtable is equal to the argument         */
/*          the hashtables are equal if they contain HostNameHashtable       */
/*          objects,  that contain mountEntrys with the same dirPath         */
/* Parameters: dirPathHashtable                                              */
/* Returns: true - if the hashtables are equal, false - otherwise            */
/* Last modified: 23.06.99                                                   */
/* Author: Victor Klimov, 1999                                               */
/*****************************************************************************/
    {
      int result;
      Enumeration elements;
      Enumeration elementsArgument;
      HostNameHashtable hostNameHashtable;
      HostNameHashtable hostNameHashtableArgument;
      Entry mountEntry;
      Entry mountEntryArgument;
                                                           /* equals */
/*---------------------------------------------------------------------------*/

      if (isEmpty() &&
          dirPathHashtable.isEmpty() )
        return true;                                   /* return ! */
      else
        ;
    /*end of if*/

      elements = elements();
      elementsArgument = dirPathHashtable.elements();

      hostNameHashtable = (HostNameHashtable)
        elements.nextElement();
      hostNameHashtableArgument = (HostNameHashtable)
        elementsArgument.nextElement();

      elements = hostNameHashtable.elements();
      elementsArgument = hostNameHashtableArgument.elements();

      mountEntry = (Entry) elements.nextElement();
      mountEntryArgument = (Entry) elementsArgument.nextElement();

      if (mountEntry.getDirPath().equals(
            mountEntryArgument.getDirPath() )
         )
        return true;
      else
        return false;
    /*end of if*/

    }
/*end of equals*/


} /* end of DirPathHashtable class */

/*****************************************************************************/
/* End of file: DirPathHashtable.java                                        */
/*****************************************************************************/
