/** * Determines if this number is equal to another. * * @param comparator The object to compare to. * * @return <tt>true</tt> if the comparator is a number equal in value to this one, <tt>false</tt> otherwise. */ public boolean equals(Object comparator) { if (this == comparator) { return true; } if ((comparator == null) || !(comparator instanceof NumericType)) { return false; } NumericType comparatorNumber = (NumericType) comparator; return value == comparatorNumber.floatValue(); }
/** * Determines if this number is equal to another. * * @param comparator The object to compare to. * * @return <tt>true</tt> if the comparator is a number equal in value to this one, <tt>false</tt> otherwise. */ public boolean equals(Object comparator) { if (this == comparator) { return true; } if ((comparator == null) || !(comparator instanceof NumericType)) { return false; } NumericType comparatorNumber = (NumericType) comparator; return value == comparatorNumber.floatValue(); }
/** * Extracts all restricted real types from the type checked model and caches them in the 'catalogueTypes' parameter * by name. * * @param catalogueTypes The map to build up the catalogue types in. */ private void initializeAllRestrictedRealTypes(Map<String, Type> catalogueTypes) { String queryString = "?-normal_type(real_range, MN, JT, _MP), member(from(From), _MP), member(to(To), _MP)."; Iterable<Map<String, Variable>> bindingsIterable = runQuery(queryString); for (Map<String, Variable> bindings : bindingsIterable) { String typeName = engine.getFunctorName((Functor) bindings.get("MN").getValue()); String javaTypeName = engine.getFunctorName((Functor) bindings.get("JT").getValue()); NumericType fromTerm = (NumericType) bindings.get("From").getValue(); NumericType toTerm = (NumericType) bindings.get("To").getValue(); if ("float".equals(javaTypeName)) { catalogueTypes.put(typeName, FloatRangeType.createInstance(typeName, fromTerm.floatValue(), toTerm.floatValue())); } else if ("double".equals(javaTypeName)) { catalogueTypes.put(typeName, DoubleRangeType.createInstance(typeName, fromTerm.doubleValue(), toTerm.doubleValue())); } } }