/************************************************************************
* $Id: DList.java,v 1.1.1.1 2000/03/29 22:58:14 kkeys Exp $
*
* DList
* version 1.0 beta
*************************************************************************
/***********************************************************************
By accessing this software, DLIST, you are duly informed of and
agree to be bound by the conditions described below in this notice:
This software product, DLIST, is developed by Bradley Huffaker, and
Jaeyeon Jung copyrighted(C) 1998 by the University of California,
San Diego (UCSD), with all rights reserved. UCSD administers the NLANR
Cache grants, NCR-9796082 and NCR-9616602, under which most of this code
was developed.
There is no charge for DLIST software. You can redistribute it and/or
modify it under the terms of the GNU General Public License, v. 2 dated
June 1991 which is incorporated by reference herein. DLIST is
distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that the use of
it will not infringe on any third party's intellectual property
rights.
You should have received a copy of the GNU GPL along with the DLIST
program. Copies can also be obtained from
http://www.gnu.org/copyleft/gpl.html or by writing to
University of California, San Diego
SDSC/CAIDA/NLANR
9500 Gilman Dr., MS-0505
La Jolla, CA 92093 - 0505 USA
Or contact INFO@NLANR.NET
**************************************************************************/
package bhuffake.plankton;
import java.awt.*;
/** DNode *******************************************
* Helper class to DList. Used to store the data
*****************************************************/
class DNode
{
public DisplayObject value;
public DNode next;
public DNode(DisplayObject val)
{
value = val;
next = null;
}
}
/** DList *******************************************
* This code has been Modifed to Work with
* plankton.
*
* A linked list that has many of the standard
* linked list member functions clear, enqueue,
* push, pop, and empty. But also have a few of
* my own creation: where, reset, next, insert,
* and end. Which allow the user to edit/view
* list with out destory it.
*****************************************************/
public class DList
{
DNode first;
DNode tail;
DNode before;
DNode where;
boolean constant = false;
/** DList() *******************************************
* Default Constructor.
*****************************************************/
public DList()
{
where=before=tail = first = null;
}
/** DList(DList list) *****************************
* Copy constructor. Create new list with same
* values.
*****************************************************/
public DList(DList list)
{
if (list.first == null)
{
tail = first = null;
return;
}
tail = first =new DNode(list.first.value);
tail.next = null;
DNode his = list.first.next;
tail = first;
while (his != null)
{
tail.next = new DNode(his.value);
tail = tail.next;
his = his.next;
}
reset();
}
/** DList() **************************************
* Gives a new DList with its own where pointer
* that points to the same linked list
**************************************************/
synchronized DList DList()
{
DList dlist = new DList();
dlist.first = first;
dlist.tail = tail;
dlist.constant = false;
return dlist;
}
/** clear() *****************************************
* Removes all nodes from the list. Notes that
* because java does all the garabage collection
* Simple making is so all nodes point to null
* is same thing.
*****************************************************/
synchronized public void clear()
{
if (constant)
return;
where = before= tail = first = null;
}
/** add(DisplayObject value) ********************************
* Adds the value in to the list sorting it with the less
* operator.
*****************************************************/
synchronized public void add(DisplayObject value)
{
if (constant)
return;
DNode temp = new DNode(value);
if (first == null)
{
tail = first = temp;
first.next = null;
return;
}
if (first.value.greater(value))
{
temp.next = first;
first = temp;
}
else
{
DNode current = first;
while (current.next != null
&& value.greater(current.next.value))
current = current.next;
temp.next = current.next;
current.next = temp;
}
if (temp.next == null)
tail = temp;
if (temp.next == where)
before = temp;
}
/** push(DisplayObject value) ********************************
* Adds the value to the front of the list.
* This is modified to use the less then operator to
* sort the DList.
*****************************************************/
synchronized public void push(DisplayObject value)
{
if (constant)
return;
DNode temp = new DNode(value);
if (first == null)
{
tail = first = temp;
first.next = null;
return;
}
temp.next = first;
first = temp;
temp = null;
}
/** enqueue(DisplayObject value) ****************************
* Stores value in a node at the end of the link
* list.
*****************************************************/
synchronized public void enqueue(DisplayObject value)
{
if (constant)
return;
DNode temp = new DNode(value);
if (first == null)
{
tail = first = temp;
first.next = null;
return;
}
tail.next = temp;
tail = tail.next;
tail.next = null;
}
/** top() *******************************************
* Returns the value of the top node or null
* if there are no nodes.
*****************************************************/
synchronized public DisplayObject top ()
{
if (first != null)
return first.value;
else
return null;
}
/** pop() *******************************************
* Removes the top node and then returns
* the value it contrained.
*****************************************************/
synchronized public DisplayObject pop ()
{
if (first == null)
return null;
if (first == where)
where = first.next;
DisplayObject value = first.value;
first = first.next;
return value;
}
/** empty() *****************************************
* Checks to see if the list has any nodes. Returns
* true if it does else false.
*****************************************************/
synchronized public boolean empty()
{
return (first == null);
}
/** exists(DisplayObject value) *****************************
* Returns true if value is contained in the link
* list and false if it is not found.
*****************************************************/
synchronized public boolean exists(DisplayObject value)
{
DNode current = first;
while (current != null)
{
if (current.value == value)
return true;
current = current.next;
}
return false;
}
/** drop(DisplayObject value) ******************************
* Drop the first node in the list that contains
* the passed value.
*****************************************************/
synchronized public boolean drop(DisplayObject value)
{
if (constant)
return false;
DNode previous = first;
DNode current = first;
while (current != null)
{
if (current.value == value)
{
if (current == first)
{
previous = first = first.next;
}
else
previous.next = current.next;
if (before == current)
before = previous;
else if (where == current)
where = current.next;
if (current == tail)
tail = previous;
return true;
}
previous = current;
current = current.next;
}
return false;
}
/** count() *******************************************
* Returns the number of nodes currently in linked
* list.
*****************************************************/
synchronized public int count()
{
int count = 0;
DNode current = first;
while(current != null)
{
count++;
current = current.next;
}
return count;
}
/** where() *******************************************
* Returns the value stored in the where pointer.
* returns null if the where pointer is null.
*****************************************************/
synchronized public DisplayObject where()
{
if (where != null)
return where.value;
else
return null;
}
/** next() ******************************************
* Moves the where pointer to the next node in the
* link and returns the value that was stored in the
* current node, before the move.
*****************************************************/
synchronized public DisplayObject next()
{
if (where == null)
return null;
DisplayObject temp = where.value;
before = where;
where = where.next;
return temp;
}
/** remove() ****************************************
* Removes the node that where is pointing to.
* Then returns the value that was stored in the
* where pointer.
*****************************************************/
synchronized public DisplayObject remove()
{
if (constant)
return null;
if (where == null)
return null;
if (before == null)
first = first.next;
DNode temp = where;
before.next = where.next;
where = where.next;
return temp.value;
}
/** insert(DisplayObject value) ****************************
* Inserts a value into the linked list just ahead
* of the location of the where pointer.
*****************************************************/
synchronized public void insert(DisplayObject value)
{
if (constant)
return;
DNode node = new DNode (value);
if (before == null)
{
node.next = first;
first = node;
}
else
{
node.next = before.next;
before.next = node;
}
where = node;
}
/** reset() *****************************************
* Reset the where pointer to the beginnen of
* Of the linked list. Used to start a next
* Loop
*****************************************************/
synchronized public void reset()
{
before = null;
where = first;
}
/** end() *******************************************
* Notes where the where pointer reaches the end
* of the list. Used as the boolean statment
* when interating throught the loop with next
*****************************************************/
synchronized public boolean end()
{
return (where == null);
}
/** String print() **********************************
* Returns a string which is a close representaion
* of where the major nodes are
* f= first
* t = tail
* b = before
* w = where
******************************************************/
synchronized public String print()
{
DNode current = first;
String answer = "[";
while (current != null)
{
if (current == first)
answer = answer + "f";
if (current == before)
answer = answer + "b";
if (current == where)
answer = answer + "w";
if (current == tail)
answer = answer + "t";
answer = answer + ",";
current = current.next;
}
if (where == null)
answer = answer + "w";
answer = answer + "]";
return answer;
}
}
"They are called 'sampans,'" Doctor Bronson explained, "and are made entirety of wood. Of late years the Japanese sometimes use copper or iron nails for fastenings; but formerly you found them without a particle of metal about them." "And I am afraid I betrayed the fact," Bruce admitted. "I might have thought of some other way of accounting for my presence here. Still, that rather piratical-looking young man seemed to think you had done right. What's this about some man picked up in the garden?" CHAPTER LII. THE CAGE IS OPENED. Third. Combination machines can only be employed with success when one attendant performs all the operations, and when the change from one to another requires but little adjustment and re-arrangement. When their train approached ours they looked out of the windows, or opened the doors, and waved and greeted and shouted at the top of their voices. me in the cab, he told me that for three days they gave you up. of mind is gone for ever--but anyway, I never cared much for just Two legs waved over the last cockpit place. She waited, too, made silent by sudden realization of how futile anything that she might say would be. "I am glad to see you again," she faltered; "it is four years since Black River and the cloud-burst." She was angry at her own stupidity and want of resource, and her tone was more casual than she meant it to be. The result of this division shook the last resistance of Walpole. When the motion which had been rejected on the 18th of December—for copies of the correspondence with the King of Prussia—was again put, he made no opposition, and it[79] passed without a division. He made, however, one more attempt to carry his measures. In the disputed election of Chippenham he stood his ground against the petition, and was defeated by a majority of one. It was now clear to himself that he must give way. His relatives and friends assured him that to defer longer was only to court more decided discomfiture. On the 31st of January, he, therefore, prepared to depart for his seat at Houghton, and the next morning he demanded of the king, in a private audience, leave to retire. George, on this occasion, evinced a degree of feeling that did him honour. When the old Minister who had served him through so long a course of years knelt to kiss hands, the king embraced him, shed tears, and begged that he would often come to see him. On the 9th of February Sir Robert was created Earl of Orford, and on the 11th he made a formal resignation of all his places. "I'll chance it," said Alf desperately, reaching for the cup of coffee. "I'm sure it'll be better for me to eat something." "They d?an't care, nuther—it's only me." "Wipe the blood off his face." There was silence, in which a coal fell. She still stood with her arms outstretched; he knew that she was calling him—as no woman had ever called him—with all that of herself which was in his heart, part of his own being. HoME免费一1一级做爰片在线观看
ENTER NUMBET 0018www.silanmc.com.cn
www.kmfths.com.cn
www.138zg.com.cn
www.cqcq09.com.cn
www.77ebuy.com.cn
lctpk.com.cn
www.ghdjhs.com.cn
lnxld.com.cn
bjgpbg.com.cn
www.openteam.com.cn