本文整理汇总了Java中scala.actors.threadpool.Arrays类的典型用法代码示例。如果您正苦于以下问题:Java Arrays类的具体用法?Java Arrays怎么用?Java Arrays使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Arrays类属于scala.actors.threadpool包,在下文中一共展示了Arrays类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTextures
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Collection<ResourceLocation> getTextures() {
normalModels.clear();
Set<ResourceLocation> textures = Sets.newHashSet();
for (Entry<ResourceLocation, Integer> e : item.LOCATION_TO_META.entrySet()) {
ResourceLocation loc = e.getKey();
if (item.OVERRIDES.containsKey(e.getKey())) {
ResourceLocation[][] o = item.OVERRIDES.get(e.getKey());
textures.addAll(Arrays.asList(o[1]));
loc = o[0][0];
}
if (!normalModels.containsKey(loc)) {
normalModels.put(loc, getModel(loc));
}
IModel model = normalModels.get(loc);
textures.addAll(model.getTextures().stream().filter(l -> !l.getResourcePath().startsWith("texture")).collect(Collectors.toSet()));
}
return textures;
}
示例2: addTooltip
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@SubscribeEvent
public void addTooltip(ItemTooltipEvent e) {
if (!e.getItemStack().isEmpty()) {
Minecraft mc = Minecraft.getMinecraft();
if (mc.currentScreen instanceof GuiContainer) {
GuiContainer c = (GuiContainer) mc.currentScreen;
if (c.inventorySlots != null) {
for (int i = 0;i < c.inventorySlots.inventorySlots.size();i++) {
Slot s = c.inventorySlots.inventorySlots.get(i);
if (s instanceof ITooltipSlot && e.getItemStack() == s.getStack() && ((ITooltipSlot) s).showTooltip()) {
ITooltipSlot t = (ITooltipSlot) s;
t.getTooltip(e.getToolTip());
}
}
}
}
if (tooltipOverrideFast.containsKey(e.getItemStack().getItem())) {
Entry<String, String> entry = tooltipOverrideFast.get(e.getItemStack().getItem());
e.getToolTip().addAll((Collection<? extends String>) Arrays.asList((I18n.format(entry.getValue())).split("/n")).stream().map(s -> entry.getKey() + s).collect(Collectors.<String>toList()));
}
}
}
示例3: addResearchRequirements
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@Override
public void addResearchRequirements(String techName, int[] requirements) throws InvalidArgumentException {
validateTechName(techName);
if (!techs.containsKey(techName)) {
throw new InvalidArgumentException("Cannot add research requirements to a tech with the name \"" + techName
+ "\" because no such tech exists!");
}
Tech t = techs.get(techName);
if (t.requirements.length < requirements.length) {
t.requirements = Arrays.copyOf(t.requirements, requirements.length);
}
for (int i = 0; i < requirements.length; i++) {
if (requirements[i] < 0) {
throw new InvalidArgumentException("The requirement " + requirements[i] + " was less than 0!");
}
t.requirements[i] += requirements[i];
}
}
示例4: subtractResearchRequirements
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@Override
public void subtractResearchRequirements(String techName, int[] requirements) throws InvalidArgumentException {
validateTechName(techName);
if (!techs.containsKey(techName)) {
throw new InvalidArgumentException("Cannot subtract research requirements from a tech with the name \"" + techName
+ "\" because no such tech exists!");
}
Tech t = techs.get(techName);
if (t.requirements.length < requirements.length) {
t.requirements = Arrays.copyOf(t.requirements, requirements.length);
}
for (int i = 0; i < requirements.length; i++) {
if (requirements[i] < 0) {
throw new InvalidArgumentException("The requirement " + requirements[i] + " was less than 0!");
}
if (t.requirements[i] - requirements[i] < 0) {
throw new InvalidArgumentException("The requirement " + requirements[i] + " negated from " + t.requirements[i] + " was less than 0!");
}
}
for (int i = 0; i < requirements.length; i++) {
t.requirements[i] -= requirements[i];
}
}
示例5: update
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
/**
* Update state of the active server instance.
*
* This method writes this instance's Server Address to a shared node in Zookeeper.
* This information is used by other passive instances to locate the current active server.
* @throws Exception
* @param serverId ID of this server instance
*/
public void update(String serverId) throws AtlasBaseException {
try {
CuratorFramework client = curatorFactory.clientInstance();
HAConfiguration.ZookeeperProperties zookeeperProperties =
HAConfiguration.getZookeeperProperties(configuration);
String atlasServerAddress = HAConfiguration.getBoundAddressForId(configuration, serverId);
List<ACL> acls = Arrays.asList(
new ACL[]{AtlasZookeeperSecurityProperties.parseAcl(zookeeperProperties.getAcl(),
ZooDefs.Ids.OPEN_ACL_UNSAFE.get(0))});
Stat serverInfo = client.checkExists().forPath(getZnodePath(zookeeperProperties));
if (serverInfo == null) {
client.create().
withMode(CreateMode.EPHEMERAL).
withACL(acls).
forPath(getZnodePath(zookeeperProperties));
}
client.setData().forPath(getZnodePath(zookeeperProperties),
atlasServerAddress.getBytes(Charset.forName("UTF-8")));
} catch (Exception e) {
throw new AtlasBaseException(AtlasErrorCode.CURATOR_FRAMEWORK_UPDATE, e, "forPath: getZnodePath");
}
}
示例6: verifyExportForEmployeeData
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
private void verifyExportForEmployeeData(ZipSource zipSource) throws AtlasBaseException {
final List<String> expectedEntityTypes = Arrays.asList(new String[]{"Manager", "Employee", "Department"});
assertNotNull(zipSource.getCreationOrder());
assertEquals(zipSource.getCreationOrder().size(), 2);
assertTrue(zipSource.hasNext());
while (zipSource.hasNext()) {
AtlasEntity entity = zipSource.next();
assertNotNull(entity);
assertEquals(AtlasEntity.Status.ACTIVE, entity.getStatus());
assertTrue(expectedEntityTypes.contains(entity.getTypeName()));
}
verifyTypeDefs(zipSource);
}
示例7: testImportThatUpdatesRegisteredDatabase
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@Test
public void testImportThatUpdatesRegisteredDatabase() throws Exception {
// setup database
when(hiveClient.getAllDatabases()).thenReturn(Arrays.asList(new String[]{TEST_DB_NAME}));
String description = "This is a default database";
when(hiveClient.getDatabase(TEST_DB_NAME)).thenReturn(
new Database(TEST_DB_NAME, description, "/user/hive/default", null));
when(hiveClient.getAllTables(TEST_DB_NAME)).thenReturn(Arrays.asList(new String[]{}));
returnExistingDatabase(TEST_DB_NAME, atlasClient, CLUSTER_NAME);
HiveMetaStoreBridge bridge = new HiveMetaStoreBridge(CLUSTER_NAME, hiveClient, atlasClient);
bridge.importHiveMetadata(true);
// verify update is called
verify(atlasClient).updateEntity(eq("72e06b34-9151-4023-aa9d-b82103a50e76"),
(Referenceable) argThat(
new MatchesReferenceableProperty(HiveMetaStoreBridge.DESCRIPTION_ATTR, description)));
}
示例8: getStack
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@Override
public ItemStack getStack() {
TEForge te = (TEForge)inventory;
if (te.selection==-1) {
return null;
}
AetoForgeRecipe r = AetoForgeRegistry.recipes.get(te.selection);
for (int i=0;i<r.inputs.size();i++) {
AetoForgeInput inp = r.inputs.get(i);
if (!inp.isValid(te.getStackInSlot(i))) {
return null;
}
}
return r.getOutput((ItemStack[]) Arrays.copyOf(te.inventory, 4));
}
示例9: addTabCompletionOptions
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
public List addTabCompletionOptions(ICommandSender sender, String[] params)
{
if(params.length == 1)
if(sender instanceof EntityPlayerMP){
if(params[0].trim().equals(""))
return Arrays.asList(new String[]{"list", "reload", "bind", "unbind"});
else if(params[0].trim().startsWith("l"))
return Arrays.asList(new String[]{"list"});
else if(params[0].trim().startsWith("r"))
return Arrays.asList(new String[]{"reload"});
else if(params[0].trim().startsWith("b"))
return Arrays.asList(new String[]{"bind"});
else if(params[0].trim().startsWith("u"))
return Arrays.asList(new String[]{"unbind"});
}
else
if(params[0].trim().equals(""))
return Arrays.asList(new String[]{"list", "reload"});
else if(params[0].trim().startsWith("l"))
return Arrays.asList(new String[]{"list"});
else if(params[0].trim().startsWith("r"))
return Arrays.asList(new String[]{"reload"});
return null;
}
示例10: addInformation
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4, String effects, int usage) {
super.addInformation(stack, player, list, par4);
if (stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
}
if (StringUtils.isShiftKeyDown()) {
list.add(StringUtils.getChargeText(stack.stackTagCompound.getInteger("energy"), maxCapacity));
list.add(StringUtils.getEnergyUsageText(usage));
if (effects != null && !effects.equals("[]") && !effects.equals("")) {
String[] effectList = effects.replace("[", "").replace("]", "").replace(" ", "").split(",");
if (effectList != null) {
for (int i = 0; i < effectList.length; i++) {
IEffect effect = FluxedTrinketsAPI.getEffectFromName(effectList[i]);
list.add(StringUtils.WHITE + StringUtils.localize("effect." + effect.getName() + ".name"));
list.addAll(Arrays.asList(formatTooltip(StringUtils.localize("effect." + effect.getName() + ".desc"))));
}
}
}
} else {
list.add(StringUtils.getShiftText());
}
}
示例11: onInit
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@Mod.EventHandler
public void onInit(FMLInitializationEvent e) {
//Fudge blocks into Smeltery Valid list
SmelteryUtil.addValidSmelteryBlock(
Arrays.asList(new Block[]{
smelteryAlloyInhibitor
})
);
}
示例12: main
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
/**
* Launch the application.
*/
public static void main(String[] arguments) {
final List<String> args = Arrays.asList(arguments);
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ProgramOutputDisplay frame = new ProgramOutputDisplay(args.get(0), String.join(" ", args.subList(1, args.size() - 1)));
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
示例13: loadCraftingRecipes
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@Override
public void loadCraftingRecipes(ItemStack result) {
if (result == null || result.getItem() != CivItems.technology)
return;
// Technology Creation + Researching
Tech t0 = CivItems.technology.getTech(result);
EResearchState state = CivItems.technology.getState(result); // Made from other techs
Tech[] parents = t0.getParentTechs();
ItemStack[] parentItems = new ItemStack[parents.length];
for (int i = 0; i < parents.length; i++)
parentItems[i] = CivItems.technology.getItemForTech(parents[i], parents[i].getSciencePacksNeeded());
if (parentItems.length != 0)
arecipes.add(new CachedShapelessRecipe(parentItems, CivItems.technology.getItemForTech(t0, new int[0])));
if (state == EResearchState.RESEARCHING || state == EResearchState.RESEARCHED) {
int[] packsGot = CivItems.technology.getScienceCount(result);
for (int idx = 0; idx < packsGot.length; idx++) {
int beakersGot = packsGot[idx];
int max = Math.min(beakersGot, 8);
for (int i = max; i > 0; i--) {
int[] arr = Arrays.copyOf(packsGot, packsGot.length);
arr[idx] -= i;
List<ItemStack> stacks = new ArrayList<ItemStack>();
stacks.add(CivItems.technology.getItemForTech(t0, arr));
for (int b = 0; b < i; b++)
stacks.add(new ItemStack(CivItems.sciencePacks[idx]));
arecipes.add(new CachedShapelessRecipe(stacks, result));
}
}
}
}
示例14: addTabCompletionOptions
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
public List addTabCompletionOptions(ICommandSender p_71516_1_, String[] strings)
{
if(strings.length == 1)
return Arrays.asList(new String[]{"print", "reload"});
if(strings.length == 2)
if(strings[1].toLowerCase().startsWith("p"))
return Arrays.asList(new String[]{"print"});
else if(strings[1].toLowerCase().startsWith("r"))
return Arrays.asList(new String[]{"reload"});
return null;
}
示例15: testGetTraitsNames
import scala.actors.threadpool.Arrays; //导入依赖的package包/类
@Test
public void testGetTraitsNames() throws Exception {
HierarchicalTypeDefinition<TraitType> classificationTraitDefinition = TypesUtil
.createTraitTypeDef("Classification", ImmutableSet.<String>of(),
TypesUtil.createRequiredAttrDef("tag", DataTypes.STRING_TYPE));
HierarchicalTypeDefinition<TraitType> piiTrait =
TypesUtil.createTraitTypeDef("PII", ImmutableSet.<String>of());
HierarchicalTypeDefinition<TraitType> phiTrait =
TypesUtil.createTraitTypeDef("PHI", ImmutableSet.<String>of());
HierarchicalTypeDefinition<TraitType> pciTrait =
TypesUtil.createTraitTypeDef("PCI", ImmutableSet.<String>of());
HierarchicalTypeDefinition<TraitType> soxTrait =
TypesUtil.createTraitTypeDef("SOX", ImmutableSet.<String>of());
HierarchicalTypeDefinition<TraitType> secTrait =
TypesUtil.createTraitTypeDef("SEC", ImmutableSet.<String>of());
HierarchicalTypeDefinition<TraitType> financeTrait =
TypesUtil.createTraitTypeDef("Finance", ImmutableSet.<String>of());
getTypeSystem().defineTypes(ImmutableList.<EnumTypeDefinition>of(),
ImmutableList.<StructTypeDefinition>of(),
ImmutableList.of(classificationTraitDefinition, piiTrait, phiTrait, pciTrait, soxTrait, secTrait,
financeTrait), ImmutableList.<HierarchicalTypeDefinition<ClassType>>of());
final ImmutableList<String> traitsNames = getTypeSystem().getTypeNamesByCategory(DataTypes.TypeCategory.TRAIT);
Assert.assertEquals(traitsNames.size(), 7);
List traits = Arrays.asList(new String[]{"Classification", "PII", "PHI", "PCI", "SOX", "SEC", "Finance",});
Assert.assertFalse(Collections.disjoint(traitsNames, traits));
}