diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml index b4c64a3..db50a63 100644 --- a/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/ICollection'1.xml @@ -1,4 +1,4 @@ - + - java.util.Collection + CS2JNet.System.Collections.Generic.ICollectionSupport - Collection*[${T}]* + ICollectionSupport*[${T}]* System.Collections.Generic.ICollection T diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/IEnumerable'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/IEnumerable'1.xml new file mode 100644 index 0000000..d38b1f3 --- /dev/null +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/IEnumerable'1.xml @@ -0,0 +1,24 @@ + + + + + java.lang.Iterable + + Iterable*[${E}]* + System.Collections.Generic.IEnumerable + + E + + + E + ${expr} + + + +jEYi0rdl/kMLr7uBNG0M9LMlbCQ=C/hbBQnMGlWnPvwE61XrMusMlyKT+K792pEYR7D7CnpO7Td1gFgCCfkSdFVZ1axk+sLzebWIQKH8+NFRC6+hlNpViODt46v/300e+fi2Yx8BWhpq5e51zfNAhHIdaUemMqHMHNG5BMOngpFx1yrO/zxHvj7HPJqGBwJV7w8yPtU= diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/IEnumerator'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/IEnumerator'1.xml new file mode 100644 index 0000000..c8926fd --- /dev/null +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/IEnumerator'1.xml @@ -0,0 +1,27 @@ + + + + + CS2JNet.System.Collections.Generic.IEnumeratorSupport + + IEnumeratorSupport*[${E}]* + System.Collections.Generic.IEnumerator + + E + + + E + ${expr} + + + E + Current> + ${this:16}.getcurrent() + +jEYi0rdl/kMLr7uBNG0M9LMlbCQ=C/hbBQnMGlWnPvwE61XrMusMlyKT+K792pEYR7D7CnpO7Td1gFgCCfkSdFVZ1axk+sLzebWIQKH8+NFRC6+hlNpViODt46v/300e+fi2Yx8BWhpq5e51zfNAhHIdaUemMqHMHNG5BMOngpFx1yrO/zxHvj7HPJqGBwJV7w8yPtU= diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/Queue'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/Queue'1.xml new file mode 100644 index 0000000..d1fe9d2 --- /dev/null +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/Queue'1.xml @@ -0,0 +1,52 @@ + + + + + java.util.LinkedList + + LinkedList*[${E}]* + System.Collections.Generic.Queue + + E + + + + + + new LinkedList*[${E}]*() + + + + + + + E + item + + + Enqueue + System.Void + ${this:16}.add(${item}) + + + + + Dequeue + E + ${this:16}.removeLast(${item}) + + + + + System.Int + Count + ${this}.size() + + +jEYi0rdl/kMLr7uBNG0M9LMlbCQ=C/hbBQnMGlWnPvwE61XrMusMlyKT+K792pEYR7D7CnpO7Td1gFgCCfkSdFVZ1axk+sLzebWIQKH8+NFRC6+hlNpViODt46v/300e+fi2Yx8BWhpq5e51zfNAhHIdaUemMqHMHNG5BMOngpFx1yrO/zxHvj7HPJqGBwJV7w8yPtU= diff --git a/CS2JLibrary/src/CS2JNet/JavaSupport/Collections/Generic/EnumeratorSupport.java b/CS2JLibrary/src/CS2JNet/JavaSupport/Collections/Generic/EnumeratorSupport.java new file mode 100644 index 0000000..3c1f56d --- /dev/null +++ b/CS2JLibrary/src/CS2JNet/JavaSupport/Collections/Generic/EnumeratorSupport.java @@ -0,0 +1,64 @@ +/* + 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; + +import java.util.Iterator; + +import CS2JNet.JavaSupport.CS2JRunTimeException; +import CS2JNet.System.Collections.Generic.IEnumeratorSupport; + +/** + * A concrete implementation of .Net's Enumerator that wraps an Iterator + * + * @author keving + * + * @param + */ +public class EnumeratorSupport implements IEnumeratorSupport { + + private Iterator myIterator = null; + private T myCurrent = null; + + 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/JavaSupport/language/EventCollection.java b/CS2JLibrary/src/CS2JNet/JavaSupport/language/EventCollection.java index 77ff08b..d1ea809 100644 --- a/CS2JLibrary/src/CS2JNet/JavaSupport/language/EventCollection.java +++ b/CS2JLibrary/src/CS2JNet/JavaSupport/language/EventCollection.java @@ -35,7 +35,7 @@ public class EventCollection implements IEventCollection { public void Invoke(Object cause, EventArgs e) throws CS2JRunTimeException { if (listeners != null) { // do something here - throw new CS2JRunTimeException("Events are not yet implemented"); + throw new CS2JRunTimeException("CS2J: Events are not yet implemented"); } } diff --git a/CS2JLibrary/src/CS2JNet/System/Collections/Generic/ICollectionSupport.java b/CS2JLibrary/src/CS2JNet/System/Collections/Generic/ICollectionSupport.java new file mode 100644 index 0000000..fc1f4ec --- /dev/null +++ b/CS2JLibrary/src/CS2JNet/System/Collections/Generic/ICollectionSupport.java @@ -0,0 +1,43 @@ +/* + 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.Generic; + + +/** + * @author kevin.glynn@twigletsoftware.com + * + */ +public interface ICollectionSupport extends Iterable { + + + 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 IEnumeratorSupport GetEnumerator() throws Exception; + + public void CopyTo(T[] arr, int i) throws Exception; + +} diff --git a/CS2JLibrary/src/CS2JNet/System/Collections/Generic/IEnumeratorSupport.java b/CS2JLibrary/src/CS2JNet/System/Collections/Generic/IEnumeratorSupport.java new file mode 100644 index 0000000..3851dff --- /dev/null +++ b/CS2JLibrary/src/CS2JNet/System/Collections/Generic/IEnumeratorSupport.java @@ -0,0 +1,38 @@ +/* + 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.Generic; + +/** + * Mimics Net's IEnumerator interface + * + * @author keving + * + * @param + */ +public interface IEnumeratorSupport extends Iterable{ + + T getCurrent() throws Exception; + + boolean MoveNext() throws Exception; + + void Reset() throws Exception; + +}