/** * Tries to convert generic terms to more specific value types. Currently, colors (TermColor) and * rectangles (TermRect) are supported. * @param term the term to be converted * @return the corresponding more specific term type or {@code null} when nothing was found. */ private Term<?> findSpecificType(Term<?> term) { TermColor colorTerm = null; TermRect rectTerm = null; if (term instanceof TermIdent) { //idents - try to convert colors colorTerm = tf.createColor((TermIdent) term); } else if (term instanceof TermFunction) { // rgba(0,0,0) colorTerm = tf.createColor((TermFunction) term); if (colorTerm == null) rectTerm = tf.createRect((TermFunction) term); } //replace with more specific value if (colorTerm != null) { log.debug("term color is OK - creating - " + colorTerm.toString()); return colorTerm; } else if (rectTerm != null) { log.debug("term rect is OK - creating - " + rectTerm.toString()); return rectTerm; } else return null; }
colorTerm = tf.createColor((TermFunction) term); if (colorTerm == null) rectTerm = tf.createRect((TermFunction) term);