sky.monome
Class Monome


java.lang.Object

  extended by sky.monome.Component

      extended by sky.monome.Container

          extended by sky.monome.AbstractGroup<Component>

              extended by sky.monome.Group

                  extended by sky.monome.Monome


public final class Monome
extends Group

Logical Monome device. Instances of this class must be always on top of Monome assembling trees. Due to its logical nature, only one instance of this class can manage up to 4 physical 40h Monome devices at the same time, with a correct mapping done in MonomeSerial.

Author:
PJ Skyman

Nested Class Summary
static class Monome.MonomeSize
          Monome size.
 
Field Summary
static int COORDINATE_NOT_FOUND
          Deprecated. Since SkyMonome v1.3, this constant field is not used anymore.
 
Fields inherited from class sky.monome.AbstractGroup
components
 
Fields inherited from class sky.monome.Container
height, width
 
Fields inherited from class sky.monome.Component
container, eventListenerList, lockObject, name, x, y
 
Constructor Summary
Monome(java.lang.String name, Monome.MonomeSize monomeSize, java.lang.String address, java.lang.String prefix, int portInNumber, int portOutNumber)
          Constructs a logical Monome device with specified name, size, network addressing and prefix.
 
Method Summary
 boolean canHaveParentContainer()
          Returns false.
 void clear()
          Clears the led state of all leds of the Monome device.
 void clear(boolean state)
          Clears the led state of all leds of the Monome device.
 int getAbsoluteX()
          Returns 0.
 int getAbsoluteY()
          Returns 0.
 Monome getMonome()
          Returns this.
 boolean isVisible()
          Returns true.
static void main(java.lang.String[] args)
          Main method.
 void refresh()
          Refreshes the physical Monome device according to this logical Monome device.
static void throwException()
          Throws an exception and prints the stack trace.
 java.lang.String toString()
          Returns a string representation of this logical Monome device.
 
Methods inherited from class sky.monome.Group
addComponent, getComponents, removeComponent, removeComponents
 
Methods inherited from class sky.monome.AbstractGroup
getBounds, notify, writeOn
 
Methods inherited from class sky.monome.Container
getHeight, getWidth
 
Methods inherited from class sky.monome.Component
getContainer, getLockObject, getName, getX, getY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COORDINATE_NOT_FOUND


@Deprecated

public static final int COORDINATE_NOT_FOUND
Deprecated. Since SkyMonome v1.3, this constant field is not used anymore.
Constant used to denote that a coordinate was not found.

See Also:
Constant Field Values
Constructor Detail

Monome


public Monome(java.lang.String name,

              Monome.MonomeSize monomeSize,

              java.lang.String address,

              java.lang.String prefix,

              int portInNumber,

              int portOutNumber)

       throws MonomeException
Constructs a logical Monome device with specified name, size, network addressing and prefix.

Parameters:
name - Name of this Monome device.
monomeSize - Size of this Monome device.
address - Network address of this Monome device, typically "localhost".
prefix - Prefix of this Monome device. Prefix is used by MonomeSerial. Typically "/40h".
portInNumber - Port number for entering communication, typically 8000.
portOutNumber - Port number for outgoing communication, typically 8080.
Throws:
MonomeException - When it's impossible to create network connections with MonomeSerial.
Method Detail

getMonome


public Monome getMonome()
Returns this.

Overrides:
getMonome in class AbstractGroup<Component>
Returns:
this.

getAbsoluteX


public int getAbsoluteX()
Returns 0.

Overrides:
getAbsoluteX in class AbstractGroup<Component>
Returns:
0.

getAbsoluteY


public int getAbsoluteY()
Returns 0.

Overrides:
getAbsoluteY in class AbstractGroup<Component>
Returns:
0.

toString


public java.lang.String toString()
Returns a string representation of this logical Monome device.

Overrides:
toString in class Group
Returns:
A string representation of this logical Monome device.

isVisible


public boolean isVisible()
Returns true.

Overrides:
isVisible in class AbstractGroup<Component>
Returns:
true.

canHaveParentContainer


public boolean canHaveParentContainer()
Returns false.

Overrides:
canHaveParentContainer in class AbstractGroup<Component>
Returns:
false.

refresh


public void refresh()

             throws MonomeException
Refreshes the physical Monome device according to this logical Monome device. It internally uses a DefaultFrame. This logicial Monome device asks to its contained components to write down to the DefaultFrame, and then the virtual "image" represented by the DefaultFrame is sent in one shot to the physical Monome device.

Throws:
MonomeException - When an error appears when communicating with MonomeSerial.

clear


public void clear()

           throws MonomeException
Clears the led state of all leds of the Monome device.

Throws:
MonomeException - When an error appears when communicating with MonomeSerial.
Since:
SkyMonome v1.1

clear


public void clear(boolean state)

           throws MonomeException
Clears the led state of all leds of the Monome device.

Parameters:
state - true if all leds should be turned on, or false if all leds should turned off.
Throws:
MonomeException - When an error appears when communicating with MonomeSerial.
Since:
SkyMonome v1.1

throwException


public static void throwException()
Throws an exception and prints the stack trace. This method is designed for debugging purpose only.

Since:
SkyMonome v1.1

main


public static void main(java.lang.String[] args)
Main method. This prints out an about message on the console.

Parameters:
args - Arguments passed to the program. They won't be used.