Changeset 396:2bc089d9c6a2 in livinglogic.java.ul4

Show
Ignore:
Timestamp:
02/24/11 16:39:50 (9 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Fixed comparison operator when only one of the arguments is null.

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • docs/versiondoc.txt

    r394 r396  
     1exp-37: 
     2------- 
     3Comments: 
     4* Fixed comparison operator when only one of the arguments is null. 
     5 
     6 
    17exp-36: 
    28------- 
  • library/src/com/livinglogic/ul4/Utils.java

    r390 r396  
    13921392        if (null != obj1 && null != obj2) 
    13931393            return cmp(obj1, obj2, "==") == 0; 
    1394         return true; 
     1394        return (null == obj1) == (null == obj2); 
    13951395    } 
    13961396 
     
    13991399        if (null != obj1 && null != obj2) 
    14001400            return cmp(obj1, obj2, "!=") != 0; 
    1401         return false; 
     1401        return (null == obj1) != (null == obj2); 
    14021402    } 
    14031403 
     
    14061406        if (null != obj1 && null != obj2) 
    14071407            return cmp(obj1, obj2, "<") < 0; 
     1408        if ((null == obj1) != (null == obj2)) 
     1409            throw new UnsupportedOperationException(objectType(arg1) + " < " + objectType(arg2) + " not supported!"); 
    14081410        return false; 
    14091411    } 
     
    14131415        if (null != obj1 && null != obj2) 
    14141416            return cmp(obj1, obj2, "<=") <= 0; 
     1417        if ((null == obj1) != (null == obj2)) 
     1418            throw new UnsupportedOperationException(objectType(arg1) + " <= " + objectType(arg2) + " not supported!"); 
    14151419        return true; 
    14161420    } 
     
    14201424        if (null != obj1 && null != obj2) 
    14211425            return cmp(obj1, obj2, ">") > 0; 
     1426        if ((null == obj1) != (null == obj2)) 
     1427            throw new UnsupportedOperationException(objectType(arg1) + " > " + objectType(arg2) + " not supported!"); 
    14221428        return false; 
    14231429    } 
     
    14271433        if (null != obj1 && null != obj2) 
    14281434            return cmp(obj1, obj2, ">=") >= 0; 
     1435        if ((null == obj1) != (null == obj2)) 
     1436            throw new UnsupportedOperationException(objectType(arg1) + " >= " + objectType(arg2) + " not supported!"); 
    14291437        return true; 
    14301438    }