View Javadoc

1   /*
2    * Copyright (c) 2001, Zoltan Farkas All Rights Reserved.
3    *
4    * This library is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Lesser General Public
6    * License as published by the Free Software Foundation; either
7    * version 2.1 of the License, or (at your option) any later version.
8    *
9    * This library is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU Lesser General Public
15   * License along with this program; if not, write to the Free Software
16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17   */
18  package net.sf.zel.vm;
19  
20  import net.sf.zel.math.ExtendedMathContext;
21  
22  public class ProcDepContext
23          implements ParsingContext
24  {
25  
26      /**
27       * dependencies storage
28       */
29      private java.util.Set<Variable> dependencies = new java.util.HashSet<Variable>();
30  
31      public ProcDepContext()
32      {
33      }
34  
35      /**
36       * does nothing
37       *
38       * @param instr Instruction
39       * @param arg Object
40       */
41      @Override
42      final public void generateCode(Object... args)
43      {
44      }
45      /**
46       * return the current code address
47       * @return
48       */
49      @Override
50      public int getAddress()
51      {
52          throw new UnsupportedOperationException("Not supported yet.");
53      }
54  
55  
56      /**
57       * process dependencies
58       * @param obj Object
59       */
60      @Override
61      final public void process(Object obj)
62      {
63          if (obj instanceof java.util.List)
64          {
65              dependencies.add(new Variable((java.util.List) obj));
66          } else
67          {
68              dependencies.add(new Variable((String) obj));
69          }
70      }
71      ;
72  
73      /**
74       * return dependecy set
75       * @return
76       */
77      final public java.util.Set<Variable> getDependencySet()
78      {
79          return dependencies;
80      }
81  
82      /**
83       * get the code generated in this context
84       * @return Object[]
85       */
86      @Override
87      final public ProgramBuilder getProgramBuilder()
88      {
89          throw new UnsupportedOperationException("Code is not generated with ProcDepContext");
90      }
91  
92      /**
93       * Add code to this context
94       * @param code Object[]
95       */
96      @Override
97      final public void generateCodeAll(ParsingContext parsingContext)
98      {
99      }
100 
101     @Override
102     public ProcDepContext createSubContext()
103     {
104         return this;
105     }
106 
107     @Override
108     public ExtendedMathContext getMathContext()
109     {
110         return null;
111     }
112 
113     @Override
114     public void generateCodeAt(int address, Object... args)
115     {
116     }
117 }