Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: nice/tools/code/Inline.java


1   /**************************************************************************/
2   /*                             N I C E                                    */
3   /*        A simple imperative object-oriented research language           */
4   /*                   (c)  Daniel Bonniot 1999                             */
5   /*                                                                        */
6   /*  This program is free software; you can redistribute it and/or modify  */
7   /*  it under the terms of the GNU General Public License as published by  */
8   /*  the Free Software Foundation; either version 2 of the License, or     */
9   /*  (at your option) any later version.                                   */
10  /*                                                                        */
11  /**************************************************************************/
12  
13  // File    : Inline.java
14  // Created : Tue Jul 25 12:26:52 2000 by Daniel Bonniot
15  //$Modified: Tue Aug 29 10:24:25 2000 by Daniel Bonniot $
16  
17  package nice.tools.code;
18  
19  import gnu.expr.Expression;
20  import gnu.expr.ApplyExp;
21  import gnu.mapping.*;
22  
23  /**
24     Static class to inline code written in <code>Procedure</code>s.
25     
26     @author Daniel Bonniot
27   */
28  
29  public final class Inline
30  {
31    public static Expression inline(Procedure1 proc)
32    {
33      return new ApplyExp(proc, Expression.noExpressions);
34    }
35  
36    public static Expression inline(Procedure1 proc, Expression arg1)
37    {
38      return new ApplyExp(proc, new Expression[]{ arg1 });
39    }
40  
41    public static Expression inline(Procedure2 proc, 
42            Expression arg1, Expression arg2)
43    {
44      return new ApplyExp(proc, new Expression[]{ arg1, arg2 });
45    }
46  }