From 92c7ee06be59fa514693d63730d06837b67164a1 Mon Sep 17 00:00:00 2001 From: yushijinhun Date: Sun, 15 Apr 2018 08:59:05 +0800 Subject: [PATCH] [json-simple]remove ItemList --- .../internal/org/json/simple/ItemList.java | 147 ------------------ 1 file changed, 147 deletions(-) delete mode 100644 src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/ItemList.java diff --git a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/ItemList.java b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/ItemList.java deleted file mode 100644 index bb0c0e5..0000000 --- a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/ItemList.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * $Id: ItemList.java,v 1.1 2006/04/15 14:10:48 platform Exp $ - * Created on 2006-3-24 - */ -package org.to2mbn.authlibinjector.internal.org.json.simple; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -/** - * |a:b:c| => |a|,|b|,|c| - * |:| => ||,|| - * |a:| => |a|,|| - * - * @author FangYidong - */ -public class ItemList { - private String sp = ","; - List items = new ArrayList(); - - public ItemList() {} - - public ItemList(String s) { - this.split(s, sp, items); - } - - public ItemList(String s, String sp) { - this.sp = s; - this.split(s, sp, items); - } - - public ItemList(String s, String sp, boolean isMultiToken) { - split(s, sp, items, isMultiToken); - } - - public List getItems() { - return items; - } - - public String[] getArray() { - return (String[]) items.toArray(); - } - - public void split(String s, String sp, List append, boolean isMultiToken) { - if (s == null || sp == null) - return; - if (isMultiToken) { - StringTokenizer tokens = new StringTokenizer(s, sp); - while (tokens.hasMoreTokens()) { - append.add(tokens.nextToken().trim()); - } - } else { - this.split(s, sp, append); - } - } - - public void split(String s, String sp, List append) { - if (s == null || sp == null) - return; - int pos = 0; - int prevPos = 0; - do { - prevPos = pos; - pos = s.indexOf(sp, pos); - if (pos == -1) - break; - append.add(s.substring(prevPos, pos).trim()); - pos += sp.length(); - } while (pos != -1); - append.add(s.substring(prevPos).trim()); - } - - public void setSP(String sp) { - this.sp = sp; - } - - public void add(int i, String item) { - if (item == null) - return; - items.add(i, item.trim()); - } - - public void add(String item) { - if (item == null) - return; - items.add(item.trim()); - } - - public void addAll(ItemList list) { - items.addAll(list.items); - } - - public void addAll(String s) { - this.split(s, sp, items); - } - - public void addAll(String s, String sp) { - this.split(s, sp, items); - } - - public void addAll(String s, String sp, boolean isMultiToken) { - this.split(s, sp, items, isMultiToken); - } - - /** - * @param i - * 0-based - * @return - */ - public String get(int i) { - return (String) items.get(i); - } - - public int size() { - return items.size(); - } - - @Override - public String toString() { - return toString(sp); - } - - public String toString(String sp) { - StringBuffer sb = new StringBuffer(); - - for (int i = 0; i < items.size(); i++) { - if (i == 0) - sb.append(items.get(i)); - else { - sb.append(sp); - sb.append(items.get(i)); - } - } - return sb.toString(); - - } - - public void clear() { - items.clear(); - } - - public void reset() { - sp = ","; - items.clear(); - } -}