KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > token > signedinteger


1 package com.daffodilwoods.daffodildb.server.sql99.token;
2
3 import com.daffodilwoods.daffodildb.utils.field.*;
4
5 public class signedinteger implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter {
6    public digit[] _Repdigit0;
7    public sign _Optsign1;
8
9    private FieldBase fieldBase;
10    public Object JavaDoc run(Object JavaDoc object) throws com.daffodilwoods.database.resource.DException {
11       String JavaDoc unsignedInteger = "";
12       if (fieldBase == null) {
13          for (int i = 0; i < _Repdigit0.length; i++) {
14             String JavaDoc aa = (String JavaDoc) _Repdigit0[i].run(object);
15             unsignedInteger += aa.trim();
16          }
17
18          if (_Optsign1 != null) {
19             String JavaDoc sign = (String JavaDoc) _Optsign1.run(null);
20             if (sign.trim().equalsIgnoreCase("-")) {
21                unsignedInteger = sign + unsignedInteger;
22             }
23          }
24          fieldBase = new FieldLiteral(unsignedInteger, -1);
25       }
26       return fieldBase;
27    }
28
29    public String JavaDoc toString() {
30       StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
31       sb.append(" ");
32       if (_Optsign1 != null) {
33          sb.append(_Optsign1);
34       }
35       for (int i = 0; i < _Repdigit0.length; i++) {
36          sb.append(_Repdigit0[i]);
37       }
38       return sb.toString();
39    }
40
41    public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
42       signedinteger tempClass = new signedinteger();
43       digit[] temp_Repdigit0 = new digit[_Repdigit0.length];
44       for (int i = 0; i < _Repdigit0.length; i++) {
45          temp_Repdigit0[i] = (digit) _Repdigit0[i].clone();
46       }
47       tempClass._Repdigit0 = temp_Repdigit0;
48       if (_Optsign1 != null) {
49          tempClass._Optsign1 = (sign) _Optsign1.clone();
50       }
51       return tempClass;
52    }
53
54    /*public Object run1(Object object) throws com.daffodilwoods.database.resource.DException{
55         String unsignedInteger = (String)_unsignedinteger0.run(object);
56         if(_Optsign1 != null){
57           String sign = (String)_Optsign1.run(null);
58           unsignedInteger = sign + unsignedInteger;
59         }
60         return unsignedInteger;
61      } */

62
63 }
64
Popular Tags