[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Project.java,1.30,1.31 Constraints.ja
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-01-30 14:48:58
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24172/src/net/sourceforge/bprocessor/model Modified Files: Project.java Removed Files: Constraints.java Log Message: Removed "Constraints" object and moved functionality to Project --- Constraints.java DELETED --- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Project.java 30 Jan 2006 10:08:14 -0000 1.30 --- Project.java 30 Jan 2006 14:48:48 -0000 1.31 *************** *** 47,50 **** --- 47,53 ---- /** The domain id */ private long cameraId; + + /** The constraints */ + private Collection constraints; /** Has changes been made */ *************** *** 80,83 **** --- 83,87 ---- observers = new LinkedList(); mesh = new Mesh(); + constraints = new LinkedList(); } *************** *** 142,145 **** --- 146,193 ---- currentCamera = cam0; } + + /** + * Add a constraint + * @param constraint The constraint to add + */ + public void add(Constraint constraint) { + constraints.add(constraint); + } + + /** + * Remove a constraint + * @param constraint The constraint to remove + */ + public void remove(Constraint constraint) { + constraints.remove(constraint); + } + + /** + * Return constraints + * @return The constraints + */ + public Collection getConstraints() { + return constraints; + } + + /** + * Update all constraints related to entity + * @param entity The changed entity + */ + public void updateConstraints(Entity entity) { + // TODO implement general constraint updating mechanism + // that ensures that constraints are updated in correct + // order + + Iterator iter = constraints.iterator(); + while (iter.hasNext()) { + Constraint current = (Constraint) iter.next(); + if (current.depends(entity)) { + current.update(entity); + } + } + entity.changed(); + } + /** |