当前位置: 首页>>代码示例>>Java>>正文


Java TLongSet.contains方法代码示例

本文整理汇总了Java中gnu.trove.set.TLongSet.contains方法的典型用法代码示例。如果您正苦于以下问题:Java TLongSet.contains方法的具体用法?Java TLongSet.contains怎么用?Java TLongSet.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnu.trove.set.TLongSet的用法示例。


在下文中一共展示了TLongSet.contains方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: equals

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
/** {@inheritDoc) */
public boolean equals( Object other ) {
    if (! ( other instanceof TLongSet ) ) {
        return false;
    }
    final TLongSet that = ( TLongSet ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    for ( int i = _states.length; i-- > 0; ) {
        if ( _states[i] == FULL ) {
            if ( ! that.contains( _set[i] ) ) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:19,代码来源:TLongObjectHashMap.java

示例2: equals

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
/** {@inheritDoc} */
public boolean equals( Object other ) {
    if ( ! ( other instanceof TLongSet ) ) {
        return false;
    }
    TLongSet that = ( TLongSet ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    for ( int i = _states.length; i-- > 0; ) {
        if ( _states[i] == FULL ) {
            if ( ! that.contains( _set[i] ) ) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:19,代码来源:TLongHashSet.java

示例3: equals

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
public boolean equals( Object other ) {
    if (! ( other instanceof TLongSet ) ) {
        return false;
    }
    final TLongSet that = ( TLongSet ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    for ( int i = _states.length; i-- > 0; ) {
        if ( _states[i] == FULL ) {
            if ( ! that.contains( _set[i] ) ) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:18,代码来源:TLongObjectHashMap.java

示例4: equals

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
/** {@inheritDoc) */
@Override
public boolean equals( Object other ) {
    if (! ( other instanceof TLongSet ) ) {
        return false;
    }
    final TLongSet that = ( TLongSet ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    for ( int i = _states.length; i-- > 0; ) {
        if ( _states[i] == FULL ) {
            if ( ! that.contains( _set[i] ) ) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TLongObjectHashMap.java

示例5: equals

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean equals( Object other ) {
    if ( ! ( other instanceof TLongSet ) ) {
        return false;
    }
    TLongSet that = ( TLongSet ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    for ( int i = _states.length; i-- > 0; ) {
        if ( _states[i] == FULL ) {
            if ( ! that.contains( _set[i] ) ) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TLongHashSet.java

示例6: equals

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean equals( Object other ) {
    if ( ! ( other instanceof TLongSet ) ) {
        return false;
    }
    TLongSet that = ( TLongSet ) other;
    if ( that.size() != this.size() ) {
        return false;
    }
    for ( int i = capacity(); i-- > 0; ) {
        if ( _states.get(i) == FULL ) {
            if ( ! that.contains( _set.get( i ) ) ) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TLongOffheapHashSet.java

示例7: hasNodeIntersections

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
/**
 * Return whether this ring has intersections in terms of node ids appearing
 * multiple times.
 */
public boolean hasNodeIntersections() {
    int size = this.nodeIds.size();
    // Keep a set of already encountered ids
    TLongSet before = new TLongHashSet();
    // The first id can't be there already because the set is empty
    before.add(this.nodeIds.get(0));
    // Check all nodes except the last one which gets special care
    for (int i = 1; i < size - 1; i++) {
        long id = this.nodeIds.get(i);
        // Is it already on the set -> there is an intersection
        if (before.contains(id)) {
            return true;
        }
        // Add to the set of encountered ids
        before.add(id);
    }
    // If this ring is closed, the last node intersects the first one, but
    // that is okay
    if (this.isClosed()) {
        return false;
    }
    // If the ring is not closed, the last node might be an intersection
    // with one of the others
    return before.contains(this.nodeIds.get(size - 1));
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:30,代码来源:ChainOfNodes.java

示例8: findMemberRelationsRecursively

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
private void findMemberRelationsRecursively(Deque<OsmRelation> queue,
                                            Set<OsmRelation> outRelations) throws EntityNotFoundException {
    TLongSet ids = new TLongHashSet();
    while (!queue.isEmpty()) {
        OsmRelation relation = queue.remove();
        for (OsmRelationMember member : OsmModelUtil
                .membersAsList(relation)) {
            if (member.getType() != EntityType.Relation) {
                continue;
            }
            long id = member.getId();
            if (ids.contains(id)) {
                continue;
            }
            ids.add(id);

            OsmRelation child = this.entityProvider.getRelation(id);
            outRelations.add(child);
            queue.add(child);
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:23,代码来源:EntityFinderThrowMissing.java

示例9: findMemberRelationsRecursively

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
private void findMemberRelationsRecursively(Deque<OsmRelation> queue,
                                            Set<OsmRelation> outRelations) {
    TLongSet ids = new TLongHashSet();
    while (!queue.isEmpty()) {
        OsmRelation relation = queue.remove();
        for (OsmRelationMember member : OsmModelUtil
                .membersAsList(relation)) {
            if (member.getType() != EntityType.Relation) {
                continue;
            }
            long id = member.getId();
            if (ids.contains(id)) {
                continue;
            }
            ids.add(id);

            try {
                OsmRelation child = this.entityProvider.getRelation(id);
                outRelations.add(child);
                queue.add(child);
            } catch (EntityNotFoundException e) {
                // ignore silently
            }
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:27,代码来源:EntityFinderIgnoreMissing.java

示例10: findMemberRelationsRecursively

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
private void findMemberRelationsRecursively(Deque<OsmRelation> queue,
                                            Set<OsmRelation> outRelations) {
    TLongSet ids = new TLongHashSet();
    while (!queue.isEmpty()) {
        OsmRelation relation = queue.remove();
        for (OsmRelationMember member : OsmModelUtil
                .membersAsList(relation)) {
            if (member.getType() != EntityType.Relation) {
                continue;
            }
            long id = member.getId();
            if (ids.contains(id)) {
                continue;
            }
            ids.add(id);

            try {
                OsmRelation child = this.entityProvider.getRelation(id);
                outRelations.add(child);
                queue.add(child);
            } catch (EntityNotFoundException e) {
                this.logRelationNotFound(id);
            }
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:27,代码来源:EntityFinderLogMissing.java

示例11: isSupported

import gnu.trove.set.TLongSet; //导入方法依赖的package包/类
/**
 * Test if the given block is either self-supporting (doesn't match any falling rules) or is adjacent to a supported block.
 * The supported and unsupported arguments may contain the results of previous completed searches. The blocks visited by
 * this search will be added to one or the other set depending on the final result.
 *
 * @param pos           position of the block to test
 * @param supported     set of blocks already known to be supported
 * @param unsupported   set of blocks already known to be unsupported
 *
 * @return              true iff the given block is definitely supported
 */
private boolean isSupported(long pos, TLongSet supported, TLongSet unsupported) throws MaxSearchVisitsExceeded {
    World world = this.getMatch().getWorld();

    LongDeque queue = new LongDeque();
    TLongSet visited = new TLongHashSet();
    queue.add(pos);
    visited.add(pos);

    while(!queue.isEmpty()) {
        pos = queue.remove();

        if(supported.contains(pos)) {
            // If we find a block already known to be supported, it supports all blocks visited in the search.
            supported.addAll(visited);
            return true;
        }

        if(++this.visitsThisTick > MAX_SEARCH_VISITS_PER_TICK) {
            throw new MaxSearchVisitsExceeded();
        }

        if(unsupported.contains(pos)) {
            // Don't continue the search through blocks known to be unsupported
            continue;
        }

        Block block = blockAt(world, pos);
        if(block == null) continue;

        boolean selfSupporting = true;
        for(FallingBlocksRule rule : this.rules) {
            if(rule.canFall(block)) {
                // If a rule matches, this block is not self-supporting,
                // and its status depends on the final result of the search.
                selfSupporting = false;

                // Continue the search through any neighbors that are capable of
                // supporting this block, and have not yet been visited.
                for(BlockFace face : NEIGHBORS) {
                    long neighborPos = neighborPos(pos, face);
                    if(!visited.contains(neighborPos)) {
                        Block neighbor = blockAt(world, neighborPos);
                        if(rule.canSupport(neighbor, face)) {
                            queue.add(neighborPos);
                            visited.add(neighborPos);
                        }
                    }
                }
            }
        }

        if(selfSupporting) {
            // If no rules match this block, then it is self-supporting,
            // and it can support all the other visited blocks.
            supported.addAll(visited);
            return true;
        }
    }

    // If the entire block network has been searched without finding a
    // supported block, then we know the entire network is unsupported.
    unsupported.addAll(visited);
    return false;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:76,代码来源:FallingBlocksMatchModule.java


注:本文中的gnu.trove.set.TLongSet.contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。