ecj-4.2.2

16:35:29.798 INFO  jd.cli.Main - Decompiling ecj-4.2.2.jar
package org.eclipse.jdt.core;

import java.util.Comparator;

class JDTCompilerAdapter$1
  implements Comparator
{
  final JDTCompilerAdapter this$0;
  
  JDTCompilerAdapter$1(JDTCompilerAdapter paramJDTCompilerAdapter)
  {
    this$0 = paramJDTCompilerAdapter;
  }
  
  public int compare(Object o1, Object o2)
  {
    return ((String)o2).length() - ((String)o1).length();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.JDTCompilerAdapter.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Javac;
import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Commandline.Argument;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.JavaEnvUtils;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.antadapter.AntAdapterMessages;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
import org.eclipse.jdt.internal.compiler.util.Util;

public class JDTCompilerAdapter
  extends DefaultCompilerAdapter
{
  private static final char[] SEPARATOR_CHARS = { '/', '\\' };
  private static final char[] ADAPTER_PREFIX = "#ADAPTER#".toCharArray();
  private static final char[] ADAPTER_ENCODING = "ENCODING#".toCharArray();
  private static final char[] ADAPTER_ACCESS = "ACCESS#".toCharArray();
  private static String compilerClass = "org.eclipse.jdt.internal.compiler.batch.Main";
  String logFileName;
  Map customDefaultOptions;
  private Map fileEncodings = null;
  private Map dirEncodings = null;
  private List accessRules = null;
  
  public boolean execute()
    throws BuildException
  {
    attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.usingJDTCompiler"), 3);
    Commandline cmd = setupJavacCommand();
    try
    {
      Class c = Class.forName(compilerClass);
      Constructor batchCompilerConstructor = c.getConstructor(new Class[] { PrintWriter.class, PrintWriter.class, Boolean.TYPE, Map.class });
      Object batchCompilerInstance = batchCompilerConstructor.newInstance(new Object[] { new PrintWriter(System.out), new PrintWriter(System.err), Boolean.TRUE, customDefaultOptions });
      Method compile = c.getMethod("compile", new Class[] { String[].class });
      Object result = compile.invoke(batchCompilerInstance, new Object[] { cmd.getArguments() });
      boolean resultValue = ((Boolean)result).booleanValue();
      if ((!resultValue) && (logFileName != null)) {
        attributes.log(AntAdapterMessages.getString("ant.jdtadapter.error.compilationFailed", logFileName));
      }
      return resultValue;
    }
    catch (ClassNotFoundException localClassNotFoundException5)
    {
      throw new BuildException(AntAdapterMessages.getString("ant.jdtadapter.error.cannotFindJDTCompiler"));
    }
    catch (Exception ex)
    {
      throw new BuildException(ex);
    }
  }
  
  protected Commandline setupJavacCommand()
    throws BuildException
  {
    Commandline cmd = new Commandline();
    customDefaultOptions = new CompilerOptions().getMap();
    
    Class javacClass = Javac.class;
    
    String[] compilerArgs = processCompilerArguments(javacClass);
    
    cmd.createArgument().setValue("-noExit");
    if (bootclasspath != null)
    {
      cmd.createArgument().setValue("-bootclasspath");
      if (bootclasspath.size() != 0) {
        cmd.createArgument().setPath(bootclasspath);
      } else {
        cmd.createArgument().setValue(Util.EMPTY_STRING);
      }
    }
    if (extdirs != null)
    {
      cmd.createArgument().setValue("-extdirs");
      cmd.createArgument().setPath(extdirs);
    }
    Path classpath = new Path(project);
    
    classpath.append(getCompileClasspath());
    
    cmd.createArgument().setValue("-classpath");
    createClasspathArgument(cmd, classpath);
    
    Path sourcepath = null;
    
    Method getSourcepathMethod = null;
    try
    {
      getSourcepathMethod = javacClass.getMethod("getSourcepath", null);
    }
    catch (NoSuchMethodException localNoSuchMethodException1) {}
    Path compileSourcePath = null;
    if (getSourcepathMethod != null) {
      try
      {
        compileSourcePath = (Path)getSourcepathMethod.invoke(attributes, null);
      }
      catch (IllegalAccessException localIllegalAccessException1) {}catch (InvocationTargetException localInvocationTargetException1) {}
    }
    if (compileSourcePath != null) {
      sourcepath = compileSourcePath;
    } else {
      sourcepath = src;
    }
    cmd.createArgument().setValue("-sourcepath");
    createClasspathArgument(cmd, sourcepath);
    
    String javaVersion = JavaEnvUtils.getJavaVersion();
    String memoryParameterPrefix = javaVersion.equals("1.1") ? "-J-" : "-J-X";
    if (memoryInitialSize != null) {
      if (!attributes.isForkedJavac()) {
        attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.ignoringMemoryInitialSize"), 1);
      } else {
        cmd.createArgument().setValue(memoryParameterPrefix + 
          "ms" + memoryInitialSize);
      }
    }
    if (memoryMaximumSize != null) {
      if (!attributes.isForkedJavac()) {
        attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.ignoringMemoryMaximumSize"), 1);
      } else {
        cmd.createArgument().setValue(memoryParameterPrefix + 
          "mx" + memoryMaximumSize);
      }
    }
    if (debug)
    {
      Method getDebugLevelMethod = null;
      try
      {
        getDebugLevelMethod = javacClass.getMethod("getDebugLevel", null);
      }
      catch (NoSuchMethodException localNoSuchMethodException2) {}
      String debugLevel = null;
      if (getDebugLevelMethod != null) {
        try
        {
          debugLevel = (String)getDebugLevelMethod.invoke(attributes, null);
        }
        catch (IllegalAccessException localIllegalAccessException2) {}catch (InvocationTargetException localInvocationTargetException2) {}
      }
      if (debugLevel != null)
      {
        customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.localVariable", "do not generate");
        customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.lineNumber", "do not generate");
        customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.sourceFile", "do not generate");
        if (debugLevel.length() != 0)
        {
          if (debugLevel.indexOf("vars") != -1) {
            customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.localVariable", "generate");
          }
          if (debugLevel.indexOf("lines") != -1) {
            customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.lineNumber", "generate");
          }
          if (debugLevel.indexOf("source") != -1) {
            customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.sourceFile", "generate");
          }
        }
      }
      else
      {
        customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.localVariable", "generate");
        customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.lineNumber", "generate");
        customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.sourceFile", "generate");
      }
    }
    else
    {
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.localVariable", "do not generate");
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.lineNumber", "do not generate");
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.debug.sourceFile", "do not generate");
    }
    if (attributes.getNowarn())
    {
      Object[] entries = customDefaultOptions.entrySet().toArray();
      int i = 0;
      for (int max = entries.length; i < max; i++)
      {
        Map.Entry entry = (Map.Entry)entries[i];
        if ((entry.getKey() instanceof String)) {
          if ((entry.getValue() instanceof String)) {
            if (((String)entry.getValue()).equals("warning")) {
              customDefaultOptions.put(entry.getKey(), "ignore");
            }
          }
        }
      }
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.taskTags", Util.EMPTY_STRING);
      if (deprecation)
      {
        customDefaultOptions.put("org.eclipse.jdt.core.compiler.problem.deprecation", "warning");
        customDefaultOptions.put("org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode", "enabled");
        customDefaultOptions.put("org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod", "enabled");
      }
    }
    else if (deprecation)
    {
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.problem.deprecation", "warning");
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode", "enabled");
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod", "enabled");
    }
    else
    {
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.problem.deprecation", "ignore");
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode", "disabled");
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod", "disabled");
    }
    if (destDir != null)
    {
      cmd.createArgument().setValue("-d");
      cmd.createArgument().setFile(destDir.getAbsoluteFile());
    }
    if (verbose) {
      cmd.createArgument().setValue("-verbose");
    }
    if (!attributes.getFailonerror()) {
      cmd.createArgument().setValue("-proceedOnError");
    }
    if (target != null) {
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", target);
    }
    String source = attributes.getSource();
    if (source != null) {
      customDefaultOptions.put("org.eclipse.jdt.core.compiler.source", source);
    }
    if (compilerArgs != null)
    {
      int length = compilerArgs.length;
      if (length != 0)
      {
        int i = 0;
        for (int max = length; i < max; i++)
        {
          String arg = compilerArgs[i];
          if ((logFileName == null) && ("-log".equals(arg)) && (i + 1 < max)) {
            logFileName = compilerArgs[(i + 1)];
          }
          cmd.createArgument().setValue(arg);
        }
      }
    }
    if (encoding != null)
    {
      cmd.createArgument().setValue("-encoding");
      cmd.createArgument().setValue(encoding);
    }
    logAndAddFilesToCompile(cmd);
    return cmd;
  }
  
  private String[] processCompilerArguments(Class javacClass)
  {
    Method getCurrentCompilerArgsMethod = null;
    try
    {
      getCurrentCompilerArgsMethod = javacClass.getMethod("getCurrentCompilerArgs", null);
    }
    catch (NoSuchMethodException localNoSuchMethodException) {}
    String[] compilerArgs = null;
    if (getCurrentCompilerArgsMethod != null) {
      try
      {
        compilerArgs = (String[])getCurrentCompilerArgsMethod.invoke(attributes, null);
      }
      catch (IllegalAccessException localIllegalAccessException) {}catch (InvocationTargetException localInvocationTargetException) {}
    }
    if (compilerArgs != null) {
      checkCompilerArgs(compilerArgs);
    }
    return compilerArgs;
  }
  
  private void checkCompilerArgs(String[] args)
  {
    for (int i = 0; i < args.length; i++) {
      if (args[i].charAt(0) == '@') {
        try
        {
          char[] content = Util.getFileCharContent(new File(args[i].substring(1)), null);
          int offset = 0;
          int prefixLength = ADAPTER_PREFIX.length;
          while ((offset = CharOperation.indexOf(ADAPTER_PREFIX, content, true, offset)) > -1)
          {
            int start = offset + prefixLength;
            int end = CharOperation.indexOf('\n', content, start);
            if (end == -1) {
              end = content.length;
            }
            while (CharOperation.isWhitespace(content[end])) {
              end--;
            }
            if (CharOperation.equals(ADAPTER_ENCODING, content, start, start + ADAPTER_ENCODING.length))
            {
              CharOperation.replace(content, SEPARATOR_CHARS, File.separatorChar, start, end + 1);
              
              start += ADAPTER_ENCODING.length;
              int encodeStart = CharOperation.lastIndexOf('[', content, start, end);
              if ((start < encodeStart) && (encodeStart < end))
              {
                boolean isFile = CharOperation.equals(SuffixConstants.SUFFIX_java, content, encodeStart - 5, encodeStart, false);
                
                String str = String.valueOf(content, start, encodeStart - start);
                String enc = String.valueOf(content, encodeStart, end - encodeStart + 1);
                if (isFile)
                {
                  if (fileEncodings == null) {
                    fileEncodings = new HashMap();
                  }
                  fileEncodings.put(str, enc);
                }
                else
                {
                  if (dirEncodings == null) {
                    dirEncodings = new HashMap();
                  }
                  dirEncodings.put(str, enc);
                }
              }
            }
            else if (CharOperation.equals(ADAPTER_ACCESS, content, start, start + ADAPTER_ACCESS.length))
            {
              start += ADAPTER_ACCESS.length;
              int accessStart = CharOperation.indexOf('[', content, start, end);
              CharOperation.replace(content, SEPARATOR_CHARS, File.separatorChar, start, accessStart);
              if ((start < accessStart) && (accessStart < end))
              {
                String path = String.valueOf(content, start, accessStart - start);
                String access = String.valueOf(content, accessStart, end - accessStart + 1);
                if (accessRules == null) {
                  accessRules = new ArrayList();
                }
                accessRules.add(path);
                accessRules.add(access);
              }
            }
            offset = end;
          }
        }
        catch (IOException localIOException) {}
      }
    }
  }
  
  private void createClasspathArgument(Commandline cmd, Path classpath)
  {
    Commandline.Argument arg = cmd.createArgument();
    String[] pathElements = classpath.list();
    if (pathElements.length == 0)
    {
      arg.setValue(Util.EMPTY_STRING);
      return;
    }
    if (accessRules == null)
    {
      arg.setPath(classpath);
      return;
    }
    int rulesLength = accessRules.size();
    String[] rules = (String[])accessRules.toArray(new String[rulesLength]);
    int nextRule = 0;
    StringBuffer result = new StringBuffer();
    
    int i = 0;
    for (int max = pathElements.length; i < max; i++)
    {
      if (i > 0) {
        result.append(File.pathSeparatorChar);
      }
      String pathElement = pathElements[i];
      result.append(pathElement);
      for (int j = nextRule; j < rulesLength; j += 2)
      {
        String rule = rules[j];
        if (pathElement.endsWith(rule))
        {
          result.append(rules[(j + 1)]);
          nextRule = j + 2;
          break;
        }
        if (rule.endsWith(File.separator))
        {
          int ruleLength = rule.length();
          if (pathElement.regionMatches(false, pathElement.length() - ruleLength + 1, rule, 0, ruleLength - 1))
          {
            result.append(rules[(j + 1)]);
            nextRule = j + 2;
            break;
          }
        }
        else if (pathElement.endsWith(File.separator))
        {
          int ruleLength = rule.length();
          if (pathElement.regionMatches(false, pathElement.length() - ruleLength - 1, rule, 0, ruleLength))
          {
            result.append(rules[(j + 1)]);
            nextRule = j + 2;
            break;
          }
        }
      }
    }
    arg.setValue(result.toString());
  }
  
  protected void logAndAddFilesToCompile(Commandline cmd)
  {
    attributes.log("Compilation " + cmd.describeArguments(), 
      3);
    
    StringBuffer niceSourceList = new StringBuffer("File");
    if (compileList.length != 1) {
      niceSourceList.append("s");
    }
    niceSourceList.append(" to be compiled:");
    niceSourceList.append(lSep);
    
    String[] encodedFiles = null;String[] encodedDirs = null;
    int encodedFilesLength = 0;int encodedDirsLength = 0;
    if (fileEncodings != null)
    {
      encodedFilesLength = fileEncodings.size();
      encodedFiles = new String[encodedFilesLength];
      fileEncodings.keySet().toArray(encodedFiles);
    }
    if (dirEncodings != null)
    {
      encodedDirsLength = dirEncodings.size();
      encodedDirs = new String[encodedDirsLength];
      dirEncodings.keySet().toArray(encodedDirs);
      
      Comparator comparator = new Comparator()
      {
        public int compare(Object o1, Object o2)
        {
          return ((String)o2).length() - ((String)o1).length();
        }
      };
      Arrays.sort(encodedDirs, comparator);
    }
    for (int i = 0; i < compileList.length; i++)
    {
      String arg = compileList[i].getAbsolutePath();
      boolean encoded = false;
      if (encodedFiles != null) {
        for (int j = 0; j < encodedFilesLength; j++) {
          if (arg.endsWith(encodedFiles[j]))
          {
            arg = arg + (String)fileEncodings.get(encodedFiles[j]);
            if (j < encodedFilesLength - 1) {
              System.arraycopy(encodedFiles, j + 1, encodedFiles, j, encodedFilesLength - j - 1);
            }
            encodedFiles[(--encodedFilesLength)] = null;
            encoded = true;
            break;
          }
        }
      }
      if ((!encoded) && (encodedDirs != null)) {
        for (int j = 0; j < encodedDirsLength; j++) {
          if (arg.lastIndexOf(encodedDirs[j]) != -1)
          {
            arg = arg + (String)dirEncodings.get(encodedDirs[j]);
            break;
          }
        }
      }
      cmd.createArgument().setValue(arg);
      niceSourceList.append("    " + arg + lSep);
    }
    attributes.log(niceSourceList.toString(), 3);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.JDTCompilerAdapter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.compiler;

import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;

public abstract class CategorizedProblem
  implements IProblem
{
  public static final int CAT_UNSPECIFIED = 0;
  public static final int CAT_BUILDPATH = 10;
  public static final int CAT_SYNTAX = 20;
  public static final int CAT_IMPORT = 30;
  public static final int CAT_TYPE = 40;
  public static final int CAT_MEMBER = 50;
  public static final int CAT_INTERNAL = 60;
  public static final int CAT_JAVADOC = 70;
  public static final int CAT_CODE_STYLE = 80;
  public static final int CAT_POTENTIAL_PROGRAMMING_PROBLEM = 90;
  public static final int CAT_NAME_SHADOWING_CONFLICT = 100;
  public static final int CAT_DEPRECATION = 110;
  public static final int CAT_UNNECESSARY_CODE = 120;
  public static final int CAT_UNCHECKED_RAW = 130;
  public static final int CAT_NLS = 140;
  public static final int CAT_RESTRICTION = 150;
  
  public abstract int getCategoryID();
  
  public abstract String getMarkerType();
  
  public String[] getExtraMarkerAttributeNames()
  {
    return CharOperation.NO_STRINGS;
  }
  
  public Object[] getExtraMarkerAttributeValues()
  {
    return DefaultProblem.EMPTY_VALUES;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jdt.core.compiler.CategorizedProblem
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jdt.core.compiler;

import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;

public final class CharOperation
{
  public static final char[] NO_CHAR = new char[0];
  public static final char[][] NO_CHAR_CHAR = new char[0][];
  public static final String[] NO_STRINGS = new String[0];
  
  public static final char[] append(char[] array, char suffix)
  {
    if (array == null) {
      return new char[] { suffix };
    }
    int length = array.length;
    System.arraycopy(array, 0, array = new char[length + 1], 0, length);
    array[length] = suffix;
    return array;
  }
  
  public static final char[] append(char[] target, int index, char[] array, int start, int end)
  {
    int targetLength = target.length;
    int subLength = end - start;
    int newTargetLength = subLength + index;
    if (newTargetLength > targetLength) {
      System.arraycopy(target, 0, target = new char[newTargetLength * 2], 0, index);
    }
    System.arraycopy(array, start, target, index, subLength);
    return target;
  }
  
  public static final char[][] arrayConcat(char[][] first, char[][] second)
  {
    if (first == null) {
      return second;
    }
    if (second == null) {
      return first;
    }
    int length1 = first.length;
    int length2 = second.length;
    char[][] result = new char[length1 + length2][];
    System.arraycopy(first, 0, result, 0, length1);
    System.arraycopy(second, 0, result, length1, length2);
    return result;
  }
  
  public static final boolean camelCaseMatch(char[] pattern, char[] name)
  {
    if (pattern == null) {
      return true;
    }
    if (name == null) {
      return false;
    }
    return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, false);
  }
  
  public static final boolean camelCaseMatch(char[] pattern, char[] name, boolean samePartCount)
  {
    if (pattern == null) {
      return true;
    }
    if (name == null) {
      return false;
    }
    return camelCaseMatch(pattern, 0, pattern.length, name, 0, name.length, samePartCount);
  }
  
  public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd)
  {
    return camelCaseMatch(pattern, patternStart, patternEnd, name, nameStart, nameEnd, false);
  }
  
  public static final boolean camelCaseMatch(char[] pattern, int patternStart, int patternEnd, char[] name, int nameStart, int nameEnd, boolean samePartCount)
  {
    if (name == null) {
      return false;
    }
    if (pattern == null) {
      return true;
    }
    if (patternEnd < 0) {
      patternEnd = pattern.length;
    }
    if (nameEnd < 0) {
      nameEnd = name.length;
    }
    if (patternEnd <= patternStart) {
      return nameEnd <= nameStart;
    }
    if (nameEnd <= nameStart) {
      return false;
    }
    if (name[nameStart] != pattern[patternStart]) {
      return false;
    }
    int iPattern = patternStart;
    int iName = nameStart;
    char patternChar;
    char nameChar;
    label357:
    do
    {
      do
      {
        iPattern++;
        iName++;
        if (iPattern == patternEnd)
        {
          if ((!samePartCount) || (iName == nameEnd)) {
            return true;
          }
          for (;;)
          {
            if (iName == nameEnd) {
              return true;
            }
            char nameChar = name[iName];
            if (nameChar < '?')
            {
              if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar] & 0x20) != 0) {
                return false;
              }
            }
            else if ((!Character.isJavaIdentifierPart(nameChar)) || (Character.isUpperCase(nameChar))) {
              return false;
            }
            iName++;
          }
        }
        if (iName == nameEnd) {
          return false;
        }
      } while ((patternChar = pattern[iPattern]) == name[iName]);
      if (patternChar < '?')
      {
        if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[patternChar] & 0x24) == 0) {
          return false;
        }
      }
      else if ((Character.isJavaIdentifierPart(patternChar)) && (!Character.isUpperCase(patternChar)) && (!Character.isDigit(patternChar))) {
        return false;
      }
      for (;;)
      {
        if (iName == nameEnd) {
          return false;
        }
        nameChar = name[iName];
        if (nameChar < '?')
        {
          int charNature = ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[nameChar];
          if ((charNature & 0x90) != 0)
          {
            iName++;
            continue;
          }
          if ((charNature & 0x4) != 0)
          {
            if (patternChar == nameChar) {
              break;
            }
            iName++;
            
            continue;
          }
          if (patternChar == nameChar) {
            break;
          }
          return false;
        }
        if ((Character.isJavaIdentifierPart(nameChar)) && (!Character.isUpperCase(nameChar)))
        {
          iName++;
        }
        else
        {
          if (!Character.isDigit(nameChar)) {
            break label357;
          }
          if (patternChar == nameChar) {
            break;
          }
          iName++;
        }
      }
    } while (patternChar == nameChar);
    return false;
  }
  
  public static String[] charArrayToStringArray(char[][] charArrays)
  {
    if (charArrays == null) {
      return null;
    }
    int length = charArrays.length;
    if (length == 0) {
      return NO_STRINGS;
    }
    String[] strings = new String[length];
    for (int i = 0; i < length; i++) {
      strings[i] = new String(charArrays[i]);
    }
    return strings;
  }
  
  public static String charToString(char[] charArray)
  {
    if (charArray == null) {
      return null;
    }
    return new String(charArray);
  }
  
  public static final char[][] arrayConcat(char[][] first, char[] second)
  {
    if (second == null) {
      return first;
    }
    if (first == null) {
      return new char[][] { second };
    }
    int length = first.length;
    char[][] result = new char[length + 1][];
    System.arraycopy(first, 0, result, 0, length);
    result[length] = second;
    return result;
  }
  
  public static final int compareTo(char[] array1, char[] array2)
  {
    int length1 = array1.length;
    int length2 = array2.length;
    int min = Math.min(length1, length2);
    for (int i = 0; i < min; i++) {
      if (array1[i] != array2[i]) {
        return array1[i] - array2[i];
      }
    }
    return length1 - length2;
  }
  
  public static final int compareTo(char[] array1, char[] array2, int start, int end)
  {
    int length1 = array1.length;
    int length2 = array2.length;
    int min = Math.min(length1, length2);
    min = Math.min(min, end);
    for (int i = start; i < min; i++) {
      if (array1[i] != array2[i]) {
        return array1[i] - array2[i];
      }
    }
    return length1 - length2;
  }
  
  public static final int compareWith(char[] array, char[] prefix)
  {
    int arrayLength = array.length;
    int prefixLength = prefix.length;
    int min = Math.min(arrayLength, prefixLength);
    int i = 0;
    while (min-- != 0)
    {
      char c1 = array[i];
      char c2 = prefix[(i++)];
      if (c1 != c2) {
        return c1 - c2;
      }
    }
    if (prefixLength == i) {
      return 0;
    }
    return -1;
  }
  
  public static final char[] concat(char[] first, char[] second)
  {
    if (first == null) {
      return second;
    }
    if (second == null) {
      return first;
    }
    int length1 = first.length;
    int length2 = second.length;
    char[] result = new char[length1 + length2];
    System.arraycopy(first, 0, result, 0, length1);
    System.arraycopy(second, 0, result, length1, length2);
    return result;
  }
  
  public static final char[] concat(char[] first, char[] second, char[] third)
  {
    if (first == null) {
      return concat(second, third);
    }
    if (second == null) {
      return concat(first, third);
    }
    if (third == null) {
      return concat(first, second);
    }
    int length1 = first.length;
    int length2 = second.length;
    int length3 = third.length;
    char[] result = new char[length1 + length2 + length3];
    System.arraycopy(first, 0, result, 0, length1);
    System.arraycopy(second, 0, result, length1, length2);
    System.arraycopy(third, 0, result, length1 + length2, length3);
    return result;
  }
  
  public static final char[] concat(char[] first, char[] second, char separator)
  {
    if (first == null) {
      return second;
    }
    if (second == null) {
      return first;
    }
    int length1 = first.length;
    if (length1 == 0) {
      return second;
    }
    int length2 = second.length;
    if (length2 == 0) {
      return first;
    }
    char[] result = new char[length1 + length2 + 1];
    System.arraycopy(first, 0, result, 0, length1);
    result[length1] = separator;
    System.arraycopy(second, 0, result, length1 + 1, length2);
    return result;
  }
  
  public static final char[] concat(char[] first, char sep1, char[] second, char sep2, char[] third)
  {
    if (first == null) {
      return concat(second, third, sep2);
    }
    if (second == null) {
      return concat(first, third, sep1);
    }
    if (third == null) {
      return concat(first, second, sep1);
    }
    int length1 = first.length;
    int length2 = second.length;
    int length3 = third.length;
    char[] result = new char[length1 + length2 + length3 + 2];
    System.arraycopy(first, 0, result, 0, length1);
    result[length1] = sep1;
    System.arraycopy(second, 0, result, length1 + 1, length2);
    result[(length1 + length2 + 1)] = sep2;
    System.arraycopy(third, 0, result, length1 + length2 + 2, length3);
    return result;
  }
  
  public static final char[] concat(char prefix, char[] array, char suffix)
  {
    if (array == null) {
      return new char[] { prefix, suffix };
    }
    int length = array.length;
    char[] result = new char[length + 2];
    result[0] = prefix;
    System.arraycopy(array, 0, result, 1, length);
    result[(length + 1)] = suffix;
    return result;
  }
  
  public static final char[] concatWith(char[] name, char[][] array, char separator)
  {
    int nameLength = name == null ? 0 : name.length;
    if (nameLength == 0) {
      return concatWith(array, separator);
    }
    int length = array == null ? 0 : array.length;
    if (length == 0) {
      return name;
    }
    int size = nameLength;
    int index = length;
    do
    {
      if (array[index].length > 0) {
        size += array[index].length + 1;
      }
      index--;
    } while (index >= 0);
    char[] result = new char[size];
    index = size;
    for (int i = length - 1; i >= 0; i--)
    {
      int subLength = array[i].length;
      if (subLength > 0)
      {
        index -= subLength;
        System.arraycopy(array[i], 0, result, index, subLength);
        result[(--index)] = separator;
      }
    }
    System.arraycopy(name, 0, result, 0, nameLength);
    return result;
  }
  
  public static final char[] concatWith(char[][] array, char[] name, char separator)
  {
    int nameLength = name == null ? 0 : name.length;
    if (nameLength == 0) {
      return concatWith(array, separator);
    }
    int length = array == null ? 0 : array.length;
    if (length == 0) {
      return name;
    }
    int size = nameLength;
    int index = length;
    do
    {
      if (array[index].length > 0) {
        size += array[index].length + 1;
      }
      index--;
    } while (index >= 0);
    char[] result = new char[size];
    index = 0;
    for (int i = 0; i < length; i++)
    {
      int subLength = array[i].length;
      if (subLength > 0)
      {
        System.arraycopy(array[i], 0, result, index, subLength);
        index += subLength;
        result[(index++)] = separator;
      }
    }
    System.arraycopy(name, 0, result, index, nameLength);
    return result;
  }
  
  public static final char[] concatWith(char[][] array, char separator)
  {
    int length = array == null ? 0 : array.length;
    if (length == 0) {
      return NO_CHAR;
    }
    int size = length - 1;
    int index = length;
    do
    {
      if (array[index].length == 0) {
        size--;
      } else {
        size += array[index].length;
      }
      index--;
    } while (index >= 0);
    if (size <= 0) {
      return NO_CHAR;
    }
    char[] result = new char[size];
    index = length;
    do
    {
      length = array[index].length;
      if (length > 0)
      {
        System.arraycopy(
          array[index], 
          0, 
          result, 
          size -= length, 
          length);
        size--;
        if (size >= 0) {
          result[size] = separator;
        }
      }
      index--;
    } while (index >= 0);
    return result;
  }
  
  public static final boolean contains(char character, char[][] array)
  {
    int i = array.length;
    do
    {
      char[] subarray = array[i];
      int j = subarray.length;
      do
      {
        if (subarray[j] == character) {
          return true;
        }
        j--;
      } while (j >= 0);
      i--;
    } while (i >= 0);
    return false;
  }
  
  public static final boolean contains(char character, char[] array)
  {
    int i = array.length;
    do
    {
      if (array[i] == character) {
        return true;
      }
      i--;
    } while (i >= 0);
    return false;
  }
  
  public static final boolean contains(char[] characters, char[] array)
  {
    int i = array.length;
    do
    {
      int j = characters.length;
      do
      {
        if (array[i] == characters[j]) {
          return true;
        }
        j--;
      } while (j >= 0);
      i--;
    } while (i >= 0);
    return false;
  }
  
  public static final char[][] deepCopy(char[][] toCopy)
  {
    int toCopyLength = toCopy.length;
    char[][] result = new char[toCopyLength][];
    for (int i = 0; i < toCopyLength; i++)
    {
      char[] toElement = toCopy[i];
      int toElementLength = toElement.length;
      char[] resultElement = new char[toElementLength];
      System.arraycopy(toElement, 0, resultElement, 0, toElementLength);
      result[i] = resultElement;
    }
    return result;
  }
  
  public static final boolean endsWith(char[] array, char[] toBeFound)
  {
    int i = toBeFound.length;
    int j = array.length - i;
    if (j < 0) {
      return false;
    }
    do
    {
      if (toBeFound[i] != array[(i + j)]) {
        return false;
      }
      i--;
    } while (i >= 0);
    return true;
  }
  
  public static final boolean equals(char[][] first, char[][] second)
  {
    if (first == second) {
      return true;
    }
    if ((first == null) || (second == null)) {
      return false;
    }
    if (first.length != second.length) {
      return false;
    }
    int i = first.length;
    do
    {
      if (!equals(first[i], second[i])) {
        return false;
      }
      i--;
    } while (i >= 0);
    return true;
  }
  
  public static final boolean equals(char[][] first, char[][] second, boolean isCaseSensitive)
  {
    if (isCaseSensitive) {
      return equals(first, second);
    }
    if (first == second) {
      return true;
    }
    if ((first == null) || (second == null)) {
      return false;
    }
    if (first.length != second.length) {
      return false;
    }
    int i = first.length;
    do
    {
      if (!equals(first[i], second[i], false)) {
        return false;
      }
      i--;
    } while (i >= 0);
    return true;
  }
  
  public static final boolean equals(char[] first, char[] second)
  {
    if (first == second) {
      return true;
    }
    if ((first == null) || (second == null)) {
      return false;
    }
    if (first.length != second.length) {
      return false;
    }
    int i = first.length;
    do
    {
      if (first[i] != second[i]) {
        return false;
      }
      i--;
    } while (i >= 0);
    return true;
  }
  
  public static final boolean equals(char[] first, char[] second, int secondStart, int secondEnd)
  {
    return equals(first, second, secondStart, secondEnd, true);
  }
  
  public static final boolean equals(char[] first, char[] second, int secondStart, int secondEnd, boolean isCaseSensitive)
  {
    if (first == second) {
      return true;
    }
    if ((first == null) || (second == null)) {
      return false;
    }
    if (first.length != secondEnd - secondStart) {
      return false;
    }
    if (isCaseSensitive)
    {
      int i = first.length;
      do
      {
        if (first[i] != second[(i + secondStart)]) {
          return false;
        }
        i--;
      } while (i >= 0);
    }
    else
    {
      int i = first.length;
      do
      {
        if (ScannerHelper.toLowerCase(first[i]) != ScannerHelper.toLowerCase(second[(i + secondStart)])) {
          return false;
        }
        i--;
      } while (i >= 0);
    }
    return true;
  }
  
  public static final boolean equals(char[] first, char[] second, boolean isCaseSensitive)
  {
    if (isCaseSensitive) {
      return equals(first, second);
    }
    if (first == second) {
      return true;
    }
    if ((first == null) || (second == null)) {
      return false;
    }
    if (first.length != second.length) {
      return false;
    }
    int i = first.length;
    do
    {
      if (ScannerHelper.toLowerCase(first[i]) != 
        ScannerHelper.toLowerCase(second[i])) {
        return false;
      }
      i--;
    } while (i >= 0);
    return true;
  }
  
  public static final boolean fragmentEquals(char[] fragment, char[] name, int startIndex, boolean isCaseSensitive)
  {
    int max = fragment.length;
    if (name.length < max + startIndex) {
      return false;
    }
    if (isCaseSensitive)
    {
      int i = max;
      do
      {
        if (fragment[i] != name[(i + startIndex)]) {
          return false;
        }
        i--;
      } while (
        i >= 0);
      return true;
    }
    int i = max;
    do
    {
      if (ScannerHelper.toLowerCase(fragment[i]) != 
        ScannerHelper.toLowerCase(name[(i + startIndex)])) {
        return false;
      }
      i--;
    } while (
      i >= 0);
    return true;
  }
  
  public static final int hashCode(char[] array)
  {
    int length = array.length;
    int hash = length == 0 ? '\037' : array[0];
    if (length < 8)
    {
      int i = length;
      do
      {
        hash = hash * 31 + array[i];i--;
      } while (i > 0);
    }
    else
    {
      int i = length - 1;
      for (int last = i > 16 ? i - 16 : 0; i > last; i -= 2) {
        hash = hash * 31 + array[i];
      }
    }
    return hash & 0x7FFFFFFF;
  }
  
  public static boolean isWhitespace(char c)
  {
    return (c < '?') && ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & 0x100) != 0);
  }
  
  public static final int indexOf(char toBeFound, char[] array)
  {
    return indexOf(toBeFound, array, 0);
  }
  
  public static final int indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive)
  {
    return indexOf(toBeFound, array, isCaseSensitive, 0);
  }
  
  public static final int indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive, int start)
  {
    return indexOf(toBeFound, array, isCaseSensitive, start, array.length);
  }
  
  public static final int indexOf(char[] toBeFound, char[] array, boolean isCaseSensitive, int start, int end)
  {
    int arrayLength = end;
    int toBeFoundLength = toBeFound.length;
    if ((toBeFoundLength > arrayLength) || (start < 0)) {
      return -1;
    }
    if (toBeFoundLength == 0) {
      return 0;
    }
    if (toBeFoundLength == arrayLength)
    {
      if (isCaseSensitive)
      {
        for (int i = start; i < arrayLength; i++) {
          if (array[i] != toBeFound[i]) {
            return -1;
          }
        }
        return 0;
  
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd