本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}
}
}
示例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
}
}
}
}
示例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);
}
}
}
}
示例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;
}