diff options
Diffstat (limited to '')
-rwxr-xr-x | collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java index 810c0a8f09..c7f1142964 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/layout/CompositeEntity.java @@ -23,11 +23,12 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import org.apache.tuscany.sca.impl.artifacts.Component; -import org.apache.tuscany.sca.impl.artifacts.Composite; -import org.apache.tuscany.sca.impl.artifacts.Property; -import org.apache.tuscany.sca.impl.artifacts.Reference; -import org.apache.tuscany.sca.impl.artifacts.Service; +import org.apache.tuscany.sca.impl.artifacts.ComponentArtifact; +import org.apache.tuscany.sca.impl.artifacts.CompositeArtifact; +import org.apache.tuscany.sca.impl.artifacts.Constant; +import org.apache.tuscany.sca.impl.artifacts.PropertyArtifact; +import org.apache.tuscany.sca.impl.artifacts.ReferenceArtifact; +import org.apache.tuscany.sca.impl.artifacts.ServiceArtifact; /** * Represents an unit (a component including its references, services, properties @@ -49,7 +50,7 @@ public class CompositeEntity extends Entity{ private ComponentEntity[] componentList; private int[][] connections; private HashMap<String, String> promoteAService = new HashMap<String, String>(); - private HashMap<String, String> promoteAReference = new HashMap<String, String>(); + private HashMap<String, ArrayList<String>> promoteAReference = new HashMap<String, ArrayList<String>>(); private ArrayList<String> includedComposites = new ArrayList<String>(); //private HashSet<String> connectedEntities = new HashSet<String>(); @@ -76,27 +77,27 @@ public class CompositeEntity extends Entity{ if(getDefaultNoOfRefs() < getNoOfRefs()){ - setRefHeight((getHeight() / getNoOfRefs()) - Reference.SPACING_FOR_COMPOSITE); + setRefHeight((getHeight() / getNoOfRefs()) - Constant.SPACING_FOR_COMPOSITE_OF_REFERENCE); } else - setRefHeight(Reference.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE); + setRefHeight(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_REFERENCE); } public void serviceHeight(){ if(getDefaultNoOfSers() < getNoOfSers()){ - setSerHeight((getHeight() / getNoOfSers()) - Service.SPACING_FOR_COMPOSITE); + setSerHeight((getHeight() / getNoOfSers()) - Constant.SPACING_FOR_COMPOSITE_OF_SERVICE); } else - setSerHeight(Service.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE); + setSerHeight(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_SERVICE); } public void propertyLength(){ if(getDefaultNoOfProps() < getNoOfProps()){ - setPropLength((getWidth() / getNoOfProps()) - Property.SPACING_FOR_COMPOSITE); + setPropLength((getWidth() / getNoOfProps()) - Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY); } else - setPropLength(Property.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE); + setPropLength(Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_PROPERTY); } // /** @@ -141,12 +142,12 @@ public class CompositeEntity extends Entity{ // } public void calcHeight(int initPoint) { - setHeight((Component.DEFAULT_HEIGHT * getSpaceFactor()) * (maxInternalLevel + 1) + initPoint); + setHeight((Constant.COMPONENT_DEFAULT_HEIGHT * getSpaceFactor()) * (maxInternalLevel + 1) + initPoint); } public void calcWidth(int initPoint) { System.err.println("maxInternalLane "+maxInternalLane); - setWidth((Component.DEFAULT_WIDTH * getSpaceFactor()) * (maxInternalLane + 1) + initPoint); + setWidth((Constant.COMPONENT_DEFAULT_WIDTH * getSpaceFactor()) * (maxInternalLane + 1) + initPoint); } private int max(int a, int b){ @@ -194,13 +195,17 @@ public class CompositeEntity extends Entity{ } public boolean addToPromoteAReference(String compositeRef, String componentRef){ - //ref = ref.toLowerCase(); - //ser = ser.toLowerCase(); + ArrayList<String> list; - if (promoteAReference.containsKey(compositeRef)) - return false; + if (promoteAReference.containsKey(compositeRef)){ + list = promoteAReference.get(compositeRef); + } + else{ + list = new ArrayList<String>(); + } - promoteAReference.put(compositeRef, componentRef); + list.add(componentRef); + promoteAReference.put(compositeRef, list); return true; } @@ -211,11 +216,11 @@ public class CompositeEntity extends Entity{ return true; } - public void setPromoteAReference(HashMap<String, String> promoteAReference) { + public void setPromoteAReference(HashMap<String, ArrayList<String>> promoteAReference) { this.promoteAReference = promoteAReference; } - public HashMap<String, String> getPromoteAReference() { + public HashMap<String, ArrayList<String>> getPromoteAReference() { return promoteAReference; } @@ -247,13 +252,16 @@ public class CompositeEntity extends Entity{ setDefaultNoOfSers( getHeight()/ - (Service.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE+Service.SPACING_FOR_COMPOSITE)); + (Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_SERVICE + + Constant.SPACING_FOR_COMPOSITE_OF_SERVICE)); setDefaultNoOfRefs( getHeight()/ - (Reference.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE+Reference.SPACING_FOR_COMPOSITE)); + (Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_REFERENCE + + Constant.SPACING_FOR_COMPOSITE_OF_REFERENCE)); setDefaultNoOfProps( getWidth()/ - (Property.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE+Property.SPACING_FOR_COMPOSITE)); + (Constant.DEFAULT_MAXIMUM_HEIGHT_FOR_COMPOSITE_OF_PROPERTY + + Constant.SPACING_FOR_COMPOSITE_OF_PROPERTY)); referenceHeight(); serviceHeight(); |