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

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

Introduction

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

Prototype

public Object removeValue(final Object value) 

Source Link

Document

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

Usage

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

/**
 * {@inheritDoc}//from   ww  w .  ja va 2  s  .co 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());
        }
    }

}