Java Code Examples for java.util.concurrent.ConcurrentSkipListMap#values()

The following examples show how to use java.util.concurrent.ConcurrentSkipListMap#values() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractGraphPanelVisualizer.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public void switchModel(boolean aggregate) {
    ConcurrentSkipListMap<String, AbstractGraphRow> selectedModel;
    if (aggregate) {
        // issue 64: we must fail requests for aggregate in unsupported cases
        if (modelAggregate.isEmpty() && !model.isEmpty()) {
            throw new UnsupportedOperationException("Seems you've requested "
                    + "aggregate mode for graph that don't support it. We apologize...");
        }

        selectedModel = modelAggregate;
    } else {
        selectedModel = model;
    }

    graphPanel.getGraphObject().setRows(selectedModel);
    graphPanel.clearRowsTab();

    for (AbstractGraphRow abstractGraphRow : selectedModel.values()) {
        graphPanel.addRow(abstractGraphRow);
    }

    isAggregate = aggregate;
    getSettingsPanel().setAggregateMode(aggregate);
}
 
Example 2
Source File: ConcurrentSkipListMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Values.toArray contains all values
 */
public void testValuesToArray() {
    ConcurrentSkipListMap map = map5();
    Collection v = map.values();
    Object[] ar = v.toArray();
    ArrayList s = new ArrayList(Arrays.asList(ar));
    assertEquals(5, ar.length);
    assertTrue(s.contains("A"));
    assertTrue(s.contains("B"));
    assertTrue(s.contains("C"));
    assertTrue(s.contains("D"));
    assertTrue(s.contains("E"));
}
 
Example 3
Source File: ConcurrentSkipListMapTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * values collection contains all values
 */
public void testValues() {
    ConcurrentSkipListMap map = map5();
    Collection s = map.values();
    assertEquals(5, s.size());
    assertTrue(s.contains("A"));
    assertTrue(s.contains("B"));
    assertTrue(s.contains("C"));
    assertTrue(s.contains("D"));
    assertTrue(s.contains("E"));
}
 
Example 4
Source File: BasicIndex.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public IndexValue<E> marshal (ConcurrentSkipListMap<Integer, E> map)
        throws Exception
{
    IndexValue<E> value = new IndexValue<>();
    value.list = new ArrayList<>(map.values());

    return value;
}
 
Example 5
Source File: ConcurrentSkipListMapTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Values.toArray contains all values
 */
public void testValuesToArray() {
    ConcurrentSkipListMap map = map5();
    Collection v = map.values();
    Object[] ar = v.toArray();
    ArrayList s = new ArrayList(Arrays.asList(ar));
    assertEquals(5, ar.length);
    assertTrue(s.contains("A"));
    assertTrue(s.contains("B"));
    assertTrue(s.contains("C"));
    assertTrue(s.contains("D"));
    assertTrue(s.contains("E"));
}
 
Example 6
Source File: ConcurrentSkipListMapTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * values collection contains all values
 */
public void testValues() {
    ConcurrentSkipListMap map = map5();
    Collection s = map.values();
    assertEquals(5, s.size());
    assertTrue(s.contains("A"));
    assertTrue(s.contains("B"));
    assertTrue(s.contains("C"));
    assertTrue(s.contains("D"));
    assertTrue(s.contains("E"));
}
 
Example 7
Source File: WsServerContainer.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public WsMappingResult findMapping(String path) {

        // Prevent registering additional endpoints once the first attempt has
        // been made to use one
        if (addAllowed) {
            addAllowed = false;
        }

        // Check an exact match. Simple case as there are no templates.
        ExactPathMatch match = configExactMatchMap.get(path);
        if (match != null) {
            return new WsMappingResult(match.getConfig(), Collections.<String, String>emptyMap());
        }

        // No exact match. Need to look for template matches.
        UriTemplate pathUriTemplate = null;
        try {
            pathUriTemplate = new UriTemplate(path);
        } catch (DeploymentException e) {
            // Path is not valid so can't be matched to a WebSocketEndpoint
            return null;
        }

        // Number of segments has to match
        Integer key = Integer.valueOf(pathUriTemplate.getSegmentCount());
        ConcurrentSkipListMap<String,TemplatePathMatch> templateMatches = configTemplateMatchMap.get(key);

        if (templateMatches == null) {
            // No templates with an equal number of segments so there will be
            // no matches
            return null;
        }

        // List is in alphabetical order of normalised templates.
        // Correct match is the first one that matches.
        ServerEndpointConfig sec = null;
        Map<String,String> pathParams = null;
        for (TemplatePathMatch templateMatch : templateMatches.values()) {
            pathParams = templateMatch.getUriTemplate().match(pathUriTemplate);
            if (pathParams != null) {
                sec = templateMatch.getConfig();
                break;
            }
        }

        if (sec == null) {
            // No match
            return null;
        }

        return new WsMappingResult(sec, pathParams);
    }
 
Example 8
Source File: ICCProfile.java    From freeinternals with Apache License 2.0 4 votes vote down vote up
public void generateTreeNode(DefaultMutableTreeNode parentNode) {
    DefaultMutableTreeNode nodeHeader;
    DefaultMutableTreeNode nodeTagTable;
    int lastPos;
    int diff;

    parentNode.add(nodeHeader = new DefaultMutableTreeNode(new JTreeNodeFileComponent(
            this.header.getStartPos(),
            this.header.getLength(),
            "Profile header")));
    this.header.generateTreeNode(nodeHeader);

    parentNode.add(nodeHeader = new DefaultMutableTreeNode(new JTreeNodeFileComponent(
            lastPos = this.header.getStartPos() + this.header.getLength(),
            4,
            String.format("Tag count = %d", this.tagCount))));

    lastPos = lastPos + 4;

    ConcurrentSkipListMap<Long, RefItem> sortedMap = new ConcurrentSkipListMap<Long, RefItem>();
    for (int i = 0; i < this.tagTable.length; i++) {
        parentNode.add(nodeTagTable = new DefaultMutableTreeNode(new JTreeNodeFileComponent(
                lastPos + Tag.LENGTH * i,
                Tag.LENGTH,
                String.format("Tag[%d]", i))));
        this.tagTable[i].generateTreeNode(nodeTagTable);

        if (sortedMap.get(this.tagTable[i].Offset) == null) {
            RefItem refItem = new RefItem();
            refItem.i = i;
            refItem.tag = this.tagTable[i];
            sortedMap.put(refItem.tag.Offset, refItem);
        }
    }

    lastPos = lastPos + this.tagTable.length * Tag.LENGTH;
    for (RefItem ref : sortedMap.values()) {
        diff = (int) ((this.startPos + ref.tag.Offset) - lastPos);
        if (diff > 0) {
            UITool.generateTreeNodeDiff(
                    parentNode, lastPos, diff,
                    this.rawData, this.startPos);
        }

        parentNode.add(new DefaultMutableTreeNode(new JTreeNodeFileComponent(
                this.startPos + (int) ref.tag.Offset,
                (int) ref.tag.Size,
                String.format("Data of Tag [%d]", ref.i))));
        lastPos = this.startPos + (int) ref.tag.Offset + (int) ref.tag.Size;
    }

    diff = (this.startPos + this.rawData.length) - lastPos;
    if (diff > 0) {
        UITool.generateTreeNodeDiff(
                parentNode, lastPos, diff,
                this.rawData, this.startPos);
    }
}
 
Example 9
Source File: TIFF.java    From freeinternals with Apache License 2.0 4 votes vote down vote up
public void generateTreeNode(DefaultMutableTreeNode parentNode) {
    JTreeNodeFileComponent comp;
    DefaultMutableTreeNode nodeTiffHeader;

    // TIFF Header
    comp = new JTreeNodeFileComponent(
            this.startPos,
            TIFFHeader.SIZE,
            "TIFF Header");
    comp.setDescription("A TIFF file begins with an 8-byte image file header that points to an image file directory (IFD).");
    parentNode.add(nodeTiffHeader = new DefaultMutableTreeNode(comp));
    this.tiffHeader.generateTreeNode(nodeTiffHeader);

    // TIFF Data
    ConcurrentSkipListMap<Integer, RefItem> sortedMap = new ConcurrentSkipListMap<Integer, RefItem>();
    int lastEnd = this.tiffHeader.getStartPos() + TIFFHeader.SIZE;          // Absolute position
    int diff;

    for (IFDGroup group : this.exifGroup) {
        RefItem refItem = new RefItem();
        refItem.offset = group.offset;
        refItem.length = group.length;
        refItem.ifdgroup = group;
        sortedMap.put(refItem.offset, refItem);

        this.loadRefItem(group.ifd, sortedMap);
    }

    for (RefItem ref : sortedMap.values()) {
        diff = (this.startPos + ref.offset) - lastEnd;
        if (diff > 0) {
            UITool.generateTreeNodeDiff(
                    parentNode, lastEnd, diff,
                    this.tiffByteArray, this.startPos);
        }

        if (ref.ifdgroup != null) {
            ref.ifdgroup.generateTreeNode(parentNode);
        } else {
            parentNode.add(new DefaultMutableTreeNode(new JTreeNodeFileComponent(
                    this.tiffHeader.getStartPos() + ref.offset,
                    ref.length,
                    String.format("Reference of tag [%s] %04X.H (%d, %s)",
                            ref.ifd.getTagSpace().toString(),
                            ref.ifd.ifd_tag,
                            ref.ifd.ifd_tag,
                            ref.ifd.getTagName()))));
        }

        lastEnd = this.startPos + ref.offset + ref.length;
    }

    // In case, there is some extra space in the end
    diff = (this.tiffHeader.getStartPos() + this.tiffByteArray.length) - lastEnd;
    if (diff > 0) {
        UITool.generateTreeNodeDiff(
                parentNode, lastEnd, diff,
                this.tiffByteArray, this.startPos);
    }
}