A class that provides generic useful documentation and utility information regarding a Netica object.
name | | A size-restricted and character restricted name for the object. Must contain only ascii letters, digits, or underscores, start with a letter, and be of 30 characters or less in length. |
title | | An unrestricted name for the object. May be any length of arbitrary Unicode, but recommended that it not be very long (the comment field is available for that). |
comment | | An unrestricted comment text block (any length of arbitrary Unicode), but semantically meant to describe or give detailed documentation concerning the object in question. |
user fields | | A set of key-value pairs (attribute-value pairs), where the keys are strings and the values may be of a variety of types. These WILL be saved when the General object is written to a file or stream. All userFields are placed in the User object owned by this General. Access them by calling user()user . For example: node.user().setString ("extraInfo", "This is some extra information."); |
user reference | | A single arbitrary object (but can be absolutely anything, including a Collection) that will NOT be saved when this General object is written to a file or stream, or duplicated when this General object is duplicated. The userReference resides in the User object owned by this General. Access it by calling user()user . For example: node.user().setReference (myCollection); |
Method Summary |
void |
addListener(NeticaListener listener)
Adds the given listener to this object's list of listeners. |
void |
eventOccurred(NeticaEvent event)
Netica calls back this method when an event occurred to an object we expressed interest in (by calling addListener). |
java.lang.String |
getComment()
Gets the documentation text concerning this object. |
Environ |
getEnviron()
Returns the Environ this object belong's to. |
java.lang.String |
getLabel()
|
java.lang.String |
getLabel(java.lang.String options)
|
java.lang.String |
getName()
Returns the identifer name of this object. |
java.lang.String |
getTitle()
Gets the unrestricted label of this object. |
void |
removeListener(NeticaListener listener)
Removes the given listener from this object's list of listeners. |
void |
setComment(java.lang.String comment)
Sets the documentation or a description of an object. |
void |
setName(java.lang.String name)
Changes the name of this object to be name. |
void |
setTitle(java.lang.String title)
Sets the title of this object to the unrestricted string title. |
java.lang.String |
toString()
Returns the value of getName. |
User |
user()
Retrieve the User object that stores user controlled data associated with this object. |
- Returns the identifer name of this object.
You can count on the name to be present, and to be a legal IDname , which means that it begins with a letter, is composed only of ascii letters, numbers, or underscores, and is NAME_MAX (30) or fewer characters in length.
Note that two different nets in Netica's memory may have the same name, however, two different nodes in a net always have distinct names, and two different node-states in the same node always have distinct names also.
If you have never set a Net's name, it will be assigned a default name of the form "Unnamed_#" where '#' is an integer.
If you have never set a State's name, this will return a default name of the form "s#" where '#' is the state index.
Version:
This method is available in all versions.
In the C Version of the API, this function is named GetNetName_bn, GetNodeName_bn, and GetNodeStateName_bn.
See Also:
- Sets the documentation or a description of an object.
This associates the character string comment with this object (net or node) to help document it.
The comment may contain anything, but is usually used to store such things as the origin of this object, its purpose or applicability, background information on the problem domain, a copyright notice, how to use this object, notes for future changes, etc. It is best if the comment consists only of that sort of descriptive information (and as ascii text characters), in order to meet expectations in case you share this Bayes net with other people or view it with Netica Application. If you wish to attach other data, and this object is a Net or Node, use its User object (retrieved with the user method).
To remove a comment, pass null or the empty string for comment.
Note. Currently State's do not have comment fields, and so an exception is thrown if you attempt to call this method on a State object.
Parameters:
String | | comment | | A text String of arbitrary length. |
Version:
This method is available in all versions.
In the C Version of the API, this function is named SetNetComment_bn, SetNodeComment_bn, and SetNodeStateComment_bn.
See Also:
getComment | | Retrieves value |
user | | To attach other types of information, and have it saved to file with the net |
Example:
// append String addon to the end of the existing comment for net
//
net.setComment( net.getComment() + addon);
- Changes the name of this object to be name.
name must be a legal IDname, which means it must have NAME_MAX (30) or fewer ascii characters, all of which are letters, digits or underscores, and it must start with a letter.
Two nodes in the same net may not have identical names, and two states in the same node may not have identical names (case sensitive comparison). (However, two nets in the same environment, may have identical names.)
Throws a NeticaException, if the name is invalid, explaining why it is invalid.
For General State objects only
- The default (initial) name for each state is "s#", where # is its stateIndex.
- If you pass null (not the empty string) for name, it will reset all the state names for the node to their defaults ("s0", "s1", ...).
- Discretized continuous nodes may have their states named, as well as regular discrete nodes. If you call this method on continuous nodes that have not been discretized, an exception will be thrown.
- It may be more convenient to set the names of all the states at the same time; for that, see
Node.setStateNames
.
Parameters:
String | | name | | The new name desired. |
Version:
This method is available in all versions.
In the C Version of the API, this function is named SetNetName_bn, SetNodeName_bn, or SetNodeStateName_bn.
See Also: