/** * Adds a new datatype defined to be equivalent to the given data range expression. * * @param name name of the datatype * @param datarange a data range expression * @return true if the add success */ @Override public boolean addDatatypeDefinition(final ATermAppl name, final ATermAppl datarange) { if (null == name || null == datarange) return false; return getDatatypeReasoner().define(name, datarange); }
/** * Adds a new datatype defined to be equivalent to the given data range expression. * * @param name name of the datatype * @param datarange a data range expression * @return true if the add success */ @Override public boolean addDatatypeDefinition(final ATermAppl name, final ATermAppl datarange) { if (null == name || null == datarange) return false; return getDatatypeReasoner().define(name, datarange); }
/** * Verify that a named decimal range contains correct constants * * @throws UnrecognizedDatatypeException * @throws InvalidLiteralException * @throws InvalidConstrainingFacetException */ @Test public void unaryValuesInNamedDecimalRange() throws InvalidConstrainingFacetException, InvalidLiteralException, UnrecognizedDatatypeException { final ATermAppl rdt = restrict(DECIMAL, minInclusive(literal("1.0", DECIMAL)), maxInclusive(literal("2.5", DECIMAL))); final ATermAppl name = term("newDt"); final Collection<ATermAppl> types = singleton(name); assertTrue(reasoner.define(name, rdt)); assertFalse(reasoner.isSatisfiable(types, decimal("0.99"))); assertTrue(reasoner.isSatisfiable(types, 1)); assertTrue(reasoner.isSatisfiable(types, 2)); assertTrue(reasoner.isSatisfiable(types, decimal("2.5"))); assertFalse(reasoner.isSatisfiable(types, decimal("2.51"))); }