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); }
/// <summary> /// converts object list to int array /// </summary> /// <param name="u"></param> /// <returns></returns> public static int[] ToInt32Array(java.util.ArrayList u) { int[] x = new int[u.size()]; for (int i = 0; i < u.size(); i++) { x[i] = (int)u.get(i); } return(x); }
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)); }
public static string test() { var result = ""; var l1 = new ArrayList<string> { "A", "B", "C" }; var l2 = new ArrayList<string> { "A", "C" }; for (int i = 0, j = 0; i < l1.size() && j < l2.size(); i++, j++) { if (l1[i].equals(l2[j])) { result += l1[i]; } else { break; } } for (int i = l1.size() - 1, j = l2.size() - 1; i >= 0 && j >= 0; --i, --j) { if (l1[i].equals(l2[j])) { result += l1[i]; } else { break; } } return result; }
public virtual BootableProjectInfo[] getDependencies() { ArrayList arrayList = new ArrayList(); foreach (Library library in this.getLibraries()) { if (library is BootableProjectInfo) arrayList.add((object) library); } foreach (Library library in this.getOptionalLibraries()) { if (library is BootableProjectInfo) arrayList.add((object) library); } return (BootableProjectInfo[]) arrayList.toArray((object[]) new BootableProjectInfo[arrayList.size()]); }
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); } } }
public RegionFile(File file) { lastModified = 0L; fileName = file; debugln((new StringBuilder()).append("REGION LOAD ").append(fileName).toString()); sizeDelta = 0; try { if (file.exists()) { lastModified = file.lastModified(); } dataFile = new RandomAccessFile(file, "rw"); if (dataFile.length() < 4096L) { for (int i = 0; i < 1024; i++) { dataFile.writeInt(0); } for (int j = 0; j < 1024; j++) { dataFile.writeInt(0); } sizeDelta += 8192; } if ((dataFile.length() & 4095L) != 0L) { for (int k = 0; k < (dataFile.length() & 4095L); k++) { dataFile.write(0); } } int l = (int) dataFile.length()/4096; sectorFree = new ArrayList(l); for (int i1 = 0; i1 < l; i1++) { sectorFree.add(Boolean.valueOf(true)); } sectorFree.set(0, Boolean.valueOf(false)); sectorFree.set(1, Boolean.valueOf(false)); dataFile.seek(0L); for (int j1 = 0; j1 < 1024; j1++) { int l1 = dataFile.readInt(); offsets[j1] = l1; if (l1 == 0 || (l1 >> 8) + (l1 & 0xff) > sectorFree.size()) { continue; } for (int j2 = 0; j2 < (l1 & 0xff); j2++) { sectorFree.set((l1 >> 8) + j2, Boolean.valueOf(false)); } } for (int k1 = 0; k1 < 1024; k1++) { int i2 = dataFile.readInt(); chunkTimestamps[k1] = i2; } } catch (IOException ioexception) { ioexception.printStackTrace(); } }
/** * Standard procedure to compile resources: * 1. Get an AppDomain correspondint to the Classloader. * 2. Create an assembly in the given appdomain * 3. Create a type for each resource, given the className (resourceName), contents (pReader.getBytes(resourceName)), and the AppDomain. * 4. Write the compiled types to the store. */ public override CompilationResult compile( string[] pResourceNames, ResourceReader pReader, ResourceStore pStore, ClassLoader pClassLoader ) { int OFFSETCONSTANT = 8; Type[] types = new Type[pResourceNames.Length]; string[] contents = new string[pResourceNames.Length]; CodeSnippetCompileUnit[] units = new CodeSnippetCompileUnit[pResourceNames.Length]; for (int i = 0; i < types.Length; i++) { string resourceName = pResourceNames[i].Replace('.','/')+".java"; byte[] byteArray = pReader.getBytes(resourceName); string fileContents = this.StringFromBytes(byteArray); units[i] = new CodeSnippetCompileUnit(fileContents.Replace("cli.", "")); if (fileContents.Contains("public static void consequence")) { object[] info = this.GetLinePragmaInfo(fileContents,OFFSETCONSTANT); if(info != null) units[i].LinePragma = new CodeLinePragma(info[0] as string, (int)info[1]); } } CodeDomProvider provider = GetProvider(); CompilerParameters compilerParameters = new CompilerParameters(); compilerParameters.GenerateInMemory = true; compilerParameters.IncludeDebugInformation = true; // compilerParameters.OutputAssembly = pResourceNames[i].Substring(pResourceNames[i].LastIndexOf('.') + 1); int count = 0; foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { if (assembly.FullName.StartsWith("CompiledRules")) { try { File.Delete(assembly.Location); } catch (System.Exception e) { count++; } } else { compilerParameters.ReferencedAssemblies.Add(assembly.Location); } } compilerParameters.OutputAssembly = "CompiledRules" + count + ".dll"; CompilerResults results = provider.CompileAssemblyFromDom //(compilerParameters, contents); (compilerParameters, units); Collection problems = new ArrayList(); DotnetPackageCompilationData pcData = (DotnetPackageCompilationData) ((PackageStore)pStore).getPackageCompilationData(); MemoryStream stream = new MemoryStream(1024); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, results.CompiledAssembly); for (int i = 0; i < types.Length; i++) { string resourceName = pResourceNames[i]; pcData.write(resourceName, new object[]{results.CompiledAssembly, stream.GetBuffer()}); } CompilationProblem[] result = new CompilationProblem[problems.size()]; return new CompilationResult(result); }
private static string[] parseVersions([In] string obj0) { if (obj0 == null) return new string[0]; ArrayList arrayList = new ArrayList(); StringTokenizer stringTokenizer = new StringTokenizer(obj0, "."); while (stringTokenizer.hasMoreTokens()) arrayList.add((object) stringTokenizer.nextToken()); return (string[]) arrayList.toArray((object[]) new string[arrayList.size()]); }
private PackageBodyNode parsePackageBody(bool global, int startPosition) { var result = new PackageBodyNode { StartPosition = startPosition }; startPosition = scanner.StartPosition; while (lexicalUnit == LexicalUnit.Keyword && scanner.Keyword == Keyword.Using) { if (!isIdentifier(nextLexicalUnit(true))) { throw error(ParseErrorId.IdentifierExpected); } var usingDirective = new UsingDirectiveNode { StartPosition = startPosition }; setScannerState(usingDirective); result.UsingDirectives.add(usingDirective); int sp = scanner.StartPosition; int len = getLexicalUnitLength(); var restorePoint = this.createRestorePoint(); if (nextLexicalUnit(true) == LexicalUnit.Assign) { usingDirective.AliasOffset = sp; usingDirective.AliasLength = len; nextLexicalUnit(true); } else { restore(restorePoint); } usingDirective.TypeOrPackage = parsePackageOrTypeName(true); usingDirective.EndPosition = parseSemiColon(false, false); } var done = false; var modifiers = EnumSet.noneOf(typeof(Modifier)); var annotations = new ArrayList<AnnotationSectionNode>(); do { switch (lexicalUnit) { case Keyword: case ContextualKeyword: switch (scanner.Keyword) { case Package: if (modifiers.size() > 0) { addError(ParseErrorId.PackageWithModifiers); modifiers.clear(); } var ns = new PackageDeclarationNode { StartPosition = scanner.StartPosition }; if (docCommentEndPosition > 0) { ns.DocumentationOffset = docCommentStartPosition; ns.DocumentationLength = docCommentEndPosition - docCommentStartPosition; docCommentEndPosition = 0; } setScannerState(ns); ns.Annotations.addAll(annotations); annotations.clear(); do { if (!isIdentifier(nextLexicalUnit(true))) { throw error(ParseErrorId.IdentifierExpected); } var part = new SourceCodePartNode { Offset = scanner.StartPosition, Length = getLexicalUnitLength() }; setScannerState(part); ns.Identifiers.add(part); } while (nextLexicalUnit(true) == LexicalUnit.Dot); if (lexicalUnit != LexicalUnit.OpenBrace) { throw error(ParseErrorId.OpenBraceExpected); } startPosition = scanner.StartPosition; if (nextLexicalUnit(true) != LexicalUnit.CloseBrace) { ns.Body = parsePackageBody(false, startPosition); } if (lexicalUnit != LexicalUnit.CloseBrace) { throw error(ParseErrorId.CloseBraceExpected); } ns.EndPosition = scanner.EndPosition; if (nextLexicalUnit(false) == LexicalUnit.SemiColon) { nextLexicalUnit(false); } result.Members.add(ns); break; case Public: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } addModifier(modifiers, Modifier.Public); nextLexicalUnit(true); break; case Protected: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } addModifier(modifiers, Modifier.Protected); nextLexicalUnit(true); break; case Private: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } addModifier(modifiers, Modifier.Private); nextLexicalUnit(true); break; case Abstract: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } addModifier(modifiers, Modifier.Abstract); nextLexicalUnit(true); break; case Final: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } addModifier(modifiers, Modifier.Final); nextLexicalUnit(true); break; case Static: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } addModifier(modifiers, Modifier.Static); nextLexicalUnit(true); break; case Strictfp: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } addModifier(modifiers, Modifier.Strictfp); nextLexicalUnit(true); break; case Partial: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } switch (nextLexicalUnit(true)) { case Keyword: switch (scanner.Keyword) { case Class: nextLexicalUnit(true); result.Members.add(parseClass(annotations, modifiers, false, true, startPosition)); modifiers.clear(); annotations.clear(); break; case Interface: nextLexicalUnit(true); result.Members.add(parseInterface(annotations, modifiers, true, startPosition)); modifiers.clear(); annotations.clear(); break; case Enum: nextLexicalUnit(true); result.Members.add(parseClass(annotations, modifiers, true, true, startPosition)); modifiers.clear(); annotations.clear(); break; default: throw error(ParseErrorId.ClassInterfaceEnumExpected); } break; default: throw error(ParseErrorId.ClassInterfaceEnumExpected); } break; case Class: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } nextLexicalUnit(true); result.Members.add(parseClass(annotations, modifiers, false, false, startPosition)); modifiers.clear(); annotations.clear(); break; case Interface: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } nextLexicalUnit(true); result.Members.add(parseInterface(annotations, modifiers, false, startPosition)); modifiers.clear(); annotations.clear(); break; case Enum: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } nextLexicalUnit(true); result.Members.add(parseClass(annotations, modifiers, true, false, startPosition)); modifiers.clear(); annotations.clear(); break; case Delegate: if (modifiers.size() == 0) { startPosition = scanner.StartPosition; } nextLexicalUnit(true); result.Members.add(parseDelegate(annotations, modifiers, startPosition)); modifiers.clear(); annotations.clear(); break; default: throw error(ParseErrorId.ClassInterfaceEnumDelegateExpected); } break; case OpenBracket: if (modifiers.size() > 0) { throw error(ParseErrorId.ClassInterfaceEnumDelegateExpected); } annotations.add(parseAnnotationSection()); break; case CloseBrace: if (global) { throw error(ParseErrorId.ClassInterfaceEnumDelegateExpected); } else { if (modifiers.size() > 0 || annotations.size() > 0) { throw error(ParseErrorId.ClassInterfaceEnumDelegateExpected); } done = true; } break; case EndOfStream: if (!global) { throw error(ParseErrorId.ClassInterfaceEnumDelegateExpected); } else { if (modifiers.size() > 0 || annotations.size() > 0) { throw error(ParseErrorId.ClassInterfaceEnumDelegateExpected); } done = true; } break; default: throw error(ParseErrorId.NoPackageMembers); } } while (!done); result.EndPosition = scanner.EndPosition; return result; }
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; ioException8 = (IOException) ByteCodeHelper.MapException<IOException>((Exception) ex, (ByteCodeHelper.MapFlags) num2); } ioException2 = ioException8; label_22: Log.warn((object) "Failed to lookup the user configurations.", (Exception) ioException2); } label_23: if (num1 != 0) { SystemPropertyConfiguration propertyConfiguration = new SystemPropertyConfiguration(); hierarchicalConfiguration.insertConfiguration((HierarchicalConfiguration) propertyConfiguration); } return (Configuration) hierarchicalConfiguration; }
public void testShortNumbersValidAndCorrectCost() { List<String> invalidStringCases = new ArrayList<String>(); foreach(String regionCode in shortNumberInfo.getSupportedRegions()) { if (regionCode == RegionCode.PG) { // The only short number for Papua New Guinea is 000, which fails the test, since the // national prefix is 0. This needs to be fixed. continue; } String exampleShortNumber = shortNumberInfo.getExampleShortNumber(regionCode); if (!shortNumberInfo.isValidShortNumber(exampleShortNumber, regionCode)) { String invalidStringCase = "region_code: " + regionCode + ", national_number: " + exampleShortNumber; invalidStringCases.add(invalidStringCase); LOGGER.log(Level.SEVERE, "Failed validation for string " + invalidStringCase); } PhoneNumber phoneNumber = phoneNumberUtil.parse(exampleShortNumber, regionCode); if (!shortNumberInfo.isValidShortNumber(phoneNumber)) { invalidCases.add(phoneNumber); LOGGER.log(Level.SEVERE, "Failed validation for " + phoneNumber.toString()); } foreach(ShortNumberInfo.ShortNumberCost cost in System.Enum.GetValues(typeof(ShortNumberInfo.ShortNumberCost))) { exampleShortNumber = shortNumberInfo.getExampleShortNumberForCost(regionCode, cost); if (!exampleShortNumber.equals("")) { phoneNumber = phoneNumberUtil.parse(exampleShortNumber, regionCode); if (cost != shortNumberInfo.getExpectedCost(phoneNumber)) { wrongTypeCases.add(phoneNumber); LOGGER.log(Level.SEVERE, "Wrong cost for " + phoneNumber.toString()); } } } } assertEquals(0, invalidStringCases.size()); assertEquals(0, invalidCases.size()); assertEquals(0, wrongTypeCases.size()); }
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()); } }
public virtual void removeTarget(LogTarget target) { if (target == null) { Throwable.__\u003CsuppressFillInStackTrace\u003E(); throw new NullPointerException(); } else { ArrayList arrayList = new ArrayList(); arrayList.addAll((Collection) Arrays.asList((object[]) this.logTargets)); arrayList.remove((object) target); LogTarget[] logTargetArray = new LogTarget[arrayList.size()]; this.logTargets = (LogTarget[]) arrayList.toArray((object[]) logTargetArray); } }
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; int k3 = chunkposition.z; int l3 = worldObj.getBlockId(i3, j3, k3); int i4 = worldObj.getBlockId(i3, j3 - 1, k3); if (l3 == 0 && Block.opaqueCubeLookup[i4] && ExplosionRNG.nextInt(3) == 0) { worldObj.setBlockWithNotify(i3, j3, k3, Block.fire.blockID); } } } }
public virtual Library[] getOptionalLibraries() { ArrayList arrayList = new ArrayList(); for (int index = 0; index < this.optionalLibraries.size(); ++index) { Library library = ((BasicProjectInfo.OptionalLibraryHolder) this.optionalLibraries.get(index)).getLibrary(); if (library != null) arrayList.add((object) library); } return (Library[]) arrayList.toArray((object[]) new Library[arrayList.size()]); }
// // Overload resolution // private CandidateMethodInfo resolveOverloading(List<CandidateMethodInfo> methodInfos, bool extensionMethods) { if (!extensionMethods) { // // Filter the methods from base types and outer types // TypeInfo mostNestedType = null; foreach (var i in methodInfos) { var type = i.method.DeclaringType; if (mostNestedType == null) { mostNestedType = type; } else { var t = type; while ((t = t.DeclaringType) != null) { if (mostNestedType.isAssignableFrom(t)) { mostNestedType = type; break; } } } } var mostDerivedType = mostNestedType; foreach (var i in methodInfos) { var type = i.method.getDeclaringType(); if (mostDerivedType == null) { mostDerivedType = type; } else if (mostDerivedType.isAssignableFrom(type)) { mostDerivedType = type; } } var filteredMethods = new ArrayList<CandidateMethodInfo>(); foreach (var i in methodInfos) { if (i.method.DeclaringType == mostDerivedType) { filteredMethods.add(i); } } if (filteredMethods.size() > 0) { if (filteredMethods.size() == 1) { return filteredMethods[0]; } else { methodInfos = filteredMethods; } } } // // Look for the better function member // var betterFunctionMember = methodInfos[0]; var found = false; for (int i = 1; i < methodInfos.size(); i++) { var mi = methodInfos.get(i); var m = getBetterMethod(betterFunctionMember, mi); if (m == null) { var m1 = betterFunctionMember.method; var m2 = methodInfos.get(i).method; if (m1.GenericMethodDefinition != null) { if (m2.GenericArguments.any()) { m = mi; } } else if (m2.GenericArguments.any()) { m = betterFunctionMember; } if (m1.IsVarargs && betterFunctionMember.expandedForm) { if (!m2.IsVarargs) { m = mi; } else { int c1 = m1.Parameters.count(); int c2 = m2.Parameters.count(); if (c1 < c2) { m = betterFunctionMember; } else if (c1 > c2) { m = mi; } } } else if (m2.IsVarargs && mi.expandedForm) { m = betterFunctionMember; } if (m1.GenericMethodDefinition != null && m2.GenericMethodDefinition != null) { m1 = m1.OriginalMethodDefinition; m2 = m2.OriginalMethodDefinition; var gmi = getMethodWithMostSpecificParameters(m1, m2); if (gmi == m1) { m = betterFunctionMember; } else if (gmi == m2) { m = mi; } } } if (m != null) { betterFunctionMember = m; found = true; } } if (found) { return betterFunctionMember; } else { return null; } }
private MethodInfo resolveMethodGroup(ExpressionInfo info, MethodInfo method, ArrayList<TypeInfo> paramTypes) { MethodInfo result = null; foreach (var mi in info.Members) { if (mi.MemberKind != MemberKind.Method) { return null; } var meth = mi.Method; if (method.IsVarargs != meth.IsVarargs) { continue; } int nparams = meth.Parameters.count(); if (nparams != paramTypes.size()) { continue; } var match = true; int i = 0; foreach (var p in meth.Parameters) { if (p.Type != paramTypes[i]) { match = false; break; } i++; } if (match) { if (result != null) { return null; } result = meth; } } return result; }
MethodInfo resolveMethod(Iterable<MethodInfo> methods, Iterable<ExpressionNode> arguments, TypeInfo returnType, bool extensionMethods) { var candidates = new ArrayList<CandidateMethodInfo>(); var hasLambda = false; foreach (var method in methods) { var parameterCount = method.Parameters.count(); var argumentCount = arguments.count(); if (method.IsVarargs) { if (argumentCount < parameterCount - 1) { continue; } } else if (argumentCount != parameterCount) { continue; } var fixedArgumentCount = (method.IsVarargs) ? parameterCount - 1 : parameterCount; var isCompatible = true; var parameterTypes = new TypeInfo[argumentCount]; var expandedForm = method.IsVarargs; if (!method.IsClosed) { var typeVariableInfos = new HashMap<TypeInfo, TypeVariableInfo>(); foreach (var t in method.GenericArguments) { typeVariableInfos[t] = new TypeVariableInfo(t); } // Inference phase 1 var nit = arguments.iterator(); var pit = method.Parameters.iterator(); bool closedParams = true; for (int i = 0; i < fixedArgumentCount; i++) { var paramType = pit.next().Type; var argNode = nit.next(); if (paramType.IsClosed) { if (!isArgumentCompatible(argNode, paramType)) { goto continueLookup; } } else { closedParams = false; if (argNode.ExpressionKind == ExpressionKind.Lambda) { hasLambda = true; makeExplicitParameterTypeInference(argNode, paramType, typeVariableInfos); } else { var argInfo = argNode.getUserData(typeof(ExpressionInfo)); if (argInfo == null) { continue; } if (BytecodeHelper.isDelegateType(paramType) || BytecodeHelper.isExpressionTreeType(paramType)) { makeExplicitParameterTypeInference(argNode, paramType, typeVariableInfos); } else { ValidationHelper.getType(context, argNode); makeOutputTypeInference(argNode, paramType, typeVariableInfos); } } } } if (method.IsVarargs) { var paramType = pit.next().Type.ElementType; var isClosedParam = paramType.IsClosed; var first = true; while (nit.hasNext()) { var argNode = nit.next(); if (isClosedParam) { switch (isVarargCompatible(argNode, paramType, first)) { case False: goto continueLookup; case True: expandedForm = false; if (nit.hasNext()) { goto continueLookup; } break; } } else { closedParams = false; if (argNode.ExpressionKind == ExpressionKind.Lambda) { hasLambda = true; makeExplicitParameterTypeInference(argNode, paramType, typeVariableInfos); } else { var argInfo = argNode.getUserData(typeof(ExpressionInfo)); if (argInfo == null) { continue; } if (BytecodeHelper.isDelegateType(paramType) || BytecodeHelper.isExpressionTreeType(paramType)) { makeExplicitParameterTypeInference(argNode, paramType, typeVariableInfos); } else if (paramType != ValidationHelper.getType(context, argNode) && !ValidationHelper.isAssignable(context, paramType, argNode) && first && ValidationHelper.isAssignable(context, paramType.getArrayType(), argNode)) { expandedForm = false; makeOutputTypeInference(argNode, paramType.getArrayType(), typeVariableInfos); } else { makeOutputTypeInference(argNode, paramType, typeVariableInfos); } } } first = false; } } if (closedParams && returnType != null && returnType != context.TypeSystem.VoidType) { makeLowerBoundInference(returnType, method.ReturnType, typeVariableInfos); } // Inference phase 2 for (;;) { var varFixed = false; var hasUnfixed = false; foreach (var e in typeVariableInfos.entrySet()) { if (e.Value.fixedType != null) { continue; } if (!containsUnfixedVariables(e.getValue().dependencies, typeVariableInfos)) { if (fixTypeVariable(e.getValue())) { varFixed = true; continue; } } hasUnfixed = true; } if (!varFixed) { varFixed = false; foreach (var e in typeVariableInfos.entrySet()) { if (e.Value.fixedType != null) { continue; } if (hasUnfixedTypeVariablesDependingOn(e.Key, typeVariableInfos, new HashSet<TypeInfo>())) { if (!e.Value.bounds.isEmpty()) { if (fixTypeVariable(e.Value)) { varFixed = true; continue; } } } hasUnfixed = true; } } if (!varFixed && hasUnfixed) { goto continueLookup; } if (!hasUnfixed) { break; } var mit = method.Parameters.iterator(); TypeInfo paramType = null; foreach (var e in arguments) { if (mit.hasNext()) { paramType = mit.next().Type; } if (e.ExpressionKind != ExpressionKind.Lambda) { if (!BytecodeHelper.isDelegateType(paramType) && !BytecodeHelper.isExpressionTreeType(paramType)) { continue; } } var m = getInvokeMethod(paramType); if (hasUnfixedTypeVariables(m.ReturnType, typeVariableInfos)) { hasUnfixed = false; foreach (var p in m.Parameters) { if (hasUnfixedTypeVariables(p.Type, typeVariableInfos)) { hasUnfixed = true; break; } } if (!hasUnfixed) { makeOutputTypeInference(e, paramType, typeVariableInfos); } } } } var typeArguments = new ArrayList<TypeInfo>(); foreach (var t in method.GenericArguments) { typeArguments.add(typeVariableInfos[t].fixedType); } method = context.TypeSystem.getGenericMethod(method, typeArguments); } var it1 = arguments.iterator(); var it2 = method.Parameters.iterator(); int i; for (i = 0; i < fixedArgumentCount; i++) { var argNode = it1.next(); var paramType = it2.next().Type; parameterTypes[i] = paramType; if (!isArgumentCompatible(argNode, paramType)) { isCompatible = false; break; } else if (argNode.ExpressionKind == ExpressionKind.Lambda) { hasLambda = true; } } if (isCompatible && method.IsVarargs) { var paramType = it2.next().Type.ElementType; var first = true; while (isCompatible && it1.hasNext()) { var argNode = it1.next(); parameterTypes[i++] = paramType; switch (isVarargCompatible(argNode, paramType, first)) { case False: isCompatible = false; break; case True: expandedForm = false; if (it1.hasNext()) { isCompatible = false; break; } else if (argNode.ExpressionKind == ExpressionKind.Lambda) { hasLambda = true; } break; } first = false; } } if (isCompatible) { candidates.add(new CandidateMethodInfo(method, parameterTypes, arguments, expandedForm)); } continueLookup: ; } if (candidates.size() == 0) { return null; } CandidateMethodInfo result; if (candidates.size() > 1) { result = resolveOverloading(candidates, extensionMethods); if (result == null) { return null; } } else { result = candidates[0]; } if (hasLambda) { int parameterCount = result.method.Parameters.count(); int argumentCount = arguments.count(); int fixedArgumentCount = (result.method.IsVarargs) ? parameterCount - 1 : parameterCount; var parameterTypes = new TypeInfo[argumentCount]; var pit = result.method.getParameters().iterator(); int i; for (i = 0; i < fixedArgumentCount; i++) { parameterTypes[i] = pit.next().Type; } if (result.method.IsVarargs) { if (result.expandedForm) { var paramType = pit.next().Type.ElementType; while (i < argumentCount) { parameterTypes[i++] = paramType; } } else { parameterTypes[i] = pit.next().Type; } } i = 0; foreach (var argNode in arguments) { expressionValidator.handleExpression(argNode, parameterTypes[i], true); i++; } } return result.method; }
public string GetText(PDDocument pdfDocument, bool format) { string text; double num; string str = ""; if (format) { try { PDFHelper.DisplayTrialPopupIfNecessary(); PDFTextStripperByArea pDFTextStripperByArea = new PDFTextStripperByArea(); if (PDFHelper.AddStamp) { str = string.Concat(str, "You are using a trial license of PDF Toolkit, as a result only the first three pages would be extracted."); pDFTextStripperByArea.setEndPage(3); } pDFTextStripperByArea.setSortByPosition(true); java.util.List arrayList = new java.util.ArrayList(); PDPageTree pages = pdfDocument.getPages(); arrayList.size(); foreach (PDPage page in pages) { if ((!PDFHelper.AddStamp ? true : pages.indexOf(page) <= 2)) { PDRectangle cropBox = page.getCropBox(); int rotation = page.getRotation(); if (cropBox == null) { cropBox = page.getMediaBox(); } int num1 = 0; int num2 = 0; if (rotation % 180 != 0) { num = Math.Round((double)cropBox.getWidth()); num1 = int.Parse(num.ToString()) - 50; num = Math.Round((double)cropBox.getHeight()); num2 = int.Parse(num.ToString()) - 50; } else { num = Math.Round((double)cropBox.getHeight()); num1 = int.Parse(num.ToString()) - 50; num = Math.Round((double)cropBox.getWidth()); num2 = int.Parse(num.ToString()) - 50; } pDFTextStripperByArea.addRegion("class1", new java.awt.Rectangle(0, 0, num2, num1)); pDFTextStripperByArea.extractRegions(page); str = string.Concat(str, pDFTextStripperByArea.getTextForRegion("class1")); } else { break; } } } catch (Exception exception1) { Exception exception = exception1; throw new PDFToolkitException(exception.Message, exception.InnerException); } text = str; } else { text = this.GetText(pdfDocument); } return(text); }
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); } }
public virtual Module[] getActiveModules() { ArrayList arrayList = new ArrayList(); for (int index = 0; index < this.modules.size(); ++index) { PackageState packageState = (PackageState) this.modules.get(index); if (packageState.getState() == 2) arrayList.add((object) packageState.getModule()); } return (Module[]) arrayList.toArray((object[]) new Module[arrayList.size()]); }
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(); }
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))); }
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); } }