Package de.caterdev.modelling.core

Examples of de.caterdev.modelling.core.IElement


    }
   
    @Override
    public boolean add(IAssociation association) throws ElementNotContainedException, UnsupportedAssociationException
    {
        IElement startpoint = association.getStartpoint();
        IElement endpoint = association.getEndpoint();
       
        if (!elements.contains(startpoint))
        {
            throw new ElementNotContainedException(this, startpoint);
        }
View Full Code Here


        Map<IElement, IElement> elementMapping = new HashMap<IElement, IElement>();
       
        // add all elements of the process model to the copy
        for (IElement element : input.getElements())
        {
            IElement elementCopy = element.getClass().newInstance();
            elementCopy.setLabel(element.getLabel());
           
            elementMapping.put(element, elementCopy);
            copy.add(elementCopy);
        }
       
        // add the associations between the elements in the model
        for (IAssociation association : input.getAssociations())
        {
            IElement start = elementMapping.get(association.getStartpoint());
            IElement end = elementMapping.get(association.getEndpoint());
           
            copy.add(new Association(association.isDirected(), start, end));
        }
       
        return copy;
View Full Code Here

    }
   
    @Test
    public void testGetLabel() throws Exception
    {
        IElement labeled = new MockElement("label");
       
        assertNotNull(labeled.getLabel());
        assertEquals("label", labeled.getLabel());
    }
View Full Code Here

        }
       
        // add all existing associations to the new graph model
        for (IAssociation association : pm.getAssociations())
        {
            IElement start = association.getStartpoint();
            IElement end = association.getEndpoint();
            IElement mappedStart = null;
            IElement mappedEnd = null;
           
            boolean startFound = false;
            boolean endFound = false;
           
            // we have to create a new association with the start and end nodes
            // of the graph model
            for (IElement element : gm.getElements())
            {
                if (element.equals(start))
                {
                    mappedStart = element;
                    startFound = true;
                }
                else if (element.equals(end))
                {
                    mappedEnd = element;
                    endFound = true;
                }
               
                if (startFound && endFound)
                {
                    break;
                }
            }
           
            if ((null != mappedStart) && (null != mappedEnd))
            {
                IAssociation mappedAssociation;
                if (association instanceof DirectedAssociation)
                {
                    mappedAssociation = new DirectedAssociation(mappedStart, mappedEnd);
                }
                else
                {
                    mappedAssociation = new Association(mappedStart, mappedEnd);
                }
                gm.add(mappedAssociation);
            }
            else
            {
                System.err.println("error transforming association " + association);
            }
        }
       
        // now remove all connectors from the new graph model
        while (true)
        {
            boolean changed = false;
           
            // we have to iterate over the connectors of the original process
            // model because we can't simultaneously iterate and remove graph
            // model connectors
            for (Connector connector : pm.getConnectors())
            {
                IElement graphElement = null;
               
                for (IElement ge : gm.getElements())
                {
                    if (ge.getId().equals(connector.getId()))
                    {
View Full Code Here

TOP

Related Classes of de.caterdev.modelling.core.IElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.