Package net.ontopia.topicmaps.utils
Class AssociationBuilder
- java.lang.Object
-
- net.ontopia.topicmaps.utils.AssociationBuilder
-
public class AssociationBuilder extends Object
PUBLIC: A helper class that makes it easier to build associations.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description AssociationBuilder(TopicIF assoctype, TopicIF roletype)
PUBLIC: Creates a new AssociationBuilder for unary associations.AssociationBuilder(TopicIF assoctype, TopicIF role1type, TopicIF role2type)
PUBLIC: Creates a new AssociationBuilder for binary associations.AssociationBuilder(TopicIF assoctype, TopicIF role1type, TopicIF role2type, TopicIF role3type)
PUBLIC: Creates a new AssociationBuilder for ternary associations.AssociationBuilder(TopicIF assoctype, TopicIF role1type, TopicIF role2type, TopicIF role3type, TopicIF role4type)
PUBLIC: Creates a new AssociationBuilder for quad associations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TopicIF
getAssociationType()
PUBLIC: Returns the type of associations the builder creates.Collection<TopicIF>
getScope()
PUBLIC: Returns the scope added to all associations created by this builder.AssociationIF
makeAssociation(TopicIF player)
PUBLIC: Create a unary association of the configured type, where player is the role player.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.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.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.void
setScope(Collection<TopicIF> scope)
PUBLIC: Sets the scope added to all associations created by this builder.
-
-
-
Field Detail
-
topicmap
protected TopicMapIF topicmap
-
builder
protected TopicMapBuilderIF builder
-
assoctype
protected TopicIF assoctype
-
role1type
protected TopicIF role1type
-
role2type
protected TopicIF role2type
-
role3type
protected TopicIF role3type
-
role4type
protected TopicIF role4type
-
scope
protected Collection<TopicIF> scope
-
-
Constructor Detail
-
AssociationBuilder
public AssociationBuilder(TopicIF assoctype, TopicIF roletype)
PUBLIC: Creates a new AssociationBuilder for unary associations.- Parameters:
assoctype
- The type of the created associationsroletype
- 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 associationsrole1type
- 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 associationsrole1type
- 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 associationsrole1type
- 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
-
-