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


Java ObjectSet.contains方法代码示例

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


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

示例1: discover

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
@Override
public Array<Host> discover(){
    addresses.clear();
    List<InetAddress> list = client.discoverHosts(Vars.port, 3000);
    ObjectSet<String> hostnames = new ObjectSet<>();
    Array<Host> result = new Array<>();

    for(InetAddress a : list){
        if(!hostnames.contains(a.getHostName())) {
            Host address = addresses.get(a);
            if(address != null) result.add(address);

        }
        hostnames.add(a.getHostName());
    }

    return result;
}
 
开发者ID:Anuken,项目名称:Mindustry,代码行数:19,代码来源:KryoClient.java

示例2: loadInvitations

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void loadInvitations(InvitationBuffer invitations) {
    ObjectSet<String> tmp = Pools.obtain(ObjectSet.class);
    tmp.addAll(invites);
    invites.clear();
    for (Invitation invitation : invitations) {
        invites.add(invitation.getInvitationId());
        if (!tmp.contains(invitation.getInvitationId())) {
            showInvitation(invitation);
        }
    }
    tmp.clear();
    Pools.free(tmp);
    Gdx.app.postRunnable(new Runnable() {
        @Override public void run() {
            invitesDispatcher.setState(invites.size);
        }
    });
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:20,代码来源:GameServicesMultiplayer.java

示例3: processCellAttributes

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** This is meant to handle cell attributes that will modify the extracted cell.
 *
 * @param attributes named attributes of the macro.
 * @param processedAttributes already processed attributes. Should be ignored.
 * @param table owner of the cell.
 * @param cell cell of the row. Should have its defaults set. */
protected void processCellAttributes(final ObjectMap<String, String> attributes,
        final ObjectSet<String> processedAttributes, final Table table, final Cell<?> cell) {
    final LmlSyntax syntax = getParser().getSyntax();
    for (final Entry<String, String> attribute : attributes) {
        if (processedAttributes.contains(attribute.key)) {
            continue;
        }
        final LmlAttribute<?> cellAttribute = syntax.getAttributeProcessor(table, attribute.key);
        if (cellAttribute instanceof AbstractCellLmlAttribute) {
            ((AbstractCellLmlAttribute) cellAttribute).process(getParser(), getParent(), table, cell,
                    attribute.value);
        } else {
            if (!isInternalMacroAttribute(attribute.key)) {
                getParser().throwErrorIfStrict(getTagName()
                        + " macro can process only cell attributes. Found unknown or invalid attribute: "
                        + attribute.key);
            }
        }
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:27,代码来源:TableCellLmlMacroTag.java

示例4: processAttributes

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** Utility method that processes all named attributes of the selected type.
 *
 * @param widget widget (validator, actor - processed element) that will be used to process attributes.
 * @param tag contains attributes.
 * @param parser will be used to parse attributes.
 * @param processedAttributes already processed attribute names. These attributes will be ignored. Optional, can be
 *            null.
 * @param throwExceptionIfAttributeUnknown if true and unknown attribute is found, a strict parser will throw an
 *            exception.
 * @param <Type> type of processed widget. Its class tree will be used to retrieve attributes. */
public static <Type> void processAttributes(final Type widget, final LmlTag tag, final LmlParser parser,
        final ObjectSet<String> processedAttributes, final boolean throwExceptionIfAttributeUnknown) {
    if (GdxMaps.isEmpty(tag.getNamedAttributes())) {
        return;
    }
    final LmlSyntax syntax = parser.getSyntax();
    final boolean hasProcessedAttributes = processedAttributes != null;
    for (final Entry<String, String> attribute : tag.getNamedAttributes()) {
        if (attribute == null || hasProcessedAttributes && processedAttributes.contains(attribute.key)) {
            continue;
        }
        final LmlAttribute<Type> attributeProcessor = syntax.getAttributeProcessor(widget, attribute.key);
        if (attributeProcessor == null) {
            if (throwExceptionIfAttributeUnknown) {
                parser.throwErrorIfStrict("Unknown attribute: \"" + attribute.key + "\" for widget type: "
                        + widget.getClass().getName());
            }
            continue;
        }
        attributeProcessor.process(parser, tag, widget, attribute.value);
        if (hasProcessedAttributes) {
            processedAttributes.add(attribute.key);
        }
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:36,代码来源:LmlUtilities.java

示例5: getDisplayModes

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @return array of serialized display modes' names. */
@LmlAction("displayModes")
public Array<String> getDisplayModes() {
    final ObjectSet<String> alreadyAdded = GdxSets.newSet(); // Removes duplicates.
    final Array<String> displayModes = GdxArrays.newArray(); // Keeps display modes sorted.
    for (final DisplayMode mode : fullscreenService.getDisplayModes()) {
        final String modeName = fullscreenService.serialize(mode);
        if (alreadyAdded.contains(modeName)) {
            continue; // Same size already added.
        }
        displayModes.add(modeName);
        alreadyAdded.add(modeName);
    }
    return displayModes;
}
 
开发者ID:BialJam,项目名称:M-M,代码行数:16,代码来源:SettingsController.java

示例6: addNeighbour

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
private static void addNeighbour(World world, int x, int y, ObjectSet<Coordinate> checked, ObjectSet<Coordinate> toCheck) {
    if (!world.inBounds(x, y) || !world.level.exists(LevelElementType.tile, x, y))
        return;
    Coordinate coordinate = Coordinate.obtain(x, y);
    if (checked.contains(coordinate)) {
        coordinate.free();
        return;
    }
    toCheck.add(coordinate);

}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:12,代码来源:DistanceFiller.java

示例7: canSee

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
public boolean canSee(Entity observer, Entity observable) {
	ObjectSet<Entity> targets = vision.get(observer);
	
	if (targets == null) {
		return false;
	}
	
	return targets.contains(observable);
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:10,代码来源:VisionSystem.java

示例8: isPresentInEvery

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @return true if passed value is present in all of passed sets. */
public static <Type> boolean isPresentInEvery(final Type value, final ObjectSet<Type>... sets) {
    for (final ObjectSet<Type> set : sets) {
        if (!set.contains(value)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:gdx-libs,项目名称:gdx-kiwi,代码行数:10,代码来源:GdxSets.java

示例9: isPresentInAny

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @return true if passed value is present in any of passed sets. */
public static <Type> boolean isPresentInAny(final Type value, final ObjectSet<Type>... sets) {
    for (final ObjectSet<Type> set : sets) {
        if (set.contains(value)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:gdx-libs,项目名称:gdx-kiwi,代码行数:10,代码来源:GdxSets.java

示例10: isPresentInEvery

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param value cannot be null.
 * @param sets will be checked.
 * @return true if passed value is present in all of passed sets.
 * @param <Type> type of stored values. */
public static <Type> boolean isPresentInEvery(final Type value, final ObjectSet<Type>... sets) {
    for (final ObjectSet<Type> set : sets) {
        if (!set.contains(value)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:13,代码来源:GdxSets.java

示例11: isPresentInAny

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param value cannot be null.
 * @param sets will be checked.
 * @return true if passed value is present in any of passed sets.
 * @param <Type> type of stored values. */
public static <Type> boolean isPresentInAny(final Type value, final ObjectSet<Type>... sets) {
    for (final ObjectSet<Type> set : sets) {
        if (set.contains(value)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:13,代码来源:GdxSets.java

示例12: belongsToUndisposed

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/**
 * Returns true if the supplied map belongs to a map group and is tracked as undisposed.
 * @param map
 * @return
 */
public boolean belongsToUndisposed(GameMap map) {
	String mapGroup = map.getMapGroup();
	ObjectSet<GameMap> maps = mapGroup != null ? getUndisposedMaps(mapGroup) : null;
	return maps != null && maps.contains(map);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:11,代码来源:GameState.java


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