public boolean removePredecessor ( Task targetTask , RelationType type , Duration lag ) { boolean matchFound = false ; // // Retrieve the list of predecessors // List < Relation > predecessorList = getPredecessors ( ) ; if ( ! predecessorList . isEmpty ( ) ) { // // Ensure that we have a valid lag duration // if ( lag == null ) { lag = Duration . getInstance ( 0 , TimeUnit . DAYS ) ; } // // Ensure that there is a predecessor relationship between // these two tasks, and remove it. // matchFound = removeRelation ( predecessorList , targetTask , type , lag ) ; // // If we have removed a predecessor, then we must remove the // corresponding successor entry from the target task list // if ( matchFound ) { // // Retrieve the list of successors // List < Relation > successorList = targetTask . getSuccessors ( ) ; if ( ! successorList . isEmpty ( ) ) { // // Ensure that there is a successor relationship between // these two tasks, and remove it. // removeRelation ( successorList , this , type , lag ) ; } } } return matchFound ; }
This method allows a predecessor relationship to be removed from this task instance . It will only delete relationships that exactly match the given targetTask type and lag time .