diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/collections/MyMap.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/collections/MyMap.java deleted file mode 100644 index cc589298b..000000000 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/collections/MyMap.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2010-2026 JPEXS, All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. - */ -package com.jpexs.decompiler.flash.helpers.collections; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Map implementation. - * - * @param Type of keys - * @param Type of values - * @author JPEXS - */ -public class MyMap implements Map { - - /** - * List of key-value pairs. - */ - List> values = new ArrayList<>(); - - @Override - public int size() { - return values.size(); - } - - @Override - public boolean isEmpty() { - return values.isEmpty(); - } - - @Override - public boolean containsKey(Object key) { - for (MyEntry kv : values) { - if (kv.getKey().equals(key)) { - return true; - } - } - return false; - } - - @Override - public boolean containsValue(Object value) { - for (MyEntry kv : values) { - if (kv.getValue().equals(value)) { - return true; - } - } - return false; - } - - @Override - public V get(Object key) { - for (MyEntry kv : values) { - if (kv.getKey().equals(key)) { - return kv.getValue(); - } - } - return null; - } - - @Override - public V put(K key, V value) { - for (MyEntry kv : values) { - if (kv.getKey().equals(key)) { - kv.setValue(value); - return value; - } - } - values.add(new MyEntry<>(key, value)); - return value; - } - - @Override - public V remove(Object key) { - for (int i = 0; i < values.size(); i++) { - MyEntry kv = values.get(i); - if (kv.getKey().equals(key)) { - values.remove(i); - return kv.getValue(); - } - } - return null; - } - - @Override - public void putAll(Map m) { - for (K k : m.keySet()) { - put(k, m.get(k)); - } - } - - @Override - public void clear() { - values.clear(); - } - - @Override - public Set keySet() { - Set ret = new MySet<>(); - for (MyEntry kv : values) { - ret.add(kv.getKey()); - } - return ret; - } - - @Override - public Collection values() { - Collection ret = new ArrayList<>(); - for (MyEntry kv : values) { - ret.add(kv.getValue()); - } - return ret; - } - - @Override - public Set> entrySet() { - Set> ret = new MySet<>(); - ret.addAll(values); - return ret; - } -} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/collections/MySet.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/collections/MySet.java deleted file mode 100644 index e7ff2a0a0..000000000 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/collections/MySet.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (C) 2010-2026 JPEXS, All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3.0 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. - */ -package com.jpexs.decompiler.flash.helpers.collections; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -/** - * Set implementation. - * - * @param Type of elements - * @author JPEXS - */ -public class MySet implements Set { - - /** - * List of items. - */ - List items = new ArrayList<>(); - - @Override - public int size() { - return items.size(); - } - - @Override - public boolean isEmpty() { - return items.isEmpty(); - } - - @Override - public boolean contains(Object o) { - for (T t : items) { - if (t.equals(o)) { - return true; - } - } - return false; - } - - @Override - public Iterator iterator() { - return new Iterator() { - int pos = 0; - - @Override - public boolean hasNext() { - return pos + 1 < items.size(); - } - - @Override - public T next() { - return items.get(pos++); - } - - @Override - public void remove() { - items.remove(pos--); - } - }; - } - - @Override - public Object[] toArray() { - Object[] ret = new Object[items.size()]; - for (int i = 0; i < items.size(); i++) { - ret[i] = items.get(i); - } - return ret; - } - - @Override - public T[] toArray(T[] a) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public boolean add(T e) { - items.add(e); - return true; - } - - @Override - public boolean remove(Object o) { - for (int i = 0; i < items.size(); i++) { - if (items.get(i).equals(o)) { - items.remove(i); - return true; - } - } - return false; - } - - @Override - public boolean containsAll(Collection c) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public boolean addAll(Collection c) { - for (T t : c) { - add(t); - } - return true; - } - - @Override - public boolean retainAll(Collection c) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public boolean removeAll(Collection c) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public void clear() { - items.clear(); - } - - @Override - public String toString() { - String ret = "["; - boolean first = true; - for (T t : items) { - if (!first) { - ret += ", "; - } - ret += t.toString(); - first = false; - } - ret += "]"; - return ret; - } -}