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


C# ArrayList.get方法代码示例

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


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

示例1: EntityPainting

        public EntityPainting(World world, int i, int j, int k, int l)
            : this(world)
        {
            xPosition = i;
            yPosition = j;
            zPosition = k;
            var arraylist = new ArrayList();
            EnumArt[] aenumart = EnumArt.values();
            int i1 = aenumart.Length;
            for (int j1 = 0; j1 < i1; j1++)
            {
                EnumArt enumart = aenumart[j1];
                art = enumart;
                func_179_a(l);
                if (onValidSurface())
                {
                    arraylist.add(enumart);
                }
            }

            if (arraylist.size() > 0)
            {
                art = (EnumArt) arraylist.get(rand.nextInt(arraylist.size()));
            }
            func_179_a(l);
        }
开发者ID:riverar,项目名称:Crafty,代码行数:26,代码来源:EntityPainting.cs

示例2: sort

    public static void sort(List modules)
    {
      HashMap hashMap = new HashMap();
      ArrayList arrayList1 = new ArrayList();
      ArrayList arrayList2 = new ArrayList();
      for (int index = 0; index < modules.size(); ++index)
      {
        PackageState packageState = (PackageState) modules.get(index);
        if (packageState.getState() == -2)
        {
          arrayList1.add((object) packageState);
        }
        else
        {
          PackageSorter.SortModule sortModule = new PackageSorter.SortModule(packageState);
          arrayList2.add((object) sortModule);
          hashMap.put((object) packageState.getModule().getModuleClass(), (object) sortModule);
        }
      }
      PackageSorter.SortModule[] sortModuleArray = (PackageSorter.SortModule[]) arrayList2.toArray((object[]) new PackageSorter.SortModule[arrayList2.size()]);
      for (int index = 0; index < sortModuleArray.Length; ++index)
      {
        PackageSorter.SortModule sortModule = sortModuleArray[index];
        sortModule.setDependSubsystems(PackageSorter.collectSubsystemModules(sortModule.getState().getModule(), hashMap));
      }
      int num1 = 1;
label_10:
      while (num1 != 0)
      {
        num1 = 0;
        int index = 0;
        while (true)
        {
          if (index < sortModuleArray.Length)
          {
            PackageSorter.SortModule sortModule = sortModuleArray[index];
            int num2 = PackageSorter.searchModulePosition(sortModule, hashMap);
            if (num2 != sortModule.getPosition())
            {
              sortModule.setPosition(num2);
              num1 = 1;
            }
            ++index;
          }
          else
            goto label_10;
        }
      }
      Arrays.sort((object[]) sortModuleArray);
      modules.clear();
      for (int index = 0; index < sortModuleArray.Length; ++index)
        modules.add((object) sortModuleArray[index].getState());
      for (int index = 0; index < arrayList1.size(); ++index)
        modules.add(arrayList1.get(index));
    }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:55,代码来源:PackageSorter.cs

示例3: doEffects

        public void doEffects()
        {
            worldObj.playSoundEffect(explosionX, explosionY, explosionZ, "random.explode", 4F,
                                     (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat())*0.2F)*0.7F);
            var arraylist = new ArrayList();
            arraylist.addAll(destroyedBlockPositions);
            for (int i = arraylist.size() - 1; i >= 0; i--)
            {
                var chunkposition = (ChunkPosition) arraylist.get(i);
                int j = chunkposition.x;
                int k = chunkposition.y;
                int l = chunkposition.z;
                int i1 = worldObj.getBlockId(j, k, l);
                for (int j1 = 0; j1 < 1; j1++)
                {
                    double d = j + worldObj.rand.nextFloat();
                    double d1 = k + worldObj.rand.nextFloat();
                    double d2 = l + worldObj.rand.nextFloat();
                    double d3 = d - explosionX;
                    double d4 = d1 - explosionY;
                    double d5 = d2 - explosionZ;
                    double d6 = MathHelper.sqrt_double(d3*d3 + d4*d4 + d5*d5);
                    d3 /= d6;
                    d4 /= d6;
                    d5 /= d6;
                    double d7 = 0.5D/(d6/explosionSize + 0.10000000000000001D);
                    d7 *= worldObj.rand.nextFloat()*worldObj.rand.nextFloat() + 0.3F;
                    d3 *= d7;
                    d4 *= d7;
                    d5 *= d7;
                    worldObj.spawnParticle("explode", (d + explosionX*1.0D)/2D, (d1 + explosionY*1.0D)/2D,
                                           (d2 + explosionZ*1.0D)/2D, d3, d4, d5);
                    worldObj.spawnParticle("smoke", d, d1, d2, d3, d4, d5);
                }

                if (i1 > 0)
                {
                    Block.blocksList[i1].dropBlockAsItemWithChance(worldObj, j, k, l, worldObj.getBlockMetadata(j, k, l),
                                                                   0.3F);
                    worldObj.setBlockWithNotify(j, k, l, 0);
                    Block.blocksList[i1].onBlockDestroyedByExplosion(worldObj, j, k, l);
                }
            }
        }
开发者ID:riverar,项目名称:Crafty,代码行数:44,代码来源:Explosion.cs

示例4: addModule

 public virtual void addModule(string modClass)
 {
   ArrayList arrayList = new ArrayList();
   if (!this.loadModule((ModuleInfo) new DefaultModuleInfo(modClass, (string) null, (string) null, (string) null), new ArrayList(), arrayList, false))
     return;
   for (int index = 0; index < arrayList.size(); ++index)
     this.modules.add((object) new PackageState((Module) arrayList.get(index)));
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:8,代码来源:PackageManager.cs

示例5: printUsedModules

 public virtual void printUsedModules(PrintStream p)
 {
   Module[] allModules = this.getAllModules();
   ArrayList arrayList1 = new ArrayList();
   ArrayList arrayList2 = new ArrayList();
   for (int index = 0; index < allModules.Length; ++index)
   {
     if (this.isModuleAvailable((ModuleInfo) allModules[index]))
       arrayList1.add((object) allModules[index]);
     else
       arrayList2.add((object) allModules[index]);
   }
   p.print("Active modules: ");
   p.println(arrayList1.size());
   p.println("----------------------------------------------------------");
   for (int index = 0; index < arrayList1.size(); ++index)
   {
     Module module = (Module) arrayList1.get(index);
     p.print((object) new PadMessage((object) module.getModuleClass(), 70));
     p.print(" [");
     p.print(module.getSubSystem());
     p.println("]");
     p.print("  Version: ");
     p.print(module.getMajorVersion());
     p.print("-");
     p.print(module.getMinorVersion());
     p.print("-");
     p.print(module.getPatchLevel());
     p.print(" Producer: ");
     p.println(module.getProducer());
     p.print("  Description: ");
     p.println(module.getDescription());
   }
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:34,代码来源:PackageManager.cs

示例6: createDefaultHierarchicalConfiguration

    protected internal virtual Configuration createDefaultHierarchicalConfiguration(string staticConfig, string userConfig, bool addSysProps, Class source)
    {
      int num1 = addSysProps ? 1 : 0;
      HierarchicalConfiguration hierarchicalConfiguration = new HierarchicalConfiguration();
      if (staticConfig != null)
      {
        PropertyFileConfiguration fileConfiguration = new PropertyFileConfiguration();
        fileConfiguration.load(staticConfig, Object.instancehelper_getClass((object) this));
        hierarchicalConfiguration.insertConfiguration((HierarchicalConfiguration) fileConfiguration);
        hierarchicalConfiguration.insertConfiguration((HierarchicalConfiguration) this.getPackageManager().getPackageConfiguration());
      }
      if (userConfig != null)
      {
        string str = !String.instancehelper_startsWith(userConfig, "/") ? userConfig : String.instancehelper_substring(userConfig, 1);
        Enumeration resources;
        ArrayList arrayList;
        IOException ioException1;
        try
        {
          resources = ObjectUtilities.getClassLoader(Object.instancehelper_getClass((object) this)).getResources(str);
          arrayList = new ArrayList();
          goto label_7;
        }
        catch (IOException ex)
        {
          int num2 = 1;
          ioException1 = (IOException) ByteCodeHelper.MapException<IOException>((Exception) ex, (ByteCodeHelper.MapFlags) num2);
        }
        IOException ioException2 = ioException1;
        goto label_22;
label_7:
        IOException ioException3;
        IOException ioException4;
        while (true)
        {
          URL url;
          IOException ioException5;
          try
          {
            if (resources.hasMoreElements())
            {
              url = (URL) resources.nextElement();
              try
              {
                PropertyFileConfiguration fileConfiguration = new PropertyFileConfiguration();
                InputStream @in = url.openStream();
                fileConfiguration.load(@in);
                @in.close();
                arrayList.add((object) fileConfiguration);
                continue;
              }
              catch (IOException ex)
              {
                int num2 = 1;
                ioException5 = (IOException) ByteCodeHelper.MapException<IOException>((Exception) ex, (ByteCodeHelper.MapFlags) num2);
              }
            }
            else
              goto label_17;
          }
          catch (IOException ex)
          {
            int num2 = 1;
            ioException3 = (IOException) ByteCodeHelper.MapException<IOException>((Exception) ex, (ByteCodeHelper.MapFlags) num2);
            break;
          }
          IOException ioException6 = ioException5;
          try
          {
            IOException ioException7 = ioException6;
            Log.warn((object) new StringBuffer().append("Failed to load the user configuration at ").append((object) url).toString(), (Exception) ioException7);
          }
          catch (IOException ex)
          {
            int num2 = 1;
            ioException4 = (IOException) ByteCodeHelper.MapException<IOException>((Exception) ex, (ByteCodeHelper.MapFlags) num2);
            goto label_16;
          }
        }
        ioException2 = ioException3;
        goto label_22;
label_16:
        ioException2 = ioException4;
        goto label_22;
label_17:
        IOException ioException8;
        try
        {
          int num2 = arrayList.size() - 1;
          while (num2 >= 0)
          {
            PropertyFileConfiguration fileConfiguration = (PropertyFileConfiguration) arrayList.get(num2);
            hierarchicalConfiguration.insertConfiguration((HierarchicalConfiguration) fileConfiguration);
            num2 += -1;
          }
          goto label_23;
        }
        catch (IOException ex)
        {
          int num2 = 1;
//.........这里部分代码省略.........
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:101,代码来源:AbstractBoot.cs

示例7: save

 public virtual void save(OutputStream outStream, Configuration config)
 {
   ArrayList arrayList = new ArrayList();
   Iterator propertyKeys = config.findPropertyKeys("");
   while (propertyKeys.hasNext())
   {
     string str = (string) propertyKeys.next();
     arrayList.add((object) str);
   }
   Collections.sort((List) arrayList);
   OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outStream, "iso-8859-1");
   for (int index = 0; index < arrayList.size(); ++index)
   {
     string str = (string) arrayList.get(index);
     string configProperty = config.getConfigProperty(str);
     string description = this.getDescription(str);
     if (description != null)
       this.writeDescription(description, (Writer) outputStreamWriter);
     this.saveConvert(str, 0, (Writer) outputStreamWriter);
     ((Writer) outputStreamWriter).write("=");
     this.saveConvert(configProperty, 1, (Writer) outputStreamWriter);
     ((Writer) outputStreamWriter).write(SortedConfigurationWriter.END_OF_LINE);
   }
   outputStreamWriter.flush();
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:25,代码来源:SortedConfigurationWriter.cs

示例8: updateTrackedEntities

        public void updateTrackedEntities()
        {
            var arraylist = new ArrayList();
            Iterator iterator = trackedEntitySet.iterator();
            do
            {
                if (!iterator.hasNext())
                {
                    break;
                }
                var entitytrackerentry = (EntityTrackerEntry) iterator.next();
                entitytrackerentry.updatePlayerList(mcServer.worldMngr.playerEntities);
                if (entitytrackerentry.playerEntitiesUpdated && (entitytrackerentry.trackedEntity is EntityPlayerMP))
                {
                    arraylist.add(entitytrackerentry.trackedEntity);
                }
            } while (true);

            for (int i = 0; i < arraylist.size(); i++)
            {
                var entityplayermp = (EntityPlayerMP) arraylist.get(i);
                Iterator iterator1 = trackedEntitySet.iterator();
                do
                {
                    if (!iterator1.hasNext())
                    {
                        break;
                    }
                    var entitytrackerentry1 = (EntityTrackerEntry) iterator1.next();
                    if (entitytrackerentry1.trackedEntity != entityplayermp)
                    {
                        entitytrackerentry1.updatePlayerEntity(entityplayermp);
                    }
                } while (true);
            }
        }
开发者ID:riverar,项目名称:Crafty,代码行数:36,代码来源:EntityTracker.cs

示例9: test

	public static int test(ArrayList<string> list) {
		return list.get(1).length();
	}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:3,代码来源:StringArrayList.stab.cs

示例10: doExplosion

        public void doExplosion()
        {
            float f = explosionSize;
            int i = 16;
            for (int j = 0; j < i; j++)
            {
                for (int l = 0; l < i; l++)
                {
                    for (int j1 = 0; j1 < i; j1++)
                    {
                        if (j != 0 && j != i - 1 && l != 0 && l != i - 1 && j1 != 0 && j1 != i - 1)
                        {
                            continue;
                        }
                        double d = (j/(i - 1.0F))*2.0F - 1.0F;
                        double d1 = (l/(i - 1.0F))*2.0F - 1.0F;
                        double d2 = (j1/(i - 1.0F))*2.0F - 1.0F;
                        double d3 = Math.sqrt(d*d + d1*d1 + d2*d2);
                        d /= d3;
                        d1 /= d3;
                        d2 /= d3;
                        float f1 = explosionSize*(0.7F + worldObj.rand.nextFloat()*0.6F);
                        double d5 = explosionX;
                        double d7 = explosionY;
                        double d9 = explosionZ;
                        float f2 = 0.3F;
                        do
                        {
                            if (f1 <= 0.0F)
                            {
                                goto label0;
                            }
                            int j4 = MathHelper.floor_double(d5);
                            int k4 = MathHelper.floor_double(d7);
                            int l4 = MathHelper.floor_double(d9);
                            int i5 = worldObj.getBlockId(j4, k4, l4);
                            if (i5 > 0)
                            {
                                f1 -= (Block.blocksList[i5].getExplosionResistance(exploder) + 0.3F)*f2;
                            }
                            if (f1 > 0.0F)
                            {
                                destroyedBlockPositions.add(new ChunkPosition(j4, k4, l4));
                            }
                            d5 += d*f2;
                            d7 += d1*f2;
                            d9 += d2*f2;
                            f1 -= f2*0.75F;
                        } while (true);

                        label0:
                        ;
                    }
                }
            }

            explosionSize *= 2.0F;
            int k = MathHelper.floor_double(explosionX - explosionSize - 1.0D);
            int i1 = MathHelper.floor_double(explosionX + explosionSize + 1.0D);
            int k1 = MathHelper.floor_double(explosionY - explosionSize - 1.0D);
            int l1 = MathHelper.floor_double(explosionY + explosionSize + 1.0D);
            int i2 = MathHelper.floor_double(explosionZ - explosionSize - 1.0D);
            int j2 = MathHelper.floor_double(explosionZ + explosionSize + 1.0D);
            List list = worldObj.getEntitiesWithinAABBExcludingEntity(exploder,
                                                                      AxisAlignedBB.getBoundingBoxFromPool(k, k1, i2, i1,
                                                                                                           l1, j2));
            Vec3D vec3d = Vec3D.createVector(explosionX, explosionY, explosionZ);
            for (int k2 = 0; k2 < list.size(); k2++)
            {
                var entity = (Entity) list.get(k2);
                double d4 = entity.getDistance(explosionX, explosionY, explosionZ)/explosionSize;
                if (d4 <= 1.0D)
                {
                    double d6 = entity.posX - explosionX;
                    double d8 = entity.posY - explosionY;
                    double d10 = entity.posZ - explosionZ;
                    double d11 = MathHelper.sqrt_double(d6*d6 + d8*d8 + d10*d10);
                    d6 /= d11;
                    d8 /= d11;
                    d10 /= d11;
                    double d12 = worldObj.func_494_a(vec3d, entity.boundingBox);
                    double d13 = (1.0D - d4)*d12;
                    entity.attackEntityFrom(exploder, (int) (((d13*d13 + d13)/2D)*8D*explosionSize + 1.0D));
                    double d14 = d13;
                    entity.motionX += d6*d14;
                    entity.motionY += d8*d14;
                    entity.motionZ += d10*d14;
                }
            }

            explosionSize = f;
            var arraylist = new ArrayList();
            arraylist.addAll(destroyedBlockPositions);
            if (isFlaming)
            {
                for (int l2 = arraylist.size() - 1; l2 >= 0; l2--)
                {
                    var chunkposition = (ChunkPosition) arraylist.get(l2);
                    int i3 = chunkposition.x;
                    int j3 = chunkposition.y;
//.........这里部分代码省略.........
开发者ID:riverar,项目名称:Crafty,代码行数:101,代码来源:Explosion.cs

示例11: updateAndPropagateCurrentStrength

 private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
 {
     func_21031_a(world, i, j, k, i, j, k);
     var arraylist = new ArrayList(field_21032_b);
     field_21032_b.clear();
     for (int l = 0; l < arraylist.size(); l++)
     {
         var chunkposition = (ChunkPosition) arraylist.get(l);
         world.notifyBlocksOfNeighborChange(chunkposition.x, chunkposition.y, chunkposition.z, blockID);
     }
 }
开发者ID:riverar,项目名称:Crafty,代码行数:11,代码来源:BlockRedstoneWire.cs


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