         }
     }
 
+    public function insertAfter(newMember:*, referenceMember:*):void
+    {
+        checkRelativeArguments(newMember, referenceMember);
+        var reference:Node = nodeLookup[referenceMember];
+        var node:Node = takeNode(newMember);
+        Node.insertAfter(reference, node);
+    }
+
+    public function insertBefore(newMember:*, referenceMember:*):void
+    {
+        checkRelativeArguments(newMember, referenceMember);
+        var reference:Node = nodeLookup[referenceMember];
+        var node:Node = takeNode(newMember);
+        Node.insertBefore(reference, node);
+    }
+
+    // O(n) manipulations
+    public function get(index:int):*
+    {
+        return getNodeAtIndex(index).value;
+    }
+
+    public function indexOf(query:*):int
+    {
+        var rover:Node = nodeLookup[query];
+        var index:int = -1;
+        if (rover)
+        {
+            while (rover !== _front)
+            {
+                rover = rover.prev;
+                index++;
+            }
+        }
+        return index;
+    }
+
+    public function removeAt(index:int):*
+    {
+        var memberToRemove:* = get(index);
+        remove(memberToRemove);
+        return memberToRemove;
+    }
+
+    public function insertAt(newMember:*, index:int):void
+    {
+        checkMember(newMember);
+        if (index === 0)
+        {
+            pushFront(newMember);
+        }
+        else if (index >= _length)
+        {
+            pushBack(newMember);
+        }
+        else
+        {
+            var node:Node = takeNode(newMember);
+            Node.insertBefore(getNodeAtIndex(index), node);
+        }
+    }
+
     public function toArray():Array
     {
         var array:Array = [ ];

        return new NodeIterator(_front, _back);
    }

    private function takeNode(element:*):Node
    {
        var node:Node = nodeLookup[element];
        if (node)
        {
            Node.unlink(node);
        }
        else
        {
            node = new Node(element);
            nodeLookup[element] = node;
            _length++;
        }
        return node;
    }
}
}

import flash.utils.Dictionary;


/**
 * An ordered set implemented as a doubly-linked list. All members are unique;
 * if a member that already exists in the DequeSet is inserted, it is moved
 * from its old position to its new position.  Addition, removal, and
 * retrieval from either end of the list are constant time.  Membership testing
 * by value, removal by value and insertion relative to value are also constant
 * time.  Operations by numeric index are linear time.
 */
public class DequeSet
{
    private var nodeLookup:Dictionary;
