- LinkedList.java [Project: CyberToolbox for WIN32] [Language: java] [LOC: 56]
class LinkedList {
LinkedListNode mHeaderNode;
public LinkedList () {
mHeaderNode = new LinkedListNode(true);
 | ...
![]() |
}
public void setRootNode(LinkedListNode obj) {
mHeaderNode = obj;
}
public LinkedListNode getRootNode () {
return mHeaderNode;
}
public LinkedListNode getNodes () {
return mHeaderNode.getNextNode();
}
public LinkedListNode getNode(int number) {
LinkedListNode node = getNodes();
for (int n=0; n<number && node != null; n++)
node = node.getNextNode();
return node;
}
public LinkedListNode getLastNode () {
LinkedListNode lastNode = mHeaderNode.getPrevNode();
if (lastNode.isHeaderNode())
return null;
else
return lastNode;
}
public int getNNodes() {
int n = 0;
for (LinkedListNode listNode = getRootNode(); listNode != null; listNode = listNode.getNextNode())
n++;
return n;
}
public void addNode(LinkedListNode node) {
node.insert(mHeaderNode.getPrevNode());
}
public void deleteNodes() {
LinkedListNode rootNode = getRootNode();
while (rootNode.getNextNode() != null) {
LinkedListNode nextNode = rootNode.getNextNode();
nextNode.remove();
|
|
}
}
}
|
- linkedlist.h [Project: orpheus] [Language: c++] [LOC: 77]
class linkedlist {
private:
struct flinkedlist {
void *data;
 | ...
![]() |
flinkedlist *next;
};
flinkedlist *flist;
int i;
public:
int count;
listfreeitem *freeitem;
// user defined function to free a list item
linkedlist();
~linkedlist();
void add(void *p);
// adds new element to the list
void insert(int n, void *p);
// inserts an element to n-th position
void sort(listcompare *compare);
// sorts the list
void remove(int n);
// removes an element number n from the list
void replace(int n, void *p);
// replaces n-th element value with new data
void empty();
// clears the list
void* at(int n);
// gets n-th element pointer from the list
void* find(void *p, listcompare *compare);
// returns a pointer to the element found equal to p
// with compare function
int findnum(void *p, listcompare *compare);
// the same as previous function, except for it
// returs a number, not pointer
void *foreach(listforeachfunc *exec, void *arg);
void* operator[] (int idx) {
|
|
return at(idx);
}
};
|
- LinkedList.java [Project: TuCSoN] [Language: java] [LOC: 85]
class LinkedList implements Serializable {
public Object head;
public LinkedList tail;
/** empty list */
 | ...
![]() |
public LinkedList() {
head = null;
tail = null;
}
/** list from head and tail */
public LinkedList(Object h,LinkedList t) {
head = h;
tail = t;
}
/** head insert */
public void insert(Object h) {
LinkedList t = new LinkedList(head,tail);
head = h;
tail = t;
}
/** tail insert */
public void append(Object h) {
LinkedList l = this;
while(l.tail != null)
l = l.tail;
l.head = h;
l.tail = new LinkedList();
}
public void delete(Object h) {
LinkedList l = this;
while(l.tail != null) {
if(l.head == h) {
l.head = l.tail.head;
l.tail = l.tail.tail;
return;
}
l = l.tail;
}
}
public int length() {
int c = 0;
LinkedList l = this;
while(l.tail != null) {
c++;
l = l.tail;
}
return(c);
}
public boolean isEmptyList() {
return(tail == null);
}
public Object getHead(){
return head;
}
public LinkedList getTail(){
return tail;
}
public java.util.List toList(){
java.util.List list=new java.util.LinkedList();
alice.util.LinkedList l = this;
while(!l.isEmptyList()) {
list.add(l.head);
l = l.tail;
}
|
|
return list;
}
}
|
- LinkedList.java [Project: TyRuBa: logic programming language] [Language: java] [LOC: 69]
class LinkedList {
private class Bucket {
Object el;
Bucket next = null;
 | ...
![]() |
Bucket(Object e) { el=e; }
Bucket(Object e,Bucket r) {el=e; next=r;}
}
/** The start of the stored elements list */
private Bucket head = new Bucket("dummy"); //dummy bucket makes code to add elements easier
/** The end of the stored elements list */
private Bucket tail = head;
/** Add an element to the end */
public void addElement(Object e) {
tail.next = new Bucket(e);
tail=tail.next;
}
/** Empty? */
public boolean isEmpty() {
return head.next==null;
}
/** Create an ElementSource which produces the elements in this LinkedList
one by one */
public RemovableElementSource elements() {
return new RemovableElementSource() {
private Bucket pos = head;
public int status() {
if (pos.next!=null)
return ELEMENT_READY;
else
return NO_ELEMENTS_READY;
}
public Object peekNextElement() {
return pos.next.el;
}
public void removeNextElement() {
if ((pos.next=pos.next.next)==null)
tail=pos;
}
public Object nextElement() {
pos = pos.next;
return pos.el;
}
public void print(PrintingState p) {
p.print("Linked[");
for (Bucket current = pos.next;current!=null;current = current.next) {
p.printObj(current.el);
if (current.next!=null)
p.print(",");
}
p.print("]");
}
|
|
};
}
}
|
- LinkedList.java [Project: Sniff Numerical Library] [Language: java] [LOC: 76]
class LinkedList{
private LinkedNode Root;
public LinkedList()
{
 | ...
![]() |
this.Root = null;
}
public LinkedList(Object obj)
{
this.Root = new LinkedNode(obj);
}
public void insert(Object obj)
{
LinkedNode thisNode = this.getRoot();
if (thisNode == null) // We have a totally empty LinkedList.
{
this.Root = new LinkedNode(obj);
return;
}
else
{
//Keep going till we find the last non-empty node.
while (thisNode.getNext() != null)
{
thisNode = thisNode.getNext();
}
thisNode.setNext(new LinkedNode(obj));
}
}
public LinkedNode getRoot()
{
return this.Root;
}
public void setRoot(LinkedNode node)
{
|
|
this.Root = node;
}
}
|
- LinkedList.java [Project: Universal Java Messaging] [Language: java] [LOC: 98]
class LinkedList{
private Node head, tail;
private int size;
public LinkedList()
 | ...
![]() |
{
}
public void clear()
{
while (head != null)
{
head.data = null;
head = head.next;
}
size = 0;
}
public int size()
{
return size;
}
public void add(Object o)
{
if (head == null)
head = tail = new Node(null, o, null);
else
{
Node n = new Node(tail, o, null);
tail.next = n;
tail = n;
}
size++;
}
public Object get(int index)
{
Node n = head;
for (int i = 0; n != null && i < index; i++)
n = n.next;
return n == null ? null : n.data;
}
public Object getFirst()
{
return head.data;
}
public Object getLast()
{
return tail.data;
}
public Object removeFirst()
{
if (head == null)
return null;
size--;
Object o = head.data;
head = head.next;
return o;
}
public Object removeLast()
{
if (tail == null)
return null;
size--;
Object o = tail.data;
tail = tail.prev;
return o;
}
private class Node
{
Object data;
Node next, prev;
Node(Node prev, Object data, Node next)
{
this.data = data;
this.prev = prev;
this.next = next;
|
|
}
}
}
|
- LinkedList.java [Project: CyberToolbox for Java] [Language: java] [LOC: 60]
class LinkedList {
LinkedListNode mHeaderNode;
public LinkedList () {
mHeaderNode = new LinkedListNode(true);
 | ...
![]() |
}
public void setRootNode(LinkedListNode obj) {
mHeaderNode = obj;
}
public LinkedListNode getRootNode () {
return mHeaderNode;
}
public LinkedListNode getNodes () {
return mHeaderNode.getNextNode();
}
public LinkedListNode getNode(int number) {
LinkedListNode node = getNodes();
for (int n=0; n<number && node != null; n++)
node = node.getNextNode();
return node;
}
public LinkedListNode getLastNode () {
LinkedListNode lastNode = mHeaderNode.getPrevNode();
if (lastNode.isHeaderNode())
return null;
else
return lastNode;
}
public int getNNodes() {
int n = 0;
for (LinkedListNode listNode = getNodes(); listNode != null; listNode = listNode.getNextNode())
n++;
return n;
}
public void addNode(LinkedListNode node) {
node.insert(mHeaderNode.getPrevNode());
}
public void addNodeAtFirst(LinkedListNode node) {
node.insert(mHeaderNode);
}
public void deleteNodes() {
LinkedListNode rootNode = getRootNode();
while (rootNode.getNextNode() != null) {
LinkedListNode nextNode = rootNode.getNextNode();
nextNode.remove();
|
|
}
}
}
|
- HistoryCacheSupportSync.java [Project: PippoProxy] [Language: java] [LOC: 342]
class LinkedList {
public History profile = null;
public LinkedList previous = null;
public LinkedList next = null;
 | ...
![]() |
public long expirationTime;
public String toString() {
return new StringBuffer()
.append("LinkedList[expirationTime:")
.append( Util.dateToString(expirationTime) )
.append("] [id: " )
.append( profile.getID() )
.append( "]" )
|
|
.toString();
}
}
|
- list.h [Project: wmcube] [Language: c] [LOC: 60]
typedef struct LinkedList {
void *head;
struct LinkedList *tail;
} LinkedList;
|
- list.h [Project: wmnd] [Language: c] [LOC: 68]
typedef struct LinkedList {
void *head;
struct LinkedList *tail;
} LinkedList;
|
Results Page  | Search By ProjectSearch By Language |