[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Surface.java,1.53,1.54 MemoryFacade.j
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-12-12 20:19:01
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15179/src/net/sourceforge/bprocessor/model Modified Files: Surface.java MemoryFacade.java Space.java Project.java DatabaseFacade.java Removed Files: Domain.java Log Message: Removed domain --- Domain.java DELETED --- Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** Surface.java 11 Dec 2005 17:50:30 -0000 1.53 --- Surface.java 12 Dec 2005 20:18:52 -0000 1.54 *************** *** 725,735 **** * Removes the domain from the surface, if the given domain * is either the front or back domain. ! * @param domain the domain to remove. */ ! public void removeDomain(Domain domain) { ! if (domain.equals(frontDomain)) { setFrontDomain(null); } ! if (domain.equals(backDomain)) { setBackDomain(null); } --- 725,735 ---- * Removes the domain from the surface, if the given domain * is either the front or back domain. ! * @param space the space to remove. */ ! public void removeDomain(Space space) { ! if (space == frontDomain) { setFrontDomain(null); } ! if (space == backDomain) { setBackDomain(null); } Index: DatabaseFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/DatabaseFacade.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DatabaseFacade.java 11 Dec 2005 17:27:19 -0000 1.5 --- DatabaseFacade.java 12 Dec 2005 20:18:52 -0000 1.6 *************** *** 81,85 **** * @return The domain */ ! public abstract Domain findDomainById(Long id); /** --- 81,85 ---- * @return The domain */ ! public abstract Space findDomainById(Long id); /** Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Project.java 11 Dec 2005 17:27:19 -0000 1.9 --- Project.java 12 Dec 2005 20:18:52 -0000 1.10 *************** *** 84,90 **** */ public void intern(Space space) { ! DatabaseFacade.getInstance().intern((Object) space); ! Notification n = new Notification(Notification.CONSTRUCTION_SPACE_CREATED, space.getId()); ! Notifier.getInstance().sendNotification(n); } --- 84,93 ---- */ public void intern(Space space) { ! if (space.isConstructionSpace()) { ! intern((ConstructionSpace) space); ! } ! if (space.isFunctionalSpace()) { ! intern((FunctionalSpace) space); ! } } *************** *** 110,119 **** while (surfIt.hasNext()) { Surface surface = (Surface)surfIt.next(); ! Domain back = surface.getBackDomain(); if (back == c) { surface.setBackDomain(null); DatabaseFacade.getInstance().update(surface); } else { ! Domain front = surface.getFrontDomain(); if (front == c) { surface.setFrontDomain(null); --- 113,122 ---- while (surfIt.hasNext()) { Surface surface = (Surface)surfIt.next(); ! Space back = surface.getBackDomain(); if (back == c) { surface.setBackDomain(null); DatabaseFacade.getInstance().update(surface); } else { ! Space front = surface.getFrontDomain(); if (front == c) { surface.setFrontDomain(null); *************** *** 149,153 **** * @param domain The domain to update */ ! public void update(Domain domain) { if (domain instanceof ConstructionSpace) { DatabaseFacade.getInstance().update((ConstructionSpace)domain); --- 152,156 ---- * @param domain The domain to update */ ! public void update(Space domain) { if (domain instanceof ConstructionSpace) { DatabaseFacade.getInstance().update((ConstructionSpace)domain); *************** *** 177,181 **** * @return The domain */ ! public Domain findDomainById(Long id) { return DatabaseFacade.getInstance().findDomainById(id); } --- 180,184 ---- * @return The domain */ ! public Space findDomainById(Long id) { return DatabaseFacade.getInstance().findDomainById(id); } *************** *** 249,258 **** while (surfIt.hasNext()) { Surface surface = (Surface)surfIt.next(); ! Domain back = surface.getBackDomain(); if (back == space) { surface.setBackDomain(null); DatabaseFacade.getInstance().update(surface); } else { ! Domain front = surface.getFrontDomain(); if (front == space) { surface.setFrontDomain(null); --- 252,261 ---- while (surfIt.hasNext()) { Surface surface = (Surface)surfIt.next(); ! Space back = surface.getBackDomain(); if (back == space) { surface.setBackDomain(null); DatabaseFacade.getInstance().update(surface); } else { ! Space front = surface.getFrontDomain(); if (front == space) { surface.setFrontDomain(null); *************** *** 278,287 **** while (surfIt.hasNext()) { Surface surface = (Surface)surfIt.next(); ! Domain back = surface.getBackDomain(); if (back == f) { surface.setBackDomain(null); DatabaseFacade.getInstance().update(surface); } else { ! Domain front = surface.getFrontDomain(); if (front == f) { surface.setFrontDomain(null); --- 281,290 ---- while (surfIt.hasNext()) { Surface surface = (Surface)surfIt.next(); ! Space back = surface.getBackDomain(); if (back == f) { surface.setBackDomain(null); DatabaseFacade.getInstance().update(surface); } else { ! Space front = surface.getFrontDomain(); if (front == f) { surface.setFrontDomain(null); *************** *** 341,345 **** //from any domain to which it belongs. ! Domain back = s.getBackDomain(); if (back != null) { if (back.removeSurface(s)) { --- 344,348 ---- //from any domain to which it belongs. ! Space back = s.getBackDomain(); if (back != null) { if (back.removeSurface(s)) { *************** *** 348,352 **** s.setBackDomain(null); } ! Domain front = s.getFrontDomain(); if (front != null) { if (front.removeSurface(s)) { --- 351,355 ---- s.setBackDomain(null); } ! Space front = s.getFrontDomain(); if (front != null) { if (front.removeSurface(s)) { Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Space.java 11 Dec 2005 17:50:30 -0000 1.8 --- Space.java 12 Dec 2005 20:18:52 -0000 1.9 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import org.apache.log4j.Logger; /** --- 7,14 ---- package net.sourceforge.bprocessor.model; + import java.io.Serializable; + import java.util.HashSet; + import java.util.Set; /** *************** *** 18,29 **** * column="DOMAIN_ID" */ ! public class Space extends Domain { ! /** The logger */ ! private static Logger log = Logger.getLogger(Space.class); ! ! /** The space id */ ! private Long spaceId; ! ! /** The modellor */ private Modellor modellor; --- 20,32 ---- * column="DOMAIN_ID" */ ! public class Space implements Serializable { ! /** The id */ ! private Long id; ! /** The name */ ! private String name; ! /** The attributes */ ! private Set attributes; ! /** The surfaces */ ! private Set surfaces; /** The modellor */ private Modellor modellor; *************** *** 43,66 **** setName(name); } /** ! * Get the space id ! * @return The space id * @hibernate.id ! * column="SPACE_ID" * generator-class="increment" */ ! protected Long getSpaceId() { ! return spaceId; } /** ! * Set the space id ! * @param id The space id */ ! private void setSpaceId(Long id) { ! this.spaceId = id; } ! ! /** * Test for construction-space --- 46,189 ---- setName(name); } + /** ! * Create a Construction Space ! * @param name The name ! * @return The space ! */ ! public static Space createConstructionSpace(String name) { ! return new ConstructionSpace(name); ! } ! ! /** ! * Create a Functional Space ! * @param name The name ! * @return The space ! */ ! public static Space createFunctionalSpace(String name) { ! return new FunctionalSpace(name); ! } ! ! /** ! * Get the id ! * @return The id * @hibernate.id ! * column="DOMAIN_ID" * generator-class="increment" */ ! public Long getId() { ! return id; } /** ! * Set the id ! * @param id The id */ ! public void setId(Long id) { ! this.id = id; } ! ! /** ! * Get the name ! * @return The name ! * @hibernate.property ! */ ! public String getName() { ! return name; ! } ! ! /** ! * Set the name ! * @param name The name ! */ ! public void setName(String name) { ! this.name = name; ! } ! ! /** ! * Get the attributes ! * @return The attributes ! * @hibernate.set ! * cascade="delete" ! * lazy="false" ! * @hibernate.key ! * column="DOMAIN_ID" ! * @hibernate.one-to-many ! * class="net.sourceforge.bprocessor.model.Attribute" ! */ ! public Set getAttributes() { ! return attributes; ! } ! ! /** ! * Set the attributes ! * @param attributes The attributes ! */ ! public void setAttributes(Set attributes) { ! this.attributes = attributes; ! } ! ! /** ! * Get the surfaces ! * @return The surfaces ! * @hibernate.set ! * lazy="false" ! * @hibernate.key ! * column="DOMAIN_ID" ! * @hibernate.many-to-many ! * class="net.sourceforge.bprocessor.model.Surface" ! */ ! public Set getSurfaces() { ! return surfaces; ! } ! ! /** ! * Set the surfaces ! * @param surfaces The surfaces ! */ ! public void setSurfaces(Set surfaces) { ! this.surfaces = surfaces; ! } ! ! /** ! * Add a surface to the list of surfaces ! * @param surface The surface ! */ ! public void addSurface(Surface surface) { ! Set s = getSurfaces(); ! if (s == null) { ! Set set = new HashSet(); ! set.add(surface); ! setSurfaces(set); ! } else { ! s.add(surface); ! } ! Project.getInstance().update(this); ! } ! ! /** ! * 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); ! Project.getInstance().update(this); ! return true; ! } ! return false; ! } ! ! /** ! * String representation of the object ! * @return The string ! */ ! public String toString() { ! return "Domain[id=" + id + ",name=" + name + ",attributes=" + attributes.size() + ! ",surfaces=" + surfaces == null ? "0" : surfaces.size() + "]"; ! } ! /** * Test for construction-space *************** *** 70,74 **** return false; } ! /** * Test for functional-space --- 193,197 ---- return false; } ! /** * Test for functional-space *************** *** 78,82 **** return false; } ! /** * Get the modellor --- 201,205 ---- return false; } ! /** * Get the modellor *************** *** 86,90 **** return modellor; } ! /** * Set the modellor --- 209,213 ---- return modellor; } ! /** * Set the modellor *************** *** 94,104 **** this.modellor = modellor; } - - /** - * String representation of the object - * @return The string - */ - public String toString() { - return "Space[" + super.toString() + "]"; - } } --- 217,219 ---- Index: MemoryFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/MemoryFacade.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MemoryFacade.java 11 Dec 2005 17:27:19 -0000 1.5 --- MemoryFacade.java 12 Dec 2005 20:18:52 -0000 1.6 *************** *** 51,56 **** } else if (o instanceof Surface) { intern((Surface) o); ! } else if (o instanceof Domain) { ! intern((Domain) o); } } --- 51,56 ---- } else if (o instanceof Surface) { intern((Surface) o); ! } else if (o instanceof Space) { ! intern((Space) o); } } *************** *** 90,97 **** * @param d The Domain */ ! private void intern(Domain d) { d.setId(new Long(domainId++)); domains.put(d.getId(), d); - //System.out.println("d-intern " + d.toString()); } --- 90,96 ---- * @param d The Domain */ ! private void intern(Space d) { d.setId(new Long(domainId++)); domains.put(d.getId(), d); } *************** *** 115,120 **** } else if (o instanceof Surface) { remove((Surface) o); ! } else if (o instanceof Domain) { ! remove((Domain) o); } } --- 114,119 ---- } else if (o instanceof Surface) { remove((Surface) o); ! } else if (o instanceof Space) { ! remove((Space) o); } } *************** *** 151,155 **** * @param d The Domain */ ! private void remove(Domain d) { domains.remove(d.getId()); d.setId(null); --- 150,154 ---- * @param d The Domain */ ! private void remove(Space d) { domains.remove(d.getId()); d.setId(null); *************** *** 196,201 **** * @return The Domain */ ! public Domain findDomainById(Long id) { ! return (Domain) domains.get(id); } --- 195,200 ---- * @return The Domain */ ! public Space findDomainById(Long id) { ! return (Space) domains.get(id); } |