Example usage for java.util.concurrent ConcurrentSkipListSet remove

List of usage examples for java.util.concurrent ConcurrentSkipListSet remove

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentSkipListSet remove.

Prototype

public boolean remove(Object o) 

Source Link

Document

Removes the specified element from this set if it is present.

Usage

From source file:annis.gui.flatquerybuilder.ValueField.java

@Override
public void textChange(TextChangeEvent event) {
    ReducingStringComparator rsc = sq.getRSC();
    String fm = sq.getFilterMechanism();
    if (!"generic".equals(fm)) {
        ConcurrentSkipListSet<String> notInYet = new ConcurrentSkipListSet<>();
        String txt = event.getText();
        if (!txt.equals("")) {
            scb.removeAllItems();//from   w ww .  ja  v a2 s .  co m
            for (Iterator<String> it = values.keySet().iterator(); it.hasNext();) {
                String s = it.next();
                if (rsc.compare(s, txt, fm) == 0) {
                    scb.addItem(s);
                } else {
                    notInYet.add(s);
                }
            }
            //startsWith
            for (String s : notInYet) {
                if (rsc.startsWith(s, txt, fm)) {
                    scb.addItem(s);
                    notInYet.remove(s);
                }
            }
            //contains
            for (String s : notInYet) {
                if (rsc.contains(s, txt, fm)) {
                    scb.addItem(s);
                }
            }
        } else {
            buildValues(this.vm);
        }
    } else {
        String txt = event.getText();
        HashMap<Integer, Collection> levdistvals = new HashMap<>();
        if (txt.length() > 1) {
            scb.removeAllItems();
            for (String s : values.keySet()) {
                Integer d = StringUtils.getLevenshteinDistance(removeAccents(txt).toLowerCase(),
                        removeAccents(s).toLowerCase());
                if (levdistvals.containsKey(d)) {
                    levdistvals.get(d).add(s);
                }
                if (!levdistvals.containsKey(d)) {
                    Set<String> newc = new TreeSet<>();
                    newc.add(s);
                    levdistvals.put(d, newc);
                }
            }
            SortedSet<Integer> keys = new TreeSet<>(levdistvals.keySet());
            for (Integer k : keys.subSet(0, 10)) {
                List<String> valueList = new ArrayList(levdistvals.get(k));
                Collections.sort(valueList, String.CASE_INSENSITIVE_ORDER);
                for (String v : valueList) {
                    scb.addItem(v);
                }
            }
        }
    }
}

From source file:annis.gui.flatquerybuilder.SearchBox.java

@Override
public void textChange(TextChangeEvent event) {
    if ("specific".equals(sq.getFilterMechanism())) {
        ConcurrentSkipListSet<String> notInYet = new ConcurrentSkipListSet<String>();
        reducingStringComparator esc = new reducingStringComparator();
        String txt = event.getText();
        if (!txt.equals("")) {
            cb.removeAllItems();/*from ww w  .  j a v  a  2 s  . co  m*/
            for (Iterator<String> it = annonames.iterator(); it.hasNext();) {
                String s = it.next();
                if (esc.compare(s, txt) == 0) {
                    cb.addItem(s);
                } else {
                    notInYet.add(s);
                }
            }
            //startsWith
            for (String s : notInYet) {
                if (esc.startsWith(s, txt)) {
                    cb.addItem(s);
                    notInYet.remove(s);
                }
            }
            //contains
            for (String s : notInYet) {
                if (esc.contains(s, txt)) {
                    cb.addItem(s);
                }
            }
        } else {
            //have a look and speed it up
            SpanBox.buildBoxValues(cb, ebene, sq);
        }
    }

    if ("levenshtein".equals(sq.getFilterMechanism())) {
        String txt = event.getText();
        HashMap<Integer, Collection> levdistvals = new HashMap<Integer, Collection>();
        if (txt.length() > 1) {
            cb.removeAllItems();
            for (String s : annonames) {
                Integer d = StringUtils.getLevenshteinDistance(removeAccents(txt), removeAccents(s));
                if (levdistvals.containsKey(d)) {
                    levdistvals.get(d).add(s);
                }
                if (!levdistvals.containsKey(d)) {
                    Set<String> newc = new TreeSet<String>();
                    newc.add(s);
                    levdistvals.put(d, newc);
                }
            }
            SortedSet<Integer> keys = new TreeSet<Integer>(levdistvals.keySet());
            for (Integer k : keys.subSet(0, 5)) {
                List<String> values = new ArrayList(levdistvals.get(k));
                Collections.sort(values, String.CASE_INSENSITIVE_ORDER);
                for (String v : values) {
                    cb.addItem(v);
                }
            }
        }
    }
}

From source file:com.houghtonassociates.bamboo.plugins.dao.GerritService.java

public Set<GerritChangeVO> getLastUnverifiedChanges() throws RepositoryException {
    log.debug("getLastUnverifiedChange()...");

    Set<GerritChangeVO> changes = getGerritChangeInfo();

    ConcurrentSkipListSet<GerritChangeVO> filtedChanges = new ConcurrentSkipListSet<GerritChangeVO>(
            new SortByUnVerifiedLastUpdate());
    filtedChanges.addAll(changes);// w w  w. j  ava2  s.c  om

    if ((filtedChanges.size() > 0)) {
        for (GerritChangeVO c : filtedChanges) {
            if (c.getVerificationScore() > 0) {
                filtedChanges.remove(c);
            }
        }
    }

    return filtedChanges;
}

From source file:org.epics.archiverappliance.config.DefaultConfigService.java

@Override
public void removePVFromCluster(String pvName) {
    logger.info("Removing PV from cluster.." + pvName);
    pv2appliancemapping.remove(pvName);//from   w  w w. jav a 2s.co  m
    pvsForThisAppliance.remove(pvName);
    typeInfos.remove(pvName);
    pausedPVsForThisAppliance.remove(pvName);
    String[] parts = this.pvName2KeyConverter.breakIntoParts(pvName);
    for (String part : parts) {
        ConcurrentSkipListSet<String> pvNamesForPart = parts2PVNamesForThisAppliance.get(part);
        if (pvNamesForPart != null) {
            pvNamesForPart.remove(pvName);
        }
    }
}