summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahaase2008-01-23 08:23:27 (EST)
committer ahaase2008-01-23 08:23:27 (EST)
commit16a3cfa5bacb192068c9876acc3fe194e9208f32 (patch)
treeb432aff820bd9955484628276aaf9d5a570c6ad9
parent69940dc01c20e9647ada3cf773fa7662bede0358 (diff)
downloadorg.eclipse.xpand-16a3cfa5bacb192068c9876acc3fe194e9208f32.zip
org.eclipse.xpand-16a3cfa5bacb192068c9876acc3fe194e9208f32.tar.gz
org.eclipse.xpand-16a3cfa5bacb192068c9876acc3fe194e9208f32.tar.bz2
cleanup: separated a specific XtendLib from the general syslib
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java17
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/SyntaxConstants.java13
2 files changed, 14 insertions, 16 deletions
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java
index 8c3f51a..c4dd2ba 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java
@@ -10,15 +10,26 @@ Contributors:
*/
package org.eclipse.xtend.backend.util;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
/**
*
* @author Arno Haase (http://www.haase-consulting.com)
*/
public final class CollectionHelper {
- public static Object[] withoutFirst (Object[] o) {
- final Object[] result = new Object[o.length - 1];
- System.arraycopy(o, 1, result, 0, result.length);
+ public static<T> T[] withoutFirst (T[] o) {
+ return Arrays.copyOfRange (o, 1, o.length);
+ }
+
+ public static<T> List<T> withoutFirst (List<T> o) {
+ final List<T> result = new ArrayList<T>();
+
+ for (int i=1; i<o.size(); i++)
+ result.add (o.get(i));
+
return result;
}
}
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/SyntaxConstants.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/SyntaxConstants.java
index 134ec88..fb3818f 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/SyntaxConstants.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/SyntaxConstants.java
@@ -18,17 +18,4 @@ package org.eclipse.xtend.backend.util;
public interface SyntaxConstants {
String NS_DELIM = "::";
String THIS = "this";
-
- // special function names
- String WRITE_TO_FILE = "writeToFile";
-
- String FOREACH_WITHOUT_ITERATOR = "forEach";
- String FOREACH_WITH_ITERATOR = "forEachWithIterator";
-
- // function names for operator overloading
- String OPERATOR_PLUS = "operatorPlus";
- String OPERATOR_MINUS = "operatorMinus";
- String OPERATOR_MULT = "operatorMult";
- String OPERATOR_DIV = "operatorDiv";
- String OPERATOR_MOD = "operatorMod";
}