KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > DxLib > DxListNode


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: DxListNode.java,v 1.1 2001/12/18 10:31:30 per_nyfelt Exp $
8

9 package org.ozoneDB.DxLib;
10
11
12 class DxListNode extends DxObject {
13     
14     final static long serialVersionUID = 1L;
15     
16     Object JavaDoc _data;
17     DxListNode _next;
18     DxListNode _prev;
19     
20     
21     public DxListNode() {
22     }
23     
24     
25     public DxListNode( Object JavaDoc obj ) {
26         _data = obj;
27     }
28     
29     
30     public void storeBehind( DxListNode node ) {
31         // if ((node._prev!=null)||(node._next!=null))
32
// warning ("DxListNode wird in zwei Listen gleichzeitig gespeichert");
33
if (_next != null) {
34             _next._prev = node;
35         }
36         node._next = _next;
37         node._prev = this;
38         _next = node;
39     }
40     
41     
42     public void storeInfront( DxListNode node ) {
43         // if ((node._prev!=null)||(node._next!=null))
44
// ln ("\nWarnung: DxListNode wird in zwei Listen gleichzeitig gespeichert");
45
if (_prev != null) {
46             _prev._next = node;
47         }
48         node._next = this;
49         node._prev = _prev;
50         _prev = node;
51     }
52     
53     
54     public void remove() {
55         if (_next != null) {
56             _next._prev = _prev;
57         }
58         if (_prev != null) {
59             _prev._next = _next;
60         }
61         _prev = _next = null;
62     }
63     
64     
65     public DxListNode next() {
66         return _next;
67     }
68     
69     
70     public DxListNode prev() {
71         return _prev;
72     }
73     
74     
75     public Object JavaDoc data() {
76         return _data;
77     }
78 }
79
Popular Tags