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

ch.ninecode.cim.CIMRelationship.scala Maven / Gradle / Ivy

There is a newer version: 2.12-3.0.1-5.1.1
Show newest version
package ch.ninecode.cim

/**
 * Relation description between CIM classes.
 *
 * @param field            the name of the field in this CIM class holding the reference to the other class
 * @param clazz            the class name of the other class
 * @param this_cardinality the cardinality of this side of the relation
 * @param mate_cardinality the cardinality on the other side of the relation
 */
case class CIMRelationship (
    field: String,
    clazz: String,
    this_cardinality: String,
    mate_cardinality: String)
{
    /**
     * Predicate that indicates this side of the relation can be more that one object.
     *
     * @return true if this relation is many:something
     */
    def multiple: Boolean = !(this_cardinality.equals ("1") || this_cardinality.endsWith ("..1"))

    /**
     * Predicate that indicates this side of the relation can be more that one object and the other side is one (1).
     *
     * @return true if this relation is many:1
     */
    def heavyside: Boolean = multiple && (mate_cardinality.equals ("1") || mate_cardinality.endsWith ("..1"))
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy