Package net.sf.jmd.metarepresentation

Examples of net.sf.jmd.metarepresentation.IModelItem


    public boolean equals(final Object obj) {
        boolean result = false;
        if (!(obj instanceof ModelItem)) {
            return false;
        }
        IModelItem otherModelItem = (IModelItem) obj;

        boolean identifiersEqual = this.getIdentifier().equals(otherModelItem
                .getIdentifier());
       
        boolean typesEqual = this.type.equals(otherModelItem.getType());

        // Lists
        boolean modifiersContainsEqual = this.modifiers
                .containsAll(otherModelItem.getModifiers());
        boolean modifiersSizeEqual = (this.modifiers.size() == otherModelItem
                .getModifiers().size());
        boolean modifiersEqual = (modifiersContainsEqual && modifiersSizeEqual);

        boolean extendeesContainsEqual = this.extendees
                .containsAll(otherModelItem.getExtendees());
        boolean extendeesSizeEqual = (this.extendees.size() == otherModelItem
                .getExtendees().size());
        boolean extendeesEqual = (extendeesContainsEqual && extendeesSizeEqual);

        boolean membersContainsEqual = this.members.equals(otherModelItem
                .getMembers());
        boolean membersSizeEqual = (this.members.size() == otherModelItem
                .getMembers().size());
        boolean membersEqual = (membersContainsEqual && membersSizeEqual);

        result = (identifiersEqual && typesEqual && modifiersEqual
                && extendeesEqual && membersEqual);
View Full Code Here


    public void testImports() {
        IMetaRepresentation rep = MetaRepresentation.getInstance();
       
        List<IModelItem> elements = rep.getAmModel().getItems();

        IModelItem importsALot = null;
        for (IModelItem item : elements) {
            if (item.getIdentifier().equals("ImportsALot")){
                importsALot = item;
            }
        }
        assertNotNull("ImportsALot could not be found.", importsALot);
       
        assertTrue("There should be 2 import statements",
                (importsALot.getImports().size() == 2));
       
        assertEquals("java.util.Iterator", importsALot.getImports().get(0));
        assertEquals("java.util.List", importsALot.getImports().get(1));
    }
View Full Code Here

    public void testExtends() {
      
        IMetaRepresentation rep = MetaRepresentation.getInstance();
        List<IModelItem> elements = rep.getAmModel().getItems();
       
        IModelItem extendsALot = null;
        for (IModelItem item : elements) {
            if (item.getIdentifier().equals("IExtendALot")){
                extendsALot = item;
            }
        }
        assertNotNull("IExtendALot could not be found.", extendsALot);
       
        List<IModelItem> extendsList = extendsALot.getExtendees();
        int expected = 4;
        int actual = extendsList.size();
        assertTrue("There should be 4 super classes in the extends list, "
                + "found: " + actual, expected == actual);
       
View Full Code Here

   
    public void testImplements() {
        IMetaRepresentation rep = MetaRepresentation.getInstance();
        List<IModelItem> elements = rep.getAmModel().getItems();
       
        IModelItem implementsALot = null;
        for (IModelItem item : elements) {
            if (item.getIdentifier().equals("ImplementsALot")){
                implementsALot = item;
            }
        }
        assertNotNull("ImplementsALot could not be found.", implementsALot);
      

        List<IModelItem> implementsList = implementsALot.getExtendees();
        int expected = 4;
        int actual = implementsList.size();
        assertTrue("There should be 4 super classes in the extends list, "
                + "found: " + actual, expected == actual);
       
View Full Code Here

        model = new Model();
        other = new Model();
    }

    public void setUp() {
        IModelItem item = new ModelItem();
        item.setName("anItem");
        item.setNamespace("de.dlr.modi");
        item.setType("interface");
       
        Operation operation = new Operation();
        operation.setName("anOperation");
        operation.setNamespace(item.getIdentifier());
       
        Parameter parameter = new Parameter();
        parameter.setName("aParameter");
        parameter.setNamespace(operation.getIdentifier());
       
        operation.addParameter(parameter);
       
        Variable variable = new Variable();
        variable.setName("aVariable");
        variable.setNamespace(item.getIdentifier());

        item.addMember(operation);
        item.addMember(variable);
       
        //these two models are equal
        model.addModelItem(item);
        other.addModelItem(item);
    }
View Full Code Here

            int type = tmp.getType();
            switch (type) { // switch over the interesting types, ignoring the
            // rest.

            case GeneratedJavaTokenTypes.IDENT:
                IModelItem superclass = new ModelItem();
                superclass.setName(tmp.getText());
                modelItem.addExtendee(superclass);
                break;

            default:
                break;
View Full Code Here

    public void testImports() {
        IMetaRepresentation rep = MetaRepresentation.getInstance();
       
        List<IModelItem> elements = rep.getAmModel().getItems();

        IModelItem importsALot = null;
        for (IModelItem item : elements) {
            if (item.getIdentifier().equals("ImportsALot")){
                importsALot = item;
            }
        }
        assertNotNull("ImportsALot could not be found.", importsALot);
       
        assertTrue("There should be 2 import statements",
                (importsALot.getImports().size() == 2));
       
        assertEquals("java.util.Iterator", importsALot.getImports().get(0));
        assertEquals("java.util.List", importsALot.getImports().get(1));
    }
View Full Code Here

    public void testExtends() {
      
        IMetaRepresentation rep = MetaRepresentation.getInstance();
        List<IModelItem> elements = rep.getAmModel().getItems();
       
        IModelItem extendsALot = null;
        for (IModelItem item : elements) {
            if (item.getIdentifier().equals("IExtendALot")){
                extendsALot = item;
            }
        }
        assertNotNull("IExtendALot could not be found.", extendsALot);
       
        List<IModelItem> extendsList = extendsALot.getExtendees();
        int expected = 4;
        int actual = extendsList.size();
        assertTrue("There should be 4 super classes in the extends list, "
                + "found: " + actual, expected == actual);
       
View Full Code Here

        model = new Model();
        other = new Model();
    }

    public void setUp() {
        IModelItem item = new ModelItem();
        item.setName("anItem");
        item.setNamespace("de.dlr.modi");
        item.setType("interface");
       
        Operation operation = new Operation();
        operation.setName("anOperation");
        operation.setNamespace(item.getIdentifier());
       
        Parameter parameter = new Parameter();
        parameter.setName("aParameter");
        parameter.setNamespace(operation.getIdentifier());
       
        operation.addParameter(parameter);
       
        Variable variable = new Variable();
        variable.setName("aVariable");
        variable.setNamespace(item.getIdentifier());

        item.addMember(operation);
        item.addMember(variable);
       
        //these two models are equal
        model.addModelItem(item);
        other.addModelItem(item);
    }
View Full Code Here

   
    public void testImplements() {
        IMetaRepresentation rep = MetaRepresentation.getInstance();
        List<IModelItem> elements = rep.getAmModel().getItems();
       
        IModelItem implementsALot = null;
        for (IModelItem item : elements) {
            if (item.getIdentifier().equals("ImplementsALot")){
                implementsALot = item;
            }
        }
        assertNotNull("ImplementsALot could not be found.", implementsALot);
      

        List<IModelItem> implementsList = implementsALot.getExtendees();
        int expected = 4;
        int actual = implementsList.size();
        assertTrue("There should be 4 super classes in the extends list, "
                + "found: " + actual, expected == actual);
       
View Full Code Here

TOP

Related Classes of net.sf.jmd.metarepresentation.IModelItem

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.