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