ilog.cpl.graph
Interface IlpGraphModel

All Known Subinterfaces:
IlpEquipmentModel, IlpMutableEquipmentModel, IlpMutableGraphModel, IlpMutableNetworkModel, IlpNetworkModel
All Known Implementing Classes:
IlpAbstractEquipmentModel, IlpAbstractGraphModel, IlpAbstractNetworkModel, IlpDefaultEquipmentModel, IlpDefaultNetworkModel

public interface IlpGraphModel

The 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 GraphModelEvents 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.

Since:
JTGO 4.0

Method Summary
 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.
 

Method Detail

getRootObjects

Collection getRootObjects()
Returns an unmodifiable collection of the objects contained in the top level (with respect to the getChildren/getParent hierarchy) of the model.

Changes to this collection must be signaled through GraphModelEvents of type ROOT_OBJECT_ADDED, ROOT_OBJECT_REMOVED.

Returns:
A collection of IlpRepresentationNodes.

isLeaf

boolean isLeaf(IlpRepresentationObject object)
Returns 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.

Returns:
true if the object cannot have children; false if it may have children.

getChildren

List getChildren(IlpRepresentationObject object)
Returns a list of the child objects of this object.

Note: The order of this list is important as follows:

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.

Parameters:
object - The parent object.
Returns:
An unmodifiable list of IlpRepresentationNodes.
See Also:
getParent(ilog.cpl.model.IlpRepresentationObject)

getParent

IlpRepresentationNode getParent(IlpRepresentationObject object)
Returns the parent object of an object.

The result of this method cannot change as long as the object is contained in the model.

Parameters:
object - The object.
Returns:
null for a top-level object, non-null for a lower-level object.
See Also:
getChildren(ilog.cpl.model.IlpRepresentationObject)

isNode

boolean isNode(IlpRepresentationObject object)
Returns 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.

Parameters:
object - The object to be checked.
Returns:
true if the object is a node in this model; false otherwise.
See Also:
isLink(ilog.cpl.model.IlpRepresentationObject)

isLink

boolean isLink(IlpRepresentationObject object)
Returns 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.

Parameters:
object - The object to be checked.
Returns:
true if the object is a link in this model; false otherwise.
See Also:
isNode(ilog.cpl.model.IlpRepresentationObject)

getFrom

IlpRepresentationObject getFrom(IlpRepresentationObject link)
Returns the from end of a link.

Changes to the from end must be signaled through GraphModelEvents of type LINK_END_CHANGED.

Parameters:
link - The link.
Returns:
The IlpRepresentationNode that is the from end.
See Also:
getTo(ilog.cpl.model.IlpRepresentationObject)

getTo

IlpRepresentationObject getTo(IlpRepresentationObject link)
Returns the to end of a link.

Changes to the to end must be signaled through GraphModelEvents of type LINK_END_CHANGED.

Parameters:
link - The link.
Returns:
The IlpRepresentationNode that is the to end.
See Also:
getFrom(ilog.cpl.model.IlpRepresentationObject)


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.