/** * Reply a Set of design material's that are the subject of this ToDoItem. * * @return the offenders */ public ListSet getOffenders() { assert theOffenders != null; // TODO: The cognotive system should not be aware of any other // system. Find a better way to do this. We should not use // assert on public methods. assert theOffenders.size() <= 0 || Model.getFacade().isAModelElement(theOffenders.elementAt(0)) || theOffenders.elementAt(0) instanceof Fig || theOffenders.elementAt(0) instanceof Diagram; return theOffenders; }
/** * Check the offenders. * * <p>This is called from the constructors where the offenders are given. * * <p>TODO: Why do we only care about checking the first 2 offenders above? * * @param offs The offenders. */ private void checkOffs(ListSet offs) { if (offs == null) { throw new IllegalArgumentException("A ListSet of offenders must be supplied."); } Object offender = CollectionUtil.getFirstItemOrNull(offs); if (offender != null && !Model.getFacade().isAModelElement(offender) && !(offender instanceof Fig) && !(offender instanceof Diagram)) { // TODO: The cognotive system should not be aware of any other // system. Find a better way to do this. throw new IllegalArgumentException( "The first offender must be a model element, " + "a Fig or a Diagram"); } if (offs.size() >= 2) { offender = offs.elementAt(1); if (!Model.getFacade().isAModelElement(offender) && !(offender instanceof Fig) && !(offender instanceof Diagram)) { // TODO: The cognotive system should not be aware of any other // system. Find a better way to do this. throw new IllegalArgumentException( "The second offender must be a model element, " + "a Fig or a Diagram"); } } }