public interface IlpGraphModel
IlpGraphModel
interface describes the objects
to be represented in either an IlpNetwork
or
IlpEquipment
component.
The model contains a set of top-level objects, and a method
getChildren
that permits access to more objects at lower
levels. The model conceptually contains the top-level objects and all
objects indirectly accessible through getChildren
, even if
this is an infinite set of objects loaded on demand.
An object can either be a node or a link, but can't be both.
Every link has two end nodes, called from
and to
ends. They must belong to the model. A link with two identical ends is called
a self-link.
When objects are added to or removed from the model, implementations
of IlpGraphModel
will signal this by sending
GraphModelEvent
s of type
ROOT_OBJECT_ADDED
, ROOT_OBJECT_REMOVED
or - for
lower levels - CHILDREN_ADDED
, CHILDREN_REMOVED
.
Note: This interface does not provide methods to add
and/or remove model listeners. Such methods are available as typed methods
(like IlpNetworkModel.addNetworkModelListener
and
IlpEquipmentModel.removeEquipmentModelListener
). This is to
keep backward compatibility only.
Modifier and Type | Method and Description |
---|---|
List |
getChildren(IlpRepresentationObject object)
Returns a list of the child objects of this object.
|
IlpRepresentationObject |
getFrom(IlpRepresentationObject link)
Returns the
from end of a link. |
IlpRepresentationNode |
getParent(IlpRepresentationObject object)
Returns the parent object of an object.
|
Collection |
getRootObjects()
Returns an unmodifiable collection of the objects contained in the top
level (with respect to the
getChildren /getParent
hierarchy) of the model. |
IlpRepresentationObject |
getTo(IlpRepresentationObject link)
Returns the
to end of a link. |
boolean |
isLeaf(IlpRepresentationObject object)
Returns
true if this object, by its nature, has no children. |
boolean |
isLink(IlpRepresentationObject object)
Returns
true if a representation object is a link (and not
a node) in this model. |
boolean |
isNode(IlpRepresentationObject object)
Returns
true if a representation object is a node (and not
a link) in this model. |
Collection getRootObjects()
getChildren
/getParent
hierarchy) of the model.
Changes to this collection must be signaled through
GraphModelEvent
s of type
ROOT_OBJECT_ADDED
, ROOT_OBJECT_REMOVED
.
IlpRepresentationNode
s.boolean isLeaf(IlpRepresentationObject object)
true
if this object, by its nature, has no children.
When this method returns false
, there may or may not be some
children currently attached to the object; children can be added and
removed dynamically.
The result of this method cannot change as long as the object is contained in the model.
true
if the object cannot have children;
false
if it may have children.List getChildren(IlpRepresentationObject object)
Note: The order of this list is important as follows:
RepresentationNodeEvent
events, which indicate
the children added (after addition) or removed (before removal).
A change to the list of children must be signaled through a
GraphModelEvent
of type CHILDREN_ADDED
or CHILDREN_REMOVED
.
Note: Load-on-demand can be implemented by letting
this method return an empty list when first called for a given object,
and then adding children dynamically, accompanied by
CHILDREN_ADDED
events.
object
- The parent object.IlpRepresentationNode
s.getParent(ilog.cpl.model.IlpRepresentationObject)
IlpRepresentationNode getParent(IlpRepresentationObject object)
The result of this method cannot change as long as the object is contained in the model.
object
- The object.null
for a top-level object, non-null
for a lower-level object.getChildren(ilog.cpl.model.IlpRepresentationObject)
boolean isNode(IlpRepresentationObject object)
true
if a representation object is a node (and not
a link) in this model.
The result of this method cannot change as long as the object is contained in the model.
object
- The object to be checked.true
if the object is a node in this model;
false
otherwise.isLink(ilog.cpl.model.IlpRepresentationObject)
boolean isLink(IlpRepresentationObject object)
true
if a representation object is a link (and not
a node) in this model.
The result of this function cannot change as long as the object is contained in the model.
object
- The object to be checked.true
if the object is a link in this model;
false
otherwise.isNode(ilog.cpl.model.IlpRepresentationObject)
IlpRepresentationObject getFrom(IlpRepresentationObject link)
from
end of a link.
Changes to the from
end must be signaled through
GraphModelEvent
s of type
LINK_END_CHANGED
.
link
- The link.IlpRepresentationNode
that is the
from
end.getTo(ilog.cpl.model.IlpRepresentationObject)
IlpRepresentationObject getTo(IlpRepresentationObject link)
to
end of a link.
Changes to the to
end must be signaled through
GraphModelEvent
s of type
LINK_END_CHANGED
.
link
- The link.IlpRepresentationNode
that is the to
end.getFrom(ilog.cpl.model.IlpRepresentationObject)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.