|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
public abstract class Piece
Basic piece for buildnig computer graphics algorithms (compositions).
Instances of Piece object act as nodes in graph of execution while
instances of Channel object are connecting them as graph edges.
Template| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,Channel> |
channels
Map of actually connected Channels (connected Plugs). |
protected InfoModule |
info
XML-persistent data about this module instance. |
protected ProgressListener |
pl
Progress listener object. |
protected java.util.Map<java.lang.String,Plug> |
plugs
Map of Plugs (potential Channels). |
static RegPiece |
reg
Static registration instance for this class. |
static java.lang.Class<?> |
TEMPLATE_TYPE
Static instance of Class object for Template. |
protected boolean |
userBreak
External break did occur? |
| Fields inherited from interface cz.cuni.jagrlib.iface.Property |
|---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
| Constructor Summary | |
|---|---|
protected |
Piece()
Default constructor: creates an empty instance (it should be assigned later). |
| Method Summary | |
|---|---|
protected java.lang.String |
className()
|
void |
connect(java.lang.String key,
Piece other,
java.lang.String otherKey)
Connects the Piece to the other one through the given Plug. |
Plug |
findPlug(Plug pl)
Finds Plug compatible with the given one. |
Plug |
findPlug(java.lang.String inputInterface,
java.lang.String outputInterface,
boolean cloneable,
boolean multi)
Finds Plug with the given parameters. |
InfoModule |
getInfo()
|
java.lang.Object |
getInterface(java.lang.String key)
Returns executable interface for the given channel. |
java.lang.Object |
getInterface(java.lang.String key,
java.lang.String type)
Returns executable interface for the given channel. |
Plug |
getPlug(java.lang.String key)
Find a plug from its name. |
RegPiece |
getReg(int ord)
Retrieves registration object ( RegPiece) from a statically
declared class member ("RegPiece reg" or "RegPiece[] reg"). |
int |
init(int phase)
Module initialization - called before any Worker.run(). |
boolean |
isCompatible(Piece temp)
Compatibility test: can I implement the given template? |
boolean |
isCompatible(Piece temp,
java.util.Map<java.lang.String,java.lang.String> plugMap)
Compatibility test: can I implement the given template? |
boolean |
isConnected(java.lang.String key)
Tests whether the given plug is being used (connected). |
protected void |
logError(java.lang.String message)
Writes error message (via LogFile) including the class's name. |
protected void |
logWarning(java.lang.String message)
Writes warning message (via LogFile) including the class's name. |
java.lang.Object |
myInterface(Plug _plug)
Returns interface of this Template object (callable from outside using
the given Plug). |
void |
newInputPlug(java.lang.String key,
java.lang.String _inputInterface)
Connects a new input Plug. |
void |
newOptOutputPlug(java.lang.String key,
java.lang.String _outputInterface)
Connects a new optional output Plug. |
void |
newOutputPlug(java.lang.String key,
java.lang.String _outputInterface)
Connects a new output Plug. |
void |
newPlug(java.lang.String key,
boolean _mandatory,
boolean _multi,
boolean _cloneable,
java.lang.String _inputInterface,
java.lang.String _outputInterface)
Connects a new Plug. |
int |
noTemplates()
Returns number of registration templates. |
void |
propBegin(java.lang.String name,
java.lang.String type,
java.lang.String descr,
boolean visual)
Starts definition of single property. |
void |
propBounds(java.lang.Object min,
java.lang.Object max)
Minimum and maximum allowed values (for comparable types only, non-mandatory). |
void |
propDefault(java.lang.Object value)
Default value (non-mandatory). |
void |
propEnd()
Finishes definition of the property. |
void |
propEnum(java.lang.String label,
java.lang.Object value,
java.lang.String descr)
Adds next enum label (for list-box GUI). |
void |
propManipulator(int manipulatorType)
Sets visual manipulator for GUI editing of the property. |
void |
propManipulator(java.lang.String className)
Sets visual manipulator for GUI editing of the property. |
void |
setProgressListener(ProgressListener pl)
Sets progress state listener. |
void |
setRegStrings(java.lang.String _name,
java.lang.String _template,
java.lang.String _category,
java.lang.String _description)
Sets registration strings for the module. |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
int |
setTemplateDynamic(Template t,
int ord)
Invokes statically declared method "setTemplate(Template,int)" for the given Piece instance. |
void |
stop()
Tries to stop the thread/computation.. |
| Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
|---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, get, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, set, stringProperty |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected volatile boolean userBreak
protected ProgressListener pl
protected java.util.Map<java.lang.String,Plug> plugs
Plugs (potential Channels).
Plugprotected java.util.Map<java.lang.String,Channel> channels
Channels (connected Plugs).
Channelprotected InfoModule info
public static final RegPiece reg
public static final java.lang.Class<?> TEMPLATE_TYPE
| Constructor Detail |
|---|
protected Piece()
| Method Detail |
|---|
public InfoModule getInfo()
public void newPlug(java.lang.String key,
boolean _mandatory,
boolean _multi,
boolean _cloneable,
java.lang.String _inputInterface,
java.lang.String _outputInterface)
Plug. General routine.
newPlug in interface Templatekey - New plug's key._mandatory - Is that plug mandatory (has to be connected)?_multi - Can that plug be used in multi-channels?_cloneable - Is that plug "cloneable" (=generic)? If yes,
ordinal numbers (starting from 0) will be appended to its name._inputInterface - Fully qualified identifier of input (implemented)
interface._outputInterface - Fully qualified identifier of output (required)
interface.
public void newInputPlug(java.lang.String key,
java.lang.String _inputInterface)
Plug. Common-use routine: creates mandatory,
non-cloneable, multi plug.
newInputPlug in interface Templatekey - New plug's key._inputInterface - Fully qualified identifier of input (implemented)
interface.
public void newOutputPlug(java.lang.String key,
java.lang.String _outputInterface)
Plug. Common-use routine: creates mandatory,
non-cloneable, multi plug.
newOutputPlug in interface Templatekey - New plug's key._outputInterface - Fully qualified identifier of output (required)
interface.
public void newOptOutputPlug(java.lang.String key,
java.lang.String _outputInterface)
Plug. Common-use routine: creates optional,
non-cloneable, multi plug.
newOptOutputPlug in interface Templatekey - New plug's key._outputInterface - Fully qualified identifier of output (required)
interface.
public void setRegStrings(java.lang.String _name,
java.lang.String _template,
java.lang.String _category,
java.lang.String _description)
setRegStrings in interface Templatepublic void stop()
Runnable implementators: Thread.interrupt() will be called afterwards.
stop in interface Breakablepublic void setProgressListener(ProgressListener pl)
setProgressListener in interface Breakablepublic Plug getPlug(java.lang.String key)
public Plug findPlug(java.lang.String inputInterface,
java.lang.String outputInterface,
boolean cloneable,
boolean multi)
Plug with the given parameters.
inputInterface - Fully qualified input interface name (or null).outputInterface - Fully qualified output interface name (or null).cloneable - Should the Plug be cloneable?multi - Should the Plug have the multi-channel property?
Plug or null.public Plug findPlug(Plug pl)
Plug compatible with the given one. Checks Plug interfaces only,
neither names nor input/output flags are relevant.
pl - Plug template (interfaces are important here .. names, order, input/output
are irrelevant).
Plug or null.public boolean isCompatible(Piece temp)
temp - Object which plays a role of an template.
true if I'm compatible with the temp object.
public boolean isCompatible(Piece temp,
java.util.Map<java.lang.String,java.lang.String> plugMap)
temp - Object which plays a role of an template.plugMap - Mapping from temp's plugs into my ones (null
for identity).
true if I'm compatible with the temp object.public java.lang.Object myInterface(Plug _plug)
Template object (callable from outside using
the given Plug).
_plug - The required Plug.
Plug.public boolean isConnected(java.lang.String key)
public java.lang.Object getInterface(java.lang.String key)
key - String key (identical to Plug's one).
Object.
public java.lang.Object getInterface(java.lang.String key,
java.lang.String type)
key - String key (identical to Plug's one).type - Fully qualified interface type.
Object.
BadInterfaceException
public void connect(java.lang.String key,
Piece other,
java.lang.String otherKey)
throws BadInterfaceException
Piece to the other one through the given Plug.
Checks the Plug compatibility (throws the BadInterfaceException).
key - Local key.other - The other Piece.otherKey - The other Piece's key.
BadInterfaceException - in case the Plugs are not compatible.public int init(int phase)
Worker.run().
Individual phases (starting at 0) will be called until maximum
requested phase number is reached.
phase - Current phase number.
protected void logError(java.lang.String message)
LogFile) including the class's name.
protected void logWarning(java.lang.String message)
LogFile) including the class's name.
public int noTemplates()
public RegPiece getReg(int ord)
RegPiece) from a statically
declared class member ("RegPiece reg" or "RegPiece[] reg").
ord - Ordinal number of template to use..noTemplates()
public int setTemplateDynamic(Template t,
int ord)
public static int setTemplate(Template t,
int ord)
public void propBegin(java.lang.String name,
java.lang.String type,
java.lang.String descr,
boolean visual)
propBegin in interface Templatename - String identifier (unique inside one module class).type - Value type - full Java class identifier.descr - Brief textual description (for human eyes only).visual - Should be this property represented visually in GUI?propEnd()public void propDefault(java.lang.Object value)
propDefault in interface Template
public void propBounds(java.lang.Object min,
java.lang.Object max)
propBounds in interface Templatepublic void propManipulator(int manipulatorType)
propManipulator in interface Templatepublic void propManipulator(java.lang.String className)
propManipulator in interface TemplateclassName - Class name (either fully-qualified or local in package cz.cuni.jagrlib.gui).
public void propEnum(java.lang.String label,
java.lang.Object value,
java.lang.String descr)
propEnum in interface Templatelabel - Textual label to appear in the listbox.value - Associated property value (real-value).descr - Optional item's description (for human eyes only).public void propEnd()
propBegin(java.lang.String, java.lang.String, java.lang.String, boolean) must
be properly closed by propEnd().
propEnd in interface TemplatepropBegin(java.lang.String, java.lang.String, java.lang.String, boolean)protected final java.lang.String className()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||