4 * Copyright 2004-2007 MTBJ, Inc.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 package com
.dtrules
.interpreter
;
22 import java
.util
.ArrayList
;
23 import java
.util
.Date
;
24 import java
.util
.HashMap
;
26 import com
.dtrules
.entity
.IREntity
;
27 import com
.dtrules
.infrastructure
.RulesException
;
28 import com
.dtrules
.mapping
.XMLTag
;
29 import com
.dtrules
.session
.DTState
;
30 import com
.dtrules
.session
.IRSession
;
32 public abstract class ARObject
implements IRObject
{
35 * No point in implementing this here. Every Object that has
36 * an array representation needs to implement it themselves.
38 public RArray
rArrayValue() throws RulesException
{
39 throw new RulesException("Conversion Error","ARObject","No Time value exists for "+this.stringValue());
42 public RBoolean
rBooleanValue() throws RulesException
{
43 return RBoolean
.getRBoolean(booleanValue());
46 public RDouble
rDoubleValue() throws RulesException
{
47 return RDouble
.getRDoubleValue(doubleValue());
50 public RTime
rTimeValue() throws RulesException
{
51 return RTime
.getRTime(timeValue());
54 public Date
timeValue() throws RulesException
{
55 throw new RulesException("Undefined","Conversion Error","No Time value exists for: "+this);
58 public void execute(DTState state
) throws RulesException
{
62 public IRObject
getExecutable(){
66 public IRObject
getNonExecutable() {
70 public boolean equals(IRObject o
) throws RulesException
{
74 public boolean isExecutable() {
78 public String
postFix() {
82 public RString
rStringValue() {
83 return RString
.newRString(stringValue());
86 public IRObject
rclone() {
87 return (IRObject
) this;
90 /** Conversion Methods. Default is to throw a RulesException **/
92 public int intValue() throws RulesException
{
93 throw new RulesException("Undefined","Conversion Error","No Integer value exists for "+this);
96 public ArrayList
<IRObject
> arrayValue() throws RulesException
{
97 throw new RulesException("Undefined","Conversion Error","No Array value exists for "+this);
100 public boolean booleanValue() throws RulesException
{
101 throw new RulesException("Undefined","Conversion Error","No Boolean value exists for "+this);
104 public double doubleValue() throws RulesException
{
105 throw new RulesException("Undefined","Conversion Error","No double value exists for "+this);
108 public IREntity
rEntityValue() throws RulesException
{
109 throw new RulesException("Undefined","Conversion Error","No Entity value exists for "+this);
111 @SuppressWarnings({"unchecked"})
112 public HashMap
hashMapValue() throws RulesException
{
113 throw new RulesException("Undefined","Conversion Error","No Integer value exists for "+this);
116 public long longValue() throws RulesException
{
117 throw new RulesException("Undefined","Conversion Error","No Long value exists for "+this);
120 public RName
rNameValue() throws RulesException
{
121 throw new RulesException("Undefined","Conversion Error","No Integer value exists for "+this);
124 public RInteger
rIntegerValue() throws RulesException
{
125 throw new RulesException("Undefined","Conversion Error","No Integer value exists for "+this);
128 public int compare(IRObject irObject
) throws RulesException
{
129 throw new RulesException("Undefined","No Supported","Compared Not suppoted for this object"+this);
133 * By default, objects clone themselves by simply returnning themselves.
134 * This is because the clone of a number or boolean etc. is itself.
136 public IRObject
clone(IRSession s
) throws RulesException
{
141 * @see com.dtrules.interpreter.IRObject#rTableValue()
143 public RTable
rTableValue() throws RulesException
{
144 throw new RulesException("Undefined","Not Supported","No Table value exists for "+this);
148 * @see com.dtrules.interpreter.IRObject#tableValue()
150 @SuppressWarnings({"unchecked"})
151 public HashMap
tableValue() throws RulesException
{
152 throw new RulesException("Undefined","Not Supported","No Table value exists for "+this);
156 * @see com.dtrules.interpreter.IRObject#rXmlValue()
158 public RXmlValue
rXmlValue() throws RulesException
{
159 throw new RulesException("Conversion Error","","No XmlValue value exists for "+this);
163 * @see com.dtrules.interpreter.IRObject#xmlTagValue()
165 public XMLTag
xmlTagValue() throws RulesException
{
166 throw new RulesException("Conversion Error","","No XmlValue value exists for "+this);