Skip to main content

[el-spec commits] [el-spec~source-code:33] Some bug fixes

  • From: kchung@...
  • To: commits@...
  • Subject: [el-spec commits] [el-spec~source-code:33] Some bug fixes
  • Date: Tue, 10 Jan 2012 23:59:58 +0000

Project:    el-spec
Repository: source-code
Revision:   33
Author:     kchung
Date:       2012-01-10 23:59:56 UTC
Link:       

Log Message:
------------
Some bug fixes



Revisions:
----------
33


Modified Paths:
---------------
trunk/impl/src/main/java/com/sun/el/query/BaseDoubleIterator.java
trunk/impl/src/main/java/com/sun/el/parser/ELParser.jjt
trunk/impl/src/main/java/com/sun/el/query/QueryOperator.java
trunk/impl/src/main/java/com/sun/el/query/SelectMany.java
trunk/impl/src/main/java/com/sun/el/lang/EvaluationContext.java
trunk/impl/src/main/java/com/sun/el/parser/ELParser.java


Diffs:
------
Index: trunk/impl/src/main/java/com/sun/el/lang/EvaluationContext.java
===================================================================
--- trunk/impl/src/main/java/com/sun/el/lang/EvaluationContext.java     
(revision 32)
+++ trunk/impl/src/main/java/com/sun/el/lang/EvaluationContext.java     
(revision 33)
@@ -40,10 +40,15 @@
 
 package com.sun.el.lang;
 
+import java.util.EventListener;
+import java.util.List;
+import java.util.Map;
+
 import javax.el.ELContext;
 import javax.el.ELResolver;
 import javax.el.FunctionMapper;
 import javax.el.VariableMapper;
+import javax.el.TypeConverter;
 
 public final class EvaluationContext extends ELContext {
 
@@ -97,4 +102,28 @@
     public void setPropertyResolved(boolean resolved) {
         this.elContext.setPropertyResolved(resolved);
     }
+
+    public TypeConverter getTypeConverter() {
+        return this.elContext.getTypeConverter();
+    }
+
+    public <T extends EventListener> void addListener(T listener) {
+        this.elContext.addListener(listener);
+    }
+
+    public List<EventListener> getListeners() {
+        return this.elContext.getListeners();
+    }
+
+    public Object getLambdaArgument(String arg) {
+        return this.elContext.getLambdaArgument(arg);
+    }
+
+    public void enterLambdaScope(Map<String,Object> args) {
+        this.elContext.enterLambdaScope(args);
+    }
+
+    public void exitLambdaScope() {
+        this.elContext.exitLambdaScope();
+    }
 }
Index: trunk/impl/src/main/java/com/sun/el/query/SelectMany.java
===================================================================
--- trunk/impl/src/main/java/com/sun/el/query/SelectMany.java   (revision 32)
+++ trunk/impl/src/main/java/com/sun/el/query/SelectMany.java   (revision 33)
@@ -21,7 +21,7 @@
                         Object tmp = selector.invoke(context, item, index);
                         if (tmp instanceof Iterable) {
                             @SuppressWarnings("unchecked")
-                            Iterator<Object> _iter = (Iterator<Object>) tmp;
+                            Iterator<Object> _iter = 
((Iterable<Object>)tmp).iterator();
                             return _iter;
                         }
                         // Undefined.  We yield tmp, to continue
Index: trunk/impl/src/main/java/com/sun/el/query/QueryOperator.java
===================================================================
--- trunk/impl/src/main/java/com/sun/el/query/QueryOperator.java        
(revision 32)
+++ trunk/impl/src/main/java/com/sun/el/query/QueryOperator.java        
(revision 33)
@@ -22,8 +22,46 @@
         operators.put("where", new Where());
         operators.put("select", new Select());
         operators.put("selectMany", new SelectMany());
+        operators.put("take", new Take());
+        operators.put("skip", new Skip());
+        operators.put("takeWhile", new TakeWhile());
+        operators.put("skipWhile", new SkipWhile());
+        operators.put("join", new Join());
+        operators.put("groupJoin", new GroupJoin());
+        operators.put("concat", new Concat());
+        operators.put("orderBy", new OrderBy());
+        operators.put("thenBy", new ThenBy());
+        operators.put("orderByDescending", new OrderByDescending());
+        operators.put("thenByDescending", new ThenByDescending());
+        operators.put("reverse", new Reverse());
+        operators.put("groupBy", new GroupBy());
+        operators.put("distinc", new Distinct());
+        operators.put("union", new Union());
+        operators.put("interset", new Intersect());
+        operators.put("except", new Except());
+        operators.put("toArray", new ToArray());
+        operators.put("toList", new ToList());
+        operators.put("toMap", new ToMap());
+        operators.put("toLookup", new ToLookup());
+        operators.put("sequenceEqual", new SequenceEqual());
+        operators.put("first", new First());
+        operators.put("firstOrDefault", new FirstOrDefault());
+        operators.put("last", new Last());
+        operators.put("lastOrDefault", new LastOrDefault());
+        operators.put("single", new Single());
+        operators.put("singleOrDefault", new SingleOrDefault());
+        operators.put("elementAt", new ElementAt());
+        operators.put("elementAtOrDefault", new ElementAtOrDefault());
+        operators.put("defaultEmpty", new DefaultEmpty());
+        operators.put("any", new Any());
+        operators.put("all", new All());
+        operators.put("contains", new Contains());
+        operators.put("count", new Count());
         operators.put("sum", new Sum());
-//        operators.put("average", Average.class);
+        operators.put("min", new Min());
+        operators.put("max", new Max());
+        operators.put("average", new Average());
+        operators.put("aggregate", new Aggregate());
     }
 
     public abstract Object invoke(ELContext context,
@@ -43,7 +81,7 @@
      */
     static LambdaExpression getLambda(String name, Object[] params, int i,
                                       boolean optional) {
-        if (i > params.length || !(params[i] instanceof LambdaExpression)) {
+        if (i >= params.length || !(params[i] instanceof LambdaExpression)) {
             if (optional) {
                 return null;
             }
@@ -59,7 +97,7 @@
 
     static Object getArgument(String name, Object[] params, int i,
                               boolean optional) {
-        if (i > params.length ) {
+        if (i >= params.length ) {
             if (optional) {
                 return null;
             }
@@ -70,7 +108,7 @@
     }
 
     static int getInt(String name, Object[] params, int i) {
-        if (i > params.length || ! (params[i] instanceof Integer)) {
+        if (i >= params.length || ! (params[i] instanceof Integer)) {
             throw new ELException("Expecting an integer for " + 
                 "argument " + i + " of " + name + " operator.");
         }
@@ -78,7 +116,7 @@
     }
 
     static Iterable<Object> getIterable(String name, Object[] params, int i) 
{
-        if (i > params.length || ! (params[i] instanceof Iterable)) {
+        if (i >= params.length || ! (params[i] instanceof Iterable)) {
             throw new ELException("Expecting an Iterable for " + 
                 "argument " + i + " of " + name + " operator.");
         }
@@ -89,7 +127,7 @@
 
     static Comparator<Object> getComparator(String name, Object[] params, 
int i,
                                     boolean optional) {
-        if (i > params.length || ! (params[i] instanceof Comparator)) {
+        if (i >= params.length || ! (params[i] instanceof Comparator)) {
             if (optional) {
                 return null;
             }
Index: trunk/impl/src/main/java/com/sun/el/query/BaseDoubleIterator.java
===================================================================
--- trunk/impl/src/main/java/com/sun/el/query/BaseDoubleIterator.java   
(revision 32)
+++ trunk/impl/src/main/java/com/sun/el/query/BaseDoubleIterator.java   
(revision 33)
@@ -11,6 +11,7 @@
     private Object current;
     private boolean yielded;
     private boolean inOuter;
+    Object outerItem = null;
 
     BaseDoubleIterator(Iterable<Object> base){
         iter = base.iterator();
@@ -26,7 +27,6 @@
 
     @Override
     public boolean hasNext() {
-        Object outerItem = null;
         while (!yielded) {
             if (inOuter) {
                 if (! iter.hasNext()) {
Index: trunk/impl/src/main/java/com/sun/el/parser/ELParser.java
===================================================================
--- trunk/impl/src/main/java/com/sun/el/parser/ELParser.java    (revision 32)
+++ trunk/impl/src/main/java/com/sun/el/parser/ELParser.java    (revision 33)
@@ -1529,8 +1529,8 @@
     try {
       Expression();
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case ARROW:
-        jj_consume_token(ARROW);
+      case COLON:
+        jj_consume_token(COLON);
         Expression();
         break;
       default:
@@ -2631,10 +2631,10 @@
       jj_la1_init_1();
    }
    private static void jj_la1_init_0() {
-      jj_la1_0 = new int[] 
{0xe,0xe,0x575a00,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf8000000,0x60000000,0x18000000,0x0,0x80000000,0xf8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x575a00,0x480000,0x575a00,0x480000,0x100000,0x100000,0x2000000,0x575a00,0x2000000,0x0,0x100000,0x100000,0x400200,0x2000000,0x575a00,0x0,0x2000000,0x575a00,0x80000,0x100000,0x1000000,0x2000000,0x575a00,0x75800,0x30000,};
+      jj_la1_0 = new int[] 
{0xe,0xe,0x575a00,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf8000000,0x60000000,0x18000000,0x0,0x80000000,0xf8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x575a00,0x480000,0x575a00,0x480000,0x100000,0x100000,0x2000000,0x575a00,0x2000000,0x0,0x100000,0x100000,0x400200,0x2000000,0x575a00,0x1000000,0x2000000,0x575a00,0x80000,0x100000,0x1000000,0x2000000,0x575a00,0x75800,0x30000,};
    }
    private static void jj_la1_init_1() {
-      jj_la1_1 = new int[] 
{0x0,0x0,0xa022180,0x0,0x1000000,0x40000,0x1800,0x1800,0x600,0x600,0x78,0x18,0x60,0x78,0x7,0x0,0x0,0x6,0x1,0x7,0x800000,0x30000,0x30000,0x788000,0x180000,0x600000,0x788000,0x180,0xa022180,0x0,0xa000000,0x0,0x0,0x0,0x0,0xa022180,0x0,0x8000000,0x8000000,0x0,0xa000000,0x0,0xa022180,0x4000000,0x0,0xa022180,0x0,0x0,0x0,0x0,0xa022180,0x0,0x0,};
+      jj_la1_1 = new int[] 
{0x0,0x0,0xa022180,0x0,0x1000000,0x40000,0x1800,0x1800,0x600,0x600,0x78,0x18,0x60,0x78,0x7,0x0,0x0,0x6,0x1,0x7,0x800000,0x30000,0x30000,0x788000,0x180000,0x600000,0x788000,0x180,0xa022180,0x0,0xa000000,0x0,0x0,0x0,0x0,0xa022180,0x0,0x8000000,0x8000000,0x0,0xa000000,0x0,0xa022180,0x0,0x0,0xa022180,0x0,0x0,0x0,0x0,0xa022180,0x0,0x0,};
    }
   final private JJCalls[] jj_2_rtns = new JJCalls[2];
   private boolean jj_rescan = false;
Index: trunk/impl/src/main/java/com/sun/el/parser/ELParser.jjt
===================================================================
--- trunk/impl/src/main/java/com/sun/el/parser/ELParser.jjt     (revision 32)
+++ trunk/impl/src/main/java/com/sun/el/parser/ELParser.jjt     (revision 33)
@@ -349,7 +349,7 @@
 
 void MapEntry() #MapEntry: {}
 {
-    Expression() (<ARROW> Expression())?
+    Expression() (<COLON> Expression())?
 }
 
 void ListData() #ListData: {}





[el-spec commits] [el-spec~source-code:33] Some bug fixes

kchung 01/11/2012
 
 
Close
loading
Please Confirm
Close