gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/lava/gzz/potion Call.java CommandCall.java ...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/lava/gzz/potion Call.java CommandCall.java ...
Date: Mon, 02 Dec 2002 20:01:59 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      02/12/02 20:01:58

Modified files:
        lava/gzz/potion: Call.java CommandCall.java FunctionCall.java 
                         Head.java Type.java 
        lava/gzz/potion/potions: Break.java Clone.java 
Added files:
        lava/gzz/potion: AbstractHead.java 
        lava/gzz/potion/potions: Types.java 

Log message:
        More potion work

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/AbstractHead.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/Call.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/CommandCall.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/FunctionCall.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/Head.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/Type.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Types.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Break.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Clone.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gzz/lava/gzz/potion/Call.java
diff -u gzz/lava/gzz/potion/Call.java:1.3 gzz/lava/gzz/potion/Call.java:1.4
--- gzz/lava/gzz/potion/Call.java:1.3   Sun Nov 24 11:02:19 2002
+++ gzz/lava/gzz/potion/Call.java       Mon Dec  2 20:01:58 2002
@@ -29,14 +29,22 @@
     Head head;
     FunctionExpression[] params;
   
-    public Call(Head head, FunctionExpression[] params){
+    public Call(Head head, FunctionExpression[] params) {
        this.head = head;
        this.params = params;
     }
   
-    public String getString(Map context){
-       return null;
+    public String getString(Map context) {
+       return head.getString(params, context);
     }
-    public void render(Map context, HChain into){
+    public void render(Map context, HChain into) {
+       head.render(params, context, into);
+    }
+
+    protected List[] evaluateParams(Map context) {
+       List[] result = new List[params.length];
+       for(int i=0; i<params.length; i++)
+           result[i] = params[i].evaluate(context);
+       return result;
     }
 }
Index: gzz/lava/gzz/potion/CommandCall.java
diff -u gzz/lava/gzz/potion/CommandCall.java:1.1 
gzz/lava/gzz/potion/CommandCall.java:1.2
--- gzz/lava/gzz/potion/CommandCall.java:1.1    Fri Nov 22 12:05:30 2002
+++ gzz/lava/gzz/potion/CommandCall.java        Mon Dec  2 20:01:58 2002
@@ -7,9 +7,11 @@
     Command command;
 
     public CommandCall(Command command, FunctionExpression[] params) {
-       super(null, null);
+       super(command, params);
+       this.command = command;
     }
 
     public void execute(Map context) {
+       command.execute(evaluateParams(context), context);
     }
 }
Index: gzz/lava/gzz/potion/FunctionCall.java
diff -u gzz/lava/gzz/potion/FunctionCall.java:1.1 
gzz/lava/gzz/potion/FunctionCall.java:1.2
--- gzz/lava/gzz/potion/FunctionCall.java:1.1   Thu Nov 21 18:51:35 2002
+++ gzz/lava/gzz/potion/FunctionCall.java       Mon Dec  2 20:01:58 2002
@@ -1,45 +1,17 @@
-/*
-FunctionCall.java
- *
- *    Copyright (c) 2002, OSK Group
- *
- *    You may use and distribute under the terms of either the GNU
-Lesser
- *    General Public License, either version 2 of the license or,
- *    at your choice, any later version. Alternatively, you may use and
- *    distribute under the terms of the XPL.
- *
- *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms
-of
- *    the licenses.
- *
- *    This software is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-README
- *    file for more details.
- *
- */
-/*
- * Written by OSK Group
- */
+//(c):OSK Group
 package gzz.potion;
 import java.util.*;
 import gzz.vob.linebreaking.HChain;
 
-public class FunctionCall extends Call implements FunctionExpression{
+public class FunctionCall extends Call implements FunctionExpression {
 
-       Function function;
+    Function function;
 
-       public FunctionCall(Function function, FunctionExpression params){
-               super(null, null);
-               this.function = function;
-               }
-       public List evaluate(Map contetxt){
-               return null;
-       }
-       public String getString(Map context){
-               return null;
-       }
-       public void render(Map context, HChain into){}
+    public FunctionCall(Function function, FunctionExpression[] params) {
+       super(function, params);
+       this.function = function;
+    }
+    public List evaluate(Map context) {
+       return function.evaluate(evaluateParams(context), context);
+    }
 }
Index: gzz/lava/gzz/potion/Head.java
diff -u gzz/lava/gzz/potion/Head.java:1.1 gzz/lava/gzz/potion/Head.java:1.2
--- gzz/lava/gzz/potion/Head.java:1.1   Thu Nov 21 18:51:35 2002
+++ gzz/lava/gzz/potion/Head.java       Mon Dec  2 20:01:58 2002
@@ -1,34 +1,10 @@
-/*
-Head.java
- *
- *    Copyright (c) 2002, OSK Group
- *
- *    You may use and distribute under the terms of either the GNU
-Lesser
- *    General Public License, either version 2 of the license or,
- *    at your choice, any later version. Alternatively, you may use and
- *    distribute under the terms of the XPL.
- *
- *    See the LICENSE.lgpl and LICENSE.xpl files for the specific terms
-of
- *    the licenses.
- *
- *    This software is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-README
- *    file for more details.
- *
- */
-/*
- * Written by OSK Group
- */
+//(c):OSK Group
 package gzz.potion;
 import java.util.*;
 import gzz.vob.linebreaking.HChain;
 
-public interface Head{
-       String getString(Expression[] params, Map context);
-       void render (Expression[] params, Map context, HChain into);
-       Type[] getParams();
+public interface Head {
+    String getString(Expression[] params, Map context);
+    void render(Expression[] params, Map context, HChain into);
+    Type[] getParams();
 }
Index: gzz/lava/gzz/potion/Type.java
diff -u gzz/lava/gzz/potion/Type.java:1.2 gzz/lava/gzz/potion/Type.java:1.3
--- gzz/lava/gzz/potion/Type.java:1.2   Sun Nov 24 11:02:19 2002
+++ gzz/lava/gzz/potion/Type.java       Mon Dec  2 20:01:58 2002
@@ -27,8 +27,8 @@
 
 public interface Type{
     
-    public Object readCell(Cell c, Map context);
-    public Object readDir(int win, int axis, int dir, Map context);
-    public String getQuestionString();
-    public void renderQuestion(HChain into);
+    Object readCell(Cell c, Map context);
+    Object readDir(int win, int axis, int dir, Map context);
+    String getQuestionString();
+    void renderQuestion(HChain into);
 }
Index: gzz/lava/gzz/potion/potions/Break.java
diff -u gzz/lava/gzz/potion/potions/Break.java:1.1 
gzz/lava/gzz/potion/potions/Break.java:1.2
--- gzz/lava/gzz/potion/potions/Break.java:1.1  Mon Nov 25 18:52:50 2002
+++ gzz/lava/gzz/potion/potions/Break.java      Mon Dec  2 20:01:58 2002
@@ -6,30 +6,19 @@
 import gzz.*;
 import gzz.potion.Expression.*;
 
-public class Break implements Command{
+public class Break extends AbstractHead implements Command{
 
-        public String getString(Expression[] params, Map context){
-        
-                return null;
-        
-        }
+    public Break() {
+       super(new Object[] {
+           "Break ", Types.CONNECTION
+       });
+    }
 
-       public void render(Expression[] params, Map context, HChain hchain ){}
-       
-       public Type[] getParams() {
-        
-                  return null;
-                   
-       }
-
-       public void execute(List[] params, Map context) {
-        
-                for(Iterator i=params[0].iterator(); i.hasNext();) {
-               
-                       Connection c = (Connection)i.next();
-                       c.negside.disconnect(c.dim, 1);
-                       c.posside.disconnect(c.dim, -1);
-               }
-        
+    public void execute(List[] params, Map context) {
+       for(Iterator i=params[0].iterator(); i.hasNext();) {
+           Connection c = (Connection)i.next();
+           c.negside.disconnect(c.dim, 1);
+           c.posside.disconnect(c.dim, -1);
        }
+    }
 }
Index: gzz/lava/gzz/potion/potions/Clone.java
diff -u gzz/lava/gzz/potion/potions/Clone.java:1.1 
gzz/lava/gzz/potion/potions/Clone.java:1.2
--- gzz/lava/gzz/potion/potions/Clone.java:1.1  Mon Nov 25 18:52:50 2002
+++ gzz/lava/gzz/potion/potions/Clone.java      Mon Dec  2 20:01:58 2002
@@ -6,36 +6,22 @@
 import gzz.*;
 import gzz.potion.Expression.*;
 
-public class Clone{
+public class Clone extends AbstractHead implements Command {
+    
+    public Clone() {
+       super(new Object[] {
+           "Clone ", Types.CELL, " ", Types.PLACE
+       });
+    }
 
-       public String getString(Expression[] params, Map context){
-        
-                return null;
-        
-        }
-
-       public void render(Expression[] params, Map context, HChain hchain ){}
-       
-       public Type[] getParams() {
-        
-                  return null;
-                   
+    public void execute(List[] params, Map context) {
+       for(Iterator i=params[0].iterator(); i.hasNext();) {
+           Cell c = (Cell)i.next();
+           for(Iterator j=params[1].iterator(); j.hasNext();) {
+               Place p = (Place)j.next();
+               c.zzclone();
+               p.cell.insert(p.dim, p.dir, c); 
+           }
        }
-
-       public void execute(List[] params, Map context) {
-        
-                for(Iterator i=params[0].iterator(); i.hasNext();) {
-               
-                       Cell c = (Cell)i.next();
-                
-                        for(Iterator j=params[1].iterator(); j.hasNext();) {
-               
-                               Place p = (Place)j.next();
-                                c.zzclone();
-                               p.cell.insert(p.dim, p.dir, c); 
-
-                       }
-               }
-        }
-
-}
\ No newline at end of file
+    }
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]