org.rubato.composer.rubette
Class Connector

java.lang.Object
  extended by org.rubato.composer.rubette.Connector

public class Connector
extends java.lang.Object

Connectors are the the little boxes on rubettes where links come in and go out. There are two types of connectors: input and output. Each connector can be in one of two states, namely connected or unconnected, which is indicated by the use of different colors.

Author:
Gérard Milmeister

Field Summary
static int CONNECTED
           
static int INPUT
           
static int OUTPUT
           
static java.lang.String[] stateString
           
static int UNCONNECTED
           
 
Constructor Summary
Connector(JRubette jrubette, int pos, java.awt.Rectangle r, int state, int type)
          Creates a new connector.
 
Method Summary
 boolean addLink(JLink link)
          Adds a new link to the connector.
 boolean contains(int x, int y)
           
 java.awt.Point getConnectPoint()
           
 JRubette getJRubette()
           
 JLink getLink(int i)
           
 int getLinkCount()
           
 java.util.List<JLink> getLinks()
           
 int getPos()
           
 int getState()
           
 int getType()
           
 void paint(java.awt.Graphics2D g)
           
 void refresh()
           
 void removeLink(JLink link)
           
 boolean setLink(JLink link)
           
 void setRectangle(java.awt.Rectangle r)
           
 void setState(int state)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECTED

public static final int CONNECTED
See Also:
Constant Field Values

UNCONNECTED

public static final int UNCONNECTED
See Also:
Constant Field Values

INPUT

public static final int INPUT
See Also:
Constant Field Values

OUTPUT

public static final int OUTPUT
See Also:
Constant Field Values

stateString

public static final java.lang.String[] stateString
Constructor Detail

Connector

public Connector(JRubette jrubette,
                 int pos,
                 java.awt.Rectangle r,
                 int state,
                 int type)
Creates a new connector.

Parameters:
jrubette - the rubette this connector is part of
pos - the position of the connector (1..8)
r - the size of the connector
state - the initial state of the connector
type - the type of the connector
Method Detail

getJRubette

public JRubette getJRubette()

getPos

public int getPos()

getState

public int getState()

getType

public int getType()

setState

public void setState(int state)

getLinkCount

public int getLinkCount()

getLink

public JLink getLink(int i)

addLink

public boolean addLink(JLink link)
Adds a new link to the connector. The start of end position of the link is set according to the type of the connector.


setLink

public boolean setLink(JLink link)

removeLink

public void removeLink(JLink link)

getLinks

public java.util.List<JLink> getLinks()

getConnectPoint

public java.awt.Point getConnectPoint()

contains

public boolean contains(int x,
                        int y)

setRectangle

public void setRectangle(java.awt.Rectangle r)

paint

public void paint(java.awt.Graphics2D g)

refresh

public void refresh()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object