// $ANTLR end "method" // $ANTLR start "association" // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:79:1: association returns [Association association] : (ma= multiplicity )? (labelA= label )? a= ( SIMPLE_ASSOCIATION | DIRECTIONAL_ASSOCIATION | BIDECTIONAL_ASSOCIATION | INHERRITANCE_ASSOCIATION ) (labelB= label )? (mb= multiplicity )? ; public Association association() // throws RecognitionException [1] { Association association = default(Association); IToken a = null; string ma = default(string); string labelA = default(string); string labelB = default(string); string mb = default(string); association = new Association(); try { // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:80:2: ( (ma= multiplicity )? (labelA= label )? a= ( SIMPLE_ASSOCIATION | DIRECTIONAL_ASSOCIATION | BIDECTIONAL_ASSOCIATION | INHERRITANCE_ASSOCIATION ) (labelB= label )? (mb= multiplicity )? ) // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:2: (ma= multiplicity )? (labelA= label )? a= ( SIMPLE_ASSOCIATION | DIRECTIONAL_ASSOCIATION | BIDECTIONAL_ASSOCIATION | INHERRITANCE_ASSOCIATION ) (labelB= label )? (mb= multiplicity )? { // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:5: (ma= multiplicity )? int alt11 = 2; int LA11_0 = input.LA(1); if ( (LA11_0 == MM) ) { alt11 = 1; } switch (alt11) { case 1 : // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:5: ma= multiplicity { PushFollow(FOLLOW_multiplicity_in_association276); ma = multiplicity(); state.followingStackPointer--; } break; } // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:28: (labelA= label )? int alt12 = 2; int LA12_0 = input.LA(1); if ( (LA12_0 == 21) ) { alt12 = 1; } switch (alt12) { case 1 : // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:28: labelA= label { PushFollow(FOLLOW_label_in_association283); labelA = label(); state.followingStackPointer--; } break; } a = (IToken)input.LT(1); if ( (input.LA(1) >= SIMPLE_ASSOCIATION && input.LA(1) <= INHERRITANCE_ASSOCIATION) ) { input.Consume(); state.errorRecovery = false; } else { MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:150: (labelB= label )? int alt13 = 2; int LA13_0 = input.LA(1); if ( (LA13_0 == 21) ) { alt13 = 1; } switch (alt13) { case 1 : // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:150: labelB= label { PushFollow(FOLLOW_label_in_association312); labelB = label(); state.followingStackPointer--; } break; } // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:163: (mb= multiplicity )? int alt14 = 2; int LA14_0 = input.LA(1); if ( (LA14_0 == MM) ) { alt14 = 1; } switch (alt14) { case 1 : // D:\\Olle\\Projects\\WikiUml\\source\\Grammar\\WikiUml.g:81:163: mb= multiplicity { PushFollow(FOLLOW_multiplicity_in_association320); mb = multiplicity(); state.followingStackPointer--; } break; } if(a.Type == SIMPLE_ASSOCIATION) association.Type = AssociationType.Simple; else if(a.Type == DIRECTIONAL_ASSOCIATION) association.Type = AssociationType.Directional; else if(a.Type == BIDECTIONAL_ASSOCIATION) association.Type = AssociationType.Bidirectional; else if(a.Type == INHERRITANCE_ASSOCIATION) association.Type = AssociationType.Inherritance; association.LabelA = labelA; association.LabelB = labelB; association.MultiplicityA = ma; association.MultiplicityB = mb; } } catch (RecognitionException re) { ReportError(re); Recover(input,re); } finally { } return association; }
public void AddAssociation(Association association) { Associations.Add(association); }