Class MultiplicityLabel
Represents the label rendered at one end of a UML relationship connector to express multiplicity.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.Diagram.dll
Syntax
public class MultiplicityLabel : DiagramObject, IDiagramObject, ICloneable
Remarks
The MultiplicityLabel class defines the cardinality of relationships between UML elements. It is used within ClassifierMultiplicity to represent the source and target multiplicities of a connector.
The multiplicity is typically displayed in UML notation such as 1, 0..1, or 0..*.
These values are derived from LowerBounds and UpperBounds.
Examples
connectors.Add(new Connector()
{
SourcePoint = new DiagramPoint() { X = 100, Y = 200 },
TargetPoint = new DiagramPoint() { X = 300, Y = 200 },
Type = ConnectorSegmentType.Straight,
Shape = new RelationShip()
{
RelationshipShape = Relationship.Association,
Multiplicity = new ClassifierMultiplicity()
{
Source = new MultiplicityLabel()
{
LowerBounds = "1",
UpperBounds = "1"
},
Target = new MultiplicityLabel()
{
LowerBounds = "0",
UpperBounds = "*"
}
}
}
});
Constructors
MultiplicityLabel()
Initializes a new instance of MultiplicityLabel.
Declaration
public MultiplicityLabel()
MultiplicityLabel(MultiplicityLabel)
Initializes a new instance of MultiplicityLabel copied from src.
Declaration
public MultiplicityLabel(MultiplicityLabel src)
Parameters
| Type | Name | Description |
|---|---|---|
| MultiplicityLabel | src |
Properties
LowerBounds
Specifies the lower bound of the multiplicity (e.g., "0", "1").
Declaration
[JsonPropertyName("lowerBounds")]
public string LowerBounds { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the minimum number of instances. |
Remarks
This property defines the minimum number of elements allowed in the relationship.
Common values include "0", "1", etc.
Examples
This example demonstrates setting the lower bound of a multiplicity:
connectors.Add(new Connector()
{
ID = "connector2",
SourcePoint = new DiagramPoint() { X = 100, Y = 250 },
TargetPoint = new DiagramPoint() { X = 300, Y = 250 },
Shape = new RelationShip()
{
RelationshipShape = Relationship.Dependency,
Multiplicity = new ClassifierMultiplicity()
{
Source = new MultiplicityLabel() { LowerBounds = "1" },
Target = new MultiplicityLabel() { LowerBounds = "0", UpperBounds = "*" }
}
}
});
UpperBounds
Specifies the upper bound of the multiplicity (e.g., "1", "*").
Declaration
[JsonPropertyName("upperBounds")]
public string UpperBounds { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string representing the maximum number of instances. |
Remarks
This property defines the maximum number of elements allowed in the relationship.
Common values include "1" for a single instance or "*" for unlimited.
When specified along with LowerBounds, the multiplicity is displayed
in the format LowerBounds..UpperBounds.
Examples
This example demonstrates setting both lower and upper bounds:
connectors.Add(new Connector()
{
ID = "connector3",
SourcePoint = new DiagramPoint() { X = 150, Y = 300 },
TargetPoint = new DiagramPoint() { X = 350, Y = 300 },
Shape = new RelationShip()
{
RelationshipShape = Relationship.Association,
Multiplicity = new ClassifierMultiplicity()
{
Source = new MultiplicityLabel()
{
LowerBounds = "1",
UpperBounds = "1"
},
Target = new MultiplicityLabel()
{
LowerBounds = "0",
UpperBounds = "*"
}
}
}
});
Methods
Clone()
Creates a new instance of the MultiplicityLabel.
Declaration
public override object Clone()
Returns
| Type |
|---|
| object |