net.ontopia.topicmaps.utils
Class AssociationBuilder

java.lang.Object
  extended by net.ontopia.topicmaps.utils.AssociationBuilder

public class AssociationBuilder
extends java.lang.Object

PUBLIC: A helper class that makes it easier to build associations.

Since:
1.2

Field Summary
protected  TopicIF assoctype
           
protected  TopicMapBuilderIF builder
           
protected  TopicIF role1type
           
protected  TopicIF role2type
           
protected  TopicIF role3type
           
protected  TopicIF role4type
           
protected  java.util.Collection scope
           
protected  TopicMapIF topicmap
           
 
Constructor Summary
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
 TopicIF getAssociationType()
          PUBLIC: Returns the type of associations the builder creates.
 java.util.Collection 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(java.util.Collection scope)
          PUBLIC: Sets the scope added to all associations created by this builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 java.util.Collection 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 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 java.util.Collection getScope()
PUBLIC: Returns the scope added to all associations created by this builder.


setScope

public void setScope(java.util.Collection 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:
java.lang.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:
java.lang.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


Copyright © 2000-2012 Ontopia.