diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/Dictionary'2.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/Dictionary'2.xml index 147e2c4..9a21d51 100644 --- a/CS2JLibrary/NetFramework/System/Collections/Generic/Dictionary'2.xml +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/Dictionary'2.xml @@ -19,7 +19,7 @@ - System.Collections.IDictionary*[K,V]* + System.Collections.Generic.IDictionary*[K,V]* diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml index 669bd16..8a80c6e 100644 --- a/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml @@ -8,13 +8,16 @@ --> - java.util.Collection + CS2JNet.System.Collections.ICollection - Collection*[${T}]* + ICollection*[${T}]* System.Collections.Generic.ICollection T + + >System.Collections.Generic.IEnumerable*[T]* + T ${expr} diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/Dictionary'2.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/Dictionary'2.xml new file mode 100644 index 0000000..1c1a279 --- /dev/null +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/Dictionary'2.xml @@ -0,0 +1,135 @@ + + + + + java.util.HashMap + + HashMap*[${K},${V}]* + System.Collections.Generic.Dictionary + + K + V + + + + System.Collections.Generic.IDictionary*[K,V]* + + + + KeyValuePair*[K,V]* + ${expr}.entrySet() + + + + + ${this:16}.put(${key}, ${value}) + + + K + key + + + V + value + + + Add + System.Void + + + + ${this:16}.clear() + + Clear + System.Void + + + + ${this:16}.containsKey(${key}) + + + K + key + + + ContainsKey + System.Boolean + + + + ${this:16}.containsValue(${value}) + + + V + value + + + ContainsValue + System.Boolean + + + + ${this:16}.remove(${key}) + + + System.Object + key + + + Remove + + System.Boolean + + + + + + ${this:16}.size() + System.Int32 + Count + ${this:16}.size() + + + + CS2JNet.JavaSupport.Collections.Generic.LCC.CollectionSupport + + System.Collections.Generic.KeyCollection*[K]* + Keys + CollectionSupport.mk(${this:16}.keySet()) + + + + + + + + + System.Object + key + + + V + ${this:16}.get(${key}) + ${this:16}.put(${key}, ${value}) + + + + + + new HashMap*[${K},${V}]*() + + + + + + + +qbxkvItrQBq06TjO7qOtFI8C/q0=RcwnIhyoghrIJVGfVld2S5OkoSKruLMH/elhtAB+HTovqtoa+1Sdb1cVkFbu8Vb4YpAubmZh6Kv87UYSjKb50c15xCsx3naC7Je/qZ68rac206rokoqKiLXAV5M5C+Pr0q8gFyQK60WohWma7DrsO+B5ByXYR1UORm6Tk4WO04Q= diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/ICollection'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/ICollection'1.xml new file mode 100644 index 0000000..492139a --- /dev/null +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/ICollection'1.xml @@ -0,0 +1,41 @@ + + + + + CS2JNet.System.Collections.LCC.ICollection + + ICollection*[${T}]* + System.Collections.Generic.ICollection + + T + + + System.Collections.Generic.IEnumerable*[T]* + + + T + ${expr} + + + + + + + ${this:16}.add(${arg}) + + + T + arg + + + Add + System.Int32 + + +E8HIpKiRknOratBbxt4a71EId0E=bqvpolcous2/NZYPel/paViJS5fRwPaIvj75jVeZg70SnvhIFVNstqctcVLe2mw52NihU5aIVD3Pl1E5ZCeZbXs15yeg9B2CG//EbCpSXGO/a9iLa0aZhv4O63vLJAqBqT1tqKj+Z8FXIJxbwo4rtwnNHH7rqUAMsg3GfojAmS8= diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/IDictionary'2.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/IDictionary'2.xml new file mode 100644 index 0000000..4a83cdf --- /dev/null +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/IDictionary'2.xml @@ -0,0 +1,103 @@ + + + + + java.util.Map + + Map*[${K},${V}]* + System.Collections.Generic.IDictionary + + K + V + + + System.Collections.Generic.KeyValuePair*[K,V]* + ${expr}.entrySet() + + + + + ${this:16}.put(${key}, ${value}) + + + K + key + + + V + value + + + Add + System.Void + + + + ${this:16}.clear() + + Clear + System.Void + + + + ${this:16}.containsKey(${key}) + + + K + key + + + ContainsKey + System.Boolean + + + + ${this:16}.remove(${key}) + + + K + key + + + Remove + + System.Boolean + + + + + + + + K + key + + + V + ${this:16}.get(${key}) + ${this:16}.put(${key}, ${value}) + + + + + + CS2JNet.JavaSupport.Collections.Generic.LCC.CollectionSupport + + System.Collections.Generic.ICollection*[K]* + Keys + CollectionSupport.mk(${this:16}.keySet()) + + + + System.Collections.Generic.ICollection*[V]* + Values + ${this:16}.values() + + +BBHaGzWIzkVajkMtIotxcu6p5VY=WOOzmkxA0yBm1tFVetTcQxQc7SztNyQygCPbn5vaHLtHI/MoQMuTuytu5BrGb4UJ7KG68galgfmWUlUD99Txs44X+XdHA7wY0XcAUwXHV+/uti6FicyhHw7mDr9Bj4+Rjq4RIA2I0gS5P25V9nMEIEQCD3/jjc+wc4Lt5AHw/b4= diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/KeyCollection'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/KeyCollection'1.xml new file mode 100644 index 0000000..c3b924f --- /dev/null +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/LCC/KeyCollection'1.xml @@ -0,0 +1,75 @@ + + + + + CS2JNet.JavaSupport.Collections.Generic.CollectionSupport + + CollectionSupport*[${T}]* + + System.Collections.Generic.KeyCollection + + T + + + + + + T + ${expr} + + + + + CS2JNet.System.Collections.Generic.KeyCollectionSupport + + ${this:16}.copyTo(${array}, ${index}) + + + T[] + array + + + System.Int32 + index + + + CopyTo + System.Void + + + + CS2JNet.JavaSupport.Collections.Generic.LCC.EnumeratorSupport + + new EnumeratorSupport*[T]*(${this:16}.iterator()) + + + GetEnumerator + System.Collections.Generic.IEnumerator*[T]* + + + + + + ${this:16}.size() + System.Int32 + Count + ${this:16}.size() + + + + + + + + + + + +cUmprobnXdg5Nhlk8vAMJ2coyAo=XKTAn+4HQ4/anCQ8npTwr1Yrf3AxZc69HuV6muqqws96mCfCvaUhIqmlc2rZsw4CaXd+0bkFunIbLLgqHBaOePb1eKyp29uHhXODO/68lb8kfcPHB4aGO5LKWNPGw3mQoKK4RjuuRdOWZpx1wg7P5BGr+bGdX/gVk8pUUhHzDHs= diff --git a/CS2JLibrary/src/CS2JNet/JavaSupport/Collections/Generic/LCC/CollectionSupport.java b/CS2JLibrary/src/CS2JNet/JavaSupport/Collections/Generic/LCC/CollectionSupport.java new file mode 100644 index 0000000..30506ef --- /dev/null +++ b/CS2JLibrary/src/CS2JNet/JavaSupport/Collections/Generic/LCC/CollectionSupport.java @@ -0,0 +1,175 @@ +/* + Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Author(s): + + Kevin Glynn (kevin.glynn@twigletsoftware.com) +*/ +package CS2JNet.JavaSupport.Collections.Generic.LCC; + +import java.util.Collection; +import java.util.Iterator; + +import org.apache.commons.lang.NullArgumentException; + +import CS2JNet.System.ArgumentException; +import CS2JNet.System.Collections.LCC.ICollection; +import CS2JNet.System.Collections.LCC.IEnumerator; + +/** + * A concrete implementation of .Net's ICollection that wraps a Collection + * + * @author keving + * + * @param + */ +public class CollectionSupport implements ICollection { + + private Collection myCollection = null; + + public CollectionSupport(Collection inColl) { + myCollection = inColl; + } + + public static CollectionSupport mk(Collection inColl) { + return new CollectionSupport(inColl); + } + + + public Iterator iterator() { + return myCollection.iterator(); + } + + + @Override + public boolean add(T arg0) { + return myCollection.add(arg0); + } + + + @Override + public boolean addAll(Collection arg0) { + return myCollection.addAll(arg0); + } + + + @Override + public void clear() { + myCollection.clear(); + } + + + @Override + public boolean contains(Object arg0) { + return myCollection.contains(arg0); + } + + + @Override + public boolean containsAll(Collection arg0) { + return myCollection.containsAll(arg0); + } + + + @Override + public boolean isEmpty() { + return myCollection.isEmpty(); + } + + + @Override + public boolean remove(Object arg0) { + return myCollection.remove(arg0); + } + + + @Override + public boolean removeAll(Collection arg0) { + return myCollection.removeAll(arg0); + } + + + @Override + public boolean retainAll(Collection arg0) { + return myCollection.retainAll(arg0); + } + + + @Override + public int size() { + return myCollection.size(); + } + + + @Override + public Object[] toArray() { + return myCollection.toArray(); + } + + + @Override + public S[] toArray(S[] arg0) { + return myCollection.toArray(arg0); + } + + + @Override + public boolean Contains(T x) throws Exception { + return myCollection.contains(x); + } + + + @Override + public void Add(T x) throws Exception { + myCollection.add(x); + + } + + + @Override + public boolean Remove(T x) throws Exception { + return myCollection.remove(x); + } + + + @Override + public void Clear() throws Exception { + myCollection.clear(); + + } + + + @Override + public IEnumerator getEnumerator() throws Exception { + return new EnumeratorSupport(myCollection.iterator()); + } + + + @Override + public void copyTo(T[] arr, int i) throws Exception { + if (arr == null) { + throw new NullArgumentException("arr"); + } + if (i < 0 || i + myCollection.size() > arr.length) { + throw new ArgumentException("i"); + } + int idx = 0; + for (T e : this) { + arr[i+idx] = e; + } + + } + +} diff --git a/CS2JLibrary/src/CS2JNet/JavaSupport/Collections/Generic/LCC/EnumeratorSupport.java b/CS2JLibrary/src/CS2JNet/JavaSupport/Collections/Generic/LCC/EnumeratorSupport.java new file mode 100644 index 0000000..628aa0b --- /dev/null +++ b/CS2JLibrary/src/CS2JNet/JavaSupport/Collections/Generic/LCC/EnumeratorSupport.java @@ -0,0 +1,69 @@ +/* + Copyright 2007,2008,2009,2010 Rustici Software, LLC + Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Author(s): + + Kevin Glynn (kevin.glynn@twigletsoftware.com) +*/ +package CS2JNet.JavaSupport.Collections.Generic.LCC; + +import java.util.Collection; +import java.util.Iterator; + +import CS2JNet.JavaSupport.CS2JRunTimeException; +import CS2JNet.System.Collections.LCC.IEnumerator; + +/** + * A concrete implementation of .Net's Enumerator that wraps an Iterator + * + * @author keving + * + * @param + */ +public class EnumeratorSupport implements IEnumerator { + + private Iterator myIterator = null; + private T myCurrent = null; + + public static EnumeratorSupport mk(Iterator inIt) { + return new EnumeratorSupport(inIt); + } + + public EnumeratorSupport(Iterator it) { + myIterator = it; + } + + public T getCurrent() throws Exception { + return myCurrent; + } + + public boolean moveNext() throws Exception { + boolean hasNext = myIterator.hasNext(); + if (hasNext) { + myCurrent = myIterator.next(); + } + return hasNext; + } + + public void reset() throws Exception { + throw new CS2JRunTimeException("CS2J: IEnumerator does not yet support Reset() operation"); + } + + public Iterator iterator() { + return myIterator; + } + +} diff --git a/CS2JLibrary/src/CS2JNet/System/Collections/ICollection.java b/CS2JLibrary/src/CS2JNet/System/Collections/ICollection.java index 3ac9b6c..acfff08 100644 --- a/CS2JLibrary/src/CS2JNet/System/Collections/ICollection.java +++ b/CS2JLibrary/src/CS2JNet/System/Collections/ICollection.java @@ -27,7 +27,7 @@ import java.util.Collection; * @author kevin.glynn@twigletsoftware.com * */ -public interface ICollection extends Collection { +public interface ICollection extends IEnumerable,Collection { public boolean Contains(T x) throws Exception; diff --git a/CS2JLibrary/src/CS2JNet/System/Collections/LCC/ICollection.java b/CS2JLibrary/src/CS2JNet/System/Collections/LCC/ICollection.java new file mode 100644 index 0000000..97df688 --- /dev/null +++ b/CS2JLibrary/src/CS2JNet/System/Collections/LCC/ICollection.java @@ -0,0 +1,48 @@ +/* + Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Author(s): + + Kevin Glynn (kevin.glynn@twigletsoftware.com) +*/ + +package CS2JNet.System.Collections.LCC; + +import java.util.Collection; + + +/** + * Mimics Net's IEnumerator interface + * + * @author keving + * + * @param + */ +public interface ICollection extends IEnumerable,Collection { + + + public boolean Contains(T x) throws Exception; + + public void Add(T x) throws Exception; + + public boolean Remove(T x) throws Exception; + + public void Clear() throws Exception; + + public IEnumerator getEnumerator() throws Exception; + + public void copyTo(T[] arr, int i) throws Exception; + +}