View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package net.sf.zel.vm;
7   
8   import net.sf.zel.instr.Instruction;
9   import net.sf.zel.math.ExtendedMathContext;
10  
11  /**
12   *
13   * @author zoly
14   */
15  public final class ConstantParsingContext implements ParsingContext
16  {
17      private Object obj;
18  
19  
20      ExtendedMathContext mc;
21  
22      public ConstantParsingContext(ExtendedMathContext mc)
23      {
24          this.mc = mc;
25      }
26  
27  
28      @Override
29      public void generateCode(Object... args)
30      {
31        for (Object o : args)
32        if (!(o instanceof Instruction))
33              obj=o;
34  
35      }
36  
37      /**
38       * return the current code address
39       * @return
40       */
41      @Override
42      public int getAddress()
43      {
44          throw new UnsupportedOperationException("Not supported yet.");
45      }
46  
47  
48      @Override
49      public void process(Object obj)
50      {
51          throw new UnsupportedOperationException("Not supported yet.");
52      }
53  
54      @Override
55      public ProgramBuilder getProgramBuilder()
56      {
57          throw new UnsupportedOperationException("Not supported yet.");
58      }
59  
60      @Override
61      public void generateCodeAll(ParsingContext parsingContext)
62      {
63          throw new UnsupportedOperationException("Not supported yet.");
64      }
65  
66      @Override
67      public ConstantParsingContext createSubContext()
68      {
69          return this;
70      }
71  
72      public Object getConstant()
73      {
74          return obj;
75      }
76  
77      @Override
78      public ExtendedMathContext getMathContext()
79      {
80          return mc;
81      }
82  
83      @Override
84      public void generateCodeAt(int address, Object... args)
85      {
86          throw new UnsupportedOperationException("Not supported yet.");
87      }
88  }