Esempio n. 1
0
/**
 * this method searches the nodes in the list to find one with the same jobid as the passed in value
 */
NodePtr search(const ListPtr list, const void * searchFor)
{
	if (list == NULL )
		return NULL ;
	if (list->size < 0 || (list->head != NULL && list->head->data == NULL) || (list->tail != NULL && list->tail->data == NULL))
		return NULL;
	if (list ->size == 0 && list->head == NULL && list->tail ==NULL)
		return NULL;
	if (searchFor == NULL)
		return NULL;

	NodePtr temp = list->head;
	while (temp != NULL ) {
		if (list->compareTo(searchFor, temp->data))
			return temp;
		else
			temp = temp->next;
	}
	return NULL;
}
Esempio n. 2
0
NodePtr search(ListPtr list, const void * o) {
	NodePtr tempNode;
	if (list == NULL ) {
		return NULL ;
	}
	if (list->head == NULL ) {
		return NULL ;
	}
	tempNode = list->head;
	while (tempNode->next) {


		if (list->compareTo(( void *)o,( void *)tempNode->obj)==0) {
			return tempNode;

		}
		tempNode = tempNode->next;
	}

	return NULL ;
}