1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

firtle with enumerators and collection templates

This commit is contained in:
Kevin Glynn 2011-04-18 19:27:23 +02:00
parent 0bbd8402db
commit 830987e80a
6 changed files with 44 additions and 19 deletions

View File

@ -20,8 +20,10 @@
<Java>${expr}</Java>
</Iterable>
<Properties>
<Type>E</Type>
<Name>Current></Name>
<Get>${this:16}.getcurrent()</Get>
<Property>
<Type>E</Type>
<Name>Current</Name>
<Get>${this:16}.getCurrent()</Get>
</Property>
</Properties>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>jEYi0rdl/kMLr7uBNG0M9LMlbCQ=</DigestValue></Reference></SignedInfo><SignatureValue>C/hbBQnMGlWnPvwE61XrMusMlyKT+K792pEYR7D7CnpO7Td1gFgCCfkSdFVZ1axk+sLzebWIQKH8+NFRC6+hlNpViODt46v/300e+fi2Yx8BWhpq5e51zfNAhHIdaUemMqHMHNG5BMOngpFx1yrO/zxHvj7HPJqGBwJV7w8yPtU=</SignatureValue></Signature></Interface>

View File

@ -47,7 +47,7 @@
<Imports>
<Import>CS2JNet.JavaSupport.Collections.Generic.EnumeratorSupport</Import>
</Imports>
<Java>new EnumeratorSupport*[T]*(${this}.iterator())</Java>
<Java>new EnumeratorSupport*[T]*(${this:16}.iterator())</Java>
<Params>
</Params>
<Name>GetEnumerator</Name>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is
@ -8,15 +8,19 @@
-->
<Interface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
<Imports />
<Java>Iterable</Java>
<Imports>
<Import>CS2JNet.System.Collections.Generic.ICollectionSupport</Import>
</Imports>
<Java>ICollectionSupport</Java>
<Name>System.Collections.ICollection</Name>
<Uses />
<Inherits> <Type>System.Object</Type> </Inherits>
<Methods>
<Method>
<Imports />
<Java>${this:16}.iterator()</Java>
<Imports>
<Import>CS2JNet.JavaSupport.Collections.Generic.EnumeratorSupport</Import>
</Imports>
<Java>EnumeratorSupport.mk(${this:16}.iterator())</Java>
<Params />
<Name>GetEnumerator</Name>
<Return>System.IEnumerator</Return>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is
@ -8,18 +8,22 @@
-->
<Interface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
<Imports />
<Java>Iterable</Java>
<Name>System.Collections.IEnumerable</Name>
<Imports>
<Import>CS2JNet.System.Collections.Generic.IEnumeratorSupport</Import>
</Imports>
<Java>IEnumeratorSupport</Java>
<Name>System.Collections.IEnumerator</Name>
<Uses />
<Inherits> <Type>System.Object</Type> </Inherits>
<Methods>
<Method>
<Imports />
<Java>${this:16}.iterator()</Java>
<Imports>
<Import>CS2JNet.JavaSupport.Collections.Generic.EnumeratorSupport</Import>
</Imports>
<Java>EnumeratorSupport.mk(${this:16}.iterator())</Java>
<Params />
<Name>GetEnumerator</Name>
<Return>System.IEnumerator</Return>
<Return>System.Collections.IEnumerator</Return>
</Method>
</Methods>
<Properties />

View File

@ -12,9 +12,19 @@
</Imports>
<Java>IEnumeratorSupport</Java>
<Name>System.Collections.IEnumerator</Name>
<Methods>
<Method>
<Java>${this:16}.MoveNext()</Java>
<Params />
<Name>MoveNext</Name>
<Return>System.Boolean</Return>
</Method>
</Methods>
<Properties>
<Type>System.Object</Type>
<Name>Current></Name>
<Get>${this:16}.getcurrent()</Get>
<Property>
<Type>System.Object</Type>
<Name>Current</Name>
<Get>${this:16}.getCurrent()</Get>
</Property>
</Properties>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>jEYi0rdl/kMLr7uBNG0M9LMlbCQ=</DigestValue></Reference></SignedInfo><SignatureValue>C/hbBQnMGlWnPvwE61XrMusMlyKT+K792pEYR7D7CnpO7Td1gFgCCfkSdFVZ1axk+sLzebWIQKH8+NFRC6+hlNpViODt46v/300e+fi2Yx8BWhpq5e51zfNAhHIdaUemMqHMHNG5BMOngpFx1yrO/zxHvj7HPJqGBwJV7w8yPtU=</SignatureValue></Signature></Interface>

View File

@ -20,6 +20,7 @@
*/
package CS2JNet.JavaSupport.Collections.Generic;
import java.util.Collection;
import java.util.Iterator;
import CS2JNet.JavaSupport.CS2JRunTimeException;
@ -37,6 +38,10 @@ public class EnumeratorSupport<T> implements IEnumeratorSupport<T> {
private Iterator<T> myIterator = null;
private T myCurrent = null;
public static <S> EnumeratorSupport<S> mk(Iterator<S> inIt) {
return new EnumeratorSupport<S>(inIt);
}
public EnumeratorSupport(Iterator<T> it) {
myIterator = it;
}