public class UmlAssociation extends AbstractUmlObject
All the information related to the types/UML classes (getSource()
and
getTarget()
) gets derived from the contained association ends (getSourceEnd()
and getTargetEnd()
). Whether association is informative, in contrast, is based on the
stereotype (this allows us to identify and report when the due stereotype is missing).
Ownership of association is defined in OwningWg
, according to TC57 rules.
Associations with their two ends are a bit tricky. To define owner (owning top-level package and
its WG), we use the classes at both ends, i.e., methods getSource()
and
getTarget()
.
Consider example association from combined CIM model, between Location and PowerSystemResource. Location (from IEC61968) is the source and PowerSystemResource (from IEC61970) is the target. Qualified association ends, to display association, are shown so:
[0..*] Location.PowerSystemResources - [0..1] PowerSystemResource.Location
Modifier and Type | Class and Description |
---|---|
static class |
UmlAssociation.Data
Data from the UML model repository specific to
UmlAssociation . |
static class |
UmlAssociation.Direction
Direction (navigability) of association.
|
Modifier and Type | Field and Description |
---|---|
private UmlAssociation.Data |
_data |
private UmlAssociationEnd.Kind |
_kind |
private static org.apache.log4j.Logger |
_logger |
private UmlAssociationEnd |
_sourceEnd |
private UmlAssociationEnd |
_targetEnd |
static java.util.List<java.lang.String> |
STEREOTYPES
Allowed stereotypes for UML associations.
|
CLASS_SEPARATOR, NULL_OBJ_NAME, PACKAGE_SEPARATOR
Constructor and Description |
---|
UmlAssociation(UmlAssociationEnd sourceEnd,
UmlAssociationEnd targetEnd,
UmlObjectData objData,
UmlAssociation.Data data)
Intended to be called by
UmlClass and tests only: Creates an instance and sets itself
as containing association of both sourceEnd and targetEnd . |
Modifier and Type | Method and Description |
---|---|
boolean |
areEndVisibilitiesSame()
Returns whether both ends have the same visibility.
|
(package private) static UmlAssociation |
basic(UmlAssociationEnd sourceEnd,
UmlAssociationEnd targetEnd)
For testing only: Constructs minimal association.
|
(package private) static UmlAssociation |
basic(UmlAssociationEnd sourceEnd,
UmlAssociationEnd targetEnd,
UmlStereotype stereotype)
For testing only: Constructs minimal association with stereotype.
|
UmlAssociation.Direction |
getDirection()
Returns the direction (navigability).
|
UmlAssociationEnd.AssociationEndPair |
getEndsFor(UmlClass type)
Returns the pair of association ends from the perspective of
type (this is what
we need when printing model documentation for associations of a type , or when
reading RDF/OWL properties). |
UmlAssociationEnd.AssociationEndPair |
getEndsForSelfAssociation(boolean asSource)
For recursive association (self-association on a class), returns the pair of association ends
from the perspective of source if
asSource true, from the perspective of target
otherwise. |
UmlKind |
getKind()
Returns kind of this UML object, as assigned by the application.
|
static java.util.List<UmlKind> |
getKinds(Nature nature)
Returns all available classifications (kinds) for associations.
|
Nature |
getNature()
Returns the nature of this UML object, which determines the validation rules to apply, and
sometimes document generation formats.
|
OwningWg |
getOwner()
Returns the IEC working group owning this UML object, as calculated by the application based
on the UML model structure.
|
java.lang.String |
getQualifiedName()
Returns the name of this UML object combined with some container-related information (e.g.,
packageName.className, or containingPackageName.packageName).
|
UmlClass |
getSource()
Returns
UmlClass used as type for the source end. |
UmlAssociationEnd |
getSourceEnd()
Returns source end.
|
UmlClass |
getTarget()
Returns
UmlClass used as type for the target end. |
UmlAssociationEnd |
getTargetEnd()
Returns target end.
|
boolean |
involvesWg(OwningWg wg)
Returns whether any of two classes of this association involve owner
wg . |
boolean |
isAtLeastOneEndPublic()
Returns whether at least one end is public.
|
boolean |
isDirectionMismatchForEnds()
Returns whether an association with unspecified direction has a navigable end.
|
boolean |
isInformative()
Returns whether this UML object is informative (and thus should be ignored when generating
official IEC documents).
|
boolean |
isMapping()
Returns whether this association is between a CIM and an IEC 61850 class.
|
boolean |
isNonPrivate()
Returns whethern any end is not private.
|
boolean |
isNonPublic()
Returns whether neither end is public.
|
boolean |
isWithinSameWg()
Returns whether this association is between the classes with the same owner.
|
java.lang.String |
toString() |
addTaggedValue, classifyPerScope, classifyPerScopePerTag, classifyPerTag, collectDuplicateDescriptions, collectDuplicateNames, collectForScope, collectNames, collectQNames, findWithSameUuidAndLog, getAlias, getDescription, getHtmlDescription, getId, getName, getPredefinedTagNames, getSince, getStereotype, getTaggedValues, getUnallowedTagNames, getUuid, getVisibility, isDeprecated, saveTags, toShortString, toShortString, validateTag
private static final org.apache.log4j.Logger _logger
public static final java.util.List<java.lang.String> STEREOTYPES
private final UmlAssociationEnd _sourceEnd
private final UmlAssociationEnd _targetEnd
private final UmlAssociation.Data _data
private final UmlAssociationEnd.Kind _kind
UmlAssociation(UmlAssociationEnd sourceEnd, UmlAssociationEnd targetEnd, UmlObjectData objData, UmlAssociation.Data data)
UmlClass
and tests only: Creates an instance and sets itself
as containing association of both sourceEnd
and targetEnd
. After
creating this object, you may want to add tagged values.sourceEnd
- targetEnd
- objData
- data
- java.lang.IllegalArgumentException
- if sourceEnd
and non-null targetEnd
are from different
models.public static java.util.List<UmlKind> getKinds(Nature nature)
nature
- ignored in this methodstatic UmlAssociation basic(UmlAssociationEnd sourceEnd, UmlAssociationEnd targetEnd)
static UmlAssociation basic(UmlAssociationEnd sourceEnd, UmlAssociationEnd targetEnd, UmlStereotype stereotype)
public UmlAssociationEnd getSourceEnd()
public UmlAssociationEnd getTargetEnd()
public UmlAssociationEnd.AssociationEndPair getEndsFor(UmlClass type)
type
(this is what
we need when printing model documentation for associations of a type
, or when
reading RDF/OWL properties).public UmlAssociationEnd.AssociationEndPair getEndsForSelfAssociation(boolean asSource)
asSource
true, from the perspective of target
otherwise.public boolean isNonPrivate()
public boolean isNonPublic()
public boolean isAtLeastOneEndPublic()
public boolean areEndVisibilitiesSame()
public UmlAssociation.Direction getDirection()
public boolean isDirectionMismatchForEnds()
public boolean isMapping()
public boolean isWithinSameWg()
public boolean involvesWg(OwningWg wg)
wg
.public OwningWg getOwner()
UmlObject
getOwner
in interface UmlObject
getOwner
in class AbstractUmlObject
public Nature getNature()
UmlObject
getNature
in interface UmlObject
getNature
in class AbstractUmlObject
public boolean isInformative()
UmlObject
isInformative
in interface UmlObject
isInformative
in class AbstractUmlObject
public UmlKind getKind()
UmlObject
getKind
in interface UmlObject
getKind
in class AbstractUmlObject
public java.lang.String getQualifiedName()
UmlObject
getQualifiedName
in interface UmlObject
getQualifiedName
in class AbstractUmlObject
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2009-2015 Tatjana (Tanja) Kostic