Hi Bob, et al.,
My purpose is to detangle circular dependencies, in this case in the
org.argouml.kernel package (Project,...).
This package contains the MemberList class, which depends on
org.argouml.uml - and I want to remove this dependency.
Although the MemberList implements the List interface, and it keeps track of
ProjectMembers, they are not kept in a List.
Would it not be better to refactor this class, to make use of a real List
(ArrayList)?
That would mean that we can remove the dependency on the org.argouml.uml
package.
In issue 2979, Bob wrote:
«A am grouping project members into 3 main categories, model, diagram and
other.
The purpose of these categories is to make sure that members are read and
written in the correct order. all models must be read before diagrams,
diagrams
must be read before todo items.»These categories can be implemented by
making the ProjectMember have a enumerated "category" attribute LOAD_FIRST,
LOAD_LAST, NEUTRAL.
Any thoughts?
Can I go ahead?
Regards,
Michiel
This is the beginning of the MemberList class:
package org.argouml.kernel;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.apache.log4j.Logger;
import org.argouml.uml.ProjectMemberModel;
import org.argouml.uml.cognitive.ProjectMemberTodoList;
import org.argouml.uml.diagram.ProjectMemberDiagram;
import org.tigris.gef.base.Diagram;
/**
* @author Bob Tarling
*/
public class MemberList implements List {
/**
* Logger.
*/
private static final Logger LOG = Logger.getLogger(MemberList.class);
private AbstractProjectMember model;
private List diagramMembers = new ArrayList(10);
private AbstractProjectMember todoList;
/**
* The constructor.
*/
public MemberList() {
LOG.info("Creating a member list");
}
public boolean add(Object member) {
if (member instanceof ProjectMemberModel) {
// Always put the model at the top
model = (AbstractProjectMember) member;
return true;
} else if (member instanceof ProjectMemberTodoList) {
// otherwise add the diagram at the start
setTodoList((AbstractProjectMember) member);
return true;
} else if (member instanceof ProjectMemberDiagram) {
// otherwise add the diagram at the start
return diagramMembers.add(member);
}
return false;
}
....etc.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]