01: /*
02: * $Id: VariableAssembler.java,v 1.1 2003/08/19 01:12:57 jonesde Exp $
03: *
04: * Copyright (c) 1999 Steven J. Metsker.
05: * Copyright (c) 2001 The Open For Business Project - www.ofbiz.org
06: *
07: * Permission is hereby granted, free of charge, to any person obtaining a
08: * copy of this software and associated documentation files (the "Software"),
09: * to deal in the Software without restriction, including without limitation
10: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11: * and/or sell copies of the Software, and to permit persons to whom the
12: * Software is furnished to do so, subject to the following conditions:
13: *
14: * The above copyright notice and this permission notice shall be included
15: * in all copies or substantial portions of the Software.
16: *
17: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18: * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20: * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21: * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
22: * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
23: * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24: */
25:
26: package org.ofbiz.rules.logikus;
27:
28: import org.ofbiz.rules.engine.*;
29: import org.ofbiz.rules.parse.*;
30: import org.ofbiz.rules.parse.tokens.*;
31:
32: /**
33: * Pops a string like "X" or "Person" from an assembly's stack and pushes a variable with that name.
34: *
35: * @author Steven J. Metsker
36: * @version 1.0
37: */
38: public class VariableAssembler extends Assembler {
39:
40: /**
41: * Pops a string like "X" or "Person" from an assembly's stack
42: * and pushes a variable with that name.
43: *
44: * @param Assembly the assembly to work on
45: */
46: public void workOn(Assembly a) {
47: Token t = (Token) a.pop();
48: String name = t.sval();
49:
50: a.push(new Variable(name));
51: }
52: }
|