All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.umlg.javageneration.util.UmlgAssociationClassOperations Maven / Gradle / Ivy

There is a newer version: 2.0.15
Show newest version
package org.umlg.javageneration.util;

import org.eclipse.uml2.uml.AssociationClass;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Generalization;

/**
 * Date: 2013/06/14
 * Time: 8:32 PM
 */
public class UmlgAssociationClassOperations extends UmlgClassOperations {


    /**
     * This returns true if the association class has no associations, no enums
     *
     * @param associationClass
     */
    public static boolean isSimple(AssociationClass associationClass) {
        return true;
    }

    public static boolean hasAssociationClassAsGeneralization(AssociationClass associationClass) {
        for (Generalization generalization : associationClass.getGeneralizations()) {
            if (generalization.getGeneral() instanceof AssociationClass) {
                return true;
            }
        }
        return false;
    }

    public static boolean extendsAssociationClass(Classifier classifier) {
        if (classifier instanceof AssociationClass) {
            return true;
        }
        for (Generalization generalization : classifier.getGeneralizations()) {
            if (generalization.getGeneral() instanceof AssociationClass) {
                return true;
            }
        }
        return false;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy