New Content patch getting big progress on base and progress on lists.
-Changed: Build Task no longer Sync's because it is 9x slower and a File Builder never collides with another File Builder. -Added: getEquals() function for faster compare builders. -Changed: getNonClassType to getNonFileType() -Added: New Rule to the Rule Sheet. -Added: Regex Helper so recursion is supported -Added: FunctionMapper that supports more then 1 argument. -Changed: Injection & FunctionMapper support recursion- -Added: Loads of Variables to the GlobalVariables as they were added for templates. -Added: AbstractCollection, AbstractList, List, ListIterator, BidirectionalIterator, Arrays and ArrayList template.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package speiger.src.collections.PACKAGE.utils;
|
||||
|
||||
public class ARRAYS
|
||||
{
|
||||
#if !TYPE_OBJECT
|
||||
public static CLASS_TYPE[] wrap(KEY_TYPE[] a) {
|
||||
CLASS_TYPE[] result = new CLASS_TYPE[a.length];
|
||||
for(int i = 0,m=a.length;i<m;i++)
|
||||
result[i] = KEY_TO_OBJ(a[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static KEY_TYPE[] unwrap(CLASS_TYPE[] a) {
|
||||
KEY_TYPE[] result = new KEY_TYPE[a.length];
|
||||
for(int i = 0,m=a.length;i<m;i++)
|
||||
result[i] = OBJ_TO_KEY(a[i]);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package speiger.src.collections.PACKAGE.utils;
|
||||
|
||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||
|
||||
public class ITERATORS
|
||||
{
|
||||
public static GENERIC_BRACES ArrayIterator KEY_GENERIC_TYPE wrap(KEY_TYPE[] a) {
|
||||
return wrap(a, 0, a.length);
|
||||
}
|
||||
|
||||
public static GENERIC_BRACES ArrayIterator KEY_GENERIC_TYPE wrap(KEY_TYPE[] a, int start, int end) {
|
||||
return new ArrayIteratorBRACES(a, start, end);
|
||||
}
|
||||
|
||||
public static GENERIC_BRACES int unwrap(KEY_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i) {
|
||||
return unwrap(a, i, 0, a.length);
|
||||
}
|
||||
|
||||
public static GENERIC_BRACES int unwrap(KEY_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i, int offset) {
|
||||
return unwrap(a, i, offset, a.length);
|
||||
}
|
||||
|
||||
public static GENERIC_BRACES int unwrap(KEY_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i, int offset, int max) {
|
||||
if(max < 0) throw new IllegalStateException("The max size is smaller then 0");
|
||||
if(offset + max >= a.length) throw new IllegalStateException("largest array index exceeds array size");
|
||||
int index = 0;
|
||||
for(;index<max && i.hasNext();index++) a[index+offset] = i.NEXT();
|
||||
return index;
|
||||
}
|
||||
|
||||
#if !TYPE_OBJECT
|
||||
public static GENERIC_BRACES int unwrap(CLASS_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i) {
|
||||
return unwrap(a, i, 0, a.length);
|
||||
}
|
||||
|
||||
public static GENERIC_BRACES int unwrap(CLASS_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i, int offset) {
|
||||
return unwrap(a, i, offset, a.length);
|
||||
}
|
||||
|
||||
public static GENERIC_BRACES int unwrap(CLASS_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i, int offset, int max) {
|
||||
if(max < 0) throw new IllegalStateException("The max size is smaller then 0");
|
||||
if(offset + max >= a.length) throw new IllegalStateException("largest array index exceeds array size");
|
||||
int index = 0;
|
||||
for(;index<max && i.hasNext();index++) a[index+offset] = KEY_TO_OBJ(i.NEXT());
|
||||
return index;
|
||||
}
|
||||
|
||||
#endif
|
||||
private static class ArrayIterator KEY_GENERIC_TYPE implements ITERATOR KEY_GENERIC_TYPE
|
||||
{
|
||||
KEY_TYPE[] a;
|
||||
int from;
|
||||
int to;
|
||||
|
||||
ArrayIterator(KEY_TYPE[] a, int from, int to) {
|
||||
this.a = a;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return from < to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KEY_TYPE NEXT() {
|
||||
return a[from++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int skip(int amount) {
|
||||
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||
int left = Math.min(amount, to - from);
|
||||
from += left;
|
||||
return amount - left;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user