Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.greenstone.gatherer.util
Class ArrayTools  view ArrayTools download ArrayTools.java

java.lang.Object
  extended byorg.greenstone.gatherer.util.ArrayTools

public class ArrayTools
extends java.lang.Object

This utility class contains a series of static methods for common array type manipulations including appending, casting and changing between containers.

Version:
2.3

Nested Class Summary
private static class ArrayTools.FileComparator
          Comparator used to order files.
 
Constructor Summary
ArrayTools()
           
 
Method Summary
static java.awt.Component[] add(java.awt.Component[] a, java.awt.Component b)
          Append a Component onto an array of Components.
static org.w3c.dom.Element[] add(org.w3c.dom.Element[] a, org.w3c.dom.Element b)
          This method efficiently appends a new element onto the end of a element array.
static org.w3c.dom.Element[] add(org.w3c.dom.Element[] a, org.w3c.dom.Element[] b)
          This method efficently appends one element array onto the end of another.
static java.io.File[] add(java.io.File[] a, java.io.File b)
          This method efficiently appends a new file onto the end of a file array.
static java.io.File[] add(java.io.File[] a, java.io.File[] b)
          This method efficently appends one file array onto the end of another.
static org.greenstone.gatherer.file.FileNode[] add(org.greenstone.gatherer.file.FileNode[] a, org.greenstone.gatherer.file.FileNode b)
          This method efficiently appends a new FileNode onto the end of a FileNode array.
static org.greenstone.gatherer.file.FileNode[] add(org.greenstone.gatherer.file.FileNode[] a, org.greenstone.gatherer.file.FileNode[] b)
          This method efficently appends one FileNode array onto the end of another FileNode array.
static org.greenstone.gatherer.msm.Metadata[] add(org.greenstone.gatherer.msm.Metadata[] a, org.greenstone.gatherer.msm.Metadata b)
          Append a Metadata object onto an array of Metadata objects.
static org.greenstone.gatherer.msm.Metadata[] add(org.greenstone.gatherer.msm.Metadata[] a, org.greenstone.gatherer.msm.Metadata[] b)
          Append a Metadata object array onto an array of Metadata objects.
static org.w3c.dom.Node[] add(org.w3c.dom.Node[] a, org.w3c.dom.Node b)
          This method efficiently appends a new node onto the end of a node array.
static org.w3c.dom.Node[] add(org.w3c.dom.Node[] a, org.w3c.dom.Node[] b)
          This method efficently appends one node array onto the end of another.
static java.lang.String[] add(java.lang.String[] a, java.lang.String b)
          This method efficiently appends a new string onto the end of a string array.
static java.lang.String[] add(java.lang.String[] a, java.lang.String[] b)
          This method efficently appends one string array onto the end of another.
static java.lang.String[] arrayListToStringArray(java.util.ArrayList a)
          This method takes an array list and creates a string array.
static boolean contains(org.greenstone.gatherer.file.FileNode[] array, org.greenstone.gatherer.file.FileNode a)
          Determine if a certain FileNode is present in an array of FileNodes.
static java.io.File[] filter(java.io.File[] files, java.lang.String pattern, boolean exclude)
           
static org.w3c.dom.Node[] nodeListToNodeArray(org.w3c.dom.NodeList node_list)
          Method to convert a list of nodes from the DOM model into a node array.
static java.lang.String objectArrayToString(java.lang.Object[] objects)
          Transforms an Object array into a single string of the form '[o1,o2,...,on]'.
static java.io.File[] remove(java.io.File[] files, int index)
          Remove the file at the given index from the array of files.
static org.greenstone.gatherer.msm.Metadata[] remove(org.greenstone.gatherer.msm.Metadata[] a, int index)
          Remove the Metadata object at the given index form the specified Metadata object array.
static void sort(java.io.File[] files)
          Sorts an array of files.
static void sort(java.io.File[] files, boolean directories_first)
          Sorts an array of files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayTools

public ArrayTools()
Method Detail

add

public static java.awt.Component[] add(java.awt.Component[] a,
                                       java.awt.Component b)
Append a Component onto an array of Components.


add

public static org.w3c.dom.Element[] add(org.w3c.dom.Element[] a,
                                        org.w3c.dom.Element b)
This method efficiently appends a new element onto the end of a element array.


add

public static org.w3c.dom.Element[] add(org.w3c.dom.Element[] a,
                                        org.w3c.dom.Element[] b)
This method efficently appends one element array onto the end of another.


add

public static java.io.File[] add(java.io.File[] a,
                                 java.io.File b)
This method efficiently appends a new file onto the end of a file array.


add

public static java.io.File[] add(java.io.File[] a,
                                 java.io.File[] b)
This method efficently appends one file array onto the end of another.


add

public static org.greenstone.gatherer.file.FileNode[] add(org.greenstone.gatherer.file.FileNode[] a,
                                                          org.greenstone.gatherer.file.FileNode b)
This method efficiently appends a new FileNode onto the end of a FileNode array.


add

public static final org.greenstone.gatherer.file.FileNode[] add(org.greenstone.gatherer.file.FileNode[] a,
                                                                org.greenstone.gatherer.file.FileNode[] b)
This method efficently appends one FileNode array onto the end of another FileNode array.


contains

public static final boolean contains(org.greenstone.gatherer.file.FileNode[] array,
                                     org.greenstone.gatherer.file.FileNode a)
Determine if a certain FileNode is present in an array of FileNodes.


add

public static org.greenstone.gatherer.msm.Metadata[] add(org.greenstone.gatherer.msm.Metadata[] a,
                                                         org.greenstone.gatherer.msm.Metadata b)
Append a Metadata object onto an array of Metadata objects.


add

public static org.greenstone.gatherer.msm.Metadata[] add(org.greenstone.gatherer.msm.Metadata[] a,
                                                         org.greenstone.gatherer.msm.Metadata[] b)
Append a Metadata object array onto an array of Metadata objects.


remove

public static org.greenstone.gatherer.msm.Metadata[] remove(org.greenstone.gatherer.msm.Metadata[] a,
                                                            int index)
Remove the Metadata object at the given index form the specified Metadata object array.


add

public static org.w3c.dom.Node[] add(org.w3c.dom.Node[] a,
                                     org.w3c.dom.Node b)
This method efficiently appends a new node onto the end of a node array.


add

public static org.w3c.dom.Node[] add(org.w3c.dom.Node[] a,
                                     org.w3c.dom.Node[] b)
This method efficently appends one node array onto the end of another.


add

public static java.lang.String[] add(java.lang.String[] a,
                                     java.lang.String b)
This method efficiently appends a new string onto the end of a string array.


add

public static java.lang.String[] add(java.lang.String[] a,
                                     java.lang.String[] b)
This method efficently appends one string array onto the end of another.


arrayListToStringArray

public static java.lang.String[] arrayListToStringArray(java.util.ArrayList a)
This method takes an array list and creates a string array.


filter

public static java.io.File[] filter(java.io.File[] files,
                                    java.lang.String pattern,
                                    boolean exclude)

nodeListToNodeArray

public static org.w3c.dom.Node[] nodeListToNodeArray(org.w3c.dom.NodeList node_list)
Method to convert a list of nodes from the DOM model into a node array. This is quite useful as using a NodeList is problematic if you wish to traverse the tree while editing. Because they are 'live' representations of the model you are editing, it is easy to drop out of for loops early or run off the ends of arrays.


objectArrayToString

public static java.lang.String objectArrayToString(java.lang.Object[] objects)
Transforms an Object array into a single string of the form '[o1,o2,...,on]'.


remove

public static java.io.File[] remove(java.io.File[] files,
                                    int index)
Remove the file at the given index from the array of files.


sort

public static void sort(java.io.File[] files)
Sorts an array of files.


sort

public static void sort(java.io.File[] files,
                        boolean directories_first)
Sorts an array of files. Can also to instructed to list directories first. Case insensitive.