001package org.andromda.metafacades.uml14; 002 003import java.util.ArrayList; 004import java.util.Collection; 005import java.util.Iterator; 006import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph; 007import org.omg.uml.behavioralelements.activitygraphs.Partition; 008import org.omg.uml.behavioralelements.statemachines.StateVertex; 009 010/** 011 * MetafacadeLogic implementation for org.andromda.metafacades.uml.PartitionFacade. 012 * 013 * @see org.andromda.metafacades.uml.PartitionFacade 014 * @author Bob Fields 015 */ 016public class PartitionFacadeLogicImpl 017 extends PartitionFacadeLogic 018{ 019 private static final long serialVersionUID = 8178073921061583901L; 020 // ---------------- constructor ------------------------------- 021 022 /** 023 * @param metaObject 024 * @param context 025 */ 026 public PartitionFacadeLogicImpl(Partition metaObject, String context) 027 { 028 super(metaObject, context); 029 } 030 031 /** 032 * @see org.andromda.metafacades.uml.PartitionFacade#getActivityGraph() 033 */ 034 @Override 035 protected ActivityGraph handleGetActivityGraph() 036 { 037 return metaObject.getActivityGraph(); 038 } 039 040 /** 041 * @see org.andromda.metafacades.uml14.PartitionFacadeLogic#handleGetVertices() 042 */ 043 protected Collection<StateVertex> handleGetVertices() 044 { 045 Collection<StateVertex> vertices = new ArrayList<StateVertex>(); 046 047 final Collection contents = metaObject.getContents(); 048 for (final Iterator contentIterator = contents.iterator(); contentIterator.hasNext();) 049 { 050 final Object element = contentIterator.next(); 051 if (element instanceof StateVertex) 052 { 053 vertices.add((StateVertex)element); 054 } 055 } 056 057 return vertices; 058 } 059}