[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Domain.java,1.7,1.8 DomainFacade.java
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2005-09-21 14:04:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28016/src/net/sourceforge/bprocessor/model Modified Files: Domain.java DomainFacade.java Surface.java SurfaceFacade.java Log Message: added som updates on facades to make setFronDomain and setBackDomain Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Surface.java 21 Sep 2005 07:29:30 -0000 1.25 --- Surface.java 21 Sep 2005 14:04:33 -0000 1.26 *************** *** 474,478 **** public Space getFrontSpace() { Set set = FunctionalSpaceFacade.getInstance().findBySurface(this); ! log.info("spaces found " + set.size()); if (set != null) { Iterator it = set.iterator(); --- 474,478 ---- public Space getFrontSpace() { Set set = FunctionalSpaceFacade.getInstance().findBySurface(this); ! //log.info("spaces found " + set.size()); if (set != null) { Iterator it = set.iterator(); *************** *** 526,529 **** --- 526,532 ---- */ public void setBackDomain(Domain back) { + if (backDomain != null) { + backDomain.removeSurface(this); + } backDomain = back; } *************** *** 544,547 **** --- 547,553 ---- */ public void setFrontDomain(Domain front) { + if (frontDomain != null) { + frontDomain.removeSurface(this); + } frontDomain = front; } Index: SurfaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SurfaceFacade.java 21 Sep 2005 08:57:07 -0000 1.10 --- SurfaceFacade.java 21 Sep 2005 14:04:33 -0000 1.11 *************** *** 113,121 **** Domain back = s.getBackDomain(); if (back != null) { ! back.removeSurface(s); } Domain front = s.getFrontDomain(); if (front != null) { ! front.removeSurface(s); } --- 113,127 ---- Domain back = s.getBackDomain(); if (back != null) { ! if (back.removeSurface(s)) { ! DomainFacade.getInstance().update(back); ! } ! s.setBackDomain(null); } Domain front = s.getFrontDomain(); if (front != null) { ! if (front.removeSurface(s)) { ! DomainFacade.getInstance().update(front); ! } ! s.setFrontDomain(null); } Index: Domain.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Domain.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Domain.java 12 Sep 2005 18:23:30 -0000 1.7 --- Domain.java 21 Sep 2005 14:04:33 -0000 1.8 *************** *** 140,152 **** /** ! *Remove a surface from this domain ! *@param surface The surface to remove */ ! public void removeSurface(Surface surface) { Set s = getSurfaces(); ! if (s != null) { ! //Maybe this should be done by a setSurfaces call? s.remove(surface); } } --- 140,154 ---- /** ! * Remove a surface from this domain ! * @param surface The surface to remove ! * @return True if the Domain contained the surface otherwise false */ ! public boolean removeSurface(Surface surface) { Set s = getSurfaces(); ! if (s != null && s.contains(surface)) { s.remove(surface); + return true; } + return false; } Index: DomainFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/DomainFacade.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DomainFacade.java 21 Sep 2005 07:59:39 -0000 1.3 --- DomainFacade.java 21 Sep 2005 14:04:33 -0000 1.4 *************** *** 45,48 **** --- 45,66 ---- /** + * Update the Domain + * @param domain The domain to update + */ + public synchronized void update(Domain domain) { + if (domain instanceof ConstructionSpace) { + ConstructionSpaceFacade.getInstance().update((ConstructionSpace)domain); + } else if (domain instanceof FunctionalSpace) { + FunctionalSpaceFacade.getInstance().update((FunctionalSpace)domain); + } else if (domain instanceof Element) { + ElementFacade.getInstance().update((Element)domain); + } else if (domain instanceof Part) { + PartFacade.getInstance().update((Part)domain); + } else { + log.error("Unsupported type: " + domain.getClass().getName()); + } + } + + /** * Find all domains * @return the set of all domains |