summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/VectorProperty.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/VectorProperty.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/scape/VectorProperty.java')
-rw-r--r--NET/worlds/scape/VectorProperty.java76
1 files changed, 76 insertions, 0 deletions
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;
+ }
+}