Ignore:
Timestamp:
05/08/08 14:30:09 (16 years ago)
Author:
ra33
Message:
 
Location:
trunk/src/org/expeditee/simple
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/simple/Context.java

    r7 r21  
    225225
    226226        public void createFrameset(String framesetNameVar, String successVar)
    227                         throws Exception {
    228                 // Get the values to be set
    229                 String framesetName = primitives_.getStringValue(framesetNameVar);
    230                 Frame firstFrame = FrameIO.CreateNewFrameset(framesetName);
    231 
    232                 if (successVar != null) {
    233                         Boolean success = firstFrame != null;
     227                        throws IncorrectTypeException {
     228                boolean success = true;
     229                try {
     230                        // Get the values to be set
     231                        String framesetName = primitives_.getStringValue(framesetNameVar);
     232                        Frame firstFrame = FrameIO.CreateNewFrameset(framesetName);
     233                        success = firstFrame != null;
     234                } catch (Exception e) {
     235                        success = false;
     236                }
     237                if (successVar != null) {
    234238                        primitives_.setValue(successVar, new SBoolean(success));
    235239                }
  • trunk/src/org/expeditee/simple/IncorrectTypeException.java

    r4 r21  
    33public class IncorrectTypeException extends RuntimeException {
    44        static final long serialVersionUID = -7034897190745766939L;
    5 
     5       
    66        public IncorrectTypeException(String type, int no) {
    77                super("Expected param " + no + " to be " + type);
  • trunk/src/org/expeditee/simple/Primitives.java

    r4 r21  
    2424
    2525        public void setValue(String variableName, SPrimitive newValue)
    26                         throws Exception {
     26                        throws IncorrectTypeException {
    2727                try {
    2828                        // if it is an existing variable change the value
     
    4949         *             if the variable name is invalid
    5050         */
    51         public void add(String name, SPrimitive value) throws Exception {
     51        public void add(String name, SPrimitive value) throws IncorrectTypeException {
    5252                // figure out the type and add it...
    5353                SPrimitive newVar;
  • trunk/src/org/expeditee/simple/SBoolean.java

    r4 r21  
    1212        }
    1313
    14         public SBoolean(Boolean value) throws Exception {
     14        public SBoolean(Boolean value) throws IncorrectTypeException {
    1515                super(value);
    1616        }
     
    4444
    4545        @Override
    46         public void setValue(SPrimitive v) throws Exception {
     46        public void setValue(SPrimitive v) throws IncorrectTypeException {
    4747                value_ = v.booleanValue();
    4848        }
  • trunk/src/org/expeditee/simple/SCharacter.java

    r4 r21  
    5050
    5151        @Override
    52         public void setValue(SPrimitive v) throws Exception {
     52        public void setValue(SPrimitive v) throws IncorrectTypeException {
    5353                value_ = v.characterValue();
    5454        }
  • trunk/src/org/expeditee/simple/SInteger.java

    r4 r21  
    5353
    5454        @Override
    55         public void setValue(SPrimitive v) throws Exception {
     55        public void setValue(SPrimitive v) throws IncorrectTypeException {
    5656                value_ = v.integerValue();
    5757        }
  • trunk/src/org/expeditee/simple/SPrimitive.java

    r4 r21  
    1515        }
    1616
    17         public Long integerValue() throws Exception {
    18                 throw new Exception("Can not convert " + this.getClass().getName()
    19                                 + " to Integer");
     17        public Long integerValue() throws IncorrectTypeException {
     18                throw new IncorrectTypeException("integer",this.getClass().getName());
    2019        }
    2120
    22         public Boolean booleanValue() throws Exception {
    23                 throw new Exception("Can not convert " + this.getClass().getName()
    24                                 + " to Boolean");
     21        public Boolean booleanValue() throws IncorrectTypeException {
     22                throw new IncorrectTypeException("boolean", this.getClass().getName());
    2523        }
    2624
    27         public Double doubleValue() throws Exception {
    28                 throw new Exception("Can not convert " + this.getClass().getName()
    29                                 + " to Real");
     25        public Double doubleValue() throws IncorrectTypeException {
     26                throw new IncorrectTypeException("real", this.getClass().getName());
    3027        }
    3128
    32         public Character characterValue() throws Exception {
    33                 throw new Exception("Can not convert " + this.getClass().getName()
    34                                 + " to Character");
     29        public Character characterValue() throws IncorrectTypeException {
     30                throw new IncorrectTypeException("character", this.getClass().getName());
    3531        }
    3632
    37         public abstract void setValue(SPrimitive v) throws Exception;
     33        public abstract void setValue(SPrimitive v) throws IncorrectTypeException;
    3834
    3935        @Override
    40         public void setValue(SVariable<T> v) throws Exception {
     36        public void setValue(SVariable<T> v) throws IncorrectTypeException {
    4137                if (v instanceof SPrimitive) {
    4238                        setValue((SPrimitive<?>) v);
    4339                        return;
    4440                }
    45                 throw new Exception("Can not set primitive variable with pointer");
     41                throw new IncorrectTypeException("primitive", "pointer");
    4642        }
    4743
  • trunk/src/org/expeditee/simple/SReal.java

    r4 r21  
    4949
    5050        @Override
    51         public void setValue(SPrimitive v) throws Exception {
     51        public void setValue(SPrimitive v) throws IncorrectTypeException {
    5252                value_ = v.doubleValue();
    5353        }
Note: See TracChangeset for help on using the changeset viewer.