Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24861/src/Spring/Spring.Core/Expressions
Modified Files:
Expression.g SelectionNode.cs
Log Message:
SPRNET-901
Index: SelectionNode.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions/SelectionNode.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SelectionNode.cs 7 Sep 2007 03:01:26 -0000 1.5
--- SelectionNode.cs 25 Mar 2008 22:33:04 -0000 1.6
***************
*** 36,40 ****
/// Create a new instance
/// </summary>
! public SelectionNode():base()
{
}
--- 36,41 ----
/// Create a new instance
/// </summary>
! public SelectionNode()
! : base()
{
}
***************
*** 47,51 ****
{
}
!
/// <summary>
/// Returns a <see cref="IList"/> containing results of evaluation
--- 48,52 ----
{
}
!
/// <summary>
/// Returns a <see cref="IList"/> containing results of evaluation
***************
*** 64,78 ****
}
! BaseNode expression = (BaseNode) this.getFirstChild();
IList selectionList = new ArrayList();
using (evalContext.SwitchThisContext())
{
foreach (object o in enumerable)
{
evalContext.ThisContext = o;
! bool isMatch = (bool) expression.GetValueInternal(o, evalContext);
if (isMatch)
{
! selectionList.Add(o);
}
}
--- 65,100 ----
}
! BaseNode expression = (BaseNode)this.getFirstChild();
! BaseNode minIndexExpression = (BaseNode)expression.getNextSibling();
! BaseNode maxIndexExpression = (minIndexExpression == null) ? null : (BaseNode)minIndexExpression.getNextSibling();
!
! int minIndex = (int)((minIndexExpression == null)
! ? Int32.MinValue
! : minIndexExpression.GetValueInternal(context, evalContext));
! int maxIndex = (int)((maxIndexExpression == null)
! ? Int32.MaxValue
! : maxIndexExpression.GetValueInternal(context, evalContext));
!
IList selectionList = new ArrayList();
+
using (evalContext.SwitchThisContext())
{
+ int found = 0;
foreach (object o in enumerable)
{
evalContext.ThisContext = o;
! bool isMatch = (bool)expression.GetValueInternal(o, evalContext);
if (isMatch)
{
! if (minIndex <= found && found <= maxIndex)
! {
! selectionList.Add(o);
! }
! found++;
!
! if (found>maxIndex)
! {
! break; // don't look any further
! }
}
}
Index: Expression.g
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Expressions/Expression.g,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** Expression.g 11 Oct 2007 13:55:37 -0000 1.25
--- Expression.g 25 Mar 2008 22:33:04 -0000 1.26
***************
*** 207,211 ****
selection
:
! SELECT^ <AST = Spring.Expressions.SelectionNode> expression RCURLY!
;
--- 207,211 ----
selection
:
! SELECT^ <AST = Spring.Expressions.SelectionNode> expression (COMMA! expression)* RCURLY!
;
|