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

cdc.mf.model.MfComposition Maven / Gradle / Ivy

The newest version!
package cdc.mf.model;

import cdc.util.lang.Introspection;

/**
 * Composition class.
 *
 * @author Damien Carbonne
 */
public final class MfComposition extends MfConnector {
    public static final Class PARENT_CLASS =
            MfConnectorOwner.class;
    public static final Class> BUILDER_CLASS =
            Introspection.uncheckedCast(Builder.class);

    protected MfComposition(Builder builder) {
        super(builder);

        addToParent(FEATURES);
        addToModel();
    }

    public MfTip getWholeTip() {
        return getSourceTip();
    }

    public MfTip getPartTip() {
        return getTargetTip();
    }

    @Override
    public MfComposition duplicate(MfConnectorOwner tgtParent) {
        return tgtParent.composition()
                        .set(this)
                        .build();
    }

    @Override
    public MfDocumentation.Builder documentation() {
        return MfDocumentation.builder(this);
    }

    @Override
    public MfTag.Builder tag() {
        return MfTag.builder(this);
    }

    @Override
    public MfDependency.Builder dependency() {
        return MfDependency.builder(this);
    }

    @Override
    public MfTip.Builder source() {
        return MfTip.builder(this, MfTipSide.SOURCE).type((MfType) getParent());
    }

    @Override
    public MfTip.Builder target() {
        return MfTip.builder(this, MfTipSide.TARGET);
    }

    @Override
    public MfTip.Builder tip(MfTipSide side) {
        return side == MfTipSide.SOURCE ? source() : target();
    }

    @Override
    public MfConstraint.Builder constraint() {
        return MfConstraint.builder(this);
    }

    static 

Builder

builder(P parent) { return new Builder<>(parent); } /** * Builder of compositions. * * @author Damien Carbonne * * @param

The concrete parent type. */ public static final class Builder

extends MfConnector.Builder, MfComposition, P> { protected Builder(P parent) { super(parent); } @Override public Class getElementClass() { return MfComposition.class; } @Override public MfComposition build() { return new MfComposition(this); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy