Class TaskCollection
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<T>
-
- com.aspose.tasks.TaskCollection
-
public class TaskCollection extends AbstractList<T>
Represents a collection of
Task
objects.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Task
add()
Adds new task to project tasks collection on the same outline level of the last task.Task
add(RecurringTaskParameters parameters)
Inserts a new task before a task with the specified id and on the same outline level.boolean
add(Task item)
Add the specified task to the instance of theTaskCollection
class.Task
add(String taskName)
Adds a new task to children tasks collection.Task
add(String taskName, int beforeTaskId)
Adds a new recurring task to children tasks collection.void
clear()
boolean
contains(Task item)
Checks if collection contains specified item.Task
get(int index)
(@inheritDoc}Task
getById(int id)
Returns a task with the specified Id whose ancestor is parent task of this collection .Task
getByUid(int uid)
Returns a task with the specified Uid whose ancestor is parent task of this collection .Project
getParentProject()
Gets the parent project of the TaskCollection object.int
indexOf(Object o)
boolean
isReadOnly()
Gets a value indicating whether this collection is read only.Iterator<Task>
iterator()
Returns an enumerator for this collection.boolean
remove(Object item)
This is the stub implementation of ICollection's Remove method, that only throws UnsupportedOperationExceptionint
size()
Gets the number of objects contained in the TaskCollection.void
sort(Comparator<? super Task> c)
List<Task>
toList()
Converts the TaskCollection object to a list ofTask
objects.-
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, lastIndexOf, listIterator, listIterator, remove, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, removeAll, replaceAll, retainAll, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
add
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).- Specified by:
add
in interfaceCollection<Task>
- Specified by:
add
in interfaceList<Task>
- Overrides:
add
in classAbstractList<Task>
- Parameters:
item
- the specified task which should be added to this task collection.- Returns:
- true if operation was successful.
-
add
public final Task add()
Adds new task to project tasks collection on the same outline level of the last task.
- Returns:
- returns the newly added instance of the
Task
class.
-
add
public final Task add(String taskName)
Adds a new task to children tasks collection.
- Parameters:
taskName
- the specified task name.- Returns:
- returns the newly added instance of the
Task
class.
-
add
public final Task add(String taskName, int beforeTaskId)
Adds a new recurring task to children tasks collection.
- Parameters:
taskName
- the specified task name.beforeTaskId
- The specified id of a task before which a new task will be inserted.- Returns:
- returns a task which was inserted before a task with the specified id.
- Throws:
com.aspose.ms.System.ArgumentOutOfRangeException
- ArgumentOutOfRangeException is thrown if the specified id is not a valid task id.
-
add
public final Task add(RecurringTaskParameters parameters)
Inserts a new task before a task with the specified id and on the same outline level.
- Parameters:
parameters
- The parameters the specified parameters for creation of recurring task.- Returns:
- returns the newly added instance of the
Task
class. - Throws:
com.aspose.ms.System.ArgumentNullException
- Thrown if the specified parameters are null.com.aspose.ms.System.ArgumentException
- Thrown if the specified parameters are invalid.
-
clear
public final void clear()
- Specified by:
clear
in interfaceCollection<Task>
- Specified by:
clear
in interfaceList<Task>
- Overrides:
clear
in classAbstractList<Task>
-
contains
public final boolean contains(Task item)
Checks if collection contains specified item.
- Parameters:
item
- The item to check.- Returns:
- true, if collection contains an item, false otherwise.
-
getById
public final Task getById(int id)
Returns a task with the specified Id whose ancestor is parent task of this collection .
- Parameters:
id
- TaskEntity Id- Returns:
- returns the instance of
Task
class with the specified id whose ancestor is parent task of this collection.
-
getByUid
public final Task getByUid(int uid)
Returns a task with the specified Uid whose ancestor is parent task of this collection .
- Parameters:
uid
- TaskEntity Uid.- Returns:
- 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:
- the parent project of the TaskCollection object.
-
indexOf
public final int indexOf(Object o)
-
isReadOnly
public final boolean isReadOnly()
Gets a value indicating whether this collection is read only.
- Returns:
- a value indicating whether this collection is read only.
-
remove
public final boolean remove(Object item)
This is the stub implementation of ICollection's Remove method, that only throws UnsupportedOperationException
- Specified by:
remove
in interfaceCollection<Task>
- Specified by:
remove
in interfaceList<Task>
- Overrides:
remove
in classAbstractCollection<Task>
- Parameters:
item
- The item to remove.- Returns:
true
if the item was removed;false
otherwise.
-
size
public final int size()
Gets the number of objects contained in the TaskCollection.
- Specified by:
size
in interfaceCollection<Task>
- Specified by:
size
in interfaceList<Task>
- Specified by:
size
in classAbstractCollection<Task>
- Returns:
- the number of objects contained in the TaskCollection.
-
sort
public final void sort(Comparator<? super Task> c)
-
toList
public final List<Task> toList()
Converts the TaskCollection object to a list of
Task
objects.- Returns:
- returns a list which contains the
Task
class instances of this collection.
-
-