/** * @param mechname * @return true if the bracketed keyword on the sign matches the given mechname; false otherwise * or if no sign. * @throws ClassCastException if the declarative constructor was used in such a way that a * non-sign block was specified for a sign. */ public boolean matches(String mechname) { return (sign == null) ? false : (((Sign) sign.getState()).getLine(1).equalsIgnoreCase("[" + mechname + "]")); // the astute will notice there's a problem coming up here with the one dang thing that had to // go and break the mold with second line definer. }
/** * @return a Sign BlockState, or null if there is no sign block. * @throws ClassCastException if there a sign block is set, but it's not *actually* a sign block. */ public Sign getSign() { return (sign == null) ? null : (Sign) sign.getState(); }