コード例 #1
0
  /**
   * Constructor.
   *
   * @param useInFilter whether preprocessing filters are permitted
   */
  public HomogeneousTablesInput(boolean useInFilter) {
    List<Parameter> paramList = new ArrayList();

    /* Input tables parameter. */
    inTablesParam_ = new InputTablesParameter("in");
    inTablesParam_.setUsage("<table> [<table> ...]");
    inTablesParam_.setPrompt("Location of input table(s)");
    paramList.add(inTablesParam_);
    paramList.add(inTablesParam_.getFormatParameter());
    paramList.add(inTablesParam_.getMultiParameter());
    paramList.add(inTablesParam_.getStreamParameter());

    /* Input filter parameter. */
    if (useInFilter) {
      inFilterParam_ = new FilterParameter("icmd");
      inFilterParam_.setPrompt("Processing command(s) " + "for each input table");
      inFilterParam_.setDescription(
          new String[] {
            "<p>Commands which will operate on each of the input tables,",
            "before any other processing takes place.",
            "</p>",
            inFilterParam_.getDescription(),
          });
      paramList.add(inFilterParam_);
    } else {
      inFilterParam_ = null;
    }
    params_ = paramList.toArray(new Parameter[0]);
  }
コード例 #2
0
 public InputTableSpec[] getInputSpecs(final Environment env) throws TaskException {
   ProcessingStep[] steps = inFilterParam_ == null ? null : inFilterParam_.stepsValue(env);
   TableProducer[] tprods = inTablesParam_.tablesValue(env);
   final int nIn = tprods.length;
   InputTableSpec[] specs = new InputTableSpec[nIn];
   for (int i = 0; i < nIn; i++) {
     final int index = i;
     final TableProducer tprod = tprods[i];
     specs[i] =
         new InputTableSpec(tprod.toString(), steps) {
           public StarTable getInputTable() throws TaskException {
             try {
               logger_.config("Input table " + (index + 1) + "/" + nIn);
               return tprod.getTable();
             } catch (IOException e) {
               throw new TaskException(e.getMessage(), e);
             }
           }
         };
   }
   return specs;
 }