Exemplo n.º 1
0
 public UmlAddRelationAttribute([NotNull] Type relatedType,
                                string name,
                                UmlRelationKind kind = UmlRelationKind.Aggregation) : base(kind)
 {
     RelatedType = relatedType;
     Name        = name;
 }
Exemplo n.º 2
0
        private UmlRelation FindRelation(Type resultType, UmlRelationKind kind, UmlRelationAttribute att, string name,
                                         Type t)
        {
            if (_types.ContainsKey(resultType))
            {
                var tmp = kind == UmlRelationKind.CompositionMany
                    ? Composition(t, resultType, att?.ArrowDirection, name)
                    : Aggregation(t, resultType, att?.ArrowDirection, name);
                tmp.Arrow = tmp.Arrow.With(att?.ArrowDirection ?? UmlArrowDirections.Auto);
                tmp.Note  = att?.Note;
                return(tmp);
            }

            var t1 = GetListElement(resultType);

            if (t1 != null && _types.ContainsKey(t1))
            {
                var tmp = kind == UmlRelationKind.CompositionMany
                    ? Composition(t, t1, att?.ArrowDirection, name, "1", "0..n")
                    : Aggregation(t, t1, att?.ArrowDirection, name, "1", "0..n");

                tmp.Note = att?.Note;
                return(tmp);
            }

            return(null);
        }
Exemplo n.º 3
0
        public static UmlRelationArrow GetRelationByKind(UmlRelationKind attKind, bool multiple)
        {
            UmlRelationArrow result;

            switch (attKind)
            {
            case UmlRelationKind.Aggregation:
                result = new UmlRelationArrow(ArrowEnd.DiamondWhite, ArrowEnd.Empty);
                break;

            case UmlRelationKind.AggregationDotted:
                result = new UmlRelationArrow(ArrowEnd.DiamondWhite, ArrowEnd.Empty, true);
                break;

            case UmlRelationKind.Composition:
                result = new UmlRelationArrow(ArrowEnd.DiamondBlack, ArrowEnd.Empty);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(attKind), attKind, null);
            }

            result.RightSign = multiple ? ArrowEnd.Multiple : ArrowEnd.ArrowOpen;
            return(result);
        }
Exemplo n.º 4
0
            public static UmlRelationArrow GetRelationByKind(UmlRelationKind iKind)
            {
                switch (iKind)
                {
                case UmlRelationKind.AggregationWithArrow:
                    return(new UmlRelationArrow("o", ">"));

                case UmlRelationKind.CompositionMany:
                    return(new UmlRelationArrow("o", "{"));

                case UmlRelationKind.AggregationDottedWithArrow:
                    return(new UmlRelationArrow("o", ">", true));

                default:
                    throw new ArgumentOutOfRangeException(nameof(iKind), iKind, null);
                }
            }
Exemplo n.º 5
0
 public UmlRelationAttribute(UmlRelationKind kind = UmlRelationKind.Aggregation,
                             UmlArrowDirections arrowDirection = UmlArrowDirections.Auto) : base(kind)
 {
     ArrowDirection = arrowDirection;
 }
Exemplo n.º 6
0
 protected BaseRelationAttribute(UmlRelationKind kind)
 {
     Kind = kind;
 }