Class AssociationBuilder


  • public class AssociationBuilder
    extends Object
    PUBLIC: A helper class that makes it easier to build associations.
    Since:
    1.2
    • Constructor Detail

      • AssociationBuilder

        public AssociationBuilder​(TopicIF assoctype,
                                  TopicIF roletype)
        PUBLIC: Creates a new AssociationBuilder for unary associations.
        Parameters:
        assoctype - The type of the created associations
        roletype - The role type.
        Since:
        4.0
      • AssociationBuilder

        public AssociationBuilder​(TopicIF assoctype,
                                  TopicIF role1type,
                                  TopicIF role2type)
        PUBLIC: Creates a new AssociationBuilder for binary associations.
        Parameters:
        assoctype - The type of the created associations
        role1type - The first role type.
        role2type - The second role type.
      • AssociationBuilder

        public AssociationBuilder​(TopicIF assoctype,
                                  TopicIF role1type,
                                  TopicIF role2type,
                                  TopicIF role3type)
        PUBLIC: Creates a new AssociationBuilder for ternary associations.
        Parameters:
        assoctype - The type of the created associations
        role1type - The first role type.
        role2type - The second role type.
        role3type - The third role type.
        Since:
        1.3
      • AssociationBuilder

        public AssociationBuilder​(TopicIF assoctype,
                                  TopicIF role1type,
                                  TopicIF role2type,
                                  TopicIF role3type,
                                  TopicIF role4type)
        PUBLIC: Creates a new AssociationBuilder for quad associations.
        Parameters:
        assoctype - The type of the created associations
        role1type - The first role type.
        role2type - The second role type.
        role3type - The third role type.
        role4type - The fourth role type.
        Since:
        1.3
    • Method Detail

      • getScope

        public Collection<TopicIF> getScope()
        PUBLIC: Returns the scope added to all associations created by this builder.
      • setScope

        public void setScope​(Collection<TopicIF> scope)
        PUBLIC: Sets the scope added to all associations created by this builder.
      • makeAssociation

        public AssociationIF makeAssociation​(TopicIF player)
        PUBLIC: Create a unary association of the configured type, where player is the role player.
        Since:
        4.0
      • makeAssociation

        public AssociationIF makeAssociation​(TopicIF player1,
                                             TopicIF player2)
        PUBLIC: Create a binary association of the configured type, where player1 plays the first role and player2 the second.
      • makeAssociation

        public AssociationIF makeAssociation​(TopicIF player1,
                                             TopicIF player2,
                                             TopicIF player3)
        PUBLIC: Create a ternary association of the configured type, where player1 plays the first role, player2 the second, and player3 the third.
        Throws:
        IllegalArgumentException - if the builder is only configured for binary associations.
        Since:
        1.3
      • makeAssociation

        public AssociationIF makeAssociation​(TopicIF player1,
                                             TopicIF player2,
                                             TopicIF player3,
                                             TopicIF player4)
        PUBLIC: Create a quad association of the configured type, where player1 plays the first role, and player2 the second, and player3 the third, and player4 the fourth.
        Throws:
        IllegalArgumentException - if the builder is only configured for binary or ternary associations.
        Since:
        4.0
      • getAssociationType

        public TopicIF getAssociationType()
        PUBLIC: Returns the type of associations the builder creates.
        Since:
        2.0