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


Java ObjectSet.add方法代码示例

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


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

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** Add a Batchable to the queue. */
public void add (T batchable) {
	if (batchable.isOpaque()) {
		for (ObjectMap.Entry<T, ObjectSet<T>> entry : opaqueBatchables) {
			if (batchable.hasEquivalentTextures(entry.key)) {
				entry.value.add((T)batchable);
				return;
			}
		}
		ObjectSet<T> set = objectSetPool.obtain();
		set.add(batchable);
		opaqueBatchables.put(batchable, set);
	} else {
		blendedBatchables.add(batchable);
	}
	needSort = true;
}
 
开发者ID:CypherCove,项目名称:gdx-cclibs,代码行数:18,代码来源:BatchableSorter.java

示例3: provide

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
@Override
public ObjectSet<Object> provide() {
    final ObjectSet<Object> assets = GdxSets.newSet();
    for (final String assetPath : assetPaths) {
        if (loadOnDemand) {
            assets.add(assetService.finishLoading(assetPath, assetClass));
            continue;
        }
        if (!assetService.isLoaded(assetPath)) {
            // LibGDX method that should load a specific asset immediately does pretty much the same.
            assetService.finishLoading();
        }
        assets.add(assetService.get(assetPath, assetClass));
    }
    return assets;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:17,代码来源:ObjectSetAssetProvider.java

示例4: processBuildingAttributes

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
private void processBuildingAttributes(final LmlActorBuilder builder, final ObjectSet<String> processedAttributes) {
    if (getNamedAttributes() == null) {
        return;
    }
    final LmlSyntax syntax = getParser().getSyntax();
    for (final Entry<String, String> attribute : getNamedAttributes()) {
        // Processing building attributes:
        final LmlBuildingAttribute<LmlActorBuilder> buildingAttributeProcessor = syntax
                .getBuildingAttributeProcessor(builder, attribute.key);
        if (buildingAttributeProcessor != null // This is the actual processing method:
                && buildingAttributeProcessor.process(getParser(), this, builder, attribute.value)) {
            // If processing returns true, the attribute is fully parsed and can be omitted during attribute parsing
            // after the actor is initiated. If it returns false, it is expected that the attribute will be
            // eventually parsed by a second processor, after the widget is created.
            processedAttributes.add(attribute.key);
        }
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:19,代码来源:AbstractActorLmlTag.java

示例5: injectAssets

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void injectAssets(final AssetService assetService) {
    try {
        ObjectSet set = (ObjectSet) Reflection.getFieldValue(field, component);
        if (set == null) {
            set = GdxSets.newSet();
        }
        for (final String assetPath : assetPaths) {
            set.add(assetService.get(assetPath, assetType));
        }
        Reflection.setFieldValue(field, component, set);
    } catch (final ReflectionException exception) {
        throw new GdxRuntimeException("Unable to inject set of assets into component: " + component + ".",
                exception);
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:17,代码来源:ObjectSetAssetInjection.java

示例6: 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

示例7: 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

示例8: addUndisposedMap

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/**
 * Adds the supplied map to the list of undisposed maps.
 * 
 * The map is only added if it is not disposed and belongs to a map group.
 * @param map
 */
public void addUndisposedMap(GameMap map) {
	String group = map.getMapGroup();
	if (group != null && !map.isDisposed()) {
		ObjectSet<GameMap> maps = undisposedMapsByGroup.get(group);
		if (maps == null) {
			maps = new ObjectSet<GameMap>();
			undisposedMapsByGroup.put(group, maps);
		}
		maps.add(map);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:18,代码来源:GameState.java

示例9: of

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @return a new ImmutableObjectSet with the passed values. */
public static <Type> ImmutableObjectSet<Type> of(final Type... values) {
    final ObjectSet<Type> set = new ObjectSet<Type>(values.length);
    for (final Type value : values) {
        set.add(value);
    }
    return copyOf(set);
}
 
开发者ID:gdx-libs,项目名称:gdx-kiwi,代码行数:9,代码来源:ImmutableObjectSet.java

示例10: newSet

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @return a new ObjectSet with the passed values. */
public static <Type> ObjectSet<Type> newSet(final Type... values) {
    final ObjectSet<Type> set = new ObjectSet<Type>();
    for (final Type value : values) {
        set.add(value);
    }
    return set;
}
 
开发者ID:gdx-libs,项目名称:gdx-kiwi,代码行数:9,代码来源:GdxSets.java

示例11: of

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param values will be copied.
 * @return a new ImmutableObjectSet with the passed values.
 * @param <Type> type of stored values. */
public static <Type> ImmutableObjectSet<Type> of(final Type... values) {
    final ObjectSet<Type> set = new ObjectSet<Type>(values.length);
    for (final Type value : values) {
        set.add(value);
    }
    return copyOf(set);
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:11,代码来源:ImmutableObjectSet.java

示例12: newSet

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param values will be added to the set.
 * @return a new ObjectSet with the passed values.
 * @param <Type> type of stored values. */
public static <Type> ObjectSet<Type> newSet(final Type... values) {
    final ObjectSet<Type> set = new ObjectSet<Type>();
    for (final Type value : values) {
        set.add(value);
    }
    return set;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:11,代码来源:GdxSets.java

示例13: intersectTo

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** @param set will contain all values that are present in every passed set (excluding this one).
 * @param sets will be intersected.
 * @return first argument set will all intersecting values.
 * @param <Type> type of stored values. */
public static <Type> ObjectSet<Type> intersectTo(final ObjectSet<Type> set, final ObjectSet<Type>... sets) {
    if (sets == null || sets.length == 0) {
        return set;
    }
    final ObjectSet<Type> allValues = union(sets);
    for (final Type value : allValues) {
        if (isPresentInEvery(value, sets)) {
            set.add(value);
        }
    }
    return set;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:17,代码来源:GdxSets.java

示例14: processBuildingAttributeToDetermineTable

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
/** This is meant to handle toButtonTable, toTitleTable, toDialogTable to choose which table should have a row
 * appended.
 *
 * @param attributes named attributes of the macro.
 * @param processedAttributes should contain processed building attributes after this method invocation.
 * @param builder used to process named attributes. */
protected void processBuildingAttributeToDetermineTable(final ObjectMap<String, String> attributes,
        final ObjectSet<String> processedAttributes, final LmlActorBuilder builder) {
    final LmlSyntax syntax = getParser().getSyntax();
    for (final Entry<String, String> attribute : attributes) {
        final LmlBuildingAttribute<LmlActorBuilder> buildingAttribute = syntax
                .getBuildingAttributeProcessor(builder, attribute.key);
        if (buildingAttribute != null) {
            buildingAttribute.process(getParser(), getParent(), builder, attribute.value);
            processedAttributes.add(attribute.key);
        }
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:19,代码来源:TableCellLmlMacroTag.java

示例15: injectSetOfActors

import com.badlogic.gdx.utils.ObjectSet; //导入方法依赖的package包/类
protected <View> void injectSetOfActors(final View view, final Field field, final String[] actorIds) {
    final ObjectSet<Actor> actorContainer = new ObjectSet<Actor>();
    for (final String actorId : convertActorIds(actorIds)) {
        final Actor actor = actorsByIds.get(actorId);
        if (actor != null) {
            actorContainer.add(actor);
        }
    }
    injectFieldValueGracefully(field, view, actorContainer);
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:11,代码来源:AbstractLmlParser.java


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