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


C# ArrayList.size方法代码示例

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


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

	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;
	}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:20,代码来源:For2.stab.cs

示例4: getDependencies

 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()]);
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:15,代码来源:BootableProjectInfo.cs

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

示例6: resolveOverloading

        //
        // 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) {
//.........这里部分代码省略.........
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:101,代码来源:MethodResolver.stab.cs

示例7: parsePackageBody

        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);
//.........这里部分代码省略.........
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:101,代码来源:Parser.stab.cs

示例8: testShortNumbersValidAndCorrectCost

        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());
        }
开发者ID:jason-persson,项目名称:LibPhoneNumberPortable,代码行数:37,代码来源:ExampleNumbersTest.cs

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

示例10: removeTarget

 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);
   }
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:16,代码来源:Log.cs

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

示例12: compile

        /**
         * 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);
        }
开发者ID:happy280684,项目名称:droolsdotnet,代码行数:86,代码来源:DotnetCSharpCompiler.cs

示例13: resolveMethodGroup

 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;
 }
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:32,代码来源:MethodResolver.stab.cs

示例14: resolveMethod


//.........这里部分代码省略.........
                                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;
        }
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:101,代码来源:MethodResolver.stab.cs

示例15: parseVersions

 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()]);
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:10,代码来源:ObjectUtilities.cs


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