Example usage for org.apache.commons.collections4.bidimap DualTreeBidiMap DualTreeBidiMap

List of usage examples for org.apache.commons.collections4.bidimap DualTreeBidiMap DualTreeBidiMap

Introduction

In this page you can find the example usage for org.apache.commons.collections4.bidimap DualTreeBidiMap DualTreeBidiMap.

Prototype

public DualTreeBidiMap() 

Source Link

Document

Creates an empty DualTreeBidiMap

Usage

From source file:eu.scidipes.toolkits.pawebapp.util.FrameworkUtils.java

private static void populateMapFromRILProps(final Properties props,
        final Map<FormType, Map<String, CurationPersistentIdentifier>> rilMap, final FormType key) {
    final Map<String, CurationPersistentIdentifier> innerMap = new DualTreeBidiMap<>();

    for (final Object o : props.keySet()) {
        final String innerKey = (String) o;
        try {//from  www.  j a v  a2 s  . c om
            final CurationPersistentIdentifier cpid = new CoreCurationPersistentIdentifier(
                    props.getProperty(innerKey));

            /* If corresponding RIL does not exist on an enabled registry, the CPID won't be added */
            innerMap.put(innerKey, FrameworkWrapper.getRepInfoLabel(cpid).getCpid());
        } catch (final RIException e) {
            LOG.warn(e.getMessage());
        }
    }

    rilMap.put(key, innerMap);
}

From source file:org.rapla.storage.impl.server.LocalAbstractCachableOperator.java

protected void initIndizes() {
    deleteUpdateSet = new DualTreeBidiMap<String, DeleteUpdateEntry>();

    timestampSetAddAll(cache.getDynamicTypes());
    timestampSetAddAll(cache.getReservations());
    timestampSetAddAll(cache.getAllocatables());
    timestampSetAddAll(cache.getUsers());
    // The appointment map
    appointmentMap = new HashMap<String, SortedSet<Appointment>>();
    for (Reservation r : cache.getReservations()) {
        for (Appointment app : ((ReservationImpl) r).getAppointmentList()) {
            Reservation reservation = app.getReservation();
            Allocatable[] allocatables = reservation.getAllocatablesFor(app);
            {//w w  w. jav a2 s.  co m
                Collection<Appointment> list = getAndCreateList(appointmentMap, null);
                list.add(app);
            }
            for (Allocatable alloc : allocatables) {
                Collection<Appointment> list = getAndCreateList(appointmentMap, alloc);
                list.add(app);
            }
        }
    }
    Date today2 = today();
    AllocationMap allocationMap = new AllocationMap() {
        public SortedSet<Appointment> getAppointments(Allocatable allocatable) {
            return LocalAbstractCachableOperator.this.getAppointments(allocatable);
        }

        @SuppressWarnings("unchecked")
        public Collection<Allocatable> getAllocatables() {
            return (Collection) cache.getAllocatables();
        }
    };
    // The conflict map
    Logger logger = getLogger();
    conflictFinder = new ConflictFinder(allocationMap, today2, logger, this, cache);
    long delay = 0;//DateTools.MILLISECONDS_PER_HOUR;
    long period = DateTools.MILLISECONDS_PER_HOUR;
    Command cleanUpConflicts = new Command() {

        @Override
        public void execute() throws Exception {
            removeOldConflicts();
        }
    };
    cleanConflictsTask = scheduler.schedule(cleanUpConflicts, delay, period);
}