Example usage for org.apache.commons.collections.bidimap TreeBidiMap remove

List of usage examples for org.apache.commons.collections.bidimap TreeBidiMap remove

Introduction

In this page you can find the example usage for org.apache.commons.collections.bidimap TreeBidiMap remove.

Prototype

public Object remove(final Object key) 

Source Link

Document

Removes the mapping for this key from this map if present.

Usage

From source file:de.topicmapslab.majortom.inmemory.virtual.internal.VirtualReificationStore.java

/**
 * {@inheritDoc}/*from  ww  w  . ja v  a  2  s.  c o m*/
 */
public void removeVirtualConstruct(IConstruct construct, IConstruct newConstruct) {
    /*
     * construct is a topic
     */
    if (construct instanceof ITopic) {
        TreeBidiMap reificiation = getReificationMap();
        if (reificiation != null && reificiation.containsKey(construct)) {
            Object reified = reificiation.remove(construct);
            reificiation.put(newConstruct, reified);
        }
        if (removedReifications != null && removedReifications.containsKey(construct.getId())) {
            IConstruct reified = (IConstruct) removedReifications.remove(construct.getId());
            removedReifications.put(newConstruct.getId(), reified.getId());
        }
    }
    /*
     * construct is an reified construct
     */
    else if (construct instanceof IReifiable) {
        TreeBidiMap reificiation = getReificationMap();
        if (reificiation != null && reificiation.containsValue(construct)) {
            Object reifier = reificiation.removeValue(construct);
            reificiation.put(reifier, newConstruct);
        }
        if (removedReifications != null && removedReifications.containsValue(construct.getId())) {
            IConstruct reifier = (IConstruct) removedReifications.removeValue(construct.getId());
            removedReifications.put(reifier.getId(), newConstruct.getId());
        }
    }

}