java.util.concurrent.ConcurrentSkipListMap#values ( )源码实例Demo

下面列出了java.util.concurrent.ConcurrentSkipListMap#values ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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);
}
 
源代码2 项目: openjdk-jdk9   文件: ConcurrentSkipListMapTest.java
/**
 * 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"));
}
 
源代码3 项目: openjdk-jdk9   文件: ConcurrentSkipListMapTest.java
/**
 * 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"));
}
 
源代码4 项目: audiveris   文件: BasicIndex.java
@Override
public IndexValue<E> marshal (ConcurrentSkipListMap<Integer, E> map)
        throws Exception
{
    IndexValue<E> value = new IndexValue<>();
    value.list = new ArrayList<>(map.values());

    return value;
}
 
源代码5 项目: j2objc   文件: ConcurrentSkipListMapTest.java
/**
 * 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"));
}
 
源代码6 项目: j2objc   文件: ConcurrentSkipListMapTest.java
/**
 * 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"));
}
 
源代码7 项目: Tomcat8-Source-Read   文件: WsServerContainer.java
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);
    }
 
源代码8 项目: freeinternals   文件: ICCProfile.java
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);
    }
}
 
源代码9 项目: freeinternals   文件: TIFF.java
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);
    }
}