KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > innig > macker > rule > Variable


1 /*______________________________________________________________________________
2  *
3  * Macker http://innig.net/macker/
4  *
5  * Copyright 2002 Paul Cantrell
6  *
7  * This program is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License version 2, as published by the
9  * Free Software Foundation. See the file LICENSE.html for more information.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the license for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
17  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
18  *______________________________________________________________________________
19  */

20  
21 package net.innig.macker.rule;
22
23 import net.innig.macker.structure.ClassManager;
24 import net.innig.macker.structure.ClassInfo;
25 import net.innig.macker.event.MackerIsMadException;
26
27 import java.util.*;
28
29 public class Variable
30     extends Rule
31     {
32     public Variable(RuleSet parent, String JavaDoc name, String JavaDoc value)
33         {
34         super(parent);
35         setVariableName(name);
36         setValue(value);
37         }
38         
39     public String JavaDoc getVariableName()
40         { return variableName; }
41     
42     public void setVariableName(String JavaDoc variableName)
43         { this.variableName = variableName; }
44     
45     public String JavaDoc getValue()
46         { return value; }
47     
48     public void setValue(String JavaDoc value)
49         { this.value = value;}
50
51     public void check(
52             EvaluationContext context,
53             ClassManager classes)
54         throws RulesException, MackerIsMadException
55         {
56         context.setVariableValue(getVariableName(), getValue());
57         }
58     
59     private String JavaDoc variableName, value;
60     }
Popular Tags