org-netbeans-modules-sendopts

16:40:14.234 INFO  jd.cli.Main - Decompiling org-netbeans-modules-sendopts.jar
package org.netbeans.api.sendopts;

public final class CommandException
  extends Exception
{
  private final int exitCode;
  private final String locMsg;
  
  public CommandException(int paramInt)
  {
    this("Error code: " + paramInt, paramInt, null);
  }
  
  public CommandException(int paramInt, String paramString)
  {
    this("Error code: " + paramInt, paramInt, paramString);
  }
  
  CommandException(String paramString1, int paramInt, String paramString2)
  {
    super(paramString1);
    exitCode = paramInt;
    locMsg = paramString2;
  }
  
  CommandException(String paramString, int paramInt)
  {
    this(paramString, paramInt, null);
  }
  
  public int getExitCode()
  {
    return exitCode;
  }
  
  public String getLocalizedMessage()
  {
    if (locMsg != null) {
      return locMsg;
    }
    if (getCause() != null) {
      return getCause().getLocalizedMessage();
    }
    return super.getLocalizedMessage();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.api.sendopts.CommandException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.api.sendopts;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.netbeans.modules.sendopts.OptionImpl;
import org.netbeans.modules.sendopts.OptionImpl.Appearance;
import org.netbeans.modules.sendopts.OptionImpl.Trampoline;
import org.netbeans.spi.sendopts.Env;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;

public final class CommandLine
{
  private static final int ERROR_BASE = 50345;
  
  public static CommandLine getDefault()
  {
    return new CommandLine();
  }
  
  public void process(String[] paramArrayOfString)
    throws CommandException
  {
    process(paramArrayOfString, null, null, null, null);
  }
  
  public void process(String[] paramArrayOfString, InputStream paramInputStream, OutputStream paramOutputStream1, OutputStream paramOutputStream2, File paramFile)
    throws CommandException
  {
    if (paramInputStream == null) {
      paramInputStream = System.in;
    }
    if (paramOutputStream1 == null) {
      paramOutputStream1 = System.out;
    }
    if (paramOutputStream2 == null) {
      paramOutputStream2 = System.err;
    }
    if (paramFile == null) {
      paramFile = new File(System.getProperty("user.dir"));
    }
    Env localEnv = OptionImpl.Trampoline.DEFAULT.create(paramInputStream, paramOutputStream1, paramOutputStream2, paramFile);
    
    ArrayList localArrayList1 = new ArrayList();
    ArrayList localArrayList2 = new ArrayList();
    Object localObject1 = null;
    
    OptionImpl[] arrayOfOptionImpl1 = getOptions();
    LinkedHashSet localLinkedHashSet = new LinkedHashSet();
    for (int i = 0; i < arrayOfOptionImpl1.length; i++) {
      arrayOfOptionImpl1[i] = arrayOfOptionImpl1[i].addWorkingCopy(localLinkedHashSet);
    }
    OptionImpl[] arrayOfOptionImpl2 = (OptionImpl[])localLinkedHashSet.toArray(new OptionImpl[0]);
    
    int j = 1;
    Object localObject3;
    for (int k = 0; k < paramArrayOfString.length; k++) {
      if (paramArrayOfString[k] != null)
      {
        if (j != 0)
        {
          Object localObject4;
          String str3;
          String str4;
          if (paramArrayOfString[k].startsWith("--"))
          {
            if (paramArrayOfString[k].length() == 2)
            {
              j = 0;
              continue;
            }
            String str1 = paramArrayOfString[k].substring(2);
            String str2 = null;
            int i2 = str1.indexOf('=');
            if (i2 >= 0)
            {
              str2 = str1.substring(i2 + 1);
              str1 = str1.substring(0, i2);
            }
            localObject4 = findByLongName(str1, arrayOfOptionImpl2);
            if (localObject4 == null) {
              throw new CommandException(paramArrayOfString[k], 50346);
            }
            if ((((OptionImpl)localObject4).getArgumentType() == 1) && (str2 == null))
            {
              for (;;)
              {
                k++;
                if (k == paramArrayOfString.length) {
                  throw new CommandException(NbBundle.getMessage(CommandLine.class, "MSG_MissingArgument", "--" + ((OptionImpl)localObject4).getLongName()), 50347);
                }
                if (!paramArrayOfString[k].equals("--")) {
                  break;
                }
                j = 0;
              }
              if ((j != 0) && (paramArrayOfString[k].startsWith("-"))) {
                throw new CommandException(NbBundle.getMessage(CommandLine.class, "MSG_MissingArgument", "--" + ((OptionImpl)localObject4).getLongName()), 50347);
              }
              str2 = paramArrayOfString[k];
            }
            if (str2 != null)
            {
              if ((((OptionImpl)localObject4).getArgumentType() != 1) && (((OptionImpl)localObject4).getArgumentType() != 2)) {
                throw new CommandException("Option " + localObject4 + " cannot have value " + str2, 50347);
              }
              ((OptionImpl)localObject4).associateValue(str2);
            }
            if (((OptionImpl)localObject4).getArgumentType() == 3)
            {
              if (localObject1 != null)
              {
                str3 = findOptionName((OptionImpl)localObject1, paramArrayOfString);
                str4 = findOptionName((OptionImpl)localObject4, paramArrayOfString);
                String str5 = NbBundle.getMessage(CommandLine.class, "MSG_CannotTogether", str3, str4);
                throw new CommandException(str5, 50348);
              }
              localObject1 = localObject4;
            }
            localArrayList2.add(localObject4);
            continue;
          }
          if ((paramArrayOfString[k].startsWith("-")) && (paramArrayOfString[k].length() > 1))
          {
            for (int m = 1; m < paramArrayOfString[k].length(); m++)
            {
              n = paramArrayOfString[k].charAt(m);
              localObject3 = findByShortName(n, arrayOfOptionImpl2);
              if (localObject3 == null) {
                throw new CommandException("Unknown option " + paramArrayOfString[k], 50346);
              }
              if ((paramArrayOfString[k].length() == m + 1) && (((OptionImpl)localObject3).getArgumentType() == 1)) {
                throw new CommandException(NbBundle.getMessage(CommandLine.class, "MSG_MissingArgument", paramArrayOfString[k]), 50347);
              }
              if ((paramArrayOfString[k].length() > m) && ((((OptionImpl)localObject3).getArgumentType() == 1) || (((OptionImpl)localObject3).getArgumentType() == 2)))
              {
                ((OptionImpl)localObject3).associateValue(paramArrayOfString[k].substring(m + 1));
                m = paramArrayOfString[k].length();
              }
              if (((OptionImpl)localObject3).getArgumentType() == 3)
              {
                if (localObject1 != null)
                {
                  localObject4 = findOptionName((OptionImpl)localObject1, paramArrayOfString);
                  str3 = findOptionName((OptionImpl)localObject3, paramArrayOfString);
                  str4 = NbBundle.getMessage(CommandLine.class, "MSG_CannotTogether", localObject4, str3);
                  throw new CommandException(str4, 50348);
                }
                localObject1 = localObject3;
              }
              localArrayList2.add(localObject3);
            }
            continue;
          }
        }
        localArrayList1.add(paramArrayOfString[k]);
      }
    }
    if ((localObject1 == null) && (!localArrayList1.isEmpty()))
    {
      for (k = 0; k < arrayOfOptionImpl2.length; k++) {
        if (arrayOfOptionImpl2[k].getArgumentType() == 4)
        {
          if (localObject1 != null) {
            throw new CommandException("There cannot be two default options: " + localObject1 + " and " + arrayOfOptionImpl2[k], 50348);
          }
          localObject1 = arrayOfOptionImpl2[k];
          localArrayList2.add(localObject1);
        }
      }
      if (localObject1 == null) {
        throw new CommandException("There are params but noone wants to proces them: " + localArrayList1, 50347);
      }
    }
    OptionImpl.Appearance[] arrayOfAppearance = new OptionImpl.Appearance[arrayOfOptionImpl1.length];
    
    Object localObject2 = new HashSet(localArrayList2);
    for (int n = 0; n < arrayOfOptionImpl1.length; n++)
    {
      localObject3 = arrayOfOptionImpl1[n].checkConsistent((Set)localObject2);
      arrayOfAppearance[n] = localObject3;
      if (((OptionImpl.Appearance)localObject3).isThere()) {
        arrayOfOptionImpl1[n].markConsistent((OptionImpl.Appearance)localObject3);
      }
    }
    localObject2 = new HashSet(localArrayList2);
    for (int i1 = 0; i1 < arrayOfOptionImpl1.length; i1++) {
      if (arrayOfAppearance[i1].isError())
      {
        localObject3 = arrayOfOptionImpl1[i1].findNotUsedOption((Set)localObject2);
        if (localObject3 != null) {
          throw new CommandException(arrayOfAppearance[i1].errorMessage(paramArrayOfString), 50349);
        }
      }
    }
    localObject2 = new LinkedHashMap();
    for (i1 = 0; i1 < arrayOfOptionImpl1.length; i1++) {
      if (arrayOfAppearance[i1].isThere())
      {
        localObject3 = (Map)((Map)localObject2).get(arrayOfOptionImpl1[i1].getProvider());
        if (localObject3 == null)
        {
          localObject3 = new HashMap();
          ((Map)localObject2).put(arrayOfOptionImpl1[i1].getProvider(), localObject3);
        }
        arrayOfOptionImpl1[i1].process((String[])localArrayList1.toArray(new String[0]), (Map)localObject3);
      }
    }
    for (Iterator localIterator = ((Map)localObject2).entrySet().iterator(); localIterator.hasNext();)
    {
      localObject3 = (Map.Entry)localIterator.next();
      OptionImpl.Trampoline.DEFAULT.process((OptionProcessor)((Map.Entry)localObject3).getKey(), localEnv, (Map)((Map.Entry)localObject3).getValue());
    }
  }
  
  public void usage(PrintWriter paramPrintWriter)
  {
    OptionImpl[] arrayOfOptionImpl1 = getOptions();
    LinkedHashSet localLinkedHashSet = new LinkedHashSet();
    for (int i = 0; i < arrayOfOptionImpl1.length; i++) {
      arrayOfOptionImpl1[i].addWorkingCopy(localLinkedHashSet);
    }
    OptionImpl[] arrayOfOptionImpl2 = (OptionImpl[])localLinkedHashSet.toArray(new OptionImpl[0]);
    
    int j = 25;
    String[] arrayOfString = new String[arrayOfOptionImpl2.length];
    for (int k = 0; k < arrayOfOptionImpl2.length; k++)
    {
      StringBuffer localStringBuffer = new StringBuffer();
      
      String str1 = OptionImpl.Trampoline.DEFAULT.getDisplayName(arrayOfOptionImpl2[k].getOption(), Locale.getDefault());
      if (str1 != null)
      {
        localStringBuffer.append(str1);
      }
      else
      {
        String str2 = "";
        if (arrayOfOptionImpl2[k].getShortName() != -1)
        {
          localStringBuffer.append('-');
          localStringBuffer.append((char)arrayOfOptionImpl2[k].getShortName());
          str2 = ", ";
        }
        if (arrayOfOptionImpl2[k].getLongName() != null)
        {
          localStringBuffer.append(str2);
          localStringBuffer.append("--");
          localStringBuffer.append(arrayOfOptionImpl2[k].getLongName());
        }
        else
        {
          if (str2.length() == 0) {
            continue;
          }
        }
        switch (arrayOfOptionImpl2[k].getArgumentType())
        {
        case 0: 
          break;
        case 1: 
          localStringBuffer.append(' ');
          localStringBuffer.append(NbBundle.getMessage(CommandLine.class, "MSG_OneArg"));
          break;
        case 2: 
          localStringBuffer.append(' ');
          localStringBuffer.append(NbBundle.getMessage(CommandLine.class, "MSG_OptionalArg"));
          break;
        case 3: 
          localStringBuffer.append(' ');
          localStringBuffer.append(NbBundle.getMessage(CommandLine.class, "MSG_AddionalArgs"));
          break;
        default: 
          if (!$assertionsDisabled) {
            throw new AssertionError();
          }
          break;
        }
      }
      if (localStringBuffer.length() > j) {
        j = localStringBuffer.length();
      }
      arrayOfString[k] = localStringBuffer.toString();
    }
    for (k = 0; k < arrayOfOptionImpl2.length; k++) {
      if (arrayOfString[k] != null)
      {
        paramPrintWriter.print("  ");
        paramPrintWriter.print(arrayOfString[k]);
        for (int m = arrayOfString[k].length(); m < j; m++) {
          paramPrintWriter.print(' ');
        }
        paramPrintWriter.print(' ');
        arrayOfOptionImpl2[k].usage(paramPrintWriter, j);
        paramPrintWriter.println();
      }
    }
    paramPrintWriter.flush();
  }
  
  private OptionImpl[] getOptions()
  {
    ArrayList localArrayList = new ArrayList();
    for (OptionProcessor localOptionProcessor : Lookup.getDefault().lookupAll(OptionProcessor.class))
    {
      Option[] arrayOfOption = OptionImpl.Trampoline.DEFAULT.getOptions(localOptionProcessor);
      for (int i = 0; i < arrayOfOption.length; i++) {
        localArrayList.add(OptionImpl.cloneImpl(OptionImpl.find(arrayOfOption[i]), arrayOfOption[i], localOptionProcessor));
      }
    }
    return (OptionImpl[])localArrayList.toArray(new OptionImpl[0]);
  }
  
  private OptionImpl findByLongName(String paramString, OptionImpl[] paramArrayOfOptionImpl)
  {
    int i = 0;
    OptionImpl localOptionImpl = null;
    for (int j = 0; j < paramArrayOfOptionImpl.length; j++)
    {
      String str = paramArrayOfOptionImpl[j].getLongName();
      if (str != null)
      {
        if (paramString.equals(str)) {
          return paramArrayOfOptionImpl[j];
        }
        if (str.startsWith(paramString))
        {
          i = localOptionImpl == null ? 1 : 0;
          localOptionImpl = paramArrayOfOptionImpl[j];
        }
      }
    }
    return i != 0 ? localOptionImpl : null;
  }
  
  private OptionImpl findByShortName(char paramChar, OptionImpl[] paramArrayOfOptionImpl)
  {
    for (int i = 0; i < paramArrayOfOptionImpl.length; i++) {
      if (paramChar == paramArrayOfOptionImpl[i].getShortName()) {
        return paramArrayOfOptionImpl[i];
      }
    }
    return null;
  }
  
  private static String findOptionName(OptionImpl paramOptionImpl, String[] paramArrayOfString)
  {
    for (int i = 0; i < paramArrayOfString.length; i++) {
      if (paramArrayOfString[i].startsWith("-")) {
        if (paramArrayOfString[i].startsWith("--"))
        {
          String str = paramArrayOfString[i].substring(2);
          int j = str.indexOf('=');
          if (j >= 0) {
            str = str.substring(0, j);
          }
          if (str.startsWith(paramOptionImpl.getLongName())) {
            return paramArrayOfString[i];
          }
        }
        else if (paramOptionImpl.getShortName() == paramArrayOfString[i].charAt(1))
        {
          return "-" + (char)paramOptionImpl.getShortName();
        }
      }
    }
    return paramOptionImpl.toString();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.api.sendopts.CommandLine
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.io.PrintWriter;
import org.netbeans.CLIHandler;
import org.netbeans.CLIHandler.Args;

public class Handler
  extends CLIHandler
{
  public Handler()
  {
    super(3);
  }
  
  protected int cli(CLIHandler.Args paramArgs)
  {
    return HandlerImpl.execute(paramArgs.getArguments(), paramArgs.getInputStream(), paramArgs.getOutputStream(), paramArgs.getErrorStream(), paramArgs.getCurrentDirectory());
  }
  
  protected void usage(PrintWriter paramPrintWriter)
  {
    HandlerImpl.usage(paramPrintWriter);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.Handler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.api.sendopts.CommandLine;
import org.openide.util.NbBundle;

final class HandlerImpl
{
  static int execute(String[] paramArrayOfString, InputStream paramInputStream, OutputStream paramOutputStream1, OutputStream paramOutputStream2, File paramFile)
  {
    try
    {
      CommandLine.getDefault().process(paramArrayOfString, paramInputStream, paramOutputStream1, paramOutputStream2, paramFile);
      for (int i = 0; i < paramArrayOfString.length; i++) {
        paramArrayOfString[i] = null;
      }
      return 0;
    }
    catch (CommandException localCommandException)
    {
      PrintStream localPrintStream = new PrintStream(paramOutputStream2);
      localPrintStream.println(localCommandException.getLocalizedMessage());
      
      return localCommandException.getExitCode();
    }
  }
  
  static void usage(PrintWriter paramPrintWriter)
  {
    paramPrintWriter.print(NbBundle.getMessage(HandlerImpl.class, "MSG_OptionsHeader"));
    CommandLine.getDefault().usage(paramPrintWriter);
    paramPrintWriter.println();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.HandlerImpl
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;

class OptionImpl$1AddOptionImpl
  extends OptionImpl
{
  private boolean processed;
  
  public OptionImpl$1AddOptionImpl(Option paramOption, OptionProcessor paramOptionProcessor)
  {
    super(paramOption, paramOptionProcessor, bool ? 4 : 3);
  }
  
  public void process(String[] paramArrayOfString, Map<Option, String[]> paramMap)
    throws CommandException
  {
    paramMap.put(option, paramArrayOfString);
  }
  
  public void associateValue(String paramString)
    throws CommandException
  {
    throw new IllegalStateException();
  }
  
  public OptionImpl.Appearance checkConsistent(Set<OptionImpl> paramSet)
  {
    return paramSet.contains(this) ? OptionImpl.Appearance.YES : OptionImpl.Appearance.NO;
  }
  
  protected OptionImpl handleAdd(Collection<OptionImpl> paramCollection)
  {
    1AddOptionImpl local1AddOptionImpl = (1AddOptionImpl)OptionImpl.access$000(this);
    paramCollection.add(local1AddOptionImpl);
    return local1AddOptionImpl;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.OptionImpl.1AddOptionImpl
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.util.Iterator;
import java.util.List;
import org.netbeans.api.sendopts.CommandLine;
import org.openide.util.NbBundle;

class OptionImpl$1AlternativeOptionsImpl$1MF
  implements OptionImpl.MessageFactory
{
  OptionImpl$1AlternativeOptionsImpl$1MF(OptionImpl.1AlternativeOptionsImpl param1AlternativeOptionsImpl) {}
  
  public String errorMessage(String[] paramArrayOfString)
  {
    StringBuffer localStringBuffer;
    String str3;
    Iterator localIterator;
    OptionImpl localOptionImpl;
    switch (this$0.val$type)
    {
    case 0: 
      assert (OptionImpl.1AlternativeOptionsImpl.access$100(this$0).size() >= 2) : ("At least two: " + OptionImpl.1AlternativeOptionsImpl.access$100(this$0));
      
      String str1 = ((OptionImpl)OptionImpl.1AlternativeOptionsImpl.access$100(this$0).get(0)).findName(true, paramArrayOfString);
      String str2 = ((OptionImpl)OptionImpl.1AlternativeOptionsImpl.access$100(this$0).get(1)).findName(true, paramArrayOfString);
      assert (str1 != null);
      assert (str2 != null);
      
      return NbBundle.getMessage(CommandLine.class, "MSG_CannotTogether", str1, str2);
    case 1: 
      localStringBuffer = new StringBuffer();
      str3 = "";
      for (localIterator = OptionImpl.1AlternativeOptionsImpl.access$200(this$0).iterator(); localIterator.hasNext();)
      {
        localOptionImpl = (OptionImpl)localIterator.next();
        localStringBuffer.append(str3);
        localStringBuffer.append(localOptionImpl.findName(false, paramArrayOfString));
        str3 = ", ";
      }
      return NbBundle.getMessage(CommandLine.class, "MSG_MissingOptions", localStringBuffer.toString());
    case 2: 
      localStringBuffer = new StringBuffer();
      str3 = "";
      for (localIterator = OptionImpl.1AlternativeOptionsImpl.access$200(this$0).iterator(); localIterator.hasNext();)
      {
        localOptionImpl = (OptionImpl)localIterator.next();
        localStringBuffer.append(str3);
        localStringBuffer.append(localOptionImpl.findName(false, paramArrayOfString));
        str3 = ", ";
      }
      return NbBundle.getMessage(CommandLine.class, "MSG_NeedAtLeastOne", localStringBuffer.toString());
    }
    throw new IllegalStateException("Type: " + this$0.val$type);
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.OptionImpl.1AlternativeOptionsImpl.1MF
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.api.sendopts.CommandLine;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;
import org.openide.util.NbBundle;

class OptionImpl$1AlternativeOptionsImpl
  extends OptionImpl
{
  private List<OptionImpl> arr;
  private List<OptionImpl> used;
  private Set<OptionImpl> missing;
  
  public OptionImpl$1AlternativeOptionsImpl(Option paramOption, OptionProcessor paramOptionProcessor, List<OptionImpl> paramList)
  {
    super(paramOption, paramOptionProcessor, 0);
    arr = paramList;
  }
  
  public OptionImpl.Appearance checkConsistent(Set<OptionImpl> paramSet)
  {
    int i = 0;
    
    used = new ArrayList();
    missing = new HashSet();
    
    HashSet localHashSet = new HashSet();
    for (int j = 0; j < arr.size(); j++)
    {
      OptionImpl.Appearance localAppearance = ((OptionImpl)arr.get(j)).checkConsistent(paramSet);
      if (localAppearance.isError()) {
        return localAppearance;
      }
      if (OptionImpl.Appearance.NO == localAppearance)
      {
        missing.add(arr.get(j));
      }
      else if (OptionImpl.Appearance.MAYBE == localAppearance)
      {
        localHashSet.add(arr.get(j));
      }
      else
      {
        i++;
        used.add(arr.get(j));
      }
    }
    if (i == 0) {
      return val$type == 3 ? OptionImpl.Appearance.MAYBE : OptionImpl.Appearance.NO;
    }
    switch (val$type)
    {
    case 0: 
      if (i == 1) {
        return OptionImpl.Appearance.YES;
      }
      break;
    case 1: 
      if (missing.isEmpty())
      {
        used.addAll(localHashSet);
        
        return OptionImpl.Appearance.YES;
      }
      break;
    case 2: 
    case 3: 
      if (i >= 1) {
        return OptionImpl.Appearance.YES;
      }
      break;
    }
    OptionImpl.Appearance.createError(new OptionImpl.MessageFactory()
    {
      public String errorMessage(String[] paramAnonymousArrayOfString)
      {
        StringBuffer localStringBuffer;
        String str3;
        Iterator localIterator;
        OptionImpl localOptionImpl;
        switch (val$type)
        {
        case 0: 
          assert (used.size() >= 2) : ("At least two: " + used);
          
          String str1 = ((OptionImpl)used.get(0)).findName(true, paramAnonymousArrayOfString);
          String str2 = ((OptionImpl)used.get(1)).findName(true, paramAnonymousArrayOfString);
          assert (str1 != null);
          assert (str2 != null);
          
          return NbBundle.getMessage(CommandLine.class, "MSG_CannotTogether", str1, str2);
        case 1: 
          localStringBuffer = new StringBuffer();
          str3 = "";
          for (localIterator = arr.iterator(); localIterator.hasNext();)
          {
            localOptionImpl = (OptionImpl)localIterator.next();
            localStringBuffer.append(str3);
            localStringBuffer.append(localOptionImpl.findName(false, paramAnonymousArrayOfString));
            str3 = ", ";
          }
          return NbBundle.getMessage(CommandLine.class, "MSG_MissingOptions", localStringBuffer.toString());
        case 2: 
          localStringBuffer = new StringBuffer();
          str3 = "";
          for (localIterator = arr.iterator(); localIterator.hasNext();)
          {
            localOptionImpl = (OptionImpl)localIterator.next();
            localStringBuffer.append(str3);
            localStringBuffer.append(localOptionImpl.findName(false, paramAnonymousArrayOfString));
            str3 = ", ";
          }
          return NbBundle.getMessage(CommandLine.class, "MSG_NeedAtLeastOne", localStringBuffer.toString());
        }
        throw new IllegalStateException("Type: " + val$type);
      }
    });
  }
  
  public void markConsistent(OptionImpl.Appearance paramAppearance)
  {
    super.markConsistent(paramAppearance);
    for (OptionImpl localOptionImpl : arr) {
      localOptionImpl.markConsistent(paramAppearance);
    }
  }
  
  public OptionImpl findNotUsedOption(Set<OptionImpl> paramSet)
  {
    OptionImpl localOptionImpl1 = super.findNotUsedOption(paramSet);
    if (localOptionImpl1 != null) {
      return localOptionImpl1;
    }
    for (OptionImpl localOptionImpl2 : arr)
    {
      localOptionImpl1 = localOptionImpl2.findNotUsedOption(paramSet);
      if (localOptionImpl1 != null) {
        return localOptionImpl1;
      }
    }
    return null;
  }
  
  public void associateValue(String paramString)
    throws CommandException
  {}
  
  public OptionImpl handleAdd(Collection<OptionImpl> paramCollection)
  {
    ArrayList localArrayList = new ArrayList();
    for (int i = 0; i < arr.size(); i++) {
      localArrayList.add(((OptionImpl)arr.get(i)).addWorkingCopy(paramCollection));
    }
    1AlternativeOptionsImpl local1AlternativeOptionsImpl = (1AlternativeOptionsImpl)OptionImpl.access$000(this);
    arr = localArrayList;
    paramCollection.add(local1AlternativeOptionsImpl);
    return local1AlternativeOptionsImpl;
  }
  
  public void process(String[] paramArrayOfString, Map<Option, String[]> paramMap)
    throws CommandException
  {
    paramMap.put(option, NO_VALUE);
    for (OptionImpl localOptionImpl : used) {
      localOptionImpl.process(paramArrayOfString, paramMap);
    }
  }
  
  public String findName(boolean paramBoolean, String[] paramArrayOfString)
  {
    for (Iterator localIterator = arr.iterator(); localIterator.hasNext();)
    {
      OptionImpl localOptionImpl = (OptionImpl)localIterator.next();
      String str = localOptionImpl.findName(paramBoolean, paramArrayOfString);
      if (str != null) {
        return str;
      }
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.OptionImpl.1AlternativeOptionsImpl
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;

class OptionImpl$1Always
  extends OptionImpl
{
  public OptionImpl$1Always(Option paramOption, OptionProcessor paramOptionProcessor, int paramInt)
  {
    super(paramOption, paramOptionProcessor, 5);
  }
  
  public void process(String[] paramArrayOfString, Map<Option, String[]> paramMap)
    throws CommandException
  {
    paramMap.put(option, NO_VALUE);
  }
  
  public void associateValue(String paramString)
  {
    throw new IllegalStateException();
  }
  
  public OptionImpl.Appearance checkConsistent(Set<OptionImpl> paramSet)
  {
    return OptionImpl.Appearance.YES;
  }
  
  protected OptionImpl handleAdd(Collection<OptionImpl> paramCollection)
  {
    1Always local1Always = (1Always)OptionImpl.access$000(this);
    paramCollection.add(local1Always);
    return local1Always;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.OptionImpl.1Always
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;

class OptionImpl$1NoArg
  extends OptionImpl
{
  public OptionImpl$1NoArg(Option paramOption, OptionProcessor paramOptionProcessor, int paramInt)
  {
    super(paramOption, paramOptionProcessor, 0);
  }
  
  public void process(String[] paramArrayOfString, Map<Option, String[]> paramMap)
    throws CommandException
  {
    paramMap.put(option, NO_VALUE);
  }
  
  public void associateValue(String paramString)
  {
    throw new IllegalStateException();
  }
  
  public OptionImpl.Appearance checkConsistent(Set<OptionImpl> paramSet)
  {
    return paramSet.contains(this) ? OptionImpl.Appearance.YES : OptionImpl.Appearance.NO;
  }
  
  protected OptionImpl handleAdd(Collection<OptionImpl> paramCollection)
  {
    1NoArg local1NoArg = (1NoArg)OptionImpl.access$000(this);
    paramCollection.add(local1NoArg);
    return local1NoArg;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.OptionImpl.1NoArg
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;

class OptionImpl$1OneOptionImpl
  extends OptionImpl
{
  private String arg;
  
  public OptionImpl$1OneOptionImpl(Option paramOption, OptionProcessor paramOptionProcessor, int paramInt, String paramString)
  {
    super(paramOption, paramOptionProcessor, paramInt);
    arg = paramString;
  }
  
  public void process(String[] paramArrayOfString, Map<Option, String[]> paramMap)
    throws CommandException
  {
    if (arg != null)
    {
      paramMap.put(option, new String[] { arg });
    }
    else
    {
      assert (argumentType == 2);
      paramMap.put(option, NO_VALUE);
    }
  }
  
  public void associateValue(String paramString)
    throws CommandException
  {
    arg = paramString;
  }
  
  public OptionImpl handleAdd(Collection<OptionImpl> paramCollection)
  {
    1OneOptionImpl local1OneOptionImpl = (1OneOptionImpl)OptionImpl.access$000(this);
    paramCollection.add(local1OneOptionImpl);
    return local1OneOptionImpl;
  }
  
  public OptionImpl.Appearance checkConsistent(Set<OptionImpl> paramSet)
  {
    return paramSet.contains(this) ? OptionImpl.Appearance.YES : OptionImpl.Appearance.NO;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.OptionImpl.1OneOptionImpl
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

public class OptionImpl$Appearance
{
  private OptionImpl.MessageFactory msg;
  public static final Appearance YES = new Appearance();
  public static final Appearance NO = new Appearance();
  public static final Appearance MAYBE = new Appearance();
  
  public static final Appearance createError(OptionImpl.MessageFactory paramMessageFactory)
  {
    Appearance localAppearance = new Appearance();
    msg = paramMessageFactory;
    return localAppearance;
  }
  
  public final boolean isThere()
  {
    return this == YES;
  }
  
  public boolean isError()
  {
    return (YES != this) && (NO != this) && (MAYBE != this);
  }
  
  public String errorMessage(String[] paramArrayOfString)
  {
    return msg.errorMessage(paramArrayOfString);
  }
  
  public String toString()
  {
    if (this == YES) {
      return "YES";
    }
    if (this == NO) {
      return "NO";
    }
    if (this == MAYBE) {
      return "MAYBE";
    }
    return "ERROR[" + errorMessage(new String[0]) + "]";
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.OptionImpl.Appearance
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

public abstract interface OptionImpl$MessageFactory
{
  public abstract String errorMessage(String[] paramArrayOfString);
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.OptionImpl.MessageFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.Map;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.spi.sendopts.Env;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;

public abstract class OptionImpl$Trampoline
{
  public static Trampoline DEFAULT;
  
  public abstract OptionImpl impl(Option paramOption);
  
  public abstract Env create(InputStream paramInputStream, OutputStream paramOutputStream1, OutputStream paramOutputStream2, File paramFile);
  
  public abstract void usage(PrintWriter paramPrintWriter, Option paramOption, int paramInt);
  
  public abstract Option[] getOptions(OptionProcessor paramOptionProcessor);
  
  public abstract void process(OptionProcessor paramOptionProcessor, Env paramEnv, Map<Option, String[]> paramMap)
    throws CommandException;
  
  public abstract String getLongName(Option paramOption);
  
  public abstract int getShortName(Option paramOption);
  
  public abstract String getDisplayName(Option paramOption, Locale paramLocale);
  
  static
  {
    try
    {
      Class.forName(Option.class.getName(), true, Trampoline.class.getClassLoader());
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.modules.sendopts.OptionImpl.Trampoline
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.modules.sendopts;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import org.netbeans.api.sendopts.CommandException;
import org.netbeans.api.sendopts.CommandLine;
import org.netbeans.spi.sendopts.Env;
import org.netbeans.spi.sendopts.Option;
import org.netbeans.spi.sendopts.OptionProcessor;
import org.openide.util.NbBundle;

public abstract class OptionImpl
  implements Cloneable
{
  public static final Logger LOG = Logger.getLogger(OptionImpl.class.getName());
  public static final Object NO_DEFAULT = new Object();
  static final String[] NO_VALUE = new String[0];
  public final Option root;
  Option option;
  final int argumentType;
  OptionProcessor provider;
  private Appearance appear;
  
  OptionImpl(Option paramOption, OptionProcessor paramOptionProcessor, int paramInt)
  {
    root = paramOption;
    option = paramOption;
    provider = paramOptionProcessor;
    argumentType = paramInt;
  }
  
  public int getShortName()
  {
    return Trampoline.DEFAULT.getShortName(option);
  }
  
  public String getLongName()
  {
    return Trampoline.DEFAULT.getLongName(option);
  }
  
  public int getArgumentType()
  {
    return argumentType;
  }
  
  public int hashCode()
  {
    return option.hashCode();
  }
  
  public boolean equals(Object paramObject)
  {
    if ((paramObject instanceof OptionImpl)) {
      return option.equals(option);
    }
    return false;
  }
  
  public final void append(StringBuffer paramStringBuffer)
  {
    String str = getClass().getName();
    int i = str.indexOf('$');
    assert (i >= 0);
    paramStringBuffer.append(str.substring(i + 1));
    appendInternals(paramStringBuffer);
  }
  
  void appendInternals(StringBuffer paramStringBuffer) {}
  
  public String toString()
  {
    return "Impl:" + option;
  }
  
  public String findName(boolean paramBoolean, String[] paramArrayOfString)
  {
    if (paramBoolean)
    {
      for (int i = 0; i < paramArrayOfString.length; i++)
      {
        if (paramArrayOfString[i].startsWith("-" + (char)getShortName())) {
          return "-" + (char)getShortName();
        }
        if (paramArrayOfString[i].startsWith("--" + getLongName())) {
          return "--" + getLongName();
        }
      }
    }
    else
    {
      if (getLongName() != null) {
        return "--" + getLongName();
      }
      if (getShortName() != -1) {
        return "-" + (char)getShortName();
      }
    }
    return null;
  }
  
  public Option getOption()
  {
    return option;
  }
  
  public OptionProcessor getProvider()
  {
    return provider;
  }
  
  private static <T extends OptionImpl> T doClone(T paramT)
  {
    try
    {
      return (OptionImpl)paramT.clone();
    }
    catch (CloneNotSupportedException localCloneNotSupportedException)
    {
      if (!$assertionsDisabled) {
        throw new AssertionError();
      }
    }
    return null;
  }
  
  public static OptionImpl cloneImpl(OptionImpl paramOptionImpl, Option paramOption, OptionProcessor paramOptionProcessor)
  {
    OptionImpl localOptionImpl;
    try
    {
      localOptionImpl = (OptionImpl)paramOptionImpl.clone();
    }
    catch (CloneNotSupportedException localCloneNotSupportedException)
    {
      if (!$assertionsDisabled) {
        throw new AssertionError();
      }
      return null;
    }
    option = paramOption;
    if (paramOptionProcessor != null) {
      provider = paramOptionProcessor;
    }
    return localOptionImpl;
  }
  
  public final OptionImpl addWorkingCopy(Collection<OptionImpl> paramCollection)
  {
    if (paramCollection.contains(this))
    {
      Iterator localIterator = paramCollection.iterator();
      for (;;)
      {
        OptionImpl localOptionImpl = (OptionImpl)localIterator.next();
        if (localOptionImpl.equals(this)) {
          return localOptionImpl;
        }
      }
    }
    return handleAdd(paramCollection);
  }
  
  protected abstract OptionImpl handleAdd(Collection<OptionImpl> paramCollection);
  
  public abstract Appearance checkConsistent(Set<OptionImpl> paramSet);
  
  public static class Appearance
  {
    private OptionImpl.MessageFactory msg;
    public static final Appearance YES = new Appearance();
    public static final Appearance NO = new Appearance();
    public static final Appearance MAYBE = new Appearance();
    
    public static final Appearance createError(OptionImpl.MessageFactory paramMessageFactory)
    {
      Appearance localAppearance = new Appearance();
      msg = paramMessageFactory;
      return localAppearance;
    }
    
    public final boolean isThere()
    {
      return this == YES;
    }
    
    public boolean isError()
    {
      return (YES != this) && (NO != this) && (MAYBE != this);
    }
    
    public String errorMessage(String[] paramArrayOfString)
    {
      return msg.errorMessage(paramArrayOfString);
    }
    
    public String toString()
    {
      if (this == YES) {
        return "YES";
      }
   
1 2

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