// simple ones: "->" "<>->" "+->" "++->" private AssocInfo ParseAssociation() { var sourceMult = ParseMultiplicity(); AssocInfo assocInfo = null; if (_genericTokens.TryConsume(TokenType.Dash)) { assocInfo = new AssocInfo(_genericTokens.TryConsume(TokenType.AngleClose) ? AssociationKind.Directed : AssociationKind.Undirected); } if (_genericTokens.TryConsume(TokenType.AngleOpen, TokenType.AngleClose, TokenType.Dash, TokenType.AngleClose)) { assocInfo = new AssocInfo(AssociationKind.Aggregation); } if (_genericTokens.TryConsume(TokenType.Plus)) { if (_genericTokens.TryConsume(TokenType.Dash, TokenType.AngleClose)) { assocInfo = new AssocInfo(AssociationKind.Aggregation); } if (_genericTokens.TryConsume(TokenType.Plus, TokenType.Dash, TokenType.AngleClose)) { assocInfo = new AssocInfo(AssociationKind.Composition); } } var targetMult = ParseMultiplicity(); if (assocInfo != null) { assocInfo.SourceMult = sourceMult; assocInfo.TargetMult = targetMult; } return(assocInfo); }
public Association(AssocInfo info, IClass source, IClass target) { Kind = info.Kind; Source = source; Target = target; SourceMultiplicity = info.SourceMult; TargetMultiplicity = info.TargetMult; TargetRole = string.Empty; SourceRole = string.Empty; }