// adds a new node to the LLL with the account_info passed into the method public bool add_node(account_info new_account) { if (node_count < 1) // if there are no nodes in the LLL { next = new account_node(new_account); node_count += 1; return(true); } // if there are nodes in the LLL account_node temp = next; next = new account_node(new_account); next.set_an_next(temp); node_count += 1; return(true); }
// searches the LLL of accounts to see if the name_attempt already exists public bool search_list(string name_attempt) { if (node_count < 1) // no nodes in the list { return(false); } account_info temp; account_node temp_node = next; for (int i = 0; i < node_count; ++i) // loop to check each node in the list { temp = temp_node.get_current_account(); if (temp.check_email(name_attempt)) { found_account = temp_node; return(true); } temp_node = temp_node.go_next(); } return(false); }
// sets the next node to the set_next node passed into the method public bool set_an_next(account_node set_next) { next = set_next; return(true); }
// sets the previous node to the set_previous node passed into the method public bool set_an_previous(account_node set_previous) { previous = set_previous; return(true); }
private account_node previous; // the previous node in the LLL public account_node(account_info new_account) { current_account = new_account; next = null; previous = null; }