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
Taskobjects.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Taskadd()Adds new task to project tasks collection on the same outline level of the last task.Taskadd(RecurringTaskParameters parameters)Inserts a new task before a task with the specified id and on the same outline level.booleanadd(Task item)Add the specified task to the instance of theTaskCollectionclass.Taskadd(String taskName)Adds a new task to children tasks collection.Taskadd(String taskName, int beforeTaskId)Adds a new recurring task to children tasks collection.voidclear()booleancontains(Task item)Checks if collection contains specified item.Taskget(int index)(@inheritDoc}TaskgetById(int id)Returns a task with the specified Id whose ancestor is parent task of this collection .TaskgetByUid(int uid)Returns a task with the specified Uid whose ancestor is parent task of this collection .ProjectgetParentProject()Gets the parent project of the TaskCollection object.intindexOf(Object o)booleanisReadOnly()Gets a value indicating whether this collection is read only.Iterator<Task>iterator()Returns an enumerator for this collection.booleanremove(Object item)This is the stub implementation of ICollection's Remove method, that only throws UnsupportedOperationExceptionintsize()Gets the number of objects contained in the TaskCollection.voidsort(Comparator<? super Task> c)List<Task>toList()Converts the TaskCollection object to a list ofTaskobjects.-
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
TaskCollectionclass. 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:
addin interfaceCollection<Task>- Specified by:
addin interfaceList<Task>- Overrides:
addin 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
Taskclass.
-
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
Taskclass.
-
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
Taskclass. - 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:
clearin interfaceCollection<Task>- Specified by:
clearin interfaceList<Task>- Overrides:
clearin 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
Taskclass 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
Taskclass 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:
removein interfaceCollection<Task>- Specified by:
removein interfaceList<Task>- Overrides:
removein classAbstractCollection<Task>- Parameters:
item- The item to remove.- Returns:
trueif the item was removed;falseotherwise.
-
size
public final int size()
Gets the number of objects contained in the TaskCollection.
- Specified by:
sizein interfaceCollection<Task>- Specified by:
sizein interfaceList<Task>- Specified by:
sizein 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
Taskobjects.- Returns:
- returns a list which contains the
Taskclass instances of this collection.
-
-