
package hashmap;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

// student version

public class HashMap
{	
/* private instance variables
 * TO DO: declare an ArrayList called 'buckets'
 * What is stored in 'buckets'?  Each element of 'buckets' is an 
 * ArrayList of BankAccount objects.   
 * So 'buckets' is an ArrayList holding an ArrayList of BankAccounts  */

private int numSteps;

/* The constructor sets up the hash map
 * TO DO: use 'new' to allocate memory for 'buckets'
 * Set up a loop that runs 'bucketsLength' times
 * Each time it runs, it creates another ArrayList of BankAccounts
 * and adds that new ArrayList to 'buckets' */ 
public HashMap(int bucketsLength)
{
    
}

/* TO DO: Complete this method
 * This method returns null if the account is not located
 * This method can call the 'containsKey' method 
 * Recall that buckets.get(h) returns an ArrayList of BankAccount objects
 * that all have the same hashCode
 * You should keep track of how many steps this method takes
 * Specifically, if you set up a loop, increment 'numSteps'
 * inside the loop
 * The code to get the hashCode associated with a given ID is included
 */
public BankAccount get(String ID)
{
    numSteps = 0;
    // get the hashCode for the given ID:
    ID i = new ID(ID);
    int h = i.hashCode();
    
  
} // end get method

/* TO DO: Complete this method
 * This method tests for whether a given ID is being used in 'buckets'
 * Recall that buckets.get(h) returns an ArrayList of BankAccount objects
 * that all have the same hashCode
 * You should keep track of how many steps this method takes
 * Specifically, if you set up a loop, increment 'numSteps'
 * inside the loop
 * The code to get the hashCode associated with a given ID is included
 */
public boolean containsKey(String ID)
{	
        numSteps = 0;
	myID id = new myID(ID);
        int h = id.hashCode();
	
} // end containsKey method

/* TO DO: Complete this method
 * This method puts a BankAccount into the map
 * Since BankAccount ID's are unique, the method first
 * checks whether an account with the given ID is already
 * in the map.  
 * Recall that buckets.get(h) returns an ArrayList of BankAccount objects
 * that all have the same hashCode
 * You should keep track of how many steps this method takes
 * Specifically, if you set up a loop, increment 'numSteps'
 * inside the loop
 * The code to get the hashCode associated with a given ID is included
 * The method returns true if the account was successfully added
 * Returns false if not */
public boolean put(String ID, BankAccount x)
{       
        ID mm = new ID(ID);
	int h = mm.hashCode();
       	numSteps = 1;
	
} // end add method

/* TO DO: Complete this method
 * This method removes an account from the map.
 * It returns true if the remove was successful
 * It returns false if not
 * Recall that buckets.get(h) returns an ArrayList of BankAccount objects
 * that all have the same hashCode
 * You should keep track of how many steps this method takes
 * Specifically, if you set up a loop, increment 'numSteps'
 * inside the loop
 * The code to get the hashCode associated with a given ID is included
 */
public boolean remove(String ID)
{       
        ID ID2 = new ID(ID);
	int h = ID2.hashCode();
        numSteps = 1;
	
} // end remove method

public int getNumSteps()
{
    return numSteps;
}
 
// This method prints the contents of the map
public void printSet()
{
int size = 0;
for (ArrayList <BankAccount> list : buckets)
{   System.out.print("bucket " + size + ": ");
    for (BankAccount x : list)
    {   System.out.print(x.toString() + " ");	
    }
    size++;
    System.out.println();
}
} // end printSet()

} // end class
    