summaryrefslogtreecommitdiffstats
path: root/voronoi/cFaceList.java
diff options
context:
space:
mode:
authorRichard Zahoransky2011-11-07 16:29:56 +0100
committerRichard Zahoransky2011-11-07 16:29:56 +0100
commit08d5f7b0a0b24c042aa5976f66bf3a1b5b754478 (patch)
treeba5388774100c1b218cb264927c3bb3669fd7e06 /voronoi/cFaceList.java
parentinit (diff)
downloadlocalization-08d5f7b0a0b24c042aa5976f66bf3a1b5b754478.tar.gz
localization-08d5f7b0a0b24c042aa5976f66bf3a1b5b754478.tar.xz
localization-08d5f7b0a0b24c042aa5976f66bf3a1b5b754478.zip
Localization Code. How-To will follow...
Diffstat (limited to 'voronoi/cFaceList.java')
-rw-r--r--voronoi/cFaceList.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/voronoi/cFaceList.java b/voronoi/cFaceList.java
new file mode 100644
index 0000000..a80bc4b
--- /dev/null
+++ b/voronoi/cFaceList.java
@@ -0,0 +1,62 @@
+package voronoi;
+class cFaceList {
+ int n;
+
+ cFace head;
+
+ cFaceList() {
+ head = null;
+ n = 0;
+ }
+
+ public void InitHead(cFace h) {
+ head = new cFace();
+ head = h;
+ head.next = head.prev = head;
+ n = 1;
+ }
+
+ public void InsertBefore(cFace newF, cFace oldF) {
+ if (head == null)
+ InitHead(newF);
+ else {
+ oldF.prev.next = newF;
+ newF.prev = oldF.prev;
+ newF.next = oldF;
+ oldF.prev = newF;
+ n++;
+ }
+ }
+
+ public void InsertBeforeHead(cFace e) {
+ if (head == null)
+ InitHead(e);
+ else {
+ InsertBefore(e, head);
+ }
+ }
+
+ public cFace MakeNullFace() {
+ cFace f = new cFace();
+ InsertBeforeHead(f);
+ return f;
+ }
+
+ public void Delete(cFace e) {
+
+ if (head == head.next)
+ head = null;
+ else if (e == head)
+ head = head.next;
+
+ e.prev.next = e.next;
+ e.next.prev = e.prev;
+ n--;
+ }
+
+ public void ClearFaceList() {
+ if (head != null)
+ head = null;
+ n = 0;
+ }
+}