public class CouplingManager
extends java.lang.Object
Coupling
Constructor and Description |
---|
CouplingManager(Workspace workspace)
Construct a coupling manager.
|
Modifier and Type | Method and Description |
---|---|
void |
addCoupling(Coupling<?> coupling)
Adds a coupling to this instance.
|
void |
addCouplingListener(CouplingListener listener)
Adds a new listener to be updated when changes are made.
|
void |
clearCouplings()
Clear all couplings.
|
boolean |
containseEquivalentCoupling(Coupling<?> toCheck)
Returns whether the coupling is referenced by this manager.
|
static java.awt.Color |
getColor(java.lang.Class<?> dataType)
Associates attribute and coupling data types (classes) with colors used
in displaying attributes and couplings.
|
java.util.Collection<? extends Coupling<?>> |
getCouplings()
Returns an unmodifiable list of all the couplings.
|
java.util.Collection<? extends Coupling<?>> |
getCouplings(WorkspaceComponent sourceComponent,
WorkspaceComponent targetComponent)
Returns all couplings from the given source component to the given target
component.
|
int |
getPriority()
Get the priority.
|
static java.lang.String |
getTypeDescriptor(java.lang.Class<?> dataType)
Associates attribute and coupling data types (classes) with text
descriptions used in displaying attributes.
|
void |
removeAttachedCouplings(Attribute attribute)
Removes all couplings associated with a producer or consumer.
|
void |
removeCoupling(Coupling<?> coupling)
Removes a coupling from the manager.
|
void |
removeCouplingListener(CouplingListener listener)
Removes the listener from the list.
|
void |
removeCouplings(java.util.ArrayList<Coupling<?>> couplings)
Remove a specified list of couplings.
|
void |
removeCouplings(WorkspaceComponent component)
Remove all couplings associated with a WorkspaceComponent.
|
void |
removeMatchingCoupling(Coupling<?> toRemove)
Remove coupling (if any) that is essentially a copy of the supplied
coupling.
|
void |
replaceCouplings(Attribute oldAttr,
Attribute newAttr)
Replaces any couplings where the old attribute is the source or target
with a new coupling with the new attribute in the source and/or target.
|
void |
setPriority(int value)
Set the priority.
|
void |
updateAllCouplings()
Updates all couplings in the workspace.
|
void |
updateCouplings(java.util.List<Coupling<?>> couplingList)
Convenience method for updating a set of couplings.
|
public CouplingManager(Workspace workspace)
workspace
- workspace referencepublic java.util.Collection<? extends Coupling<?>> getCouplings()
public void clearCouplings()
public java.util.Collection<? extends Coupling<?>> getCouplings(WorkspaceComponent sourceComponent, WorkspaceComponent targetComponent)
sourceComponent
- The source component to use in the search.targetComponent
- The target component to use in the search.public void updateAllCouplings()
public void removeAttachedCouplings(Attribute attribute)
attribute
- consumer or producer.public boolean containseEquivalentCoupling(Coupling<?> toCheck)
toCheck
- The coupling to search for.public void removeMatchingCoupling(Coupling<?> toRemove)
toRemove
- the coupling type to removepublic void addCoupling(Coupling<?> coupling) throws UmatchedAttributesException
coupling
- The coupling to add.UmatchedAttributesException
- thrown if the attributes in this
coupling have mismatched data typespublic void replaceCouplings(Attribute oldAttr, Attribute newAttr)
oldAttr
- the attribute to be replaced.newAttr
- the attribute to replace it with.public void removeCouplings(WorkspaceComponent component)
component
- component to check.public void removeCouplings(java.util.ArrayList<Coupling<?>> couplings)
couplings
- list of couplings to removepublic void removeCoupling(Coupling<?> coupling)
coupling
- The coupling to remove.public int getPriority()
public void setPriority(int value)
value
- the priority to setpublic void addCouplingListener(CouplingListener listener)
listener
- to be updated of changespublic void removeCouplingListener(CouplingListener listener)
listener
- to be removedpublic void updateCouplings(java.util.List<Coupling<?>> couplingList)
couplingList
- the list of couplings to be updatedpublic static java.awt.Color getColor(java.lang.Class<?> dataType)
dataType
- the data type to associate with a colorpublic static java.lang.String getTypeDescriptor(java.lang.Class<?> dataType)
dataType
- the data type to associate with a description