From c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 12 Feb 2026 22:33:32 -0800 Subject: Initial commit --- NET/worlds/scape/VectorProperty.java | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 NET/worlds/scape/VectorProperty.java (limited to 'NET/worlds/scape/VectorProperty.java') diff --git a/NET/worlds/scape/VectorProperty.java b/NET/worlds/scape/VectorProperty.java new file mode 100644 index 0000000..cbd9573 --- /dev/null +++ b/NET/worlds/scape/VectorProperty.java @@ -0,0 +1,76 @@ +package NET.worlds.scape; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +public class VectorProperty extends Property { + private PropAdder adder; + private boolean allowSorting = true; + + public VectorProperty(Properties owner, int index, String propName) { + super(owner, index, propName); + } + + public static Vector toVector(Object[] arr) { + Vector v = new Vector(arr.length); + + for (int i = 0; i < arr.length; i++) { + v.addElement(arr[i]); + } + + return v; + } + + public static Vector toVector(Hashtable hash) { + Vector v = new Vector(hash.size()); + Enumeration e = hash.elements(); + + while (e.hasMoreElements()) { + v.addElement(e.nextElement()); + } + + return v; + } + + public Object delete(Object obj) { + assert obj != null; + + assert this.adder != null; + + return this.operate(4, obj); + } + + public Object add(Object obj) { + assert obj != null; + + assert this.adder != null; + + return this.operate(3, obj); + } + + public boolean addTest(Object obj) { + assert obj != null; + + assert this.adder != null; + + return this.operate(5, obj) != null; + } + + public VectorProperty setAdder(PropAdder adder) { + this.adder = adder; + return this; + } + + public PropAdder getAdder() { + return this.adder; + } + + public void allowSorting(boolean allow) { + this.allowSorting = allow; + } + + public boolean shouldSort() { + return this.allowSorting; + } +} -- cgit v1.2.3