Example #1
0
  // returns the stream of final pig script to be passed to Grunt
  private static BufferedReader runParamPreprocessor(
      BufferedReader origPigScript,
      ArrayList<String> params,
      ArrayList<String> paramFiles,
      String scriptFile,
      boolean createFile)
      throws org.apache.pig.tools.parameters.ParseException, IOException {
    ParameterSubstitutionPreprocessor psp = new ParameterSubstitutionPreprocessor(50);
    String[] type1 = new String[1];
    String[] type2 = new String[1];

    if (createFile) {
      BufferedWriter fw = new BufferedWriter(new FileWriter(scriptFile));
      psp.genSubstitutedFile(
          origPigScript,
          fw,
          params.size() > 0 ? params.toArray(type1) : null,
          paramFiles.size() > 0 ? paramFiles.toArray(type2) : null);
      return new BufferedReader(new FileReader(scriptFile));

    } else {
      StringWriter writer = new StringWriter();
      psp.genSubstitutedFile(
          origPigScript,
          writer,
          params.size() > 0 ? params.toArray(type1) : null,
          paramFiles.size() > 0 ? paramFiles.toArray(type2) : null);
      return new BufferedReader(new StringReader(writer.toString()));
    }
  }
Example #2
0
 static {
   int current_chr = -1;
   File hgnc =
       new File(CfgReader.getBasic(Consts.CURRENT_ASSEMBLY, Consts.FORMAT_HGNC).get_Path());
   ByteBufferChannel bbc = new ByteBufferChannel(hgnc, 0, hgnc.length());
   String[] temp = bbc.ToString(Consts.DEFAULT_ENCODE).split("\n");
   ArrayList<String> ChrList_temp = new ArrayList<String>();
   ArrayList<Integer> ChrStart_temp = new ArrayList<Integer>();
   ArrayList<Integer> ChrEnd_temp = new ArrayList<Integer>();
   ChrMap = new HashMap<String, Integer>();
   SymbolMap = new HashMap<String, Integer>();
   Symbols = new String[temp.length];
   Symbols_sorted = new String[temp.length];
   HGNCs = new String[temp.length];
   Entrezs = new String[temp.length];
   RefSeqs = new String[temp.length];
   UCSCs = new String[temp.length];
   Ensembls = new String[temp.length];
   Names = new String[temp.length];
   Chrs = new int[temp.length];
   Starts = new int[temp.length];
   Ends = new int[temp.length];
   for (int i = 0; i < temp.length; i++) {
     String[] line_temp = temp[i].split("\t");
     if (!ChrMap.containsKey(line_temp[0])) {
       if (i > 0) ChrEnd_temp.add(i - 1);
       ChrMap.put(line_temp[0], ++current_chr);
       ChrList_temp.add(line_temp[0]);
       ChrStart_temp.add(i);
     }
     Chrs[i] = current_chr;
     Starts[i] = Integer.parseInt(line_temp[1]);
     Ends[i] = Integer.parseInt(line_temp[2]);
     Symbols[i] = line_temp[3];
     Symbols_sorted[i] = line_temp[3];
     SymbolMap.put(line_temp[3], i);
     RefSeqs[i] = line_temp[4];
     UCSCs[i] = line_temp[5];
     Ensembls[i] = line_temp[6];
     Entrezs[i] = line_temp[7];
     HGNCs[i] = line_temp[8];
     Names[i] = line_temp[9];
   }
   ChrEnd_temp.add(temp.length - 1);
   Arrays.sort(Symbols_sorted);
   ChrList = new String[ChrList_temp.size()];
   ChrStarts = new Integer[ChrList.length];
   ChrEnds = new Integer[ChrList.length];
   ChrList_temp.toArray(ChrList);
   ChrStart_temp.toArray(ChrStarts);
   ChrEnd_temp.toArray(ChrEnds);
 }
  public static void main(String[] args) {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */

    try {

      Scanner sc = new Scanner(new File("/home/santosh/Desktop/testData"));

      int testCases = sc.nextInt();
      int i = 0;
      ArrayList<ArrayList<Integer>> inputArraysList = new ArrayList<ArrayList<Integer>>();
      ArrayList<Integer> list;
      while (i++ < testCases) {

        int n = sc.nextInt();
        int k = 0;
        list = new ArrayList<Integer>();
        while (k < n) {
          list.add(sc.nextInt());
          k++;
        }
        inputArraysList.add(list);
      }

      // System.out.println(inputArraysList.size());
      for (ArrayList<Integer> arr : inputArraysList) {
        countPairs(arr.toArray(new Integer[arr.size()]));
      }

    } catch (Exception e) {

    }
  }
Example #4
0
 static Method[] getOverridableMethods(Class c) {
   ArrayList<Method> list = new ArrayList<Method>();
   HashSet<String> skip = new HashSet<String>();
   while (c != null) {
     Method[] methods = c.getDeclaredMethods();
     for (int i = 0; i < methods.length; i++) {
       String methodKey =
           methods[i].getName() + getMethodSignature(methods[i], methods[i].getParameterTypes());
       if (skip.contains(methodKey)) continue; // skip this method
       int mods = methods[i].getModifiers();
       if (Modifier.isStatic(mods)) continue;
       if (Modifier.isFinal(mods)) {
         // Make sure we don't add a final method to the list
         // of overridable methods.
         skip.add(methodKey);
         continue;
       }
       if (Modifier.isPublic(mods) || Modifier.isProtected(mods)) {
         list.add(methods[i]);
         skip.add(methodKey);
       }
     }
     c = c.getSuperclass();
   }
   return list.toArray(new Method[list.size()]);
 }
Example #5
0
 /**
  * Returns all editors.
  *
  * @return editors
  */
 EditorArea[] editors() {
   final ArrayList<EditorArea> edits = new ArrayList<EditorArea>();
   for (final Component c : tabs.getComponents()) {
     if (c instanceof EditorArea) edits.add((EditorArea) c);
   }
   return edits.toArray(new EditorArea[edits.size()]);
 }
Example #6
0
  // used to read in all dtf files and merge them.
  public static String[] mergeDTF() {
    // this section reads in all the text file names
    mergedDTF = new ArrayList<String>();
    File f = new File("/DogeTix/src/BackEnd/DTFFolder");
    FilenameFilter filter =
        new FilenameFilter() {
          public boolean accept(File dir, String name) {
            return name.toLowerCase().endsWith(".txt"); // or .dtf
          }
        };

    File[] files = f.listFiles(filter);
    Scanner scan;
    try {
      // for every dtf file in the directory
      for (File file : files) {
        scan = new Scanner(file);
        while (scan.hasNextLine()) {
          // add the line to the arraylist
          mergedDTF.add(scan.nextLine());
        }
      }
    } catch (IOException e) {
      System.out.println(e);
      System.exit(0);
    }

    // merge the files into mergedDTF string array
    return mergedDTF.toArray(new String[mergedDTF.size()]);
  }
  // read data from text files
  private String[] readFileText(String file_name) {
    ArrayList<String> data_out = new ArrayList<String>();
    String[] output;
    String current_line = null;

    System.out.println("readFileText: About to read file");
    try {
      InputStream file = new FileInputStream(file_name);
      BufferedReader buffer = new BufferedReader(new InputStreamReader(file));

      // read file data line by line & add to temporary storage
      while ((current_line = buffer.readLine()) != null) {
        data_out.add(new String(current_line));
      }
    } catch (Exception e) {
      System.out.println("readFileText: Failed to read file " + file_name);
    }

    System.out.println("readFileText: About to convert to array");
    output = new String[data_out.size()];
    data_out.toArray(output); // convert collected data to array

    System.out.println("readFileText: data_out size = " + data_out.size());

    for (String line : output) {
      System.out.println("readFileText: Returning = '" + line + "'");
    }

    return output;
  }
Example #8
0
  /**
   * Creates a java process that executes the given main class and waits for the process to
   * terminate.
   *
   * @return a {@link ProcessOutputReader} that can be used to get the exit code and stdout+stderr
   *     of the terminated process.
   */
  public static ProcessOutputReader fg(Class main, String[] vmArgs, String[] mainArgs)
      throws IOException {
    File javabindir = new File(System.getProperty("java.home"), "bin");
    File javaexe = new File(javabindir, "java");

    int bits = Integer.getInteger("sun.arch.data.model", 0).intValue();
    String vmKindArg = (bits == 64) ? "-d64" : null;

    ArrayList argList = new ArrayList();
    argList.add(javaexe.getPath());
    if (vmKindArg != null) {
      argList.add(vmKindArg);
    }
    // argList.add("-Dgemfire.systemDirectory=" +
    // GemFireConnectionFactory.getDefaultSystemDirectory());
    argList.add("-Djava.class.path=" + System.getProperty("java.class.path"));
    argList.add("-Djava.library.path=" + System.getProperty("java.library.path"));
    if (vmArgs != null) {
      argList.addAll(Arrays.asList(vmArgs));
    }
    argList.add(main.getName());
    if (mainArgs != null) {
      argList.addAll(Arrays.asList(mainArgs));
    }
    String[] cmd = (String[]) argList.toArray(new String[argList.size()]);
    return new ProcessOutputReader(Runtime.getRuntime().exec(cmd));
  }
  // retrieve list of servers storing a user account
  public String[] getUserLocation(String username) {
    ArrayList<String> locations = getUserLocationList().get(username);
    String[] locations_arr = new String[locations.size()];
    locations.toArray(locations_arr);

    return locations_arr;
  }
  // retrieve list of servers storing this product entry
  public String[] getStoredLocation(String name) {
    ArrayList<String> locations = getLocationList().get(name);
    String[] locations_arr = new String[locations.size()];
    locations.toArray(locations_arr);

    return locations_arr;
  }
Example #11
0
 /**
  * Returns a single selected node or {@code null} if zero or more than node is selected.
  *
  * @return selected node
  */
 private IOFile[] selectedValues() {
   // nothing selected: select first entry
   if (isSelectionEmpty() && getModel().getSize() != 0) setSelectedIndex(0);
   final ArrayList<IOFile> list = new ArrayList<>();
   for (final String val : getSelectedValuesList()) list.add(new IOFile(val));
   return list.toArray(new IOFile[list.size()]);
 }
  /**
   * When the user has to specify file names, he can use wildcards (*, ?). This methods handles the
   * usage of these wildcards.
   *
   * @param path The path were to search
   * @param s Wilcards
   * @param sort Set to true will sort file names
   * @return An array of String which contains all files matching <code>s</code> in current
   *     directory.
   */
  public static String[] getWildCardMatches(String path, String s, boolean sort) {
    if (s == null) return null;

    String files[];
    String filesThatMatch[];
    String args = new String(s.trim());
    ArrayList filesThatMatchVector = new ArrayList();

    if (path == null) path = getUserDirectory();

    files = (new File(path)).list();
    if (files == null) return null;

    for (int i = 0; i < files.length; i++) {
      if (match(args, files[i])) {
        File temp = new File(getUserDirectory(), files[i]);
        filesThatMatchVector.add(new String(temp.getName()));
      }
    }

    Object[] o = filesThatMatchVector.toArray();
    filesThatMatch = new String[o.length];
    for (int i = 0; i < o.length; i++) filesThatMatch[i] = o[i].toString();
    o = null;
    filesThatMatchVector = null;

    if (sort) Arrays.sort(filesThatMatch);

    return filesThatMatch;
  }
Example #13
0
 public static IMarker[] getProblemsFor(IResource resource) {
   try {
     if (resource != null && resource.exists()) {
       IMarker[] markers =
           resource.findMarkers(
               IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
       Set markerTypes =
           JavaModelManager.getJavaModelManager().compilationParticipants.managedMarkerTypes();
       if (markerTypes.isEmpty()) return markers;
       ArrayList markerList = new ArrayList(5);
       for (int i = 0, length = markers.length; i < length; i++) {
         markerList.add(markers[i]);
       }
       Iterator iterator = markerTypes.iterator();
       while (iterator.hasNext()) {
         markers = resource.findMarkers((String) iterator.next(), false, IResource.DEPTH_INFINITE);
         for (int i = 0, length = markers.length; i < length; i++) {
           markerList.add(markers[i]);
         }
       }
       IMarker[] result;
       markerList.toArray(result = new IMarker[markerList.size()]);
       return result;
     }
   } catch (CoreException e) {
     // assume there are no problems
   }
   return new IMarker[0];
 }
Example #14
0
 /**
  * Gets the local user's DNS names
  *
  * @return The local user's DNS names
  */
 public static String[] getPersonalDNSes() {
   synchronized (monitor) {
     final String[] rc = new String[myDNSes.size()];
     myDNSes.toArray(rc);
     return rc;
   }
 }
Example #15
0
  private boolean invokeMethod(String line, PrintWriter out, Method method, String[] fields)
      throws IllegalAccessException, InvocationTargetException {
    ArrayList<Object> methodArguments = new ArrayList<Object>();

    Class<?>[] parameterTypes = method.getParameterTypes();
    if (parameterTypes.length == 2
        && parameterTypes[0] == PrintWriter.class
        && parameterTypes[1] == String.class) {
      // FIXME: there must be a better way to say "I want to parse the line myself."
      methodArguments.add(out);
      methodArguments.add(line);
    } else {
      int nextField = 1;
      for (Class<?> parameterType : parameterTypes) {
        if (parameterType == PrintWriter.class) {
          methodArguments.add(out);
        } else if (parameterType == String.class) {
          methodArguments.add(fields[nextField++]);
        }
        // FIXME: support other common types. "int" seems a likely first candidate.
      }
    }

    method.invoke(handler, methodArguments.toArray());
    return true;
  }
 private URLClassLoader buildClassLoader() throws PluginException {
   ClassLoader parent = JarPluginProviderLoader.class.getClassLoader();
   try {
     final URL url = getCachedJar().toURI().toURL();
     final URL[] urlarray;
     if (null != getDepLibs() && getDepLibs().size() > 0) {
       final ArrayList<URL> urls = new ArrayList<URL>();
       urls.add(url);
       for (final File extlib : getDepLibs()) {
         urls.add(extlib.toURI().toURL());
       }
       urlarray = urls.toArray(new URL[urls.size()]);
     } else {
       urlarray = new URL[] {url};
     }
     URLClassLoader loaded =
         loadLibsFirst
             ? LocalFirstClassLoader.newInstance(urlarray, parent)
             : URLClassLoader.newInstance(urlarray, parent);
     classLoaders.put(getCachedJar(), loaded);
     return loaded;
   } catch (MalformedURLException e) {
     throw new PluginException("Error creating classloader for " + cachedJar, e);
   }
 }
Example #17
0
  public WDBObject[] search(SimpleNode expression, Adapter scda) throws Exception {
    boolean hasWhereClause = (expression != null);
    WDBObject[] matchesArray = new WDBObject[0];
    ArrayList<WDBObject> matchesList = new ArrayList<WDBObject>();
    WDBObject[] indexFilteredArray;
    if (hasWhereClause) {
      indexFilteredArray =
          expression
              .filterObjectsWithIndexes(scda, this.indexes)
              .getFilteredResults(scda, this.indexes);
    } else {
      indexFilteredArray = null;
    }
    if (indexFilteredArray == null) {
      // Simple for loop for search
      WDBObject object;
      for (int i = 0; i < this.instances.size(); i++) {
        object = this.getInstance(i, scda);
        if (!hasWhereClause || (hasWhereClause && expression.eval(scda, object))) {
          matchesList.add(object);
        }
      }
    } else {
      // Simple for loop for search
      for (int i = 0; i < indexFilteredArray.length; i++) {
        if (!hasWhereClause || (hasWhereClause && expression.eval(scda, indexFilteredArray[i]))) {
          matchesList.add(indexFilteredArray[i]);
        }
      }
    }

    return (WDBObject[]) matchesList.toArray(matchesArray);
  }
 public void load() {
   if (!modelExists()) {
     loadError = "Cannot find " + LEVELS_DAT_FILE + ".";
     return;
   }
   File folder = new File(location);
   File dat = new File(folder, LEVELS_DAT_FILE);
   // File lst = new File(folder, LEVELS_LST_FILE);
   if (!dat.isFile()) return;
   ArrayList levels = new ArrayList();
   try {
     FileInputStream reader = new FileInputStream(dat);
     long fileLength = dat.length();
     int length = model.getField().getSize() + 96;
     int readLength = 0;
     byte[] buffer = new byte[length];
     while (fileLength - readLength >= length) {
       int toRead = length;
       while (toRead > 0) {
         toRead -= reader.read(buffer, length - toRead, toRead);
       }
       readLength += length;
       SupaplexLevel level = new SupaplexLevel();
       level.setModel(model);
       level.loadFromBytes(buffer);
       levels.add(level);
     }
     reader.close();
   } catch (Exception e) {
     e.printStackTrace();
   }
   SupaplexLevel[] ls = (SupaplexLevel[]) levels.toArray(new SupaplexLevel[0]);
   model.setLevels(ls);
 }
 @Override
 public void ignoreProblem(RefEntity refEntity, CommonProblemDescriptor problem, int idx) {
   if (refEntity == null) return;
   final Set<QuickFix> localQuickFixes = getQuickFixActions().get(refEntity);
   final QuickFix[] fixes = problem.getFixes();
   if (isIgnoreProblem(fixes, localQuickFixes, idx)) {
     getProblemToElements().remove(problem);
     Map<RefEntity, CommonProblemDescriptor[]> problemElements = getProblemElements();
     synchronized (lock) {
       CommonProblemDescriptor[] descriptors = problemElements.get(refEntity);
       if (descriptors != null) {
         ArrayList<CommonProblemDescriptor> newDescriptors =
             new ArrayList<CommonProblemDescriptor>(Arrays.asList(descriptors));
         newDescriptors.remove(problem);
         getQuickFixActions().put(refEntity, null);
         if (!newDescriptors.isEmpty()) {
           problemElements.put(
               refEntity,
               newDescriptors.toArray(new CommonProblemDescriptor[newDescriptors.size()]));
           for (CommonProblemDescriptor descriptor : newDescriptors) {
             collectQuickFixes(descriptor.getFixes(), refEntity);
           }
         } else {
           ignoreProblemElement(refEntity);
         }
       }
     }
   }
 }
Example #20
0
  private void exportAcl(Acl acl) {
    if (acl != null) {
      ArrayList<String> propval = new ArrayList<String>();
      for (Enumeration<AclEntry> ee = acl.entries(); ee.hasMoreElements(); ) {
        AclEntry ae = ee.nextElement();

        StringBuilder sb = new StringBuilder();

        sb.append("ALLOW \"");
        sb.append(ae.getPrincipal().getName());
        sb.append("\" ");

        for (Enumeration<Permission> permissions = ae.permissions();
            permissions.hasMoreElements(); ) {
          Permission perm = permissions.nextElement();

          sb.append(perm.getActions());
          sb.append(",");
        }

        propval.add(sb.toString());
      }

      exportProperty("wiki:acl", propval.toArray(new String[propval.size()]), STRING);
    }
  }
Example #21
0
  public void removePhaseListener(PhaseListener listener) {
    if (listener == null) throw new NullPointerException();

    synchronized (_phaseList) {
      _phaseList.remove(listener);
      _phaseListeners = new PhaseListener[_phaseList.size()];
      _phaseList.toArray(_phaseListeners);
    }
  }
    public void valueChanged(ListSelectionEvent evt) {
      if (!evt.getValueIsAdjusting()) {
        JFileChooser chooser = getFileChooser();
        FileSystemView fsv = chooser.getFileSystemView();
        JList list = (JList) evt.getSource();

        int fsm = chooser.getFileSelectionMode();
        boolean useSetDirectory = usesSingleFilePane && (fsm == JFileChooser.FILES_ONLY);

        if (chooser.isMultiSelectionEnabled()) {
          File[] files = null;
          Object[] objects = list.getSelectedValues();
          if (objects != null) {
            if (objects.length == 1
                && ((File) objects[0]).isDirectory()
                && chooser.isTraversable(((File) objects[0]))
                && (useSetDirectory || !fsv.isFileSystem(((File) objects[0])))) {
              setDirectorySelected(true);
              setDirectory(((File) objects[0]));
            } else {
              ArrayList<File> fList = new ArrayList<File>(objects.length);
              for (Object object : objects) {
                File f = (File) object;
                boolean isDir = f.isDirectory();
                if ((chooser.isFileSelectionEnabled() && !isDir)
                    || (chooser.isDirectorySelectionEnabled() && fsv.isFileSystem(f) && isDir)) {
                  fList.add(f);
                }
              }
              if (fList.size() > 0) {
                files = fList.toArray(new File[fList.size()]);
              }
              setDirectorySelected(false);
            }
          }
          chooser.setSelectedFiles(files);
        } else {
          File file = (File) list.getSelectedValue();
          if (file != null
              && file.isDirectory()
              && chooser.isTraversable(file)
              && (useSetDirectory || !fsv.isFileSystem(file))) {

            setDirectorySelected(true);
            setDirectory(file);
            if (usesSingleFilePane) {
              chooser.setSelectedFile(null);
            }
          } else {
            setDirectorySelected(false);
            if (file != null) {
              chooser.setSelectedFile(file);
            }
          }
        }
      }
    }
Example #23
0
 String[] readFile(String fn) throws IOException {
   BufferedReader br = new BufferedReader(new FileReader(fn));
   String s;
   ArrayList al = new ArrayList();
   while ((s = br.readLine()) != null) {
     al.add(s);
   }
   return (String[]) al.toArray(new String[0]);
 }
 private static Field[] getAllFields(Class cls) {
   ArrayList<Field> res = new ArrayList<>();
   Class c = cls;
   while (c != View.class) {
     assert Utils.check(c != null);
     res.addAll(Arrays.asList(c.getDeclaredFields()));
     c = c.getSuperclass();
   }
   return res.toArray(new Field[res.size()]);
 }
 /**
  * Uses the feature model to determine the set of features required by the given list of checked
  * features
  *
  * @param allFeatures list of all features to search requirements in
  * @param checkedFeatures list of features to get requirements for
  * @return list of features to be checked
  */
 private Object[] getRequiredFeatures(
     final IFeatureModel[] allFeatures, final Object[] checkedFeatures) {
   ArrayList required = new ArrayList();
   for (int j = 0; j < checkedFeatures.length; j++) {
     if (checkedFeatures[j] instanceof IFeatureModel) {
       getFeatureDependencies((IFeatureModel) checkedFeatures[j], allFeatures, required);
     }
   }
   return required.toArray();
 }
 public static String[] getFeaturePaths() {
   IFeatureModel[] models = MDECore.getDefault().getFeatureModelManager().getModels();
   ArrayList list = new ArrayList();
   for (int i = 0; i < models.length; i++) {
     String location = models[i].getInstallLocation();
     if (location != null)
       list.add(location + IPath.SEPARATOR + ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
   }
   return (String[]) list.toArray(new String[list.size()]);
 }
 /**
  * Returns a list of blocks that have timed out their replication requests. Returns null if no
  * blocks have timed out.
  */
 Block[] getTimedOutBlocks() {
   synchronized (timedOutItems) {
     if (timedOutItems.size() <= 0) {
       return null;
     }
     Block[] blockList = timedOutItems.toArray(new Block[timedOutItems.size()]);
     timedOutItems.clear();
     return blockList;
   }
 }
Example #28
0
    protected void buildPanel(String strPath) {
      strPath = FileUtil.openPath(strPath);
      ArrayList aListPath = new ArrayList();
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      if (reader == null) return;

      String strLine;
      try {
        while ((strLine = reader.readLine()) != null) {
          StringTokenizer strTok = new StringTokenizer(strLine, ":");
          if (strTok.countTokens() < 4) continue;

          boolean bChecksum = false;
          boolean bShow = false;

          String strDir = strTok.nextToken();
          String strChecksum = strTok.nextToken();

          if (strChecksum.equalsIgnoreCase("checksum")) bChecksum = true;

          if (bChecksum && (strDir.equals("file") || strDir.equals("dir"))) {
            String strValue = strTok.nextToken();
            String strShow = strTok.nextToken();
            if (strShow.equalsIgnoreCase("yes")) bShow = true;

            if (bShow) aListPath.add(strValue);
          }
        }

        m_cmbPath = new JComboBox(aListPath.toArray());

        JPanel pnlDisplay = new JPanel(new GridBagLayout());
        GridBagConstraints gbc =
            new GridBagConstraints(
                0,
                0,
                1,
                1,
                0.2,
                0.2,
                GridBagConstraints.NORTHWEST,
                GridBagConstraints.HORIZONTAL,
                new Insets(0, 0, 0, 0),
                0,
                0);
        pnlDisplay.add(m_cmbPath, gbc);
        gbc.gridx = 1;
        pnlDisplay.add(m_cmbChecksum, gbc);
        add(pnlDisplay, BorderLayout.NORTH);
        add(m_txaChecksum, BorderLayout.CENTER);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  static {
    try {
      ArrayList<GribPDSParamTable> tables = new ArrayList<GribPDSParamTable>();
      String resourceName = RESOURCE_PATH + "/" + TABLE_LIST;
      readTableEntries(resourceName, tables);
      paramTables = (GribPDSParamTable[]) tables.toArray(new GribPDSParamTable[tables.size()]);

    } catch (IOException ioe) {
      throw new RuntimeException(ioe);
    }
  }
Example #30
0
 public Integer[] areas() {
   /* Return a list of all areanumbers */
   ArrayList<Integer> list = new ArrayList<Integer>();
   for (int f : area) {
     if (!(list.contains(f))) { // Add all areanumbers that not already in list
       list.add(f);
     }
   }
   Integer[] i = new Integer[list.size()]; // Convert the list to array
   return list.toArray(i); // and return the array
 }