com.monad.homerun.wiring
Class Circuit

java.lang.Object
  extended by com.monad.homerun.base.DataObject
      extended by com.monad.homerun.wiring.Circuit
All Implemented Interfaces:
java.io.Serializable

public class Circuit
extends DataObject

A Circuit is a collection of Wires - which are connections between signal sources (controls, emitters) and sinks (models) This is a very limited implementation supporting only intra-object wiring & templates

See Also:
Serialized Form

Constructor Summary
Circuit()
           
Circuit(Circuit circuit)
           
Circuit(java.lang.String name)
           
Circuit(java.lang.String domain, java.lang.String object, java.lang.String srcType, java.lang.String source, java.lang.String sinkType, java.lang.String sink)
           
 
Method Summary
 void addWire(Wire wire)
          Adds a wire to the circuit
 void clearWires()
          Removes all the wires
 java.lang.String getDomain()
          Returns the domain name
 int getNumWires()
          Returns the number of wires in the circuit
 java.lang.String getObjectName()
          Returns the object name
 java.lang.String getSinkComponent()
          Returns the name of the sink component
 java.lang.String getSinkType()
          Returns the type of the sink component (model, controls, etc)
 java.lang.String getSourceComponent()
          Returns the name of the source component
 java.lang.String getSourceType()
          Returns the type of the source component (model, control, etc)
 Wire getWire(int index)
          Returns a wire at designated index
 Wire[] getWires()
          Returns the wires in the circuit
 boolean homologous(Circuit circuit)
          Returns similarity measure between this object and another circuit
 boolean isTemplate()
          Is the circuit concrete or a template?
 boolean matches(Instance instance)
          Returns true if circuit matches the passed object
 void promote()
          Changes this circuit from a concrete circuit to a template
 void removeWire(Wire wire)
          Removes wire from the circuit
 void setDomain(java.lang.String domain)
          Sets the domain name
 void setObjectName(java.lang.String name)
          Sets the circuit object name
 void setSinkComponent(java.lang.String comp)
          Assigns the sink component
 void setSinkType(java.lang.String type)
          Assigns the type of the sink component
 void setSourceComponent(java.lang.String comp)
          Assigns the source component
 void setSourceType(java.lang.String type)
          Assigns the type of the source component
 void setWires(Wire[] wireList)
          Assigns the circuit wires
 java.lang.String templateName()
          Constructs a unique template name for the circuit
 java.lang.String uniqueName()
          Constructs a unique name for the circuit based on its parts
 
Methods inherited from class com.monad.homerun.base.DataObject
getCategory, getModificationTime, getName, getNote, setCategory, setModificationTime, setName, setNote
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Circuit

public Circuit()

Circuit

public Circuit(java.lang.String name)

Circuit

public Circuit(java.lang.String domain,
               java.lang.String object,
               java.lang.String srcType,
               java.lang.String source,
               java.lang.String sinkType,
               java.lang.String sink)

Circuit

public Circuit(Circuit circuit)
Method Detail

getDomain

public java.lang.String getDomain()
Returns the domain name

Returns:
domain the domain name

setDomain

public void setDomain(java.lang.String domain)
Sets the domain name

Parameters:
domain - the domain name

getObjectName

public java.lang.String getObjectName()
Returns the object name

Returns:
object the object name

setObjectName

public void setObjectName(java.lang.String name)
Sets the circuit object name

Parameters:
name - the name of the object or '*' for template

getSourceComponent

public java.lang.String getSourceComponent()
Returns the name of the source component

Returns:
source the source component name

setSourceComponent

public void setSourceComponent(java.lang.String comp)
Assigns the source component

Parameters:
comp - the name of the component (not binding name)

getSourceType

public java.lang.String getSourceType()
Returns the type of the source component (model, control, etc)

Returns:
sourceType the source component type

setSourceType

public void setSourceType(java.lang.String type)
Assigns the type of the source component

Parameters:
type - the type of the source component: control, emitter, model

getSinkComponent

public java.lang.String getSinkComponent()
Returns the name of the sink component

Returns:
sink the sink component name

setSinkComponent

public void setSinkComponent(java.lang.String comp)
Assigns the sink component

Parameters:
comp - the name of the sink component (not binding name)

getSinkType

public java.lang.String getSinkType()
Returns the type of the sink component (model, controls, etc)

Returns:
sinkType the sink component type

setSinkType

public void setSinkType(java.lang.String type)
Assigns the type of the sink component

Parameters:
type - the type of the sink component: control, emitter, model

getWires

public Wire[] getWires()
Returns the wires in the circuit

Returns:
wires an array of wires

getWire

public Wire getWire(int index)
Returns a wire at designated index

Parameters:
index - the index in the list of wires
Returns:
wire the wire at index

getNumWires

public int getNumWires()
Returns the number of wires in the circuit

Returns:
num the number of wires

isTemplate

public boolean isTemplate()
Is the circuit concrete or a template?

Returns:
true if a template, else false

promote

public void promote()
Changes this circuit from a concrete circuit to a template


addWire

public void addWire(Wire wire)
Adds a wire to the circuit

Parameters:
wire - the wire to add

removeWire

public void removeWire(Wire wire)
Removes wire from the circuit

Parameters:
wire - the wire to remove

setWires

public void setWires(Wire[] wireList)
Assigns the circuit wires

Parameters:
wireList - the list of wires

clearWires

public void clearWires()
Removes all the wires


matches

public boolean matches(Instance instance)
Returns true if circuit matches the passed object

Parameters:
instance - the object instance to compare
Returns:
status true if a match: i.e. object has same domain, component, etc as the circuit, otherwise false

homologous

public boolean homologous(Circuit circuit)
Returns similarity measure between this object and another circuit

Parameters:
circuit - the circuit to compare
Returns:
measure true if source and sink the same, else false

uniqueName

public java.lang.String uniqueName()
Constructs a unique name for the circuit based on its parts

Returns:
name a site-unique name for the circiut

templateName

public java.lang.String templateName()
Constructs a unique template name for the circuit

Returns:
name a site-unique template name for the circuit


Copyright © 2006-2009 Richard Rodgers. All Rights Reserved.