Examples of Getopt


Examples of gnu.getopt.Getopt

    String argString = "d:i:o:c:r:gu";
    featdim = parseFeatDim(args, argString);
    dist = parseChunkDist(args, argString, featdim);
    parseCommands(args, argString);

    Getopt opt = new Getopt("NNSwapComposer", args, argString);
    opt.setOpterr(false);

    int c = -1;
    while ((c = opt.getopt()) != -1)
    {
      switch (c)
      {
      case 'o':
        outFileName = opt.getOptarg();
        break;
      case 'r':
        reverseSort = true;
        break;
      case 'g':
        debug = true;
        break;
      case 'u':
        reuseChunks = true;
        break;
      case 'd': // already handled above
        break;
      case 'i': // already handled above
        break;
      case 'c': // already handled above
        break;
      case '?':
        printUsageAndExit();
        break;
      default:
        System.out.print("getopt() returned " + c + "\n");
      }
    }

    // parse arguments
    int ind = opt.getOptind();
    if (ind > args.length)
      printUsageAndExit();

    featFile = new FeatFile(args[args.length - 1]);
    outFile = new EDLFile(outFileName);
View Full Code Here

Examples of gnu.getopt.Getopt

    String argString = "d:i:o:c:r:g";
    // featdim = parseFeatDim(args, argString);
    // dist = parseChunkDist(args, argString, featdim);
    parseCommands(args, argString);

    Getopt opt = new Getopt("EDLComposer", args, argString);
    opt.setOpterr(false);

    int c = -1;
    while ((c = opt.getopt()) != -1)
    {
      switch (c)
      {
      case 'o':
        outFileName = opt.getOptarg();
        break;
      case 'r':
        reverseSort = true;
        break;
      case 'g':
        debug = true;
        break;
      case 'd': // already handled above
        break;
      case 'i': // already handled above
        break;
      case 'c': // already handled above
        break;
      case '?':
        printUsageAndExit();
        break;
      default:
        System.out.print("getopt() returned " + c + "\n");
      }
    }

    // parse arguments
    int ind = opt.getOptind();
    if (ind > args.length)
      printUsageAndExit();

    inEDLFile = new EDLFile(args[args.length - 1]);
    outFile = new EDLFile(outFileName);
View Full Code Here

Examples of gnu.getopt.Getopt

    String argString = "o:c:q:i:gd:f:b:";
    featdim = parseFeatDim(args, argString);
    dist = parseChunkDist(args, argString, featdim);
    parseCommands(args, argString);

    Getopt opt = new Getopt("VQComposer", args, argString);
    opt.setOpterr(false);

    int c = -1;
    while ((c = opt.getopt()) != -1)
    {
      switch (c)
      {
      case 'o':
        outFileName = opt.getOptarg();
        break;
      case 'g':
        debug = true;
        break;
      case 'q':
        cbSize = Integer.parseInt(opt.getOptarg());
        break;
      case 'b':
        beatsPerCodeword = Integer.parseInt(opt.getOptarg());
        break;
      case 'f':
        featsToQuantize = new FeatFile(opt.getOptarg());
        break;
      case 'c': // already handled above
        break;
      case 'd': // already handled above
        break;
      case 'i': // already handled above
        break;
      case '?':
        printUsageAndExit();
        break;
      default:
        System.out.print("getopt() returned " + c + "\n");
      }
    }

    // parse arguments
    int ind = opt.getOptind();
    if (ind > args.length)
      printUsageAndExit();

    trainFile = new FeatFile(args[args.length - 1]);
    if (featsToQuantize == null)
View Full Code Here

Examples of net.matuschek.getopt.GetOpt

      printUsage();
      return;
    }

    // get command line options
    GetOpt opt = new GetOpt(argv);
    String option = null;

    JoBoBase jobobase = JoBoBase.createFromXML();
    WebRobot robby = jobobase.getRobot();

    // referer
    option=opt.getOptionString("r");
    if (option != null) {
      robby.setStartReferer(option);
    }
   
    // maximal depth
    option=opt.getOptionString("d");
    if (option != null) {
  try {
    int maxDepth=Integer.parseInt(option);
    robby.setMaxDepth(maxDepth);
  } catch (NumberFormatException e) {
    System.out.println("Wrong number for maxDepth: "+option);
  }
    }
   
    // walk to other hosts ?
    if (opt.getOptionBoolean("o")) {
      robby.setWalkToOtherHosts(true);
    }
   
    // store directory
    option=opt.getOptionString("s");
    if (option != null) {
      basedir=option;
    }
   
    // minimal file size
    option=opt.getOptionString("m");
    if (option != null) {
      try {
  minSize=Integer.parseInt(option);
      } catch (NumberFormatException e) {}
    }
   
    // agent name
    option=opt.getOptionString("a");
    if (option != null) {
      robby.setAgentName(option);
    }
   
    // ignore robots.txt
    if (opt.getOptionBoolean("i")) {
      robby.setIgnoreRobotsTxt(true);
    }
   
    // wait time
    option=opt.getOptionString("w");
    if (option != null) {
      try {
  int waitTime=Integer.parseInt(option);
  robby.setSleepTime(waitTime*1000);
      } catch (NumberFormatException e) {}
    }
   
    // print usage
    if (opt.getOptionBoolean("?")) {
      printUsage();
      return;
    }
   
    URL u = new URL(argv[argv.length-1]);
View Full Code Here

Examples of netscape.ldap.util.GetOpt

    String usage = "Usage: psearch -h <hostname> -p <port> -b <suffix>" + "[-D bindDN] [-w bindPW]" + "-f <fileURL+file name>" + "-s" + "-n <number of thread>" + " -o <add,modify,delete,moddn>"+ " -l";
    String hostname = "localhost";
    int portnumber = 1389; //LDAPv3.DEFAULT_PORT;
    int nbThreads = 1;//number of thread by default
    // Check for these options. -H means to print out a usage message.
    GetOpt options = new GetOpt("h:p:b:D:w:H:f:n:o:s:l", args);

    // Get the arguments specified for each option.
    String host = options.getOptionParam('h');
    // host
    if (options.hasOption('h')) {
      if (host == null) {
        // usage
        System.out.println(usage);
        System.exit(1);
      } else {
        hostname = host;
      }
    }
    String port = options.getOptionParam('p');
    // If a port number was specified, convert the port value
    // to an integer.
    if (port != null) {
      try {
        portnumber = java.lang.Integer.parseInt(port);
      } catch (java.lang.Exception e) {
        System.out.println("Invalid port number: " + port);
        System.out.println(usage);
        System.exit(1);
      }
    }
    //number of thread
    String nbT = options.getOptionParam('n');
    if (nbT != null) {
      try {
        nbThreads = java.lang.Integer.parseInt(nbT);
      } catch (java.lang.Exception e) {
        System.out.println("Invalid Thread number: " + nbT);
        System.out.println(usage);
        System.exit(1);
      }
    }
    // PSearch suffix
    String suffix = options.getOptionParam('b');

    String bindDN = options.getOptionParam('D');

    String bindPW = options.getOptionParam('w');

    //operations all by default
    String operation = PSearchOperations.ALL;
    if (options.hasOption('o')) {
      String opParam = options.getOptionParam('o');
      if (opParam.equals("add")) {
        operation = PSearchOperations.ADD;
      } else if (opParam.equals("modify")) {
        operation = PSearchOperations.MODIFY;
      } else if (opParam.equals("delete")) {
        operation = PSearchOperations.DELETE;
      } else if (opParam.equals("moddn")) {
        operation = PSearchOperations.MODDN;
      } else if (opParam.equals("all")) {
        operation = PSearchOperations.ALL;
        ;
      } else {
        System.out.println("Invalid operation type: " + opParam);
        System.out.println(usage);
        System.exit(1);
      }
    }

    // to disable the log files
    boolean useFile = false;
    String fileName = "logLile";
    if (options.hasOption('f')) {
      useFile = options.hasOption('f');
      fileName = options.getOptionParam('f');
    }

    // to enable diff format
    boolean ldifFormat = options.hasOption('l');

    // to enable system out logs
    boolean output = options.hasOption('s');

    System.out.println("Connecting to " + hostname + ":" + portnumber +
            " as \"" + bindDN + "\"" +
            " on suffix \"" + suffix + "\"" +
            " on operation \"" + operation + "\"" +
View Full Code Here

Examples of org.apache.qpid.qmf2.util.GetOpt

        try
        {
            String host = "localhost";
            String connectionOptions = "{reconnect: true}";
            List<Pattern> filter = new ArrayList<Pattern>();
            GetOpt getopt = new GetOpt(args, "ha:f:", longOpts);
            List<String[]> optList = getopt.getOptList();

            for (String[] opt : optList)
            {
                if (opt[0].equals("-h") || opt[0].equals("--help"))
                {
View Full Code Here

Examples of org.apache.qpid.qmf2.util.GetOpt

        String[] longOpts = {"help", "whitelist=", "sasl-mechanism="};
        try
        {
            String connectionOptions = "{reconnect: true}";
            String whitelist = "./whitelist.xml";
            GetOpt getopt = new GetOpt(args, "h", longOpts);
            List<String[]> optList = getopt.getOptList();
            String[] cargs = {};
            cargs = getopt.getEncArgs().toArray(cargs);
            for (String[] opt : optList)
            {
                if (opt[0].equals("-h") || opt[0].equals("--help"))
                {
                    System.out.println(_usage);
View Full Code Here

Examples of org.apache.qpid.qmf2.util.GetOpt

        {
            String host = "localhost";
            String connectionOptions = "{reconnect: true}";
            boolean logQueues = false;

            GetOpt getopt = new GetOpt(args, "ha:q", longOpts);
            List<String[]> optList = getopt.getOptList();
            String[] cargs = {};
            cargs = getopt.getEncArgs().toArray(cargs);

            for (String[] opt : optList)
            {
                if (opt[0].equals("-h") || opt[0].equals("--help"))
                {
View Full Code Here

Examples of org.apache.qpid.qmf2.util.GetOpt

                             "force-if-used", "alternate-exchange=", "passive", "timeout=", "file=", "flow-stop-size=",
                             "flow-resume-size=", "flow-stop-count=", "flow-resume-count=", "argument="};

        try
        {
            GetOpt getopt = new GetOpt(args, "ha:bf:", longOpts);
            List<String[]> optList = getopt.getOptList();
            String[] cargs = {};
            cargs = getopt.getEncArgs().toArray(cargs);

            //System.out.println("optList");
            for (String[] opt : optList)
            {
                //System.out.println(opt[0] + ":" + opt[1]);
View Full Code Here

Examples of org.apache.qpid.qmf2.util.GetOpt

        {
            boolean includeRingQueues = false;
            String connectionOptions = "{reconnect: true}";
            List<Pattern> filter = new ArrayList<Pattern>();
            float purge = 0.2f;
            GetOpt getopt = new GetOpt(args, "hf:p:", longOpts);
            List<String[]> optList = getopt.getOptList();
            String[] cargs = {};
            cargs = getopt.getEncArgs().toArray(cargs);
            for (String[] opt : optList)
            {
                if (opt[0].equals("-h") || opt[0].equals("--help"))
                {
                    System.out.println(_usage);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.