diff options
Diffstat (limited to 'libraries/spongycastle/core/src/main/j2me/java/util')
17 files changed, 0 insertions, 2155 deletions
diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/AbstractCollection.java b/libraries/spongycastle/core/src/main/j2me/java/util/AbstractCollection.java deleted file mode 100644 index 44c85ee05..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/AbstractCollection.java +++ /dev/null @@ -1,261 +0,0 @@ -package java.util; - -public abstract class AbstractCollection - implements Collection -{ - protected AbstractCollection() - { - } - - public abstract Iterator iterator(); - - public abstract int size(); - - public boolean isEmpty() - { - return size() == 0; - } - - public boolean contains(Object o) - { - Iterator it = iterator(); - while (it.hasNext()) - { - Object e = it.next(); - if (o == null) - { - if (e == null) - { - return true; - } - } - else - { - if (o.equals(e)) - { - return true; - } - } - } - return false; - } - - public Object[] toArray() - { - Object[] arObjects = new Object[size()]; - Iterator it = iterator(); - int i = 0; - while (it.hasNext()) - { - arObjects[i++] = it.next(); - } - return arObjects; - } - - public Object[] toArray(Object[] a) - throws NullPointerException, ArrayStoreException - //TODO: Check if this is realy compatible to SUN!!! - { - if (a == null) - { - throw new NullPointerException(); - } - - if (isEmpty()) - { - return a; - } - Object[] arObjects = null; - int size = size(); - if (a.length < size) - { - Iterator it = iterator(); - Object o = it.next(); - if (o == null) //no object or object is null - { - throw new ArrayStoreException(); //correct ? - } - throw new ArrayStoreException("please pass array of correct size"); - } - else - { - arObjects = a; - if (a.length > size) - { - arObjects[size] = null; - } - - } - - Iterator it = iterator(); - int i = 0; - while (it.hasNext()) - { - Object o = it.next(); - arObjects[i++] = o; - } - return arObjects; - } - - public boolean add(Object o) - throws RuntimeException, NullPointerException, ClassCastException, IllegalArgumentException - { - throw new RuntimeException(); - } - - public boolean remove(Object o) - throws RuntimeException - { - Iterator it = iterator(); - while (it.hasNext()) - { - Object e = it.next(); - if (o == null) - { - if (e == null) - { - try - { - it.remove(); - } - catch (RuntimeException ue) - { - throw ue; - } - return true; - } - } - else - { - if (o.equals(e)) - { - try - { - it.remove(); - } - catch (RuntimeException ue) - { - throw ue; - } - return true; - } - } - } - return false; - } - - public boolean containsAll(Collection c) - { - Iterator it = c.iterator(); - while (it.hasNext()) - { - if (!contains(it.next())) - { - return false; - } - } - return true; - } - - public boolean addAll(Collection c) - throws RuntimeException - { - Iterator it = c.iterator(); - boolean ret = false; - while (it.hasNext()) - { - try - { - ret |= add(it.next()); - } - catch (RuntimeException ue) - { - throw ue; - } - } - return ret; - } - - public boolean removeAll(Collection c) - throws RuntimeException - { - Iterator it = iterator(); - boolean ret = false; - while (it.hasNext()) - { - if (c.contains(it.next())) - { - try - { - it.remove(); - ret = true; - } - catch (RuntimeException ue) - { - throw ue; - } - } - } - return ret; - } - - public boolean retainAll(Collection c) - throws RuntimeException - { - Iterator it = iterator(); - boolean ret = false; - while (it.hasNext()) - { - if (!c.contains(it.next())) - { - try - { - it.remove(); - ret = true; - } - catch (RuntimeException ue) - { - throw ue; - } - } - } - return ret; - } - - public void clear() - throws RuntimeException - { - Iterator it = iterator(); - while (it.hasNext()) - { - try - { - it.next(); - it.remove(); - } - catch (RuntimeException ue) - { - throw ue; - } - } - } - - public String toString() - { - StringBuffer ret = new StringBuffer("["); - Iterator it = iterator(); - if (it.hasNext()) - { - ret.append(String.valueOf(it.next())); - } - while (it.hasNext()) - { - ret.append(", "); - ret.append(String.valueOf(it.next())); - - } - ret.append("]"); - return ret.toString(); - } - -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/AbstractList.java b/libraries/spongycastle/core/src/main/j2me/java/util/AbstractList.java deleted file mode 100644 index dbb1dffc4..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/AbstractList.java +++ /dev/null @@ -1,304 +0,0 @@ -package java.util; - -public abstract class AbstractList - extends AbstractCollection - implements List -{ - protected AbstractList al = this; - - - protected AbstractList() - { - } - - public boolean add(Object o) - throws RuntimeException, ClassCastException, IllegalArgumentException - { - try - { - add(size(), o); - return true; - } - catch (RuntimeException ue) - { - throw ue; - } - } - - public abstract Object get(int index) - throws IndexOutOfBoundsException; - - public Object set(int index, Object element) - throws RuntimeException, ClassCastException, IllegalArgumentException, IndexOutOfBoundsException - { - throw new RuntimeException(); - } - - public void add(int index, Object element) - throws RuntimeException, ClassCastException, IllegalArgumentException, IndexOutOfBoundsException - { - throw new RuntimeException(); - } - - public Object remove(int index) - throws RuntimeException, IndexOutOfBoundsException - { - Object o = get(index); - - removeRange(index, index + 1); - return o; - } - - public int indexOf(Object o) - { - ListIterator li = listIterator(); - Object e; - while (li.hasNext()) - { - int index = li.nextIndex(); - e = li.next(); - - if (o == null) - { - if (e == null) - { - return index; - } - } - else - { - if (o.equals(e)) - { - return index; - } - } - } - return -1; - } - - public int lastIndexOf(Object o) - { - ListIterator li = listIterator(size()); - while (li.hasPrevious()) - { - int index = li.previousIndex(); - Object e = li.previous(); - if (o == null) - { - if (e == null) - { - return index; - } - } - else - { - if (o.equals(e)) - { - return index; - } - } - } - return -1; - } - - public void clear() - throws RuntimeException - { - try - { - removeRange(0, size()); - } - catch (RuntimeException ue) - { - throw ue; - } - } - - public boolean addAll(int index, Collection c) - throws RuntimeException, ClassCastException, IllegalArgumentException, IndexOutOfBoundsException - { - Iterator it = c.iterator(); - boolean ret = false; - while (it.hasNext()) - { - try - { - add(index++, it.next()); - ret = true; - } - catch (RuntimeException ue) - { - throw ue; - } - } - return ret; - } - - public Iterator iterator() - { - return new AbstractListIterator(this, 0); - } - - public ListIterator listIterator() - { - return listIterator(0); - } - - public ListIterator listIterator(int index) - throws IndexOutOfBoundsException - { - if (index < 0 || index > size()) - { - throw new IndexOutOfBoundsException(); - } - return new AbstractListListIterator(this, index); - } - - public List subList(int fromIndex, int toIndex) - throws IndexOutOfBoundsException, IllegalArgumentException - { - if (fromIndex < 0 || toIndex > size()) - { - throw new IndexOutOfBoundsException(); - } - if (fromIndex > toIndex) - { - throw new IllegalArgumentException(); - } - return (List)new Sublist(this, fromIndex, toIndex); - } - - public boolean equals(Object o) - { - if (o == this) - { - return true; - } - if (!(o instanceof List)) - { - return false; - } - Iterator it1 = iterator(); - Iterator it2 = ((List)o).iterator(); - while (it1.hasNext()) - { - if (!it2.hasNext()) - { - return false; - } - Object e1 = it1.next(); - Object e2 = it2.next(); - if (e1 == null) - { - if (e2 != null) - { - return false; - } - } - if (!e1.equals(e2)) - { - return false; - } - } - return true; - } - - public int hashCode() - { - int hashCode = 1; - Iterator it = iterator(); - while (it.hasNext()) - { - Object o = it.next(); - hashCode = 31 * hashCode + (o == null ? 0 : o.hashCode()); - } - return hashCode; - } - - protected void removeRange(int fromIndex, int toIndex) - { - if (fromIndex == toIndex) - { - return; - } - - ListIterator li = listIterator(fromIndex); - - int i = fromIndex; - do - { - li.next(); - li.remove(); - i++; - } - while (li.hasNext() && i < toIndex); - } - - private class AbstractListIterator - implements Iterator - { - AbstractList m_al = null; - int m_nextIndex = 0; - - public AbstractListIterator(AbstractList al, int index) - { - m_al = al; - m_nextIndex = index; - } - - public boolean hasNext() - { - return m_nextIndex < m_al.size(); - } - - public Object next() - { - return m_al.get(m_nextIndex++); - } - - public void remove() - { - m_al.remove(m_nextIndex - 1); - } - } - - private class AbstractListListIterator - extends AbstractListIterator - implements ListIterator - { - public AbstractListListIterator(AbstractList al, int index) - { - super(al, index); - } - - public boolean hasPrevious() - { - return m_nextIndex > 0; - } - - public Object previous()// throws NoSuchElementException; - { - return m_al.get(--m_nextIndex); - } - - public int nextIndex() - { - return m_nextIndex; - } - - public int previousIndex() - { - return m_nextIndex - 1; - } - - public void set(Object o) //throws RuntimeException, ClassCastException, IllegalArgumentException,IllegalStateException; - { - m_al.set(m_nextIndex - 1, o); - } - - public void add(Object o)// throws RuntimeException, ClassCastException, IllegalArgumentException; - { - m_al.add(m_nextIndex - 1, o); - } - } -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/AbstractMap.java b/libraries/spongycastle/core/src/main/j2me/java/util/AbstractMap.java deleted file mode 100644 index 13c61ecfa..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/AbstractMap.java +++ /dev/null @@ -1,173 +0,0 @@ -package java.util; - -public abstract class AbstractMap - implements Map -{ - - protected AbstractMap() - { - } - - public int size() - { - return entrySet().size(); - } - - public boolean isEmpty() - { - return size() == 0; - } - - public boolean containsValue(Object value) - { - Iterator it = entrySet().iterator(); - while (it.hasNext()) - { - Map.Entry v = (Map.Entry)it.next(); - if (value == null) - { - if (v.getValue() == null) - { - return true; - } - } - else - { - if (value.equals(v.getValue())) - { - return true; - } - } - } - return false; - } - - public boolean containsKey(Object key) - throws ClassCastException, NullPointerException - { - Iterator it = entrySet().iterator(); - while (it.hasNext()) - { - Map.Entry v = (Map.Entry)it.next(); - if (key == null) - { - if (v.getKey() == null) - { - return true; - } - } - else - { - if (key.equals(v.getKey())) - { - return true; - } - } - } - return false; - } - - public Object get(Object key) - throws ClassCastException, NullPointerException - { - Iterator it = entrySet().iterator(); - while (it.hasNext()) - { - Map.Entry v = (Map.Entry)it.next(); - if (key == null) - { - if (v.getKey() == null) - { - return v.getValue(); - } - } - else - { - if (key.equals(v.getKey())) - { - return v.getValue(); - } - } - } - return null; - } - - public Object put(Object key, Object value) - throws RuntimeException - { - throw new RuntimeException(); - } - - public Object remove(Object key) - { - Iterator it = entrySet().iterator(); - Object o = null; - while (it.hasNext()) - { - Map.Entry v = (Map.Entry)it.next(); - if (key == null) - { - if (v.getKey() == null) - { - o = v.getValue(); - it.remove(); - return o; - } - } - else - { - if (key.equals(v.getKey())) - { - o = v.getValue(); - it.remove(); - return o; - } - } - } - return null; - } - - public void putAll(Map t) - { - Iterator it = t.entrySet().iterator(); - while (it.hasNext()) - { - Map.Entry v = (Map.Entry)it.next(); - put(v.getKey(), v.getValue()); - } - } - - public void clear() - { - entrySet().clear(); - } - - public Set keySet() - { - throw new RuntimeException("no keySet in AbstractMap()"); - } - - public Collection values() - { - throw new RuntimeException("no values in AbstractMap()"); - } - - public abstract Set entrySet(); - - public boolean equals(Object o) - { - throw new RuntimeException("no equals in AbstractMap()"); - } - - public int hashCode() - { - throw new RuntimeException("no hashCode in AbstractMap()"); - } - - public String toString() - { - throw new RuntimeException("no toString in AbstractMap()"); - } - - -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/AbstractSet.java b/libraries/spongycastle/core/src/main/j2me/java/util/AbstractSet.java deleted file mode 100644 index 2a91c4766..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/AbstractSet.java +++ /dev/null @@ -1,46 +0,0 @@ -package java.util; - -public abstract class AbstractSet - extends AbstractCollection - implements Set -{ - protected AbstractSet() - { - } - - public boolean equals(Object o) - { - if (this == o) - { - return true; - } - if (o == null) - { - return false; - } - if (!(o instanceof Set)) - { - return false; - } - if (((Set)o).size() != size()) - { - return false; - } - return containsAll((Collection)o); - } - - public int hashCode() - { - int hashCode = 0; - Iterator it = iterator(); - while (it.hasNext()) - { - Object o = it.next(); - if (o != null) - { - hashCode += o.hashCode(); - } - } - return hashCode; - } -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/ArrayList.java b/libraries/spongycastle/core/src/main/j2me/java/util/ArrayList.java deleted file mode 100644 index 80adf4785..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/ArrayList.java +++ /dev/null @@ -1,107 +0,0 @@ -package java.util; - -public class ArrayList extends AbstractList - implements List - { - Vector m_Vector=null; - - public ArrayList() - { - m_Vector=new Vector(); - } - - public ArrayList(Collection c) - { - m_Vector=new Vector((int)(c.size()*1.1)); - addAll(c); - } - - public ArrayList(int initialCapacity) - { - m_Vector=new Vector(initialCapacity); - } - - public void trimToSize() - { - m_Vector.trimToSize(); - } - - public void ensureCapacity(int minCapacity) - { - m_Vector.ensureCapacity(minCapacity); - } - - public int size() - { - return m_Vector.size(); - } - - public boolean contains(Object elem) - { - return m_Vector.contains(elem); - } - - public int indexOf(Object elem) - { - return m_Vector.indexOf(elem); - } - - public int lastIndexOf(Object elem) - { - return m_Vector.lastIndexOf(elem); - } - - public Object clone() - { - ArrayList al=new ArrayList(this); - - return al; - } - - public Object[] toArray() - { - Object[] o=new Object[m_Vector.size()]; - m_Vector.copyInto(o); - return o; - } - - public Object get(int index) - { - return m_Vector.elementAt(index); - } - - public Object set(int index,Object elem) - { - Object o=m_Vector.elementAt(index); - m_Vector.setElementAt(elem,index); - return o; - } - - public boolean add(Object o) - { - m_Vector.addElement(o); - return true; - } - - public void add(int index,Object elem) - { - m_Vector.insertElementAt(elem,index); - } - - public Object remove(int index) - { - Object o=m_Vector.elementAt(index); - m_Vector.removeElementAt(index); - return o; - } - - public void clear() - { - m_Vector.removeAllElements(); - } - - - - - - } diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/Arrays.java b/libraries/spongycastle/core/src/main/j2me/java/util/Arrays.java deleted file mode 100644 index 8cd74daae..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/Arrays.java +++ /dev/null @@ -1,118 +0,0 @@ -package java.util; - -public class Arrays -{ - - private Arrays() - { - } - - public static void fill(byte[] ret, byte v) - { - for (int i = 0; i != ret.length; i++) - { - ret[i] = v; - } - } - - public static boolean equals(byte[] a, byte[] a2) - { - if (a == a2) - { - return true; - } - if (a == null || a2 == null) - { - return false; - } - - int length = a.length; - if (a2.length != length) - { - return false; - } - - for (int i = 0; i < length; i++) - { - if (a[i] != a2[i]) - { - return false; - } - } - - return true; - } - - public static List asList(Object[] a) - { - return new ArrayList(a); - } - - private static class ArrayList - extends AbstractList - { - private Object[] a; - - ArrayList(Object[] array) - { - a = array; - } - - public int size() - { - return a.length; - } - - public Object[] toArray() - { - Object[] tmp = new Object[a.length]; - - System.arraycopy(a, 0, tmp, 0, tmp.length); - - return tmp; - } - - public Object get(int index) - { - return a[index]; - } - - public Object set(int index, Object element) - { - Object oldValue = a[index]; - a[index] = element; - return oldValue; - } - - public int indexOf(Object o) - { - if (o == null) - { - for (int i = 0; i < a.length; i++) - { - if (a[i] == null) - { - return i; - } - } - } - else - { - for (int i = 0; i < a.length; i++) - { - if (o.equals(a[i])) - { - return i; - } - } - } - return -1; - } - - public boolean contains(Object o) - { - return indexOf(o) != -1; - } - } - -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/Collection.java b/libraries/spongycastle/core/src/main/j2me/java/util/Collection.java deleted file mode 100644 index a911dcd63..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/Collection.java +++ /dev/null @@ -1,21 +0,0 @@ - -package java.util; - -public interface Collection - { - public boolean add(Object o) throws RuntimeException,ClassCastException,IllegalArgumentException; - public boolean addAll(Collection c) throws RuntimeException,ClassCastException,IllegalArgumentException; - public void clear() throws RuntimeException; - public boolean contains(Object o); - public boolean containsAll(Collection c); - public boolean equals(Object o); - public int hashCode(); - public boolean isEmpty(); - public Iterator iterator(); - public /*SK13*/boolean remove(Object o) throws RuntimeException; - public boolean removeAll(Collection c) throws RuntimeException; - public boolean retainAll(Collection c) throws RuntimeException; - public int size(); - public Object[] toArray(); - public Object[] toArray(Object[] a) throws ArrayStoreException; - } diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/Collections.java b/libraries/spongycastle/core/src/main/j2me/java/util/Collections.java deleted file mode 100644 index d611e5e3e..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/Collections.java +++ /dev/null @@ -1,365 +0,0 @@ -package java.util; - -public class Collections -{ - public static List EMPTY_LIST = new ArrayList(); - - private Collections() - { - } - - public static Collection unmodifiableCollection(Collection c) - { - return new UnmodifiableCollection(c); - } - - static class UnmodifiableCollection - implements Collection - { - Collection c; - - UnmodifiableCollection(Collection c) - { - this.c = c; - } - - public int size() - { - return c.size(); - } - - public boolean isEmpty() - { - return c.isEmpty(); - } - - public boolean contains(Object o) - { - return c.contains(o); - } - - public Object[] toArray() - { - return c.toArray(); - } - - public Object[] toArray(Object[] a) - { - return c.toArray(a); - } - - public Iterator iterator() - { - return new Iterator() - { - Iterator i = c.iterator(); - - public boolean hasNext() - { - return i.hasNext(); - } - - public Object next() - { - return i.next(); - } - - public void remove() - { - throw new RuntimeException(); - } - }; - } - - public boolean add(Object o) - { - throw new RuntimeException(); - } - - public boolean remove(Object o) - { - throw new RuntimeException(); - } - - public boolean containsAll(Collection coll) - { - return c.containsAll(coll); - } - - public boolean addAll(Collection coll) - { - throw new RuntimeException(); - } - - public boolean removeAll(Collection coll) - { - throw new RuntimeException(); - } - - public boolean retainAll(Collection coll) - { - throw new RuntimeException(); - } - - public void clear() - { - throw new RuntimeException(); - } - - public String toString() - { - return c.toString(); - } - } - - public static Set unmodifiableSet(Set s) - { - return new UnmodifiableSet(s); - } - - static class UnmodifiableSet - extends UnmodifiableCollection - implements Set - { - UnmodifiableSet(Set s) - { - super(s); - } - - public boolean equals(Object o) - { - return c.equals(o); - } - - public int hashCode() - { - return c.hashCode(); - } - } - - public static Map unmodifiableMap(Map map) - { - return new UnmodifiableMap(map); - } - - static class UnmodifiableMap - implements Map - { - private Map map; - - UnmodifiableMap(Map map) - { - this.map = map; - } - - public int size() - { - return map.size(); - } - - public boolean isEmpty() - { - return map.isEmpty(); - } - - public boolean containsKey(Object key) - throws ClassCastException, NullPointerException - { - return map.containsKey(key); - } - - public boolean containsValue(Object value) - { - return map.containsValue(value); - } - - public Object get(Object key) - throws ClassCastException, NullPointerException - { - return map.get(key); - } - - public Object put(Object key, Object value) - throws RuntimeException, ClassCastException, IllegalArgumentException, NullPointerException - { - throw new RuntimeException("unsupported operation - map unmodifiable"); - } - - public Object remove(Object key) - throws RuntimeException - { - throw new RuntimeException("unsupported operation - map unmodifiable"); - } - - public void putAll(Map t) - throws RuntimeException, ClassCastException, IllegalArgumentException, NullPointerException - { - throw new RuntimeException("unsupported operation - map unmodifiable"); - } - - public void clear() - throws RuntimeException - { - throw new RuntimeException("unsupported operation - map unmodifiable"); - } - - public Set keySet() - { - return map.keySet(); - } - - public Collection values() - { - return map.values(); - } - - public Set entrySet() - { - return map.entrySet(); - } - } - - public static List unmodifiableList(List list) - { - return new UnmodifiableList(list); - } - - static class UnmodifiableList - extends UnmodifiableCollection - implements List - { - private List list; - - UnmodifiableList(List list) - { - super(list); - this.list = list; - } - - public boolean equals(Object o) - { - return list.equals(o); - } - - public int hashCode() - { - return list.hashCode(); - } - - public Object get(int index) - { - return list.get(index); - } - - public Object set(int index, Object element) - { - throw new RuntimeException(); - } - - public void add(int index, Object element) - { - throw new RuntimeException(); - } - - public Object remove(int index) - { - throw new RuntimeException(); - } - - public int indexOf(Object o) - { - return list.indexOf(o); - } - - public int lastIndexOf(Object o) - { - return list.lastIndexOf(o); - } - - public boolean addAll(int index, Collection c) - { - throw new RuntimeException(); - } - - public ListIterator listIterator() - { - return listIterator(0); - } - - public ListIterator listIterator(final int index) - { - return new ListIterator() - { - ListIterator i = list.listIterator(index); - - public boolean hasNext() - { - return i.hasNext(); - } - - public Object next() - { - return i.next(); - } - - public boolean hasPrevious() - { - return i.hasPrevious(); - } - - public Object previous() - { - return i.previous(); - } - - public int nextIndex() - { - return i.nextIndex(); - } - - public int previousIndex() - { - return i.previousIndex(); - } - - public void remove() - { - throw new RuntimeException(); - } - - public void set(Object o) - { - throw new RuntimeException(); - } - - public void add(Object o) - { - throw new RuntimeException(); - } - }; - } - - public List subList(int fromIndex, int toIndex) - { - return new UnmodifiableList(list.subList(fromIndex, toIndex)); - } - } - - public static Enumeration enumeration(final Collection c) - { - return new Enumeration() - { - Iterator i = c.iterator(); - - public boolean hasMoreElements() - { - return i.hasNext(); - } - - public Object nextElement() - { - return i.next(); - } - }; - } -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/HashMap.java b/libraries/spongycastle/core/src/main/j2me/java/util/HashMap.java deleted file mode 100644 index 0bcd75ddd..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/HashMap.java +++ /dev/null @@ -1,279 +0,0 @@ -package java.util; - - -public class HashMap extends AbstractMap{ - - ////////////////////////////////////////////////////////////// - ///// innere Klasse Null //////////////////////////////////// - ////////////////////////////////////////////////////////////// -public class Null extends Object - { - public Null() - { - - } - - public String toString() - { - return "Nullobject"; - } - } - - - ////////////////////////////////////////////////////////////// - ///// innere Klasse innerSet //////////////////////////////////// - ////////////////////////////////////////////////////////////// - - class ISet extends AbstractSet implements java.util.Set - { - - Vector vec = null; - - public ISet() - { - - vec = new Vector(); - - } - - public boolean add(Object o) - { - vec.addElement(o); - return true; - } - - public int size() - { - return vec.size(); - } - - public Iterator iterator() - { - return new IIterator(vec); - } - } - - ////////////////////////////////////////////////////////////// - ///// innere Klasse Iterator //////////////////////////////////// - ////////////////////////////////////////////////////////////// - class IIterator implements java.util.Iterator - { - int index = 0; - Vector vec = null; - public IIterator(Vector ve) - { - vec = ve; - } - - public boolean hasNext() - { - if (vec.size() > index) return true; - return false; - } - - public Object next() - { - Object o = vec.elementAt(index); - if (o==Nullobject) o=null; - index++; - return o; - - } - - public void remove() - { - index--; - vec.removeElementAt(index); - } - - } - - ////////////////////////////////////////////////////////////// - ///// innere Klasse Entry //////////////////////////////////// - ////////////////////////////////////////////////////////////// - - - class Entry implements Map.Entry - { - public Object key=null; - public Object value=null; - - public Entry(Object ke,Object valu) - { - key = ke; - value = valu; - } - public boolean equals(Object o) - { - if (value == ((Entry)o).value && key == ((Entry)o).key ) return true; - else return false; - - } - - public Object getValue() - { - return value; - } - - public Object getKey() - { - return (Object)key; - } - - public int hashCode() - { - return value.hashCode() + key.hashCode(); - - } - - public Object setValue(Object valu) - { - value = (String)valu; - return this; - } - } - - //////////////////////////////////////////////////////////////////// - - private Hashtable m_HashTable=null; - private Null Nullobject = null; - - public HashMap() - { - Nullobject = new Null(); - m_HashTable=new Hashtable(); - } - - public HashMap(int initialCapacity) - { - Nullobject = new Null(); - m_HashTable=new Hashtable(initialCapacity); - } - - public HashMap(Map t) - { - Nullobject = new Null(); - m_HashTable=new Hashtable(); - this.putAll(t); - } - - public void clear() - { - m_HashTable.clear(); - } - - public Object clone() - { - HashMap hm=new HashMap(this); - - return hm; - } - - public boolean containsKey(Object key) - { - if (key == null) key = Nullobject; - boolean b = m_HashTable.containsKey(key); - return b; - - } - - public boolean containsValue(Object value) - { - if (value == null ) value = Nullobject; - boolean b = m_HashTable.contains(value); - return b; - } - - public Set entrySet() - { - - Object Key = null; - ISet s = new ISet(); - Enumeration en = m_HashTable.keys(); - while (en.hasMoreElements()) - { - Key = en.nextElement(); - s.add(new Entry(Key,m_HashTable.get(Key))); - } - return s; - } - - public Object get(Object key) - { - - if (key==null) key= Nullobject; - - Object o = m_HashTable.get(key); - - if (o == Nullobject) o=null; - - return o; - } - - public boolean isEmpty() - { - return m_HashTable.isEmpty(); - } - - public Set keySet() - { - ISet s=new ISet(); - Enumeration en = m_HashTable.keys(); - - while (en.hasMoreElements()) - { - s.add(en.nextElement()); - } - - return s; - } - - public Object put(Object key, Object value) - { - if (key==null) key=Nullobject; - if (value==null) value = Nullobject; - return m_HashTable.put(key,value); - } - - public void putAll(Map m) - { - Iterator it = m.entrySet().iterator(); - Object key=null; - Object value=null; - - while (it.hasNext()) - { - Map.Entry me = (Map.Entry)it.next(); - if (me.getKey() == null) key = Nullobject; - else key= me.getKey(); - if (me.getValue()==null) value = Nullobject; - else value = me.getValue(); - m_HashTable.put(key,value); - } - } - - public Object remove(Object key) - { - return m_HashTable.remove(key); - } - - public int size() - { - return m_HashTable.size(); - } - - public Collection values() - { - - ISet s=new ISet(); - Enumeration en = m_HashTable.keys(); - - while (en.hasMoreElements()) - { - Object Key = en.nextElement(); - //s.add(((Map.Entry)m_HashTable.get(Key)).getValue()); - s.add(m_HashTable.get(Key)); - } - return s; - } -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/HashSet.java b/libraries/spongycastle/core/src/main/j2me/java/util/HashSet.java deleted file mode 100644 index e37cb7c8d..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/HashSet.java +++ /dev/null @@ -1,71 +0,0 @@ -package java.util; - -public class HashSet - extends AbstractSet -{ - private HashMap m_HashMap = null; - - public HashSet() - { - m_HashMap = new HashMap(); - } - - public HashSet(Collection c) - { - m_HashMap = new HashMap(Math.max(11, c.size() * 2)); - addAll(c); - } - - public HashSet(int initialCapacity) - { - m_HashMap = new HashMap(initialCapacity); - - } - - public Iterator iterator() - { - return (m_HashMap.keySet()).iterator(); - } - - public int size() - { - return m_HashMap.size(); - } - - public boolean contains(Object o) - { - return m_HashMap.containsKey(o); - } - - public boolean add(Object o) - { - if (!m_HashMap.containsValue(o)) - { - m_HashMap.put((Object)o, (Object)o); - - return true; - - } - - return false; - } - - public boolean remove(Object o) - { - return (m_HashMap.remove(o) != null); - } - - public void clear() - { - m_HashMap.clear(); - } - - - public Object clone() - { - HashSet hs = new HashSet(); - hs.m_HashMap = (HashMap)m_HashMap.clone(); - return hs; - } - -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/Iterator.java b/libraries/spongycastle/core/src/main/j2me/java/util/Iterator.java deleted file mode 100644 index f1b9c05fc..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/Iterator.java +++ /dev/null @@ -1,9 +0,0 @@ - -package java.util; - -public interface Iterator -{ - public abstract boolean hasNext(); - public abstract Object next() throws NoSuchElementException; - public abstract void remove() throws RuntimeException,IllegalStateException; -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/List.java b/libraries/spongycastle/core/src/main/j2me/java/util/List.java deleted file mode 100644 index d9df616fd..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/List.java +++ /dev/null @@ -1,32 +0,0 @@ -package java.util; - -public interface List - extends Collection -{ - void add(int index, Object element) - throws RuntimeException, ClassCastException, IllegalArgumentException, IndexOutOfBoundsException; - - boolean addAll(int index, Collection c) - throws RuntimeException, ClassCastException, IllegalArgumentException, IndexOutOfBoundsException; - - Object get(int index) - throws IndexOutOfBoundsException; - - int indexOf(Object o); - - int lastIndexOf(Object o); - - ListIterator listIterator(); - - ListIterator listIterator(int index) - throws IndexOutOfBoundsException; - - Object remove(int index) - throws RuntimeException, IndexOutOfBoundsException; - - Object set(int index, Object element) - throws RuntimeException, ClassCastException, IllegalArgumentException, IndexOutOfBoundsException; - - List subList(int fromIndex, int toIndex) - throws IndexOutOfBoundsException; -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/ListIterator.java b/libraries/spongycastle/core/src/main/j2me/java/util/ListIterator.java deleted file mode 100644 index 3e08d959c..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/ListIterator.java +++ /dev/null @@ -1,20 +0,0 @@ -package java.util; - -public interface ListIterator - extends Iterator -{ - public boolean hasPrevious(); - - public Object previous() - throws NoSuchElementException; - - public int nextIndex(); - - public int previousIndex(); - - public void set(Object o) - throws RuntimeException, ClassCastException, IllegalArgumentException, IllegalStateException; - - public void add(Object o) - throws RuntimeException, ClassCastException, IllegalArgumentException; -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/Map.java b/libraries/spongycastle/core/src/main/j2me/java/util/Map.java deleted file mode 100644 index cf496f89d..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/Map.java +++ /dev/null @@ -1,54 +0,0 @@ -package java.util; - -public interface Map -{ - - public static interface Entry - { - public Object getKey(); - - public Object getValue(); - - public Object setValue(Object value) - throws RuntimeException, ClassCastException, IllegalArgumentException, NullPointerException; - - public boolean equals(Object o); - - public int hashCode(); - } - - public int size(); - - public boolean isEmpty(); - - public boolean containsKey(Object Key) - throws ClassCastException, NullPointerException; - - public boolean containsValue(Object value); - - public Object get(Object key) - throws ClassCastException, NullPointerException; - - public Object put(Object key, Object value) - throws RuntimeException, ClassCastException, IllegalArgumentException, NullPointerException; - - public Object remove(Object key) - throws RuntimeException; - - public void putAll(Map t) - throws RuntimeException, ClassCastException, IllegalArgumentException, NullPointerException; - - public void clear() - throws RuntimeException; - - public Set keySet(); - - public Collection values(); - - public Set entrySet(); - - public boolean equals(Object o); - - public int hashCode(); - -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/Set.java b/libraries/spongycastle/core/src/main/j2me/java/util/Set.java deleted file mode 100644 index 6ec45c748..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/Set.java +++ /dev/null @@ -1,38 +0,0 @@ -package java.util; - -public interface Set - extends Collection -{ - - public int size(); - - public boolean isEmpty(); - - public boolean contains(Object o); - - public Iterator iterator(); - - public Object[] toArray(); - - public Object[] toArray(Object[] a); - - public boolean add(Object o); - - public boolean remove(Object o); - - public boolean containsAll(Collection c); - - public boolean addAll(Collection c); - - public boolean retainAll(Collection c); - - public boolean removeAll(Collection c); - - public void clear(); - - public boolean equals(Object o); - - public int hashCode(); - - -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/StringTokenizer.java b/libraries/spongycastle/core/src/main/j2me/java/util/StringTokenizer.java deleted file mode 100644 index 5ff7c7060..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/StringTokenizer.java +++ /dev/null @@ -1,115 +0,0 @@ -package java.util; - -import java.util.Enumeration; -import java.util.NoSuchElementException; - -public class StringTokenizer - implements Enumeration -{ - private String s; - private String delims; - private boolean retDelims; - private int maxPos; - - private int pos; - - public StringTokenizer(String s, String delims) - { - this(s, delims, false); - } - - public StringTokenizer(String s, String delims, boolean retDelims) - { - this.s = s; - this.delims = delims; - this.retDelims = retDelims; - this.maxPos = s.length(); - } - - public boolean hasMoreTokens() - { - if (retDelims) - { - return pos < maxPos; - } - else - { - int next = pos; - while (next < maxPos && isDelim(next)) - { - next++; - } - - return next < maxPos; - } - } - - public String nextToken() - { - String tok; - - if (pos == maxPos) - { - throw new NoSuchElementException("no more tokens"); - } - - if (retDelims) - { - if (isDelim(pos)) - { - tok = s.substring(pos, pos + 1); - pos++; - - return tok; - } - } - - while (pos < maxPos && isDelim(pos)) - { - pos++; - } - - int start = pos; - - while (pos < maxPos && !isDelim(pos)) - { - pos++; - } - - if (pos < maxPos) - { - tok = s.substring(start, pos); - } - else - { - tok = s.substring(start); - } - - return tok; - } - - public boolean hasMoreElements() - { - return hasMoreTokens(); - } - - public Object nextElement() - { - return nextToken(); - } - - private boolean isDelim(int index) - { - char c = s.charAt(index); - - for (int i = 0; i != delims.length(); i++) - { - if (delims.charAt(i) == c) - { - return true; - } - } - - return false; - } -} diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/Sublist.java b/libraries/spongycastle/core/src/main/j2me/java/util/Sublist.java deleted file mode 100644 index 48d8d8e89..000000000 --- a/libraries/spongycastle/core/src/main/j2me/java/util/Sublist.java +++ /dev/null @@ -1,142 +0,0 @@ -package java.util; - -public class Sublist - extends AbstractList -{ - AbstractList m_al = null; - int m_fromIndex = 0; - int m_toIndex = 0; - int size = 0; - - public Sublist(AbstractList ali, int fromIndex, int toIndex) - { - m_al = ali; - m_toIndex = toIndex; - m_fromIndex = fromIndex; - size = size(); - } - - public Object set(int index, Object o) - { - if (index < size) - { - o = m_al.set(index + m_fromIndex, o); - if (o != null) - { - size++; - m_toIndex++; - } - return o; - } - else - { - throw new IndexOutOfBoundsException(); - } - } - - public Object get(int index) - throws IndexOutOfBoundsException - { - if (index < size) - { - return m_al.get(index + m_fromIndex); - } - else - { - throw new IndexOutOfBoundsException(); - } - } - - public void add(int index, Object o) - { - - if (index <= size) - { - m_al.add(index + m_fromIndex, o); - m_toIndex++; - size++; - - } - else - { - throw new IndexOutOfBoundsException(); - } - - } - - public Object remove(int index, Object o) - { - if (index < size) - { - Object ob = m_al.remove(index + m_fromIndex); - if (ob != null) - { - m_toIndex--; - size--; - } - return ob; - } - else - { - throw new IndexOutOfBoundsException(); - } - } - - public boolean addAll(int index, Collection c) - { - if (index < size) - { - boolean bool = m_al.addAll(index + m_fromIndex, c); - if (bool) - { - int lange = c.size(); - m_toIndex = m_toIndex + lange; - size = size + lange; - } - return bool; - } - else - { - throw new IndexOutOfBoundsException(); - } - } - - public boolean addAll(Collection c) - { - boolean bool = m_al.addAll(m_toIndex, c); - if (bool) - { - int lange = c.size(); - m_toIndex = m_toIndex + lange; - size = size + lange; - } - return bool; - } - - public void removeRange(int from, int to) - { - if ((from <= to) && (from <= size) && (to <= size)) - { - m_al.removeRange(from, to); - int lange = to - from; - m_toIndex = m_toIndex - lange; - size = size - lange; - } - else - { - if (from > to) - { - throw new IllegalArgumentException(); - } - else - { - throw new IndexOutOfBoundsException(); - } - } - } - - public int size() - { - return (m_toIndex - m_fromIndex); - } -} |