HybridList interface description


HybridList nodes hierarchy:

 

class HLNode
		HLNode();
boolean 	IsBiggerThan (HLNode node,int sort_variable); 	//compare function to overload
boolean 	IsSmallerThan (HLNode node,int sort_variable);	//compare function to overload
boolean 	IsEqualTo (HLNode node,int sort_variable);		//compare function to overload
int 		CompareTo (int sort_variable, long long_val, double double_val,
							String string_val,boolean ignore_case); //compare function to overload
void 		setNextNode (HLNode node,int sort_variable); 	//
HLNode 	getNextNode (int sort_variable);
void 		setPrevNode (HLNode node,int sort_variable);
HLNode 	getPrevNode (int sort_variable);
};

Abstract class HLNode declares above functions. His subclasses (SimpleHLNode, MultiParamHLNode, etc) overload some functions used for navigation (get/setNext, get/setPrev) but these classes are still abstract because compare functions are still not defined.

User class should be subclass of some type of node  (SimpleHLNode, MultiParamHLNode, etc) and it should define compare functions.


Short description of HybridList functions:

class HybridList 
	//constants:
	static public int ASCENT=0;		//constant to set ascending order
	static public int DESCENT=1;		//constant to set descending order
	//constructors:
	HybridList(); 				//default constructor ascending order, sort_param = 0
	HybridList(int sorttype); 		//sort_param = 0
	HybridList(int sorttype,int sort_variable); //extended version of constructor
	//info functions:
	int 		getNumber(); 		// returns  number of nodes in the list
	//insert, remove:
	boolean 	Insert (HLNode node); 	//inserts node in the list
	boolean 	Remove (HLNode node); 	//removes nodes from the list
	void 		RemoveAll (); 		//removes all nodes from the list
	HLNode 		RemoveHead ();		//removes first node
	//find functions:
	HLNode 		Find (HLNode node);	//returns first node which is equal to the sample
	HLNode 		FindSimilar (HLNode node);//returns first node which is similar to the sample
	//find long:
	HLNode 		Find (long long_val); 	//searches node by long value
	HLNode 		FindSimilar (long long_val);//searches node by long value
	//find double:
	HLNode 		Find (double double_val);//searches node by double value
	HLNode 		FindSimilar (double double_val);//searches node by double value
	//find string:
	HLNode 		Find (String string_val,boolean ignore_case);//searches node by String value
	HLNode 		FindSimilar (String string_val,boolean ignore_case);//searches node by String value
	//navigation:
	HLNode 		getHead ();		//returns first node of the list
	HLNode 		getNext (HLNode node);	//returns next node
	HLNode 		getPrev (HLNode node);	//returns previous node (works only with double-linked nodes)
	

 Source code:

HLNode.java, SimpleHLNode.java, SimpleHLNode_DL.java, MultiParamHLNode.java, MultiParamHLNode_DL.java