summaryrefslogtreecommitdiff
path: root/java/src/Freeze/LinkedList.java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
committerBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
commitabada90e3f84dc703b8ddc9efcbed8a946fadead (patch)
tree2c6f9dccd510ea97cb927a7bd635422efaae547a /java/src/Freeze/LinkedList.java
parentremoving trace message (diff)
downloadice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip
Expanded tabs into spaces
Diffstat (limited to 'java/src/Freeze/LinkedList.java')
-rw-r--r--java/src/Freeze/LinkedList.java266
1 files changed, 133 insertions, 133 deletions
diff --git a/java/src/Freeze/LinkedList.java b/java/src/Freeze/LinkedList.java
index ecec1a9e0f9..64601bd8cef 100644
--- a/java/src/Freeze/LinkedList.java
+++ b/java/src/Freeze/LinkedList.java
@@ -31,193 +31,193 @@ public class LinkedList
public java.lang.Object
getFirst()
{
- if(_size == 0)
- {
- throw new java.util.NoSuchElementException();
- }
+ if(_size == 0)
+ {
+ throw new java.util.NoSuchElementException();
+ }
- return _header.next.element;
+ return _header.next.element;
}
public void
addFirst(java.lang.Object o)
{
- addBefore(o, _header.next);
+ addBefore(o, _header.next);
}
public boolean
isEmpty()
{
- return _size == 0;
+ return _size == 0;
}
public int
size()
{
- return _size;
+ return _size;
}
public java.util.Iterator
iterator()
{
- return new ForwardIterator();
+ return new ForwardIterator();
}
public java.util.Iterator
riterator()
{
- return new ReverseIterator();
+ return new ReverseIterator();
}
private class ForwardIterator implements java.util.Iterator
{
- public boolean
- hasNext()
- {
- return _next != null;
- }
-
- public java.lang.Object
- next()
- {
+ public boolean
+ hasNext()
+ {
+ return _next != null;
+ }
+
+ public java.lang.Object
+ next()
+ {
if(_next == null)
- {
+ {
throw new java.util.NoSuchElementException();
- }
-
- _current = _next;
-
- if(_next.next != _header)
- {
- _next = _next.next;
- }
- else
- {
- _next = null;
- }
- return _current.element;
- }
-
- public void
- remove()
- {
- if(_current == null)
- {
+ }
+
+ _current = _next;
+
+ if(_next.next != _header)
+ {
+ _next = _next.next;
+ }
+ else
+ {
+ _next = null;
+ }
+ return _current.element;
+ }
+
+ public void
+ remove()
+ {
+ if(_current == null)
+ {
throw new IllegalStateException();
- }
- LinkedList.this.remove(_current);
- _current = null;
- }
-
- ForwardIterator()
- {
- if(_header.next == _header)
- {
- _next = null;
- }
- else
- {
- _next = _header.next;
- }
- _current = null;
- }
-
- private Entry _current;
- private Entry _next;
+ }
+ LinkedList.this.remove(_current);
+ _current = null;
+ }
+
+ ForwardIterator()
+ {
+ if(_header.next == _header)
+ {
+ _next = null;
+ }
+ else
+ {
+ _next = _header.next;
+ }
+ _current = null;
+ }
+
+ private Entry _current;
+ private Entry _next;
}
private class ReverseIterator implements java.util.Iterator
{
- public boolean
- hasNext()
- {
- return _next != null;
- }
-
- public java.lang.Object
- next()
- {
+ public boolean
+ hasNext()
+ {
+ return _next != null;
+ }
+
+ public java.lang.Object
+ next()
+ {
if(_next == null)
- {
+ {
throw new java.util.NoSuchElementException();
- }
-
- _current = _next;
-
- if(_next.previous != _header)
- {
- _next = _next.previous;
- }
- else
- {
- _next = null;
- }
- return _current.element;
- }
-
- public void
- remove()
- {
- if(_current == null)
- {
+ }
+
+ _current = _next;
+
+ if(_next.previous != _header)
+ {
+ _next = _next.previous;
+ }
+ else
+ {
+ _next = null;
+ }
+ return _current.element;
+ }
+
+ public void
+ remove()
+ {
+ if(_current == null)
+ {
throw new IllegalStateException();
- }
- LinkedList.this.remove(_current);
- _current = null;
- }
-
- ReverseIterator()
- {
- if(_header.next == _header)
- {
- _next = null;
- }
- else
- {
- _next = _header.previous;
- }
- _current = null;
- }
-
- private Entry _current;
- private Entry _next;
+ }
+ LinkedList.this.remove(_current);
+ _current = null;
+ }
+
+ ReverseIterator()
+ {
+ if(_header.next == _header)
+ {
+ _next = null;
+ }
+ else
+ {
+ _next = _header.previous;
+ }
+ _current = null;
+ }
+
+ private Entry _current;
+ private Entry _next;
}
private static class Entry
{
- java.lang.Object element;
- Entry next;
- Entry previous;
-
- Entry(java.lang.Object element, Entry next, Entry previous)
- {
- this.element = element;
- this.next = next;
- this.previous = previous;
- }
+ java.lang.Object element;
+ Entry next;
+ Entry previous;
+
+ Entry(java.lang.Object element, Entry next, Entry previous)
+ {
+ this.element = element;
+ this.next = next;
+ this.previous = previous;
+ }
}
private Entry
addBefore(java.lang.Object o, Entry e)
{
- Entry newEntry = new Entry(o, e, e.previous);
- newEntry.previous.next = newEntry;
- newEntry.next.previous = newEntry;
- _size++;
- return newEntry;
+ Entry newEntry = new Entry(o, e, e.previous);
+ newEntry.previous.next = newEntry;
+ newEntry.next.previous = newEntry;
+ _size++;
+ return newEntry;
}
private void
remove(Entry e)
{
- if(e == _header)
- {
- throw new java.util.NoSuchElementException();
- }
-
- e.previous.next = e.next;
- e.next.previous = e.previous;
- _size--;
+ if(e == _header)
+ {
+ throw new java.util.NoSuchElementException();
+ }
+
+ e.previous.next = e.next;
+ e.next.previous = e.previous;
+ _size--;
}
private Entry _header = new Entry(null, null, null);