コード例 #1
0
 /**
  * reinsert the given <code>extension</code> before the <code>next</code> one in the ring
  *
  * @param extension
  * @param next
  */
 public final void relink(
     final MinExtension<NodeType, EdgeType> extension,
     final MinExtension<NodeType, EdgeType> next) {
   extension.backward = next.backward;
   next.backward.forward = extension;
   extension.forward = next;
   next.backward = extension;
 }
コード例 #2
0
 /**
  * remove the given <code>extension</code> from the ring
  *
  * @param extension
  * @return the extension after the removed one
  */
 public final MinExtension<NodeType, EdgeType> unlink(
     final MinExtension<NodeType, EdgeType> extension) {
   final MinExtension<NodeType, EdgeType> next = extension.forward;
   // remove ack
   extension.backward.forward = next;
   next.backward = extension.backward;
   extension.forward = extension.backward = null;
   return next;
 }
コード例 #3
0
 /**
  * finally remove the given <code>extension</code>
  *
  * @param extension
  * @return <code>true</code>, if removed correctly
  */
 public boolean removeAndFree(final MinExtension<NodeType, EdgeType> extension) {
   if (extension.forward == null || extension.backward == null) {
     return false;
   }
   extension.forward.backward = extension.backward;
   extension.backward.forward = extension.forward;
   extension.backward = extension.forward = null;
   extension.release(tenv);
   --size;
   return true;
 }
コード例 #4
0
 /**
  * inserts the given <code>extension</code>
  *
  * @param extension
  * @return <code>true</code>, if correctly added
  */
 public boolean add(final MinExtension<NodeType, EdgeType> extension) {
   if (extension.forward != null || extension.backward != null) {
     return false;
   }
   MinExtension<NodeType, EdgeType> ack = this;
   while (ack.forward.compareTo(extension) < 0) {
     ack = ack.forward;
   }
   extension.forward = ack.forward;
   extension.backward = ack;
   ack.forward = extension.forward.backward = extension;
   ++size;
   return true;
 }
コード例 #5
0
 /**
  * finally remove the given <code>extension</code> and all extensions that are connected with the
  * given on
  *
  * @param ext
  * @return <code>true</code>, if removed correctly
  */
 public boolean removeAndFreeAll(MinExtension<NodeType, EdgeType> ext) {
   boolean ret = true;
   while (ext != null) {
     final MinExtension<NodeType, EdgeType> next = (MinExtension<NodeType, EdgeType>) ext.next;
     ext.next = null;
     ret = ret && removeAndFree(ext);
     ext = next;
   }
   return ret;
 }