From 851d6a47640397c8ca683fbbd9570c1653414e0c Mon Sep 17 00:00:00 2001 From: fangyidong Date: Sat, 10 Jan 2009 08:21:36 +0000 Subject: [PATCH] --- src/org/json/simple/rope/Node.java | 12 ------ src/org/json/simple/rope/Rope.java | 68 ------------------------------ 2 files changed, 80 deletions(-) delete mode 100644 src/org/json/simple/rope/Node.java delete mode 100644 src/org/json/simple/rope/Rope.java diff --git a/src/org/json/simple/rope/Node.java b/src/org/json/simple/rope/Node.java deleted file mode 100644 index a172ef2..0000000 --- a/src/org/json/simple/rope/Node.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.json.simple.rope; - -class Node { - static final int TYPE_STR = 0; - static final int TYPE_CH = 1; - static final int TYPE_UNKNOWN = -1; - - int type = TYPE_UNKNOWN; - Node next; - char content_ch; - String content_str; -} diff --git a/src/org/json/simple/rope/Rope.java b/src/org/json/simple/rope/Rope.java deleted file mode 100644 index 8c23496..0000000 --- a/src/org/json/simple/rope/Rope.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.json.simple.rope; - -public class Rope { - private Node first; - private Node current; - private int count = 0; - - public void clear(){ - count = 0; - first = null; - current = null; - } - - public int length(){ - return count; - } - - public String toString(){ - if(count == 0) - return ""; - - char[] chs = new char[count]; - int pos = 0; - - Node p = first; - do{ - if(p.type == Node.TYPE_CH){ - chs[pos] = p.content_ch; - pos++; - } - else{ - int len = p.content_str.length(); - p.content_str.getChars(0, len, chs, pos); - pos += len; - } - p = p.next; - }while(p != null); - - return new String(chs); - } - - public void append(char ch){ - Node node = new Node(); - node.type = Node.TYPE_CH; - node.content_ch = ch; - if(first == null) - first = node; - if(current != null) - current.next = node; - current = node; - count++; - } - - public void append(String s){ - if(s == null || s.equals("")) - return; - - Node node = new Node(); - node.type = Node.TYPE_STR; - node.content_str = s; - if(first == null) - first = node; - if(current != null) - current.next = node; - current = node; - count += s.length(); - } -}