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

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

Introduction

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

Prototype

public Object put(final Object key, final Object value) 

Source Link

Document

Puts the key-value pair into the map, replacing any previous pair.

Usage

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

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

}