/** * This method validates the supplied model object. * * @param obj The model object being validated * @param logger The logger */ public void validate(ModelObject obj, Journal logger) { Recursion elem = (Recursion) obj; ModelObject act = elem.getParent(); if (elem.getLabel() != null) { boolean f_found = false; while (f_found == false && act != null && (act instanceof Protocol) == false) { if (act instanceof RecBlock && ((RecBlock) act).getLabel() != null && ((RecBlock) act).getLabel().equals(elem.getLabel())) { f_found = true; } act = act.getParent(); } if (f_found == false) { logger.error( MessageFormat.format( java.util.PropertyResourceBundle.getBundle("org.scribble.protocol.Messages") .getString("_NO_ENCLOSING_RECUR"), elem.getLabel()), obj.getProperties()); } } }
/** * This method determines whether the rule is applicable for the supplied model object. * * @return Whether the rule can be used to validate the supplied model object */ public boolean isSupported(ModelObject obj) { return (obj.getClass() == org.scribble.protocol.model.Recursion.class); }