Ignore:
Timestamp:
05/30/08 10:14:43 (16 years ago)
Author:
ra33
Message:

Added some more unit tests
Did a bunch of refactoring
AND added a few new features... @b @v were the most significant

Location:
trunk/src/org/expeditee/simple
Files:
8 edited

Legend:

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

    r4 r80  
    44
    55        private static final String[] prefixes = new String[] {
    6                         SPointer.itemPrefix, SPointer.framePrefix, SPointer.filePrefix };
     6                        SPointer.itemPrefix, SPointer.framePrefix, SPointer.filePrefix,
     7                        SPointer.associationPrefix };
    78
    89        public static boolean isPointer(String varName) {
     
    4950                        // if it is an existing variable change the value
    5051                        v = getVariable(name);
    51                 } catch (Exception e) {
     52                } catch (VariableNotFoundException e) {
    5253                        // If the first variable doesnt exist then add it
    5354                        list_.add(new SPointer<T>(name, value));
     
    5758                v.setValue(value);
    5859        }
     60
     61        /**
     62         * Deletes a variable if it exists.
     63         * @param variableName name of the variable to delete
     64         */
     65        public void delete(String variableName) {
     66                try {
     67                        list_.remove(getVariable(variableName));
     68                } catch (VariableNotFoundException e) {
     69
     70                }
     71        }
    5972}
  • trunk/src/org/expeditee/simple/Primitives.java

    r21 r80  
    157157        }
    158158
     159        /**
     160         * Increments a variable.
     161         * @param var the name of the variable to increment
     162         * @throws Exception
     163         */
    159164        public void add(String var) throws Exception {
    160165                setValue(var, new SReal(getVariable(var).doubleValue() + 1));
    161166        }
    162167
     168        /**
     169         * Decrements a variable.
     170         * @param var the name of the variable to decrement
     171         * @throws Exception
     172         */
    163173        public void subtract(String var) throws Exception {
    164174                setValue(var, new SReal(getVariable(var).doubleValue() - 1));
  • trunk/src/org/expeditee/simple/SCharacter.java

    r21 r80  
    1818        @Override
    1919        public void parse(String s) {
    20                 if (s == "")
     20                if (s.equals(""))
    2121                        value_ = '\0';
    2222                else
  • trunk/src/org/expeditee/simple/SInteger.java

    r21 r80  
    2626        @Override
    2727        public void parse(String s) throws Exception {
    28                 if (s == "")
     28                if (s.equals(""))
    2929                        value_ = 0L;
    3030                else
  • trunk/src/org/expeditee/simple/SPointer.java

    r4 r80  
    1010
    1111        public static final String filePrefix = SVariable.prefix + "f"
     12                        + SVariable.separator;
     13
     14        public static final String associationPrefix = SVariable.prefix + "ap"
    1215                        + SVariable.separator;
    1316
  • trunk/src/org/expeditee/simple/SReal.java

    r21 r80  
    2222        @Override
    2323        public void parse(String s) throws Exception {
    24                 if (s == "")
     24                if (s.equals(""))
    2525                        value_ = 0.0;
    2626                else
  • trunk/src/org/expeditee/simple/SString.java

    r4 r80  
    2828        @Override
    2929        public Long integerValue() {
    30                 if (value_ == "")
     30                if (value_.equals(""))
    3131                        return 0L;
    3232                return (long) Double.parseDouble(value_);
     
    3535        @Override
    3636        public Double doubleValue() {
    37                 if (value_ == "")
     37                if (value_.equals(""))
    3838                        return 0.0;
    3939                return Double.parseDouble(value_);
  • trunk/src/org/expeditee/simple/Variables.java

    r4 r80  
    2727        }
    2828
    29         public T getVariable(String name) throws Exception {
     29        public T getVariable(String name) throws VariableNotFoundException {
    3030                for (T v : list_) {
    3131                        if (v.getName().equalsIgnoreCase(name)) {
Note: See TracChangeset for help on using the changeset viewer.