public class IlvGanttModelUtil extends Object
IlvGanttModelUtil
is a utility class that consists exclusively
of static methods that are of general use when dealing with Gantt data
models.Modifier and Type | Method and Description |
---|---|
static Iterator<IlvActivity> |
activityBreadthFirstIterator(IlvGanttModel model)
Returns an iterator that will traverse all of the activities of a data
model in breadth first order.
|
static Iterator<IlvActivity> |
activityBreadthFirstIterator(IlvGanttModel model,
IlvActivity parent)
Returns an iterator that will traverse the parent activity and all of its
descendants in breadth first order.
|
static Iterator<IlvActivity> |
activityPostorderIterator(IlvGanttModel model)
Returns an iterator that will traverse all of the activities of a data model in
postorder.
|
static Iterator<IlvActivity> |
activityPostorderIterator(IlvGanttModel model,
IlvActivity parent)
Returns an iterator that will traverse the parent activity and
all of its descendants in postorder.
|
static Iterator<IlvActivity> |
activityPreorderIterator(IlvGanttModel model)
Returns an iterator that will traverse all of the activities of a data
model in preorder.
|
static Iterator |
breadthFirstIterator(IlvGanttModel model,
IlvHierarchyNode parent)
Returns an iterator that will traverse the parent activity or resource
and all of its descendants in breadth first order.
|
static void |
checkValidMemberActivity(IlvActivity activity,
IlvGanttModel ganttModel)
Checks that the specified activity is not
null and is a member
of the specified data model. |
static void |
checkValidMemberConstraint(IlvConstraint constraint,
IlvGanttModel ganttModel)
Checks that the specified constraint is not
null and is a
member of the specified data model. |
static void |
checkValidMemberReservation(IlvReservation reservation,
IlvGanttModel ganttModel)
Checks that the specified reservation is not
null and
is a member of the specified data model. |
static void |
checkValidMemberResource(IlvResource resource,
IlvGanttModel ganttModel)
Checks that the specified resource is not
null and is a member
of the specified data model. |
static void |
checkValidNewConstraint(IlvConstraint constraint,
IlvGanttModel ganttModel)
Checks that the specified constraint is a valid argument for
ganttModel.addConstraint() . |
static void |
checkValidNewReservation(IlvReservation reservation,
IlvGanttModel ganttModel)
Checks that the specified reservation is a valid argument for
ganttModel.addReservation() . |
static void |
checkValidNonNullActivity(IlvActivity activity)
Checks that the specified activity is not
null . |
static void |
checkValidNonNullConstraint(IlvConstraint constraint)
Checks that the specified constraint is not
null . |
static void |
checkValidNonNullReservation(IlvReservation reservation)
Checks that the specified reservation is not
null . |
static void |
checkValidNonNullResource(IlvResource resource)
Checks that the specified resource is not
null . |
static void |
checkValidNonRootMemberActivity(IlvActivity activity,
IlvGanttModel ganttModel)
Checks that the specified activity is not
null , is a member
of the specified model, but is not the root activity. |
static void |
checkValidNonRootMemberResource(IlvResource resource,
IlvGanttModel ganttModel)
Checks that the specified resource is not
null , is a member
of the specified data model, but is not the root resource. |
static Iterator |
childIterator(IlvGanttModel model,
IlvHierarchyNode parent)
Returns an iterator over the children of the specified parent activity or resource.
|
static void |
demote(IlvGanttModel model,
IlvHierarchyNode activityOrResource)
Demotes the specified activity or resource so that it becomes the child of
its immediately previous sibling.
|
static int |
getDepth(IlvGanttModel model,
IlvHierarchyNode activityOrResource)
Returns the depth of the specified activity or resource in the hierarchical
data tree.
|
static IlvHierarchyNode |
getFirstChild(IlvGanttModel model,
IlvHierarchyNode activityOrResource)
Returns the first child of the specified activity or resource.
|
static IlvHierarchyNode |
getLastChild(IlvGanttModel model,
IlvHierarchyNode activityOrResource)
Returns the last child of the specified activity or resource.
|
static boolean |
hasChildren(IlvGanttModel model,
IlvHierarchyNode activityOrResource)
Returns whether the specified activity or resource has any children.
|
static boolean |
isDescendant(IlvGanttModel model,
IlvHierarchyNode parent,
IlvHierarchyNode child)
Returns
true if the specified child activity or resource is a
descendant of the specified parent activity or resource in the hierarchical
data tree. |
static Iterator |
postorderIterator(IlvGanttModel model,
IlvHierarchyNode parent)
Returns an iterator that will traverse the parent activity or resource and all of its
descendants in postorder.
|
static Iterator |
preorderIterator(IlvGanttModel model,
IlvHierarchyNode parent)
Returns an iterator that will traverse the parent activity or resource and all of its
descendants in preorder.
|
static void |
promote(IlvGanttModel model,
IlvHierarchyNode activityOrResource)
Promotes the specified activity or resource so that it becomes a child of
its grandparent (that is, a sibling to its current parent).
|
static Iterator<IlvResource> |
resourceBreadthFirstIterator(IlvGanttModel model)
Returns an iterator that will traverse all of the resources of a data
model in breadth first order.
|
static Iterator<IlvResource> |
resourceBreadthFirstIterator(IlvGanttModel model,
IlvResource parent)
Returns an iterator that will traverse the parent resource and all of its
descendants in breadth first order.
|
static Iterator<IlvResource> |
resourcePostorderIterator(IlvGanttModel model)
Returns an iterator that will traverse all of the resources of a data model in
postorder.
|
static Iterator<IlvResource> |
resourcePostorderIterator(IlvGanttModel model,
IlvResource parent)
Returns an iterator that will traverse the parent resource and
all of its descendants in postorder.
|
static Iterator<IlvResource> |
resourcePreorderIterator(IlvGanttModel model)
Returns an iterator that will traverse all of the resources of a data
model in preorder.
|
public static boolean hasChildren(IlvGanttModel model, IlvHierarchyNode activityOrResource)
model.getChildCount(activityOrResource)
> 0
.model
- The Gantt data model that contains the activity or resource.activityOrResource
- The activity or resource.public static IlvHierarchyNode getFirstChild(IlvGanttModel model, IlvHierarchyNode activityOrResource)
model.getChild(activityOrResource,
0)
.model
- The Gantt data model that contains the activity or
resource.activityOrResource
- The activity or resource.IndexOutOfBoundsException
- if activityOrResource
does not have
any children.public static IlvHierarchyNode getLastChild(IlvGanttModel model, IlvHierarchyNode activityOrResource)
model.getChild
(activityOrResource,
model.getChildCount
(activityOrResource)-1)
.model
- The Gantt data model that contains the activity or
resource.activityOrResource
- The activity or resource.IndexOutOfBoundsException
- if activityOrResource
does not have
any children.public static Iterator childIterator(IlvGanttModel model, IlvHierarchyNode parent)
model
- The Gantt data model that contains the activity or resource.parent
- The parent activity or resource.parent
.public static Iterator<IlvActivity> activityPreorderIterator(IlvGanttModel model)
next()
method will be the model's root activity.model
- The Gantt data model.IlvGanttModel.activityPreorderIterator(ilog.views.gantt.IlvActivity)
public static Iterator<IlvResource> resourcePreorderIterator(IlvGanttModel model)
next()
method will be the model's root resource.model
- The Gantt data model.IlvGanttModel.resourcePreorderIterator(ilog.views.gantt.IlvResource)
public static Iterator preorderIterator(IlvGanttModel model, IlvHierarchyNode parent)
next()
method will be parent
.model
- The Gantt data model that contains the activity or resource.parent
- The parent of the subtree.public static Iterator<IlvActivity> activityPostorderIterator(IlvGanttModel model, IlvActivity parent)
next()
method will be
parent
.model
- The Gantt data model that contains the activity.parent
- The parent of the activity subtree.activityPostorderIterator(IlvGanttModel)
public static Iterator<IlvActivity> activityPostorderIterator(IlvGanttModel model)
next()
method will be the model's root activity.model
- The Gantt data model.activityPostorderIterator(IlvGanttModel,IlvActivity)
public static Iterator<IlvResource> resourcePostorderIterator(IlvGanttModel model, IlvResource parent)
next()
method will be
parent
.model
- The Gantt data model that contains the resource.parent
- The parent of the resource subtree.resourcePostorderIterator(IlvGanttModel)
public static Iterator<IlvResource> resourcePostorderIterator(IlvGanttModel model)
next()
method will be the model's root resource.model
- The Gantt data model.resourcePostorderIterator(IlvGanttModel,IlvResource)
public static Iterator postorderIterator(IlvGanttModel model, IlvHierarchyNode parent)
next()
method will be parent
.model
- The Gantt data model that contains the activity or resource.parent
- The parent of the subtree.public static Iterator<IlvActivity> activityBreadthFirstIterator(IlvGanttModel model, IlvActivity parent)
next()
method of the
iterator will be parent
.model
- The Gantt data model that contains the activity.parent
- The parent of the activity subtree.activityBreadthFirstIterator(IlvGanttModel)
public static Iterator<IlvActivity> activityBreadthFirstIterator(IlvGanttModel model)
next()
method of the iterator will be the root activity of
the model.model
- The Gantt data model.activityBreadthFirstIterator(IlvGanttModel, IlvActivity)
public static Iterator<IlvResource> resourceBreadthFirstIterator(IlvGanttModel model, IlvResource parent)
next()
method of the iterator will be parent
.model
- The Gantt data model that contains the resource.parent
- The parent of the resource subtree.resourceBreadthFirstIterator(IlvGanttModel)
public static Iterator<IlvResource> resourceBreadthFirstIterator(IlvGanttModel model)
next()
method of the
iterator will be the root resource of the model.model
- The Gantt data model.resourceBreadthFirstIterator(IlvGanttModel, IlvResource)
public static Iterator breadthFirstIterator(IlvGanttModel model, IlvHierarchyNode parent)
next()
method of the iterator will be parent
.model
- The Gantt data model that contains the activity or resource.parent
- The parent of the subtree.public static void promote(IlvGanttModel model, IlvHierarchyNode activityOrResource)
model
- The Gantt data model that contains the activity or resource.activityOrResource
- The activity or resource to promote.public static void demote(IlvGanttModel model, IlvHierarchyNode activityOrResource)
model
- The Gantt data model that contains the activity or resource.activityOrResource
- The activity or resource to demote.public static int getDepth(IlvGanttModel model, IlvHierarchyNode activityOrResource)
0
.model
- The Gantt data model that contains the activity or resource.activityOrResource
- The activity or resource.public static boolean isDescendant(IlvGanttModel model, IlvHierarchyNode parent, IlvHierarchyNode child)
true
if the specified child activity or resource is a
descendant of the specified parent activity or resource in the hierarchical
data tree.model
- The Gantt data model that contains both parent and
child.parent
- The parent activity or resource to test.child
- The child activity or resource to test.true
if child
is a descendant of
parent
, and false
otherwise.public static void checkValidNonNullActivity(IlvActivity activity)
null
.
If it is, an IllegalArgumentException
is thrown.activity
- The activity to check.IllegalArgumentException
- if activity
is
null
.public static void checkValidMemberActivity(IlvActivity activity, IlvGanttModel ganttModel)
null
and is a member
of the specified data model. If it is not, an
IllegalArgumentException
is thrown.
This method can be used to validate the parent
argument for
the IlvGanttModel.removeActivity(IlvActivity, int)
and
IlvGanttModel.addActivity(IlvActivity, IlvActivity, int)
methods
and the newParent
argument for the
IlvGanttModel.moveActivity(IlvActivity, IlvActivity, int)
method.
activity
- The activity to check.ganttModel
- The Gantt data model.IllegalArgumentException
- if activity
is
null
or is not a member of ganttModel
.public static void checkValidNonRootMemberActivity(IlvActivity activity, IlvGanttModel ganttModel)
null
, is a member
of the specified model, but is not the root activity. If it is not, an
IllegalArgumentException
is thrown.
This method can be used to validate the activity
argument for
the IlvGanttModel.removeActivity(IlvActivity)
and
IlvGanttModel.moveActivity(IlvActivity, IlvActivity, int)
methods.
activity
- The activity to check.ganttModel
- The Gantt data model.IllegalArgumentException
- if activity
is
null
, is not a member of ganttModel
, or is the
ganttModel
's root activity.public static void checkValidNonNullResource(IlvResource resource)
null
.
If it is, an IllegalArgumentException
is thrown.resource
- The resource to check.IllegalArgumentException
- if resource
is
null
.public static void checkValidMemberResource(IlvResource resource, IlvGanttModel ganttModel)
null
and is a member
of the specified data model. If it is not, an
IllegalArgumentException
is thrown.
This method can be used to validate the parent
argument for
the IlvGanttModel.removeResource(IlvResource, int)
and
IlvGanttModel.addResource(IlvResource, IlvResource, int)
methods
and the newParent
argument for the
IlvGanttModel.moveResource(IlvResource, IlvResource, int)
method.
resource
- The resource to check.ganttModel
- The Gantt data model.IllegalArgumentException
- if resource
is
null
or is not a member of ganttModel
.public static void checkValidNonRootMemberResource(IlvResource resource, IlvGanttModel ganttModel)
null
, is a member
of the specified data model, but is not the root resource. If it is not, an
IllegalArgumentException
is thrown.
This method can be used to validate the resource
argument for
the IlvGanttModel.removeResource(IlvResource)
and
IlvGanttModel.moveResource(IlvResource, IlvResource, int)
methods.
resource
- The resource to check.ganttModel
- The Gantt data model.IllegalArgumentException
- if resource
is
null
, is not a member of ganttModel
, or is the
ganttModel
's root resource.public static void checkValidNonNullConstraint(IlvConstraint constraint)
null
.
If it is, an IllegalArgumentException
is thrown.constraint
- The constraint to check.IllegalArgumentException
- if constraint
is
null
.public static void checkValidMemberConstraint(IlvConstraint constraint, IlvGanttModel ganttModel)
null
and is a
member of the specified data model. If it is not, an
IllegalArgumentException
is thrown.constraint
- The constraint to check.ganttModel
- The Gantt data model.IllegalArgumentException
- if constraint
is
null
or is not a member of ganttModel
.public static void checkValidNewConstraint(IlvConstraint constraint, IlvGanttModel ganttModel)
ganttModel.addConstraint()
. If it is
not, an IllegalArgumentException
is thrown.constraint
- The constraint to check.ganttModel
- The Gantt data model.IllegalArgumentException
- if constraint
is
null
, is a member of a data model, or either of its
constrained activities are not members of ganttModel
.public static void checkValidNonNullReservation(IlvReservation reservation)
null
.
If it is, an IllegalArgumentException
is thrown.reservation
- The reservation to check.IllegalArgumentException
- if reservation
is
null
.public static void checkValidMemberReservation(IlvReservation reservation, IlvGanttModel ganttModel)
null
and
is a member of the specified data model. If it is not, an
IllegalArgumentException
is thrown.reservation
- The reservation to check.ganttModel
- The Gantt data model.IllegalArgumentException
- if reservation
is
null
or is not a member of ganttModel
.public static void checkValidNewReservation(IlvReservation reservation, IlvGanttModel ganttModel)
ganttModel.addReservation()
. If it is
not, an IllegalArgumentException
is thrown.reservation
- The reservation to check.ganttModel
- The Gantt data model.IllegalArgumentException
- if reservation
is
null
, is a member of a data model, its associated resource is
not a member of ganttModel
, or its associated activity is not
a member of ganttModel
.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.