TaskCollection
Inheritance: java.lang.Object, java.util.AbstractCollection, java.util.AbstractList, com.aspose.tasks.AbstractList
public class TaskCollection extends AbstractList<Task>
Represents a collection of Task objects.
Methods
Method | Description |
---|---|
add() | Adds new task to project tasks collection on the same outline level of the last task. |
add(RecurringTaskParameters parameters) | Inserts a new task before a task with the specified id and on the same outline level. |
add(Task item) | Add the specified task to the instance of the TaskCollection class. |
add(String taskName) | Adds a new task to children tasks collection. |
add(String taskName, int beforeTaskId) | Adds a new recurring task to children tasks collection. |
clear() | {@inheritDoc} |
contains(Task item) | Checks if collection contains specified item. |
get(int index) | (@inheritDoc} |
getById(int id) | Returns a task with the specified Id whose ancestor is parent task of this collection . |
getByUid(int uid) | Returns a task with the specified Uid whose ancestor is parent task of this collection . |
getParentProject() | Gets the parent project of the TaskCollection object. |
indexOf(Object o) | {@inheritDoc} |
isReadOnly() | Gets a value indicating whether this collection is read only. |
iterator() | Returns an enumerator for this collection. |
remove(Object item) | This is the stub implementation of ICollection’s Remove method, that only throws UnsupportedOperationException |
size() | Gets the number of objects contained in the TaskCollection. |
sort(Comparator<? super Task> c) | {@inheritDoc} |
toList() | Converts the TaskCollection object to a list of Task objects. |
add()
public final Task add()
Adds new task to project tasks collection on the same outline level of the last task.
Returns: Task - returns the newly added instance of the Task class.
add(RecurringTaskParameters parameters)
public final Task add(RecurringTaskParameters parameters)
Inserts a new task before a task with the specified id and on the same outline level.
Parameters:
Parameter | Type | Description |
---|---|---|
parameters | RecurringTaskParameters | The parameters the specified parameters for creation of recurring task. |
Returns: Task - returns the newly added instance of the Task class.
add(Task item)
public final boolean add(Task item)
Add the specified task to the instance of the TaskCollection class. If ParentProject.CalculationMode is None user should invoke Project.Recalculate() after using this method (It will reschedule all project tasks (start/finish dates, sets early/late dates) and calculate the dependent fields such as slacks, work and cost fields, ids and outline levels). If ParentProject.CalculationMode is Manual the method will calculate only task id, outline level and outline numbers automatically. If ParentProject.CalculationMode is Automatic the method reschedules all project’s tasks automatically (start/finish dates, sets early/late dates, calculates slacks, work and cost fields, recalculates ids and outline levels).
Parameters:
Parameter | Type | Description |
---|---|---|
item | Task | the specified task which should be added to this task collection. |
Returns: boolean - true if operation was successful.
add(String taskName)
public final Task add(String taskName)
Adds a new task to children tasks collection.
Parameters:
Parameter | Type | Description |
---|---|---|
taskName | java.lang.String | the specified task name. |
Returns: Task - returns the newly added instance of the Task class.
add(String taskName, int beforeTaskId)
public final Task add(String taskName, int beforeTaskId)
Adds a new recurring task to children tasks collection.
Parameters:
Parameter | Type | Description |
---|---|---|
taskName | java.lang.String | the specified task name. |
beforeTaskId | int | The specified id of a task before which a new task will be inserted. |
Returns: Task - returns a task which was inserted before a task with the specified id.
clear()
public final void clear()
contains(Task item)
public final boolean contains(Task item)
Checks if collection contains specified item.
Parameters:
Parameter | Type | Description |
---|---|---|
item | Task | The item to check. |
Returns: boolean - true, if collection contains an item, false otherwise.
get(int index)
public Task get(int index)
(@inheritDoc}
Parameters:
Parameter | Type | Description |
---|---|---|
index | int | {@inheritDoc} |
Returns: Task - {@inheritDoc}
getById(int id)
public final Task getById(int id)
Returns a task with the specified Id whose ancestor is parent task of this collection .
Parameters:
Parameter | Type | Description |
---|---|---|
id | int | TaskEntity Id |
Returns: Task - returns the instance of Task class with the specified id whose ancestor is parent task of this collection.
getByUid(int uid)
public final Task getByUid(int uid)
Returns a task with the specified Uid whose ancestor is parent task of this collection .
Parameters:
Parameter | Type | Description |
---|---|---|
uid | int | TaskEntity Uid. |
Returns: Task - returns the instance of Task class with the specified uid whose ancestor is parent task of this collection.
getParentProject()
public final Project getParentProject()
Gets the parent project of the TaskCollection object.
Returns: Project - the parent project of the TaskCollection object.
indexOf(Object o)
public final int indexOf(Object o)
Parameters:
Parameter | Type | Description |
---|---|---|
o | java.lang.Object | {@inheritDoc} |
Returns: int - {@inheritDoc}
isReadOnly()
public final boolean isReadOnly()
Gets a value indicating whether this collection is read only.
Returns: boolean - a value indicating whether this collection is read only.
iterator()
public final Iterator<Task> iterator()
Returns an enumerator for this collection.
Returns: java.util.Iterator<com.aspose.tasks.Task> - an enumerator for this collection.
remove(Object item)
public final boolean remove(Object item)
This is the stub implementation of ICollection’s Remove method, that only throws UnsupportedOperationException
Parameters:
Parameter | Type | Description |
---|---|---|
item | java.lang.Object | The item to remove. |
Returns:
boolean - true
if the item was removed; false
otherwise.
size()
public final int size()
Gets the number of objects contained in the TaskCollection.
Returns: int - the number of objects contained in the TaskCollection.
sort(Comparator<? super Task> c)
public final void sort(Comparator<? super Task> c)
Parameters:
Parameter | Type | Description |
---|---|---|
c | java.util.Comparator<? super com.aspose.tasks.Task> | {@inheritDoc} |
toList()
public final List<Task> toList()
Converts the TaskCollection object to a list of Task objects.
Returns: java.util.List<com.aspose.tasks.Task> - returns a list which contains the Task class instances of this collection.