@ Override public void listInsertAfter ( final T currentElement , final T newElement ) throws FrameworkException { if ( currentElement . getUuid ( ) . equals ( newElement . getUuid ( ) ) ) { throw new IllegalStateException ( "Cannot link a node to itself!" ) ; } final T next = listGetNext ( currentElement ) ; if ( next == null ) { linkNodes ( getSiblingLinkType ( ) , currentElement , newElement ) ; } else { // unlink predecessor and successor unlinkNodes ( getSiblingLinkType ( ) , currentElement , next ) ; // link predecessor to new element linkNodes ( getSiblingLinkType ( ) , currentElement , newElement ) ; // dont create self link if ( ! newElement . getUuid ( ) . equals ( next . getUuid ( ) ) ) { // link new element to successor linkNodes ( getSiblingLinkType ( ) , newElement , next ) ; } } }
Inserts newElement after currentElement in the list defined by this LinkedListManager .