Class Bucket

java.lang.Object
org.grp1.model.Bucket
All Implemented Interfaces:
NodeChild

public class Bucket extends Object implements NodeChild
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final List<Address>
    The array of address inside of this bucket
    private final int
    The key corresponding to this bucket
  • Constructor Summary

    Constructors
    Constructor
    Description
    Bucket(int key)
    The constructor to instantiate the bucket object
    Bucket(int key, List<Address> arr)
    The constructor to instantiate the bucket object
  • Method Summary

    Modifier and Type
    Method
    Description
    The function to return the addressed inside of this bucket
    int
    The function to return the key of this bucket
    void
    insertAddress(Address newAddress)
    The function to insert the address inside bucket

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • arr

      private final List<Address> arr
      The array of address inside of this bucket
    • key

      private final int key
      The key corresponding to this bucket
  • Constructor Details

    • Bucket

      public Bucket(int key)
      The constructor to instantiate the bucket object
      Parameters:
      key - The key of the bucket
    • Bucket

      public Bucket(int key, List<Address> arr)
      The constructor to instantiate the bucket object
      Parameters:
      key - The key of the bucket
      arr - The list of address
  • Method Details

    • getKey

      public int getKey()
      The function to return the key of this bucket
      Specified by:
      getKey in interface NodeChild
      Returns:
      The key of the bucket
    • insertAddress

      public void insertAddress(Address newAddress)
      The function to insert the address inside bucket
      Parameters:
      newAddress - The address to be inserted inside of this bucket
    • getAddresses

      public List<Address> getAddresses()
      The function to return the addressed inside of this bucket
      Returns:
      The list of addresses of the bucket