org.codehaus.groovy.runtime
Class DefaultGroovyMethods

java.lang.Object
  extended byorg.codehaus.groovy.runtime.DefaultGroovyMethods

public class DefaultGroovyMethods
extends Object

This class defines all the new groovy methods which appear on normal JDK classes inside the Groovy environment. Static methods are used with the first parameter the destination class.


Nested Class Summary
protected static class DefaultGroovyMethods.ProcessRunner
          A Runnable which waits for a process to complete together with a notification scheme allowing another thread to wait a maximum number of seconds for the process to complete before killing it.
 
Constructor Summary
DefaultGroovyMethods()
           
 
Method Summary
static double abs(Double number)
          Get the absolute value
static float abs(Float number)
          Get the absolute value
static long abs(Long number)
          Get the absolute value
static int abs(Number number)
          Get the absolute value
static Socket accept(ServerSocket serverSocket, Closure closure)
          Allow to pass a Closure to the accept methods of ServerSocket
static void addObjectsFromArrayWithoutDuplicates(NSMutableArray self, NSArray other)
           
static void addObjectToObjectOnBothSidesOfRelationshipWithKey(EOEnterpriseObject self, EOEnterpriseObject reference, String key)
           
static List allProperties(Object self)
           
static NSArray allSubEntities(EOEntity self, boolean includeAbstracts)
           
static Number and(Number left, Number right)
          Bitwise AND together two Numbers
static boolean any(Object self, Closure closure)
          Iterates over every element of a collection, and check whether a predicate is valid for at least one element
static void append(File file, String text)
          Append the text at the end of the File
static void append(File file, String text, String charset)
          Append the text at the end of the File with a specified encoding
static void appendSeparatorIfLastNot(StringBuffer self, char separator, char not)
           
static boolean areIdenticalSets(NSArray self, NSArray other)
           
static NSArray array(EODataSource self)
           
static NSArray arrayByAddingObjectsFromArrayWithoutDuplicates(NSArray self, NSArray other)
           
static NSArray arrayValue(List self)
           
static NSArray arrayValue(Object self)
           
static NSArray arrayValueWithDefault(Object self, NSArray def)
           
static NSArray arrayWithoutDuplicateKeyValue(NSArray self, String key)
           
static NSArray arrayWithoutDuplicates(NSArray self)
           
static List asImmutable(List self)
          A convenience method for creating an immutable list
static Map asImmutable(Map self)
          A convenience method for creating an immutable map
static Set asImmutable(Set self)
          A convenience method for creating an immutable list
static SortedMap asImmutable(SortedMap self)
          A convenience method for creating an immutable sorted map
static SortedSet asImmutable(SortedSet self)
          A convenience method for creating an immutable sorted set
static List asList(Collection self)
          Converts the given collection into a List
static Collection asSynchronized(Collection self)
          A convenience method for creating a synchronized Collection
static List asSynchronized(List self)
          A convenience method for creating a synchronized List
static Map asSynchronized(Map self)
          A convenience method for creating a synchronized Map
static Set asSynchronized(Set self)
          A convenience method for creating a synchronized Set
static SortedMap asSynchronized(SortedMap self)
          A convenience method for creating a synchronized SortedMap
static SortedSet asSynchronized(SortedSet self)
          A convenience method for creating a synchronized SortedSet
static File asWritable(File file)
           
static File asWritable(File file, String encoding)
           
static boolean booleanValue(Object self)
           
static boolean booleanValueForBindingWithDefault(WOComponent self, String binding, boolean def)
           
static boolean booleanValueWithDefault(Object self, boolean def)
           
static GregorianCalendar calendarForTimestamp(NSTimestamp self)
           
static String center(String self, Number numberOfChars)
          Center a String and padd it with spaces appended around it
static String center(String self, Number numberOfChars, String padding)
          Center a String and padd it with the characters appended around it
static List collect(Collection self, Closure closure)
          Iterates through this collection transforming each entry into a new value using the closure as a transformer, returning a list of transformed values.
static List collect(Map self, Closure closure)
          Iterates through this Map transforming each entry into a new value using the closure as a transformer, returning a list of transformed values.
static List collect(Object self, Closure closure)
          Iterates through this object transforming each object into a new value using the closure as a transformer, returning a list of transformed values.
static int compareTo(NSTimestamp left, NSTimestamp right)
           
static Object computeAvgForKey(NSArray self, String key)
           
static Object computeCountForKey(NSArray self, String key)
           
static Object computeMaxForKey(NSArray self, String key)
           
static Object computeMinForKey(NSArray self, String key)
           
static Object computeSumForKey(NSArray self, String key)
           
static void connectWithModelNamed(EOEditingContext self, String name, NSDictionary overrides)
           
static boolean contains(String self, String text)
          Provide an implementation of contains() like Collection to make Strings more polymorphic This method is not required on JDK 1.5 onwards
static boolean containsAnyObjectFromArray(NSArray self, NSArray objects)
           
static boolean containsArray(NSArray self, NSArray objects)
           
static void copyFiles(File self, File dstDirectory, boolean deleteOriginals, boolean recursiveCopy, FileFilter filter)
           
static int count(NSArray self, Object object)
           
static int count(String self, String text)
          Count the number of occurencies of a substring
static EOEnterpriseObject createAndInsertInstance(EOEditingContext self, String entityName)
           
static EOEnterpriseObject createEO(EOEditingContext self, String entityName)
           
static EOEnterpriseObject createEO(EOEditingContext self, String entityName, NSDictionary objectInfo)
           
static EOEnterpriseObject createEOLinkedToEO(EOEditingContext self, String entityName, String relationshipName, EOEnterpriseObject eo)
           
static EOEnterpriseObject createEOLinkedToEO(EOEditingContext self, String entityName, String relationshipName, EOEnterpriseObject eo, NSDictionary objectInfo)
           
protected static StringBufferWriter createStringBufferWriter(StringBuffer self)
           
protected static StringWriter createStringWriter(String self)
           
static EODatabaseContext databaseContextForModelNamed(EOEditingContext self, String name)
           
static EOArrayDataSource dataSource(NSArray self)
           
static NSTimestamp dateByAddingTime(NSTimestamp self, NSTimestamp other)
           
static int dayOfCommonEra(NSTimestamp self)
           
static int dayOfWeek(NSTimestamp self)
           
static int dayOfYear(NSTimestamp self)
           
static byte[] decodeBase64(String value)
          Decode the Sting from base64 into a byte array
static String decodedEntityName(String self)
           
static boolean deleteDirectory(File self)
           
static NSArray deletedObjectsPKeys(EOEditingContext self)
           
static void deleteFiles(File self, boolean recurseIntoDirectories)
           
static void deplicateRelationship(ERXGenericRecord self, String relationshipName)
           
static NSDictionary destinationKeyForSourceObject(EOEditingContext self, EOEnterpriseObject object, String name)
           
static NSDictionary dictionaryByRemovingFromDictionaryKeysInArray(NSDictionary self, NSArray array)
           
static NSDictionary dictionaryGroupedByKeyPath(NSArray self, String keyPath)
           
static NSDictionary dictionaryGroupedByKeyPath(NSArray self, String keyPath, boolean includeNulls, String extraKeyPathForValues)
           
static NSDictionary dictionaryGroupedByToManyKeyPath(NSArray self, String keyPath, boolean includeNulls)
           
static NSDictionary dictionaryOfFormValues(NSArray self, String separator, boolean encrypt)
           
static NSDictionary dictionaryValue(Map self)
           
static NSDictionary dictionaryValue(Object self)
           
static NSDictionary dictionaryValueWithDefault(Object self, NSDictionary def)
           
static NSDictionary dictionaryWithDictionary(NSDictionary self, NSDictionary other)
           
static String displayName(String self)
           
static double distance(String self, String other)
           
static Number div(Character left, Character right)
          Divide two Characters
static Number div(Character left, Number right)
          Divide a Character by a Number
static Number div(Number left, Character right)
          Divide a Number by a Character
static Number div(Number left, Number right)
          Divide two Numbers
static String dump(Object self)
          Generates a detailed dump string of an object showing its class, hashCode and fields
static void each(NSArray self, Closure closure)
           
static void eachByte(File self, Closure closure)
          Traverse through each byte of the specified File
static void eachByte(InputStream is, Closure closure)
          Traverse through each byte of the specified stream
static void eachByte(URL url, Closure closure)
          Traverse through each byte of the specified URL
static void eachFile(File self, Closure closure)
          Invokes the closure for each file in the given directory
static void eachFileRecurse(File self, Closure closure)
          Invokes the closure for each file in the given directory and recursively.
static void eachKey(NSDictionary self, Closure closure)
           
static void eachLine(File self, Closure closure)
          Iterates through the given file line by line
static void eachLine(InputStream stream, Closure closure)
          Iterates through the given stream line by line
static void eachLine(Reader self, Closure closure)
          Iterates through the given reader line by line
static void eachLine(URL url, Closure closure)
          Iterates through the lines read from the URL's associated input stream
static void eachMatch(String str, String regex, Closure closure)
          process each regex matched substring of a string object.
static void eachProperty(Object self, Closure closure)
           
static void eachPropertyName(Object self, Closure closure)
           
static void eachValue(NSDictionary self, Closure closure)
           
static void eachWithIndex(NSArray self, Closure closure)
           
static EOEditingContext ec(WOComponent self)
           
static Writable encodeBase64(byte[] data)
          Produce a Writable object which writes the base64 encoding of the byte array Calling toString() on the result rerurns the encoding as a String
static Writable encodeBase64(Byte[] data)
           
static String encodedEntityName(EOEnterpriseObject self)
           
static NSArray entities(EOModelGroup self)
           
static EOEntity entityForClass(EOEditingContext self, Class theClass)
           
static EOEntity entityForObject(EOEditingContext self, EOEnterpriseObject obj)
           
static EOEntity entityNamed(EOEditingContext self, String name)
           
static void evaluateSQLWithEntityNamed(EOEditingContext self, String entityName, String exp)
           
static boolean every(Object self, Closure closure)
          Iterates over every element of a collection, and check whether a predicate is valid for all elements.
static Process execute(String self)
          Executes the given string as a command line process.
static NSDictionary executeStoredProcedureNamed(EOEditingContext self, String name, NSDictionary args)
           
static boolean existsFiles(URL self)
           
static EOEnterpriseObject faultWithPrimaryKey(EOEditingContext self, String entityName, NSDictionary pkDict)
           
static EOEnterpriseObject faultWithPrimaryKeyValue(EOEditingContext self, String entityName, Object value)
           
static NSArray filesInDirectory(File self, boolean recursive)
           
static void filterArrayWithQualifier(NSMutableArray self, EOQualifier qualifier)
           
static NSArray filteredArrayWithEntityFetchSpecification(NSArray self, String fetchSpec, String entity)
           
static NSArray filteredArrayWithEntityFetchSpecification(NSArray self, String entity, String fetchSpec, NSDictionary bindings)
           
static NSArray filteredArrayWithQualifier(NSArray self, EOQualifier qualifier)
           
static NSArray filteredArrayWithQualifierEvaluation(NSArray self, EOQualifierEvaluation qualifier)
           
static Writable filterLine(Reader reader, Closure closure)
          Filter the lines of a Reader and create a Writable in return to stream the filtered lines
static void filterLine(Reader reader, Writer writer, Closure closure)
          Filter the lines from a reader and write them on the writer, according to a closure which returns true or false.
static Object find(Collection self, Closure closure)
          Finds the first value matching the closure condition
static Object find(Map self, Closure closure)
          Finds the first value matching the closure condition
static Object find(Object self, Closure closure)
          Finds the first value matching the closure condition
static List findAll(Collection self, Closure closure)
          Finds all values matching the closure condition
static List findAll(Map self, Closure closure)
          Finds all values matching the closure condition
static List findAll(Object self, Closure closure)
          Finds all values matching the closure condition
static int findIndexOf(Object self, Closure closure)
          Iterates over every element of the collection and return the index of the first object that matches the condition specified in the closure
static String firstPropertyKey(String self)
           
static NSArray flatten(NSArray self)
           
static String friendlyDisplayForKeyPath(NSArray self, String attribute, String nullArrayDisplay, String separator, String finalSeparator)
           
static Object get(Map map, Object key, Object defaultValue)
          Looks up an item in a Map for the given key and returns the value - unless there is no entry for the given key in which case add the default value to the map and return that.
static Object get(NSKeyValueCoding self, String property)
           
static Object getAt(byte[] array, Collection indices)
           
static Object getAt(char[] array, Collection indices)
           
static CharSequence getAt(CharSequence self, Collection indices)
          Allows a List to be used as the indices to be used on a CharSequence
static Object getAt(double[] array, Collection indices)
           
static Object getAt(EOEnterpriseObject self, Object key)
           
static Object getAt(float[] array, Collection indices)
           
static Object getAt(int[] array, Collection indices)
           
static List getAt(List self, Collection indices)
          Allows a List to be used as the indices to be used on a List
static Object getAt(long[] array, Collection indices)
           
static String getAt(Matcher self, Collection indices)
          Allows a List to be used as the indices to be used on a Matcher
static Object getAt(NSArray self, int index)
           
static Object getAt(NSArray self, String key)
           
static List getAt(Object[] self, Collection indices)
          Allows a List to be used as the indices to be used on a List
static Object getAt(short[] array, Collection indices)
           
static String getAt(String self, Collection indices)
          Allows a List to be used as the indices to be used on a String
static InputStream getErr(Process self)
          An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way
static InputStream getIn(Process self)
          An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way
static Number getNextValFromSequenceNamed(EOEditingContext self, String modelNamed, String sequenceName)
           
static OutputStream getOut(Process self)
          An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way
static String getText(BufferedReader reader)
          Reads the content of the BufferedReader and returns it as a String
static String getText(File file)
          Reads the content of the File and returns it as a String
static String getText(File file, String charset)
          Reads the content of the File opened with the specified encoding and returns it as a String
static String getText(InputStream is)
          Reads the content of this InputStream and returns it as a String
static String getText(InputStream is, String charset)
          Reads the content of this InputStream with a specified charset and returns it as a String
static String getText(Process self)
          Read the text of the output stream of the Process.
static String getText(URL url)
          Reads the content of this URL and returns it as a String
static String getText(URL url, String charset)
          Reads the content of this URL and returns it as a String
static List grep(Object self, Object filter)
          Iterates over every element of the collection and return each object that matches the given filter - calling the isCase() method used by switch statements.
static int hourOfDay(NSTimestamp self)
           
static int indexOfNumeric(String self)
           
static int indexOfNumeric(String self, int fromIndex)
           
static Object inject(Collection self, Object value, Closure closure)
          Iterates through the given collection, passing in the initial value to the closure along with the current iterated item then passing into the next iteration the value of the previous closure.
static String inspect(Object self)
           
static Number intdiv(Character left, Character right)
          Integer Divide two Characters
static Number intdiv(Character left, Number right)
          Integer Divide a Character by a Number
static Number intdiv(Number left, Character right)
          Integer Divide a Number by a Character
static Number intdiv(Number left, Number right)
          Integer Divide two Numbers
static Integer integer(String self)
           
static List intersect(List left, Collection right)
          Create a List composed of the intersection of both collections
static NSArray intersectingElements(NSArray self, NSArray other)
           
static int intValue(Object self)
           
static int intValueForBindingWithDefault(WOComponent self, String binding, int def)
           
static int intValueWithDefault(Object self, int def)
           
static Object invokeMethod(Object object, String method, Object arguments)
          Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily.
static boolean isCase(Class caseValue, Object switchValue)
           
static boolean isCase(Collection caseValue, Object switchValue)
           
static boolean isCase(Object caseValue, Object switchValue)
           
static boolean isCase(Pattern caseValue, Object switchValue)
           
static boolean isCase(String caseValue, Object switchValue)
           
static boolean isEarlierThan(NSTimestamp self, NSTimestamp other)
           
static boolean isLaterThan(NSTimestamp self, NSTimestamp other)
           
static String join(Collection self, String separator)
          Concatenates all of the items of the collection together with the given String as a separator
static String join(Object[] self, String separator)
          Concatenates all of the elements of the array together with the given String as a separator
static String keyPathWithoutFirstProperty(String self)
           
static String keyPathWithoutLastProperty(String self)
           
static NSArray lastNMonthsArray(int self)
           
static NSArray lastNMonthsAsStringsArray(int self)
           
static String lastPathComponent(String self)
           
static String lastPropertyKey(String self)
           
static void leftShift(NSMutableArray self, Object object)
           
static Number leftShift(Number left, Number right)
          Implementation of the left shift operator for integral types.
static void linkFiles(File self, File destination, boolean symbolic, boolean allowUnlink, boolean doNotFollowSymbolicLinks)
           
static List list(NSArray self)
           
static EOEnterpriseObject localInstanceOfObject(EOEditingContext self, EOEnterpriseObject object)
           
static NSArray localInstancesOfObjects(EOEditingContext self, NSArray objects)
           
static String localizedTemplateStringForKey(Object self, String key, String framework, NSArray languages)
           
static Map map(NSDictionary self)
           
static Object max(Collection self)
          Selects the maximum value found in the collection
static Object max(Collection self, Comparator comparator)
          Selects the maximum value found in the collection using the given comparator
static Object min(Collection self)
          Selects the minimum value found in the collection
static Object min(Collection self, Comparator comparator)
          Selects the minimum value found in the collection using the given comparator
static NSArray minus(NSArray left, NSArray right)
           
static int minuteOfHour(NSTimestamp self)
           
static Number mod(Number left, Number right)
          Performs a division modulus operation
static EOModelGroup modelGroup(EOEditingContext self)
           
static int monthOfYear(NSTimestamp self)
           
static Number multiply(Character left, Character right)
          Multiply two Characters
static Number multiply(Character left, Number right)
          Multiply a Character by a Number
static List multiply(Collection self, Number factor)
          Create a List composed of the same elements repeated a certain number of times.
static Number multiply(Number left, Character right)
          Multiply a Number by a Character
static Number multiply(Number left, Number right)
          Multiply two Numbers
static String multiply(String self, Number factor)
          Repeat a String a certain number of times
static NSMutableArray mutableArrayValue(List self)
           
static NSMutableDictionary mutableDictionaryValue(Map self)
           
static Number negate(Number left)
          Negates the number
static BufferedInputStream newInputStream(File file)
          Helper method to create a buffered input stream for a file
static BufferedOutputStream newOutputStream(File file)
          Helper method to create a buffered output stream for a file
static PrintWriter newPrintWriter(File file)
          Helper method to create a new PrintWriter for a file
static PrintWriter newPrintWriter(File file, String charset)
          Helper method to create a new PrintWriter for a file with a specified charset
static BufferedReader newReader(File file)
          Helper method to create a buffered reader for a file
static BufferedReader newReader(File file, String charset)
          Helper method to create a buffered reader for a file, with a specified charset
static BufferedWriter newWriter(File file)
          Helper method to create a buffered writer for a file
static BufferedWriter newWriter(File file, boolean append)
          Helper method to create a buffered writer for a file in append mode
static BufferedWriter newWriter(File file, String charset)
          Helper method to create a buffered writer for a file
static BufferedWriter newWriter(File file, String charset, boolean append)
          Helper method to create a buffered writer for a file
static Number next(Character self)
          Increment a Character by one
static Date next(Date self)
          Increments a Date by a day
static Number next(Number self)
          Increment a Number by one
static String next(String self)
          Increments the last digit in the given string, resetting it and moving onto the next digit if increasing the digit no longer becomes a letter or digit.
protected static int normaliseIndex(int i, int size)
          This converts a possibly negative index to a real index into the array.
static Number objectCountWithQualifier(EOEditingContext self, String entityName, EOQualifier qualifier)
           
static EOEnterpriseObject objectFromRawRow(EOEditingContext self, String name, NSDictionary row)
           
static EOEnterpriseObject objectMatchingKeyAndValue(EOEditingContext self, String name, String key, Object value)
           
static EOEnterpriseObject objectMatchingValues(EOEditingContext self, String name, NSDictionary values)
           
static NSArray objectsByDecodingFromFormValues(EOEditingContext self, NSDictionary values)
           
static NSArray objectsForEntityNamed(EOEditingContext self, String name)
           
static NSArray objectsMatchingKeyAndValue(EOEditingContext self, String name, String key, Object value)
           
static NSArray objectsMatchingValues(EOEditingContext self, String name, NSDictionary values)
           
static NSArray objectsOfClass(EOEditingContext self, Class aClass)
           
static NSArray objectsWithFetchSpecificationAndBindings(EOEditingContext self, String entityName, String fetchSpecName, NSDictionary bindings)
           
static NSArray objectsWithQualifierFormat(EOEditingContext self, String name, String format, NSArray args)
           
static EOEnterpriseObject objectWithFetchSpecificationAndBindings(EOEditingContext self, String entityName, String fetchSpecName, NSDictionary bindings)
           
static EOEnterpriseObject objectWithPrimaryKey(EOEditingContext self, String entityName, NSDictionary pkDict)
           
static EOEnterpriseObject objectWithPrimaryKeyValue(EOEditingContext self, String entityName, Object value)
           
static EOEnterpriseObject objectWithQualifierFormat(EOEditingContext self, String name, String format, NSArray args)
           
static Number or(Number left, Number right)
          Bitwise OR together two numbers
static String padLeft(String self, Number numberOfChars)
          Pad a String with the spaces appended to the left
static String padLeft(String self, Number numberOfChars, String padding)
          Pad a String with the characters appended to the left
static String padRight(String self, Number numberOfChars)
          Pad a String with the spaces appended to the right
static String padRight(String self, Number numberOfChars, String padding)
          Pad a String with the characters appended to the right
static String pathExtension(String self)
           
static NSArray plus(NSArray left, NSArray right)
           
static Object pop(NSMutableArray self)
           
static Number power(Number self, Number exponent)
          Power of a Number to a certain exponent
static Number previous(Character self)
          Decrement a Character by one
static Date previous(Date self)
          Decrement a Date by a day
static Number previous(Number self)
          Decrement a Number by one
static String previous(String self)
          Decrements the last digit in the given string, resetting it and moving onto the next digit if increasing the digit no longer becomes a letter or digit.
static NSDictionary primaryKeyDictionaryForEntity(EOEditingContext self, String entityName)
           
static EOFetchSpecification primaryKeyFetchSpecificationForEntity(EOEditingContext self, String entityName, EOQualifier eoqualifier, NSArray sortOrderings, NSArray additionalKeys)
           
static NSDictionary primaryKeyForObject(EOEditingContext self, EOEnterpriseObject object)
           
static NSArray primaryKeysMatchingQualifier(EOEditingContext self, String entityName, EOQualifier eoqualifier, NSArray sortOrderings)
           
protected static List primitiveArrayGet(Object self, Collection indices)
          Implements the getAt(Collection) method for primitve type arrays
protected static Object primitiveArrayGet(Object array, int idx)
          Implements the getAt(int) method for primitve type arrays
protected static void primitiveArrayPut(Object array, int idx, Object newValue)
          Implements the set(int idx) method for primitve type arrays
static void print(Object self, Object value)
          Print to a console in interactive format
static void print(Object self, PrintWriter out)
          Print to a console in interactive format
static void println(Object self, Object value)
          Print to a console in interactive format along with a newline
static void println(Object self, PrintWriter out)
          Print to a console in interactive format
static NSMutableArray push(NSMutableArray self, Object object)
           
static void putAt(EOEnterpriseObject self, Object key, Object object)
           
static void putAt(NSMutableArray self, int index, Object object)
           
static void putAt(Object self, String property, Object newValue)
          Allows the subscript operator to be used to set dynamically named property values.
static EOQualifier qualifier(String self)
           
static EOQualifier qualifierForEnterpriseObject(EOEditingContext self, EOEnterpriseObject object)
           
static EOQualifier qualifierWithArray(String self, NSArray arguments)
           
static NSArray rawRowsForSQL(EOEditingContext self, String modelName, String sqlString, NSArray keys)
           
static NSArray rawRowsForStoredProcedureNamed(EOEditingContext self, String name, NSDictionary args)
           
static NSArray rawRowsMatchingKeyAndValue(EOEditingContext self, String name, String key, Object value)
           
static byte[] readBytes(File file)
          Reads the content of the file into an array of byte
static List readLines(File file)
          Reads the file into a list of Strings for each line
static List readLines(InputStream stream)
          Reads the stream into a list of Strings for each line
static List readLines(Reader reader)
          Reads the reader into a list of Strings for each line
static void refault(EOEnterpriseObject self)
           
static EORelationship relationshipWithKeyPath(EOEnterpriseObject self, String keyPath)
           
static void replicateDataToEO(ERXGenericRecord self, ERXGenericRecord other, NSArray attributeNames)
           
static void replicateRelationshipToEO(ERXGenericRecord self, ERXGenericRecord other, String relationshipName)
           
static NSArray reverse(NSArray self)
           
static void reverseEach(NSArray self, Closure closure)
           
static Number rightShift(Number left, Number right)
          Implementation of the right shift operator for integral types.
static Number rightShiftUnsigned(Number left, Number right)
          Implementation of the right shift (unsigned) operator for integral types.
static EOEntity rootParentEntity(EOEntity self)
           
static long round(Double number)
          Round the value
static int round(Float number)
          Get the absolute value
static NSSet set(NSArray self)
           
static void set(NSKeyValueCoding self, String property, Object newValue)
           
static Object shift(NSMutableArray self)
           
static void shiftObjectLeft(NSMutableArray self, Object object)
           
static void shiftObjectRight(NSMutableArray self, Object object)
           
static void show(Object self, Object value)
           
static int size(byte[] array)
           
static int size(char[] array)
           
static int size(double[] array)
           
static int size(float[] array)
           
static int size(int[] array)
           
static int size(long[] array)
           
static int size(Object[] self)
          Makes an Array look like a Collection by adding support for the size() method
static int size(short[] array)
           
static int size(String text)
          Makes a String look like a Collection by adding support for the size() method
static List sort(Collection self)
          Sorts the given collection into a sorted list
static List sort(Collection self, Comparator comparator)
          A convenience method for sorting a Collection with a specific comparator
static List sort(List self)
          A convenience method for sorting a List
static List sort(List self, Comparator comparator)
          A convenience method for sorting a List with a specific comparator
static SortedSet sort(SortedSet self)
          Avoids doing unnecessary work when sorting an already sorted set
static void sortArrayUsingKeyOrderArray(NSMutableArray self, NSArray sortOrderings)
           
static NSArray sortedArraySortedWithKey(NSArray self, String key, NSSelector selector)
           
static NSArray sortedArrayUsingKeyOrderArray(NSArray self, NSArray sortOrderings)
           
static NSMutableArray sortedMutableArraySortedWithKey(NSArray self, String key)
           
static void sortEOsUsingSingleKey(NSMutableArray self, String key)
           
static void sortEOsUsingSingleKey(NSMutableArray self, String key, NSSelector selector)
           
static NSArray sortOrderings(Map self)
           
static NSSelector sortSelector(String self)
           
static void splitEachLine(File self, String sep, Closure closure)
          Iterates through the given file line by line, splitting on the seperator
static void splitEachLine(Reader self, String sep, Closure closure)
          Iterates through the given reader line by line, splitting on the seperator
static String stackTrace(Throwable self)
           
static void step(Number self, Number to, Number stepNumber, Closure closure)
          Iterates from this number up to the given number using a step increment
static String string(File self)
           
static String string(File self, String encoding)
           
static String string(InputStream self)
           
static String string(InputStream self, String encoding)
           
static String stringByAppendingPathComponent(String self, String component)
           
static String stringByAppendingPathExtension(String self, String extension)
           
static String stringByDeletingLastPathComponent(String self)
           
static String stringByDeletingPathExtension(String self)
           
static String stringByEncodingPrimaryKeys(EOEnterpriseObject self, String seperator, boolean encrypt)
           
static String stringByEscapingApostrophe(String self)
           
static String stringByEscapingNonBasicLatinChars(char self)
           
static String stringByEscapingNonBasicLatinChars(String self)
           
static String stringByEscapingSpace(String self)
           
static String stringByNormalizingExistingPath(String self)
           
static String stringByNormalizingPath(String self)
           
static String stringByRemovingExtraDots(String self)
           
static String stringByReplacingStringByString(String self, String old, String newString)
           
static Map subMap(Map map, Collection keys)
          Creates a sub-Map containing the given keys.
static void times(Number self, Closure closure)
          Iterates a number of times
static NSTimestamp timestamp(String self)
           
static NSTimestamp timestampByAddingTime(NSTimestamp self, NSTimestamp other)
           
static Character toCharacter(String self)
          Converts the given string into a Character object using the first character in the string
static Double toDouble(String self)
          Parse a String into a Double
static Float toFloat(String self)
          Parse a String into a Float
static String toHexString(char self)
           
static String toHexString(String self)
           
static Integer toInteger(Number self)
          Transform a Number into an Integer
static Integer toInteger(String self)
          Parse a String into an Integer
static List tokenize(String self)
          Tokenize a String (with a whitespace as delimiter)
static List tokenize(String self, String token)
          Tokenize a String
static List toList(byte[] array)
           
static List toList(char[] array)
           
static List toList(Collection self)
          Convert a collection to a List.
static List toList(double[] array)
           
static List toList(float[] array)
           
static List toList(int[] array)
           
static List toList(long[] array)
           
static List toList(Object[] array)
          Allows conversion of arrays into a mutable List
static List toList(short[] array)
           
static List toList(String self)
          Converts the given String into a List of strings of one character
static Long toLong(String self)
          Parse a String into a Long
static String toLowerCase(String self)
           
protected static String toString(Object value)
           
static URL toURL(String self)
          Transforms a String representing a URL into a URL object.
static void transformChar(Reader reader, Writer writer, Closure closure)
          Transforms the characters from a reader with a Closure and write them to a writer
static void transformLine(Reader reader, Writer writer, Closure closure)
          Transforms the lines from a reader with a Closure and write them to a writer
static NSTimestamp unixDate(Number self)
           
static Integer unixTimestamp(NSTimestamp self)
           
static NSMutableArray unshift(NSMutableArray self, Object object)
           
static File unzip(File self, File destination)
           
static void upto(Number self, Number to, Closure closure)
          Iterates from this number up to the given number
static void use(Object self, Class categoryClass, Closure closure)
          Scoped use method
static void use(Object self, List categoryClassList, Closure closure)
          Scoped use method with list of categories
static NSArray valuesForKeyPaths(NSArray self, NSArray paths)
           
static void waitForOrKill(Process self, long numberOfMillis)
          Wait for the process to finish during a certain amount of time, otherwise stops the process.
static void withInputStream(File file, Closure closure)
          Helper method to create a new InputStream for a file and then passes it into the closure and ensures its closed again afterwords
static void withOutputStream(File file, Closure closure)
          Helper method to create a new OutputStream for a file and then passes it into the closure and ensures its closed again afterwords
static void withPrintWriter(File file, Closure closure)
          Helper method to create a new PrintWriter for a file and then passes it into the closure and ensures its closed again afterwords
static void withReader(File file, Closure closure)
          Helper method to create a new BufferedReader for a file and then passes it into the closure and ensures its closed again afterwords
static void withReader(InputStream in, Closure closure)
          Helper method to create a new BufferedReader for a stream and then passes it into the closure and ensures its closed again afterwords
static void withReader(Reader writer, Closure closure)
          Allows a Reader to be used, calling the closure with the writer and then ensuring that the writer is closed down again irrespective of whether exceptions occur or the
static void withReader(URL url, Closure closure)
          Helper method to create a new BufferedReader for a URL and then passes it into the closure and ensures its closed again afterwords
static void withStream(InputStream stream, Closure closure)
          Allows a InputStream to be used, calling the closure with the stream and then ensuring that the stream is closed down again irrespective of whether exceptions occur or the
static void withStream(OutputStream stream, Closure closure)
          Allows a OutputStream to be used, calling the closure with the stream and then ensuring that the stream is closed down again irrespective of whether exceptions occur.
static void withStreams(Socket socket, Closure closure)
          Allows an InputStream and an OutputStream from a Socket to be used, calling the closure with the streams and then ensuring that the streams are closed down again irrespective of whether exceptions occur.
static void withWriter(File file, Closure closure)
          Helper method to create a new BufferedWriter for a file and then passes it into the closure and ensures it is closed again afterwords
static void withWriter(File file, String charset, Closure closure)
          Helper method to create a new BufferedWriter for a file in a specified encoding and then passes it into the closure and ensures it is closed again afterwords
static void withWriter(OutputStream stream, Closure closure)
          Allows an output stream to be used, calling the closure with the output stream and then ensuring that the output stream is closed down again irrespective of whether exceptions occur
static void withWriter(OutputStream stream, String charset, Closure closure)
          Allows an output stream to be used, calling the closure with the output stream and then ensuring that the output stream is closed down again irrespective of whether exceptions occur.
static void withWriter(Writer writer, Closure closure)
          Allows a writer to be used, calling the closure with the writer and then ensuring that the writer is closed down again irrespective of whether exceptions occur or the
static void withWriterAppend(File file, String charset, Closure closure)
          Helper method to create a new BufferedWriter for a file in a specified encoding in append mode and then passes it into the closure and ensures it is closed again afterwords
static void write(File file, String text)
          Write the text to the File.
static void write(File file, String text, String charset)
          Write the text to the File with a specified encoding.
static void write(Writer self, Writable writable)
          A helper method so that dynamic dispatch of the writer.write(object) method will always use the more efficient Writable.writeTo(writer) mechanism if the object implements the Writable interface.
static void writeLine(BufferedWriter writer, String line)
          Write the text and append a new line (depending on the platform line-ending)
static void writeToFile(InputStream self, File file)
           
static int yearOfCommonEra(NSTimestamp self)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGroovyMethods

public DefaultGroovyMethods()
Method Detail

array

public static NSArray array(EODataSource self)

connectWithModelNamed

public static void connectWithModelNamed(EOEditingContext self,
                                         String name,
                                         NSDictionary overrides)

createAndInsertInstance

public static EOEnterpriseObject createAndInsertInstance(EOEditingContext self,
                                                         String entityName)

primaryKeyForObject

public static NSDictionary primaryKeyForObject(EOEditingContext self,
                                               EOEnterpriseObject object)

qualifierForEnterpriseObject

public static EOQualifier qualifierForEnterpriseObject(EOEditingContext self,
                                                       EOEnterpriseObject object)

getNextValFromSequenceNamed

public static Number getNextValFromSequenceNamed(EOEditingContext self,
                                                 String modelNamed,
                                                 String sequenceName)

primaryKeyFetchSpecificationForEntity

public static EOFetchSpecification primaryKeyFetchSpecificationForEntity(EOEditingContext self,
                                                                         String entityName,
                                                                         EOQualifier eoqualifier,
                                                                         NSArray sortOrderings,
                                                                         NSArray additionalKeys)

primaryKeysMatchingQualifier

public static NSArray primaryKeysMatchingQualifier(EOEditingContext self,
                                                   String entityName,
                                                   EOQualifier eoqualifier,
                                                   NSArray sortOrderings)

createEO

public static EOEnterpriseObject createEO(EOEditingContext self,
                                          String entityName)

createEO

public static EOEnterpriseObject createEO(EOEditingContext self,
                                          String entityName,
                                          NSDictionary objectInfo)

createEOLinkedToEO

public static EOEnterpriseObject createEOLinkedToEO(EOEditingContext self,
                                                    String entityName,
                                                    String relationshipName,
                                                    EOEnterpriseObject eo)

createEOLinkedToEO

public static EOEnterpriseObject createEOLinkedToEO(EOEditingContext self,
                                                    String entityName,
                                                    String relationshipName,
                                                    EOEnterpriseObject eo,
                                                    NSDictionary objectInfo)

databaseContextForModelNamed

public static EODatabaseContext databaseContextForModelNamed(EOEditingContext self,
                                                             String name)

destinationKeyForSourceObject

public static NSDictionary destinationKeyForSourceObject(EOEditingContext self,
                                                         EOEnterpriseObject object,
                                                         String name)

entityForClass

public static EOEntity entityForClass(EOEditingContext self,
                                      Class theClass)

entityForObject

public static EOEntity entityForObject(EOEditingContext self,
                                       EOEnterpriseObject obj)

entityNamed

public static EOEntity entityNamed(EOEditingContext self,
                                   String name)

faultWithPrimaryKey

public static EOEnterpriseObject faultWithPrimaryKey(EOEditingContext self,
                                                     String entityName,
                                                     NSDictionary pkDict)

faultWithPrimaryKeyValue

public static EOEnterpriseObject faultWithPrimaryKeyValue(EOEditingContext self,
                                                          String entityName,
                                                          Object value)

localInstanceOfObject

public static EOEnterpriseObject localInstanceOfObject(EOEditingContext self,
                                                       EOEnterpriseObject object)

localInstancesOfObjects

public static NSArray localInstancesOfObjects(EOEditingContext self,
                                              NSArray objects)

modelGroup

public static EOModelGroup modelGroup(EOEditingContext self)

objectCountWithQualifier

public static Number objectCountWithQualifier(EOEditingContext self,
                                              String entityName,
                                              EOQualifier qualifier)

deletedObjectsPKeys

public static NSArray deletedObjectsPKeys(EOEditingContext self)

primaryKeyDictionaryForEntity

public static NSDictionary primaryKeyDictionaryForEntity(EOEditingContext self,
                                                         String entityName)

rawRowsForSQL

public static NSArray rawRowsForSQL(EOEditingContext self,
                                    String modelName,
                                    String sqlString,
                                    NSArray keys)

rawRowsForStoredProcedureNamed

public static NSArray rawRowsForStoredProcedureNamed(EOEditingContext self,
                                                     String name,
                                                     NSDictionary args)

rawRowsMatchingKeyAndValue

public static NSArray rawRowsMatchingKeyAndValue(EOEditingContext self,
                                                 String name,
                                                 String key,
                                                 Object value)

executeStoredProcedureNamed

public static NSDictionary executeStoredProcedureNamed(EOEditingContext self,
                                                       String name,
                                                       NSDictionary args)

evaluateSQLWithEntityNamed

public static void evaluateSQLWithEntityNamed(EOEditingContext self,
                                              String entityName,
                                              String exp)

objectFromRawRow

public static EOEnterpriseObject objectFromRawRow(EOEditingContext self,
                                                  String name,
                                                  NSDictionary row)

objectMatchingKeyAndValue

public static EOEnterpriseObject objectMatchingKeyAndValue(EOEditingContext self,
                                                           String name,
                                                           String key,
                                                           Object value)

objectMatchingValues

public static EOEnterpriseObject objectMatchingValues(EOEditingContext self,
                                                      String name,
                                                      NSDictionary values)

objectsForEntityNamed

public static NSArray objectsForEntityNamed(EOEditingContext self,
                                            String name)

objectsMatchingKeyAndValue

public static NSArray objectsMatchingKeyAndValue(EOEditingContext self,
                                                 String name,
                                                 String key,
                                                 Object value)

objectsMatchingValues

public static NSArray objectsMatchingValues(EOEditingContext self,
                                            String name,
                                            NSDictionary values)

objectsOfClass

public static NSArray objectsOfClass(EOEditingContext self,
                                     Class aClass)

objectsWithFetchSpecificationAndBindings

public static NSArray objectsWithFetchSpecificationAndBindings(EOEditingContext self,
                                                               String entityName,
                                                               String fetchSpecName,
                                                               NSDictionary bindings)

objectsWithQualifierFormat

public static NSArray objectsWithQualifierFormat(EOEditingContext self,
                                                 String name,
                                                 String format,
                                                 NSArray args)

objectWithFetchSpecificationAndBindings

public static EOEnterpriseObject objectWithFetchSpecificationAndBindings(EOEditingContext self,
                                                                         String entityName,
                                                                         String fetchSpecName,
                                                                         NSDictionary bindings)

objectWithPrimaryKey

public static EOEnterpriseObject objectWithPrimaryKey(EOEditingContext self,
                                                      String entityName,
                                                      NSDictionary pkDict)

objectWithPrimaryKeyValue

public static EOEnterpriseObject objectWithPrimaryKeyValue(EOEditingContext self,
                                                           String entityName,
                                                           Object value)

objectWithQualifierFormat

public static EOEnterpriseObject objectWithQualifierFormat(EOEditingContext self,
                                                           String name,
                                                           String format,
                                                           NSArray args)

objectsByDecodingFromFormValues

public static NSArray objectsByDecodingFromFormValues(EOEditingContext self,
                                                      NSDictionary values)

getAt

public static Object getAt(EOEnterpriseObject self,
                           Object key)

putAt

public static void putAt(EOEnterpriseObject self,
                         Object key,
                         Object object)

refault

public static void refault(EOEnterpriseObject self)

addObjectToObjectOnBothSidesOfRelationshipWithKey

public static void addObjectToObjectOnBothSidesOfRelationshipWithKey(EOEnterpriseObject self,
                                                                     EOEnterpriseObject reference,
                                                                     String key)

relationshipWithKeyPath

public static EORelationship relationshipWithKeyPath(EOEnterpriseObject self,
                                                     String keyPath)

deplicateRelationship

public static void deplicateRelationship(ERXGenericRecord self,
                                         String relationshipName)

replicateDataToEO

public static void replicateDataToEO(ERXGenericRecord self,
                                     ERXGenericRecord other,
                                     NSArray attributeNames)

replicateRelationshipToEO

public static void replicateRelationshipToEO(ERXGenericRecord self,
                                             ERXGenericRecord other,
                                             String relationshipName)

stringByEncodingPrimaryKeys

public static String stringByEncodingPrimaryKeys(EOEnterpriseObject self,
                                                 String seperator,
                                                 boolean encrypt)

encodedEntityName

public static String encodedEntityName(EOEnterpriseObject self)

allSubEntities

public static NSArray allSubEntities(EOEntity self,
                                     boolean includeAbstracts)

rootParentEntity

public static EOEntity rootParentEntity(EOEntity self)

entities

public static NSArray entities(EOModelGroup self)

filesInDirectory

public static NSArray filesInDirectory(File self,
                                       boolean recursive)

string

public static String string(File self)
                     throws IOException
Throws:
IOException

string

public static String string(File self,
                            String encoding)
                     throws IOException
Throws:
IOException

string

public static String string(InputStream self)
                     throws IOException
Throws:
IOException

string

public static String string(InputStream self,
                            String encoding)
                     throws IOException
Throws:
IOException

copyFiles

public static void copyFiles(File self,
                             File dstDirectory,
                             boolean deleteOriginals,
                             boolean recursiveCopy,
                             FileFilter filter)
                      throws IOException,
                             FileNotFoundException
Throws:
IOException
FileNotFoundException

deleteDirectory

public static boolean deleteDirectory(File self)

deleteFiles

public static void deleteFiles(File self,
                               boolean recurseIntoDirectories)

linkFiles

public static void linkFiles(File self,
                             File destination,
                             boolean symbolic,
                             boolean allowUnlink,
                             boolean doNotFollowSymbolicLinks)
                      throws IOException
Throws:
IOException

unzip

public static File unzip(File self,
                         File destination)
                  throws IOException
Throws:
IOException

writeToFile

public static void writeToFile(InputStream self,
                               File file)
                        throws IOException
Throws:
IOException

arrayValue

public static NSArray arrayValue(List self)

mutableArrayValue

public static NSMutableArray mutableArrayValue(List self)

dictionaryValue

public static NSDictionary dictionaryValue(Map self)

mutableDictionaryValue

public static NSMutableDictionary mutableDictionaryValue(Map self)

arrayValue

public static NSArray arrayValue(Object self)

arrayValueWithDefault

public static NSArray arrayValueWithDefault(Object self,
                                            NSArray def)

booleanValue

public static boolean booleanValue(Object self)

booleanValueWithDefault

public static boolean booleanValueWithDefault(Object self,
                                              boolean def)

dictionaryValue

public static NSDictionary dictionaryValue(Object self)

dictionaryValueWithDefault

public static NSDictionary dictionaryValueWithDefault(Object self,
                                                      NSDictionary def)

intValue

public static int intValue(Object self)

intValueWithDefault

public static int intValueWithDefault(Object self,
                                      int def)

lastNMonthsArray

public static NSArray lastNMonthsArray(int self)

lastNMonthsAsStringsArray

public static NSArray lastNMonthsAsStringsArray(int self)

unixDate

public static NSTimestamp unixDate(Number self)

stackTrace

public static String stackTrace(Throwable self)

localizedTemplateStringForKey

public static String localizedTemplateStringForKey(Object self,
                                                   String key,
                                                   String framework,
                                                   NSArray languages)

sortOrderings

public static NSArray sortOrderings(Map self)

existsFiles

public static boolean existsFiles(URL self)

arrayByAddingObjectsFromArrayWithoutDuplicates

public static NSArray arrayByAddingObjectsFromArrayWithoutDuplicates(NSArray self,
                                                                     NSArray other)

dictionaryGroupedByKeyPath

public static NSDictionary dictionaryGroupedByKeyPath(NSArray self,
                                                      String keyPath)

dictionaryGroupedByKeyPath

public static NSDictionary dictionaryGroupedByKeyPath(NSArray self,
                                                      String keyPath,
                                                      boolean includeNulls,
                                                      String extraKeyPathForValues)

dictionaryGroupedByToManyKeyPath

public static NSDictionary dictionaryGroupedByToManyKeyPath(NSArray self,
                                                            String keyPath,
                                                            boolean includeNulls)

arrayWithoutDuplicateKeyValue

public static NSArray arrayWithoutDuplicateKeyValue(NSArray self,
                                                    String key)

arrayWithoutDuplicates

public static NSArray arrayWithoutDuplicates(NSArray self)

friendlyDisplayForKeyPath

public static String friendlyDisplayForKeyPath(NSArray self,
                                               String attribute,
                                               String nullArrayDisplay,
                                               String separator,
                                               String finalSeparator)

intersectingElements

public static NSArray intersectingElements(NSArray self,
                                           NSArray other)

list

public static List list(NSArray self)

dataSource

public static EOArrayDataSource dataSource(NSArray self)

set

public static NSSet set(NSArray self)

containsAnyObjectFromArray

public static boolean containsAnyObjectFromArray(NSArray self,
                                                 NSArray objects)

containsArray

public static boolean containsArray(NSArray self,
                                    NSArray objects)

areIdenticalSets

public static boolean areIdenticalSets(NSArray self,
                                       NSArray other)

computeAvgForKey

public static Object computeAvgForKey(NSArray self,
                                      String key)

computeCountForKey

public static Object computeCountForKey(NSArray self,
                                        String key)

computeMaxForKey

public static Object computeMaxForKey(NSArray self,
                                      String key)

computeMinForKey

public static Object computeMinForKey(NSArray self,
                                      String key)

computeSumForKey

public static Object computeSumForKey(NSArray self,
                                      String key)

getAt

public static Object getAt(NSArray self,
                           int index)

getAt

public static Object getAt(NSArray self,
                           String key)

count

public static int count(NSArray self,
                        Object object)

valuesForKeyPaths

public static NSArray valuesForKeyPaths(NSArray self,
                                        NSArray paths)

flatten

public static NSArray flatten(NSArray self)

filteredArrayWithQualifier

public static NSArray filteredArrayWithQualifier(NSArray self,
                                                 EOQualifier qualifier)

filteredArrayWithEntityFetchSpecification

public static NSArray filteredArrayWithEntityFetchSpecification(NSArray self,
                                                                String fetchSpec,
                                                                String entity)

filteredArrayWithEntityFetchSpecification

public static NSArray filteredArrayWithEntityFetchSpecification(NSArray self,
                                                                String entity,
                                                                String fetchSpec,
                                                                NSDictionary bindings)

filteredArrayWithQualifierEvaluation

public static NSArray filteredArrayWithQualifierEvaluation(NSArray self,
                                                           EOQualifierEvaluation qualifier)

sortedArrayUsingKeyOrderArray

public static NSArray sortedArrayUsingKeyOrderArray(NSArray self,
                                                    NSArray sortOrderings)

sortedArraySortedWithKey

public static NSArray sortedArraySortedWithKey(NSArray self,
                                               String key,
                                               NSSelector selector)

sortedMutableArraySortedWithKey

public static NSMutableArray sortedMutableArraySortedWithKey(NSArray self,
                                                             String key)

plus

public static NSArray plus(NSArray left,
                           NSArray right)

minus

public static NSArray minus(NSArray left,
                            NSArray right)

reverse

public static NSArray reverse(NSArray self)

each

public static void each(NSArray self,
                        Closure closure)

eachWithIndex

public static void eachWithIndex(NSArray self,
                                 Closure closure)

reverseEach

public static void reverseEach(NSArray self,
                               Closure closure)

dictionaryOfFormValues

public static NSDictionary dictionaryOfFormValues(NSArray self,
                                                  String separator,
                                                  boolean encrypt)

eachKey

public static void eachKey(NSDictionary self,
                           Closure closure)

eachValue

public static void eachValue(NSDictionary self,
                             Closure closure)

dictionaryByRemovingFromDictionaryKeysInArray

public static NSDictionary dictionaryByRemovingFromDictionaryKeysInArray(NSDictionary self,
                                                                         NSArray array)

dictionaryWithDictionary

public static NSDictionary dictionaryWithDictionary(NSDictionary self,
                                                    NSDictionary other)

map

public static Map map(NSDictionary self)

get

public static Object get(NSKeyValueCoding self,
                         String property)

set

public static void set(NSKeyValueCoding self,
                       String property,
                       Object newValue)

putAt

public static void putAt(NSMutableArray self,
                         int index,
                         Object object)

leftShift

public static void leftShift(NSMutableArray self,
                             Object object)

push

public static NSMutableArray push(NSMutableArray self,
                                  Object object)

unshift

public static NSMutableArray unshift(NSMutableArray self,
                                     Object object)

addObjectsFromArrayWithoutDuplicates

public static void addObjectsFromArrayWithoutDuplicates(NSMutableArray self,
                                                        NSArray other)

shiftObjectLeft

public static void shiftObjectLeft(NSMutableArray self,
                                   Object object)

shiftObjectRight

public static void shiftObjectRight(NSMutableArray self,
                                    Object object)

pop

public static Object pop(NSMutableArray self)

shift

public static Object shift(NSMutableArray self)

filterArrayWithQualifier

public static void filterArrayWithQualifier(NSMutableArray self,
                                            EOQualifier qualifier)

sortArrayUsingKeyOrderArray

public static void sortArrayUsingKeyOrderArray(NSMutableArray self,
                                               NSArray sortOrderings)

sortEOsUsingSingleKey

public static void sortEOsUsingSingleKey(NSMutableArray self,
                                         String key)

sortEOsUsingSingleKey

public static void sortEOsUsingSingleKey(NSMutableArray self,
                                         String key,
                                         NSSelector selector)

calendarForTimestamp

public static GregorianCalendar calendarForTimestamp(NSTimestamp self)

dateByAddingTime

public static NSTimestamp dateByAddingTime(NSTimestamp self,
                                           NSTimestamp other)

timestampByAddingTime

public static NSTimestamp timestampByAddingTime(NSTimestamp self,
                                                NSTimestamp other)

unixTimestamp

public static Integer unixTimestamp(NSTimestamp self)

dayOfCommonEra

public static int dayOfCommonEra(NSTimestamp self)

dayOfWeek

public static int dayOfWeek(NSTimestamp self)

dayOfYear

public static int dayOfYear(NSTimestamp self)

hourOfDay

public static int hourOfDay(NSTimestamp self)

minuteOfHour

public static int minuteOfHour(NSTimestamp self)

monthOfYear

public static int monthOfYear(NSTimestamp self)

yearOfCommonEra

public static int yearOfCommonEra(NSTimestamp self)

isEarlierThan

public static boolean isEarlierThan(NSTimestamp self,
                                    NSTimestamp other)

isLaterThan

public static boolean isLaterThan(NSTimestamp self,
                                  NSTimestamp other)

compareTo

public static int compareTo(NSTimestamp left,
                            NSTimestamp right)

timestamp

public static NSTimestamp timestamp(String self)

sortSelector

public static NSSelector sortSelector(String self)

integer

public static Integer integer(String self)

keyPathWithoutFirstProperty

public static String keyPathWithoutFirstProperty(String self)

keyPathWithoutLastProperty

public static String keyPathWithoutLastProperty(String self)

lastPropertyKey

public static String lastPropertyKey(String self)

stringByEscapingApostrophe

public static String stringByEscapingApostrophe(String self)

stringByEscapingNonBasicLatinChars

public static String stringByEscapingNonBasicLatinChars(char self)

stringByEscapingNonBasicLatinChars

public static String stringByEscapingNonBasicLatinChars(String self)

stringByEscapingSpace

public static String stringByEscapingSpace(String self)

stringByRemovingExtraDots

public static String stringByRemovingExtraDots(String self)

stringByReplacingStringByString

public static String stringByReplacingStringByString(String self,
                                                     String old,
                                                     String newString)

stringByAppendingPathComponent

public static String stringByAppendingPathComponent(String self,
                                                    String component)

stringByAppendingPathExtension

public static String stringByAppendingPathExtension(String self,
                                                    String extension)

stringByDeletingLastPathComponent

public static String stringByDeletingLastPathComponent(String self)

stringByDeletingPathExtension

public static String stringByDeletingPathExtension(String self)

stringByNormalizingExistingPath

public static String stringByNormalizingExistingPath(String self)

stringByNormalizingPath

public static String stringByNormalizingPath(String self)

appendSeparatorIfLastNot

public static void appendSeparatorIfLastNot(StringBuffer self,
                                            char separator,
                                            char not)

qualifier

public static EOQualifier qualifier(String self)

qualifierWithArray

public static EOQualifier qualifierWithArray(String self,
                                             NSArray arguments)

displayName

public static String displayName(String self)

distance

public static double distance(String self,
                              String other)

firstPropertyKey

public static String firstPropertyKey(String self)

indexOfNumeric

public static int indexOfNumeric(String self)

indexOfNumeric

public static int indexOfNumeric(String self,
                                 int fromIndex)

lastPathComponent

public static String lastPathComponent(String self)

pathExtension

public static String pathExtension(String self)

toHexString

public static String toHexString(char self)

toHexString

public static String toHexString(String self)

toLowerCase

public static String toLowerCase(String self)

decodedEntityName

public static String decodedEntityName(String self)

intValueForBindingWithDefault

public static int intValueForBindingWithDefault(WOComponent self,
                                                String binding,
                                                int def)

booleanValueForBindingWithDefault

public static boolean booleanValueForBindingWithDefault(WOComponent self,
                                                        String binding,
                                                        boolean def)

ec

public static EOEditingContext ec(WOComponent self)

show

public static void show(Object self,
                        Object value)

putAt

public static void putAt(Object self,
                         String property,
                         Object newValue)
Allows the subscript operator to be used to set dynamically named property values. bean[somePropertyNameExpression] = foo. The normal property notation of groovy is neater and more concise but only works with compile time known property names.

Parameters:
self -

dump

public static String dump(Object self)
Generates a detailed dump string of an object showing its class, hashCode and fields


eachPropertyName

public static void eachPropertyName(Object self,
                                    Closure closure)

eachProperty

public static void eachProperty(Object self,
                                Closure closure)

allProperties

public static List allProperties(Object self)

use

public static void use(Object self,
                       Class categoryClass,
                       Closure closure)
Scoped use method


use

public static void use(Object self,
                       List categoryClassList,
                       Closure closure)
Scoped use method with list of categories


print

public static void print(Object self,
                         Object value)
Print to a console in interactive format


println

public static void println(Object self,
                           Object value)
Print to a console in interactive format along with a newline


inspect

public static String inspect(Object self)
Returns:
a String that matches what would be typed into a terminal to create this object. e.g. [1, 'hello'].inspect() -> [1, "hello"]

print

public static void print(Object self,
                         PrintWriter out)
Print to a console in interactive format


println

public static void println(Object self,
                           PrintWriter out)
Print to a console in interactive format

Parameters:
out - the PrintWriter used for printing

invokeMethod

public static Object invokeMethod(Object object,
                                  String method,
                                  Object arguments)
Provide a dynamic method invocation method which can be overloaded in classes to implement dynamic proxies easily.


isCase

public static boolean isCase(Object caseValue,
                             Object switchValue)

isCase

public static boolean isCase(String caseValue,
                             Object switchValue)

isCase

public static boolean isCase(Class caseValue,
                             Object switchValue)

isCase

public static boolean isCase(Collection caseValue,
                             Object switchValue)

isCase

public static boolean isCase(Pattern caseValue,
                             Object switchValue)

every

public static boolean every(Object self,
                            Closure closure)
Iterates over every element of a collection, and check whether a predicate is valid for all elements.

Parameters:
self - the object over which we iterate
closure - the closure predicate used for matching
Returns:
true if every item in the collection matches the closure predicate

any

public static boolean any(Object self,
                          Closure closure)
Iterates over every element of a collection, and check whether a predicate is valid for at least one element

Parameters:
self - the object over which we iterate
closure - the closure predicate used for matching
Returns:
true if any item in the collection matches the closure predicate

grep

public static List grep(Object self,
                        Object filter)
Iterates over every element of the collection and return each object that matches the given filter - calling the isCase() method used by switch statements. This method can be used with different kinds of filters like regular expresions, classes, ranges etc.

Parameters:
self - the object over which we iterate
filter - the filter to perform on the collection (using the isCase(object) method)
Returns:
a list of objects which match the filter

toList

public static List toList(Collection self)
Convert a collection to a List.

Parameters:
self - a collection
Returns:
a List

collect

public static List collect(Object self,
                           Closure closure)
Iterates through this object transforming each object into a new value using the closure as a transformer, returning a list of transformed values.

Parameters:
self - the values of the object to map
closure - the closure used to map each element of the collection
Returns:
a List of the mapped values

collect

public static List collect(Collection self,
                           Closure closure)
Iterates through this collection transforming each entry into a new value using the closure as a transformer, returning a list of transformed values.

Parameters:
self - a collection
closure - the closure used for mapping
Returns:
a List of the mapped values

collect

public static List collect(Map self,
                           Closure closure)
Iterates through this Map transforming each entry into a new value using the closure as a transformer, returning a list of transformed values.

Parameters:
self - a Map
closure - the closure used for mapping
Returns:
a List of the mapped values

find

public static Object find(Object self,
                          Closure closure)
Finds the first value matching the closure condition

Parameters:
self - an Object with an iterator returning its values
closure - a closure condition
Returns:
the first Object found

find

public static Object find(Collection self,
                          Closure closure)
Finds the first value matching the closure condition

Parameters:
self - a Collection
closure - a closure condition
Returns:
the first Object found

find

public static Object find(Map self,
                          Closure closure)
Finds the first value matching the closure condition

Parameters:
self - a Map
closure - a closure condition
Returns:
the first Object found

findAll

public static List findAll(Object self,
                           Closure closure)
Finds all values matching the closure condition

Parameters:
self - an Object with an Iterator returning its values
closure - a closure condition
Returns:
a List of the values found

findAll

public static List findAll(Collection self,
                           Closure closure)
Finds all values matching the closure condition

Parameters:
self - a Collection
closure - a closure condition
Returns:
a List of the values found

findAll

public static List findAll(Map self,
                           Closure closure)
Finds all values matching the closure condition

Parameters:
self - a Map
closure - a closure condition applying on the keys
Returns:
a List of keys

inject

public static Object inject(Collection self,
                            Object value,
                            Closure closure)
Iterates through the given collection, passing in the initial value to the closure along with the current iterated item then passing into the next iteration the value of the previous closure.

Parameters:
self - a Collection
value - a value
closure - a closure
Returns:
the last value of the last iteration

join

public static String join(Collection self,
                          String separator)
Concatenates all of the items of the collection together with the given String as a separator

Parameters:
self - a Collection of objects
separator - a String separator
Returns:
the joined String

join

public static String join(Object[] self,
                          String separator)
Concatenates all of the elements of the array together with the given String as a separator

Parameters:
self - an array of Object
separator - a String separator
Returns:
the joined String

max

public static Object max(Collection self)
Selects the maximum value found in the collection

Parameters:
self - a Collection
Returns:
the maximum value

max

public static Object max(Collection self,
                         Comparator comparator)
Selects the maximum value found in the collection using the given comparator

Parameters:
self - a Collection
comparator - a Comparator
Returns:
the maximum value

min

public static Object min(Collection self)
Selects the minimum value found in the collection

Parameters:
self - a Collection
Returns:
the minimum value

min

public static Object min(Collection self,
                         Comparator comparator)
Selects the minimum value found in the collection using the given comparator

Parameters:
self - a Collection
comparator - a Comparator
Returns:
the minimum value

size

public static int size(String text)
Makes a String look like a Collection by adding support for the size() method

Parameters:
text - a String
Returns:
the length of the String

size

public static int size(Object[] self)
Makes an Array look like a Collection by adding support for the size() method

Parameters:
self - an Array of Object
Returns:
the size of the Array

toURL

public static URL toURL(String self)
                 throws MalformedURLException
Transforms a String representing a URL into a URL object.

Parameters:
self - the String representing a URL
Returns:
a URL
Throws:
MalformedURLException - is thrown if the URL is not well formed.

padLeft

public static String padLeft(String self,
                             Number numberOfChars,
                             String padding)
Pad a String with the characters appended to the left

Parameters:
numberOfChars - the total number of characters
padding - the charaters used for padding
Returns:
the String padded to the left

padLeft

public static String padLeft(String self,
                             Number numberOfChars)
Pad a String with the spaces appended to the left

Parameters:
numberOfChars - the total number of characters
Returns:
the String padded to the left

padRight

public static String padRight(String self,
                              Number numberOfChars,
                              String padding)
Pad a String with the characters appended to the right

Parameters:
numberOfChars - the total number of characters
padding - the charaters used for padding
Returns:
the String padded to the right

padRight

public static String padRight(String self,
                              Number numberOfChars)
Pad a String with the spaces appended to the right

Parameters:
numberOfChars - the total number of characters
Returns:
the String padded to the right

center

public static String center(String self,
                            Number numberOfChars,
                            String padding)
Center a String and padd it with the characters appended around it

Parameters:
numberOfChars - the total number of characters
padding - the charaters used for padding
Returns:
the String centered with padded character around

center

public static String center(String self,
                            Number numberOfChars)
Center a String and padd it with spaces appended around it

Parameters:
numberOfChars - the total number of characters
Returns:
the String centered with padded character around

getAt

public static List getAt(List self,
                         Collection indices)
Allows a List to be used as the indices to be used on a List

Parameters:
self - a List
indices - a Collection of indices
Returns:
a new list of the values at the given indices

getAt

public static List getAt(Object[] self,
                         Collection indices)
Allows a List to be used as the indices to be used on a List

Parameters:
self - an Array of Objects
indices - a Collection of indices
Returns:
a new list of the values at the given indices

getAt

public static CharSequence getAt(CharSequence self,
                                 Collection indices)
Allows a List to be used as the indices to be used on a CharSequence

Parameters:
self - a CharSequence
indices - a Collection of indices
Returns:
a String of the values at the given indices

getAt

public static String getAt(String self,
                           Collection indices)
Allows a List to be used as the indices to be used on a String

Parameters:
self - a String
indices - a Collection of indices
Returns:
a String of the values at the given indices

getAt

public static String getAt(Matcher self,
                           Collection indices)
Allows a List to be used as the indices to be used on a Matcher

Parameters:
self - a Matcher
indices - a Collection of indices
Returns:
a String of the values at the given indices

subMap

public static Map subMap(Map map,
                         Collection keys)
Creates a sub-Map containing the given keys. This method is similar to List.subList() but uses keys rather than index ranges.

Parameters:
map - a Map
keys - a Collection of keys
Returns:
a new Map containing the given keys

get

public static Object get(Map map,
                         Object key,
                         Object defaultValue)
Looks up an item in a Map for the given key and returns the value - unless there is no entry for the given key in which case add the default value to the map and return that.

Parameters:
map - a Map
key - the key to lookup the value of
defaultValue - the value to return and add to the map for this key if there is no entry for the given key
Returns:
the value of the given key or the default value, added to the map if the key did not exist

toList

public static List toList(Object[] array)
Allows conversion of arrays into a mutable List

Parameters:
array - an Array of Objects
Returns:
the array as a List

normaliseIndex

protected static int normaliseIndex(int i,
                                    int size)
This converts a possibly negative index to a real index into the array.

Parameters:
i -
size -
Returns:

asImmutable

public static Map asImmutable(Map self)
A convenience method for creating an immutable map

Parameters:
self - a Map
Returns:
an immutable Map

asImmutable

public static SortedMap asImmutable(SortedMap self)
A convenience method for creating an immutable sorted map

Parameters:
self - a SortedMap
Returns:
an immutable SortedMap

asImmutable

public static List asImmutable(List self)
A convenience method for creating an immutable list

Parameters:
self - a List
Returns:
an immutable List

asImmutable

public static Set asImmutable(Set self)
A convenience method for creating an immutable list

Parameters:
self - a Set
Returns:
an immutable Set

asImmutable

public static SortedSet asImmutable(SortedSet self)
A convenience method for creating an immutable sorted set

Parameters:
self - a SortedSet
Returns:
an immutable SortedSet

asSynchronized

public static Map asSynchronized(Map self)
A convenience method for creating a synchronized Map

Parameters:
self - a Map
Returns:
a synchronized Map

asSynchronized

public static SortedMap asSynchronized(SortedMap self)
A convenience method for creating a synchronized SortedMap

Parameters:
self - a SortedMap
Returns:
a synchronized SortedMap

asSynchronized

public static Collection asSynchronized(Collection self)
A convenience method for creating a synchronized Collection

Parameters:
self - a Collection
Returns:
a synchronized Collection

asSynchronized

public static List asSynchronized(List self)
A convenience method for creating a synchronized List

Parameters:
self - a List
Returns:
a synchronized List

asSynchronized

public static Set asSynchronized(Set self)
A convenience method for creating a synchronized Set

Parameters:
self - a Set
Returns:
a synchronized Set

asSynchronized

public static SortedSet asSynchronized(SortedSet self)
A convenience method for creating a synchronized SortedSet

Parameters:
self - a SortedSet
Returns:
a synchronized SortedSet

sort

public static List sort(Collection self)
Sorts the given collection into a sorted list

Parameters:
self - the collection to be sorted
Returns:
the sorted collection as a List

sort

public static SortedSet sort(SortedSet self)
Avoids doing unnecessary work when sorting an already sorted set

Parameters:
self -
Returns:
the sorted set

sort

public static List sort(List self)
A convenience method for sorting a List

Parameters:
self - a List to be sorted
Returns:
the sorted List

sort

public static List sort(List self,
                        Comparator comparator)
A convenience method for sorting a List with a specific comparator

Parameters:
self - a List
comparator - a Comparator used for the comparison
Returns:
a sorted List

sort

public static List sort(Collection self,
                        Comparator comparator)
A convenience method for sorting a Collection with a specific comparator

Parameters:
self - a collection to be sorted
comparator - a Comparator used for the comparison
Returns:
a newly created sorted List

asList

public static List asList(Collection self)
Converts the given collection into a List

Parameters:
self - a collection to be converted into a List
Returns:
a newly created List if this collection is not already a List

multiply

public static List multiply(Collection self,
                            Number factor)
Create a List composed of the same elements repeated a certain number of times.

Parameters:
self - a Collection
factor - the number of times to append
Returns:
a List

intersect

public static List intersect(List left,
                             Collection right)
Create a List composed of the intersection of both collections

Parameters:
left - a List
right - a Collection
Returns:
a List as an intersection of both collections

createStringWriter

protected static StringWriter createStringWriter(String self)

createStringBufferWriter

protected static StringBufferWriter createStringBufferWriter(StringBuffer self)

leftShift

public static Number leftShift(Number left,
                               Number right)
Implementation of the left shift operator for integral types. Non integral Number types throw UnsupportedOperationException.


rightShift

public static Number rightShift(Number left,
                                Number right)
Implementation of the right shift operator for integral types. Non integral Number types throw UnsupportedOperationException.


rightShiftUnsigned

public static Number rightShiftUnsigned(Number left,
                                        Number right)
Implementation of the right shift (unsigned) operator for integral types. Non integral Number types throw UnsupportedOperationException.


write

public static void write(Writer self,
                         Writable writable)
                  throws IOException
A helper method so that dynamic dispatch of the writer.write(object) method will always use the more efficient Writable.writeTo(writer) mechanism if the object implements the Writable interface.

Parameters:
self - a Writer
writable - an object implementing the Writable interface
Throws:
IOException

getAt

public static Object getAt(byte[] array,
                           Collection indices)

getAt

public static Object getAt(char[] array,
                           Collection indices)

getAt

public static Object getAt(short[] array,
                           Collection indices)

getAt

public static Object getAt(int[] array,
                           Collection indices)

getAt

public static Object getAt(long[] array,
                           Collection indices)

getAt

public static Object getAt(float[] array,
                           Collection indices)

getAt

public static Object getAt(double[] array,
                           Collection indices)

size

public static int size(byte[] array)

size

public static int size(char[] array)

size

public static int size(short[] array)

size

public static int size(int[] array)

size

public static int size(long[] array)

size

public static int size(float[] array)

size

public static int size(double[] array)

toList

public static List toList(byte[] array)

toList

public static List toList(char[] array)

toList

public static List toList(short[] array)

toList

public static List toList(int[] array)

toList

public static List toList(long[] array)

toList

public static List toList(float[] array)

toList

public static List toList(double[] array)

encodeBase64

public static Writable encodeBase64(Byte[] data)

encodeBase64

public static Writable encodeBase64(byte[] data)
Produce a Writable object which writes the base64 encoding of the byte array Calling toString() on the result rerurns the encoding as a String

Parameters:
data - byte array to be encoded
Returns:
object which will write the base64 encoding of the byte array

decodeBase64

public static byte[] decodeBase64(String value)
Decode the Sting from base64 into a byte array

Parameters:
value - the string to be decoded
Returns:
the decoded bytes as an array

primitiveArrayGet

protected static Object primitiveArrayGet(Object array,
                                          int idx)
Implements the getAt(int) method for primitve type arrays


primitiveArrayGet

protected static List primitiveArrayGet(Object self,
                                        Collection indices)
Implements the getAt(Collection) method for primitve type arrays


primitiveArrayPut

protected static void primitiveArrayPut(Object array,
                                        int idx,
                                        Object newValue)
Implements the set(int idx) method for primitve type arrays


toCharacter

public static Character toCharacter(String self)
Converts the given string into a Character object using the first character in the string

Parameters:
self - a String
Returns:
the first Character

tokenize

public static List tokenize(String self,
                            String token)
Tokenize a String

Parameters:
self - a String
token - the delimiter
Returns:
a List of tokens

tokenize

public static List tokenize(String self)
Tokenize a String (with a whitespace as delimiter)

Parameters:
self - a String
Returns:
a List of tokens

contains

public static boolean contains(String self,
                               String text)
Provide an implementation of contains() like Collection to make Strings more polymorphic This method is not required on JDK 1.5 onwards

Parameters:
self - a String
text - a String to look for
Returns:
true if this string contains the given text

count

public static int count(String self,
                        String text)
Count the number of occurencies of a substring

Parameters:
self - a String
text - a substring
Returns:
the number of occurrencies of the given string inside this String

next

public static String next(String self)
Increments the last digit in the given string, resetting it and moving onto the next digit if increasing the digit no longer becomes a letter or digit.

Parameters:
self - a String
Returns:
a String with an incremented digit at the end

previous

public static String previous(String self)
Decrements the last digit in the given string, resetting it and moving onto the next digit if increasing the digit no longer becomes a letter or digit.

Parameters:
self - a String
Returns:
a String with a decremented digit at the end

execute

public static Process execute(String self)
                       throws IOException
Executes the given string as a command line process. For more control over the process mechanism in JDK 1.5 you can use java.lang.ProcessBuilder.

Parameters:
self - a command line String
Returns:
the Process which has just started for this command line string
Throws:
IOException

multiply

public static String multiply(String self,
                              Number factor)
Repeat a String a certain number of times

Parameters:
self - a String to be repeated
factor - the number of times the String should be repeated
Returns:
a String composed of a repeatition
Throws:
IllegalArgumentException - if the number of repeatition is < 0

toString

protected static String toString(Object value)

next

public static Number next(Character self)
Increment a Character by one

Parameters:
self - a Character
Returns:
an incremented Number

next

public static Number next(Number self)
Increment a Number by one

Parameters:
self - a Number
Returns:
an incremented Number

previous

public static Number previous(Character self)
Decrement a Character by one

Parameters:
self - a Character
Returns:
a decremented Number

previous

public static Number previous(Number self)
Decrement a Number by one

Parameters:
self - a Number
Returns:
a decremented Number

multiply

public static Number multiply(Character left,
                              Number right)
Multiply a Character by a Number

Parameters:
left - a Character
right - a Number
Returns:
the multiplication of both

multiply

public static Number multiply(Number left,
                              Character right)
Multiply a Number by a Character

Parameters:
left - a Number
right - a Character
Returns:
the multiplication of both

multiply

public static Number multiply(Character left,
                              Character right)
Multiply two Characters

Parameters:
left - a Character
right - another Character
Returns:
the multiplication of both

multiply

public static Number multiply(Number left,
                              Number right)
Multiply two Numbers

Parameters:
left - a Number
right - another Number
Returns:
the multiplication of both

power

public static Number power(Number self,
                           Number exponent)
Power of a Number to a certain exponent

Parameters:
self - a Number
exponent - a Number exponent
Returns:
a Number to the power of a certain exponent

div

public static Number div(Character left,
                         Number right)
Divide a Character by a Number

Parameters:
left - a Character
right - a Number
Returns:
the multiplication of both

div

public static Number div(Number left,
                         Character right)
Divide a Number by a Character

Parameters:
left - a Number
right - a Character
Returns:
the multiplication of both

div

public static Number div(Character left,
                         Character right)
Divide two Characters

Parameters:
left - a Character
right - another Character
Returns:
the multiplication of both

div

public static Number div(Number left,
                         Number right)
Divide two Numbers

Parameters:
left - a Number
right - another Number
Returns:
a Number resulting of the divide operation

intdiv

public static Number intdiv(Character left,
                            Number right)
Integer Divide a Character by a Number

Parameters:
left - a Character
right - a Number
Returns:
the integer division of both

intdiv

public static Number intdiv(Number left,
                            Character right)
Integer Divide a Number by a Character

Parameters:
left - a Number
right - a Character
Returns:
the integer division of both

intdiv

public static Number intdiv(Character left,
                            Character right)
Integer Divide two Characters

Parameters:
left - a Character
right - another Character
Returns:
the integer division of both

intdiv

public static Number intdiv(Number left,
                            Number right)
Integer Divide two Numbers

Parameters:
left - a Number
right - another Number
Returns:
a Number (an Integer) resulting of the integer division operation

or

public static Number or(Number left,
                        Number right)
Bitwise OR together two numbers

Parameters:
left - a Number
right - another Number to bitwise OR
Returns:
the bitwise OR of both Numbers

and

public static Number and(Number left,
                         Number right)
Bitwise AND together two Numbers

Parameters:
left - a Number
right - another Number to bitwse AND
Returns:
the bitwise AND of both Numbers

mod

public static Number mod(Number left,
                         Number right)
Performs a division modulus operation

Parameters:
left - a Number
right - another Number to mod
Returns:
the modulus result

negate

public static Number negate(Number left)
Negates the number

Parameters:
left - a Number
Returns:
the negation of the number

times

public static void times(Number self,
                         Closure closure)
Iterates a number of times

Parameters:
self - a Number
closure - the closure to call a number of times

upto

public static void upto(Number self,
                        Number to,
                        Closure closure)
Iterates from this number up to the given number

Parameters:
self - a Number
to - another Number to go up to
closure - the closure to call

step

public static void step(Number self,
                        Number to,
                        Number stepNumber,
                        Closure closure)
Iterates from this number up to the given number using a step increment

Parameters:
self - a Number to start with
to - a Number to go up to
stepNumber - a Number representing the step increment
closure - the closure to call

abs

public static int abs(Number number)
Get the absolute value

Parameters:
number - a Number
Returns:
the absolute value of that Number

abs

public static long abs(Long number)
Get the absolute value

Parameters:
number - a Long
Returns:
the absolute value of that Long

abs

public static float abs(Float number)
Get the absolute value

Parameters:
number - a Float
Returns:
the absolute value of that Float

abs

public static double abs(Double number)
Get the absolute value

Parameters:
number - a Double
Returns:
the absolute value of that Double

round

public static int round(Float number)
Get the absolute value

Parameters:
number - a Float
Returns:
the absolute value of that Float

round

public static long round(Double number)
Round the value

Parameters:
number - a Double
Returns:
the absolute value of that Double

toInteger

public static Integer toInteger(String self)
Parse a String into an Integer

Parameters:
self - a String
Returns:
an Integer

toLong

public static Long toLong(String self)
Parse a String into a Long

Parameters:
self - a String
Returns:
a Long

toFloat

public static Float toFloat(String self)
Parse a String into a Float

Parameters:
self - a String
Returns:
a Float

toDouble

public static Double toDouble(String self)
Parse a String into a Double

Parameters:
self - a String
Returns:
a Double

toInteger

public static Integer toInteger(Number self)
Transform a Number into an Integer

Parameters:
self - a Number
Returns:
an Integer

next

public static Date next(Date self)
Increments a Date by a day

Parameters:
self - a Date
Returns:
the next days date

previous

public static Date previous(Date self)
Decrement a Date by a day

Parameters:
self - a Date
Returns:
the previous days date

eachLine

public static void eachLine(File self,
                            Closure closure)
                     throws IOException
Iterates through the given file line by line

Parameters:
self - a File
closure - a closure
Throws:
IOException

eachLine

public static void eachLine(Reader self,
                            Closure closure)
                     throws IOException
Iterates through the given reader line by line

Parameters:
self - a Reader
closure - a closure
Throws:
IOException

splitEachLine

public static void splitEachLine(File self,
                                 String sep,
                                 Closure closure)
                          throws IOException
Iterates through the given file line by line, splitting on the seperator

Parameters:
self - a File
sep - a String separator
closure - a closure
Throws:
IOException

splitEachLine

public static void splitEachLine(Reader self,
                                 String sep,
                                 Closure closure)
                          throws IOException
Iterates through the given reader line by line, splitting on the seperator

Parameters:
self - a Reader
sep - a String separator
closure - a closure
Throws:
IOException

readLines

public static List readLines(File file)
                      throws IOException
Reads the file into a list of Strings for each line

Parameters:
file - a File
Returns:
a List of lines
Throws:
IOException

getText

public static String getText(File file,
                             String charset)
                      throws IOException
Reads the content of the File opened with the specified encoding and returns it as a String

Parameters:
file - the file whose content we want to read
charset - the charset used to read the content of the file
Returns:
a String containing the content of the file
Throws:
IOException

getText

public static String getText(File file)
                      throws IOException
Reads the content of the File and returns it as a String

Parameters:
file - the file whose content we want to read
Returns:
a String containing the content of the file
Throws:
IOException

getText

public static String getText(URL url)
                      throws IOException
Reads the content of this URL and returns it as a String

Parameters:
url - URL to read content from
Returns:
the text from that URL
Throws:
IOException

getText

public static String getText(URL url,
                             String charset)
                      throws IOException
Reads the content of this URL and returns it as a String

Parameters:
url - URL to read content from
charset - opens the stream with a specified charset
Returns:
the text from that URL
Throws:
IOException

getText

public static String getText(InputStream is)
                      throws IOException
Reads the content of this InputStream and returns it as a String

Parameters:
is - an input stream
Returns:
the text from that URL
Throws:
IOException

getText

public static String getText(InputStream is,
                             String charset)
                      throws IOException
Reads the content of this InputStream with a specified charset and returns it as a String

Parameters:
is - an input stream
charset - opens the stream with a specified charset
Returns:
the text from that URL
Throws:
IOException

getText

public static String getText(BufferedReader reader)
                      throws IOException
Reads the content of the BufferedReader and returns it as a String

Parameters:
reader - a BufferedReader whose content we want to read
Returns:
a String containing the content of the buffered reader
Throws:
IOException

writeLine

public static void writeLine(BufferedWriter writer,
                             String line)
                      throws IOException
Write the text and append a new line (depending on the platform line-ending)

Parameters:
writer - a BufferedWriter
line - the line to write
Throws:
IOException

write

public static void write(File file,
                         String text)
                  throws IOException
Write the text to the File.

Parameters:
file - a File
text - the text to write to the File
Throws:
IOException

write

public static void write(File file,
                         String text,
                         String charset)
                  throws IOException
Write the text to the File with a specified encoding.

Parameters:
file - a File
text - the text to write to the File
charset - the charset used
Throws:
IOException

append

public static void append(File file,
                          String text)
                   throws IOException
Append the text at the end of the File

Parameters:
file - a File
text - the text to append at the end of the File
Throws:
IOException

append

public static void append(File file,
                          String text,
                          String charset)
                   throws IOException
Append the text at the end of the File with a specified encoding

Parameters:
file - a File
text - the text to append at the end of the File
charset - the charset used
Throws:
IOException

readLines

public static List readLines(Reader reader)
                      throws IOException
Reads the reader into a list of Strings for each line

Parameters:
reader - a Reader
Returns:
a List of lines
Throws:
IOException

eachFile

public static void eachFile(File self,
                            Closure closure)
Invokes the closure for each file in the given directory

Parameters:
self - a File
closure - a closure

eachFileRecurse

public static void eachFileRecurse(File self,
                                   Closure closure)
Invokes the closure for each file in the given directory and recursively. It is a depth-first exploration, directories are included in the search.

Parameters:
self - a File
closure - a closure

newReader

public static BufferedReader newReader(File file)
                                throws IOException
Helper method to create a buffered reader for a file

Parameters:
file - a File
Returns:
a BufferedReader
Throws:
IOException

newReader

public static BufferedReader newReader(File file,
                                       String charset)
                                throws FileNotFoundException,
                                       UnsupportedEncodingException
Helper method to create a buffered reader for a file, with a specified charset

Parameters:
file - a File
charset - the charset with which we want to write in the File
Returns:
a BufferedReader
Throws:
FileNotFoundException - if the File was not found
UnsupportedEncodingException - if the encoding specified is not supported

withReader

public static void withReader(File file,
                              Closure closure)
                       throws IOException
Helper method to create a new BufferedReader for a file and then passes it into the closure and ensures its closed again afterwords

Parameters:
file -
Throws:
FileNotFoundException
IOException

newOutputStream

public static BufferedOutputStream newOutputStream(File file)
                                            throws IOException
Helper method to create a buffered output stream for a file

Parameters:
file -
Returns:
Throws:
FileNotFoundException
IOException

withOutputStream

public static void withOutputStream(File file,
                                    Closure closure)
                             throws IOException
Helper method to create a new OutputStream for a file and then passes it into the closure and ensures its closed again afterwords

Parameters:
file - a File
Throws:
FileNotFoundException
IOException

withInputStream

public static void withInputStream(File file,
                                   Closure closure)
                            throws IOException
Helper method to create a new InputStream for a file and then passes it into the closure and ensures its closed again afterwords

Parameters:
file - a File
Throws:
FileNotFoundException
IOException

newWriter

public static BufferedWriter newWriter(File file)
                                throws IOException
Helper method to create a buffered writer for a file

Parameters:
file - a File
Returns:
a BufferedWriter
Throws:
FileNotFoundException
IOException

newWriter

public static BufferedWriter newWriter(File file,
                                       boolean append)
                                throws IOException
Helper method to create a buffered writer for a file in append mode

Parameters:
file - a File
append - true if in append mode
Returns:
a BufferedWriter
Throws:
FileNotFoundException
IOException

newWriter

public static BufferedWriter newWriter(File file,
                                       String charset,
                                       boolean append)
                                throws IOException
Helper method to create a buffered writer for a file

Parameters:
file - a File
charset - the name of the encoding used to write in this file
append - true if in append mode
Returns:
a BufferedWriter
Throws:
FileNotFoundException
IOException

newWriter

public static BufferedWriter newWriter(File file,
                                       String charset)
                                throws IOException
Helper method to create a buffered writer for a file

Parameters:
file - a File
charset - the name of the encoding used to write in this file
Returns:
a BufferedWriter
Throws:
FileNotFoundException
IOException

withWriter

public static void withWriter(File file,
                              Closure closure)
                       throws IOException
Helper method to create a new BufferedWriter for a file and then passes it into the closure and ensures it is closed again afterwords

Parameters:
file - a File
closure - a closure
Throws:
FileNotFoundException
IOException

withWriter

public static void withWriter(File file,
                              String charset,
                              Closure closure)
                       throws IOException
Helper method to create a new BufferedWriter for a file in a specified encoding and then passes it into the closure and ensures it is closed again afterwords

Parameters:
file - a File
charset - the charset used
closure - a closure
Throws:
FileNotFoundException
IOException

withWriterAppend

public static void withWriterAppend(File file,
                                    String charset,
                                    Closure closure)
                             throws IOException
Helper method to create a new BufferedWriter for a file in a specified encoding in append mode and then passes it into the closure and ensures it is closed again afterwords

Parameters:
file - a File
charset - the charset used
closure - a closure
Throws:
FileNotFoundException
IOException

newPrintWriter

public static PrintWriter newPrintWriter(File file)
                                  throws IOException
Helper method to create a new PrintWriter for a file

Parameters:
file - a File
Throws:
FileNotFoundException
IOException

newPrintWriter

public static PrintWriter newPrintWriter(File file,
                                         String charset)
                                  throws IOException
Helper method to create a new PrintWriter for a file with a specified charset

Parameters:
file - a File
charset - the charset
Returns:
a PrintWriter
Throws:
FileNotFoundException
IOException

withPrintWriter

public static void withPrintWriter(File file,
                                   Closure closure)
                            throws IOException
Helper method to create a new PrintWriter for a file and then passes it into the closure and ensures its closed again afterwords

Parameters:
file - a File
Throws:
FileNotFoundException
IOException

withWriter

public static void withWriter(Writer writer,
                              Closure closure)
                       throws IOException
Allows a writer to be used, calling the closure with the writer and then ensuring that the writer is closed down again irrespective of whether exceptions occur or the

Parameters:
writer - the writer which is used and then closed
closure - the closure that the writer is passed into
Throws:
IOException

withReader

public static void withReader(Reader writer,
                              Closure closure)
                       throws IOException
Allows a Reader to be used, calling the closure with the writer and then ensuring that the writer is closed down again irrespective of whether exceptions occur or the

Parameters:
writer - the writer which is used and then closed
closure - the closure that the writer is passed into
Throws:
IOException

withStream

public static void withStream(InputStream stream,
                              Closure closure)
                       throws IOException
Allows a InputStream to be used, calling the closure with the stream and then ensuring that the stream is closed down again irrespective of whether exceptions occur or the

Parameters:
stream - the stream which is used and then closed
closure - the closure that the stream is passed into
Throws:
IOException

readLines

public static List readLines(InputStream stream)
                      throws IOException
Reads the stream into a list of Strings for each line

Parameters:
stream - a stream
Returns:
a List of lines
Throws:
IOException

eachLine

public static void eachLine(InputStream stream,
                            Closure closure)
                     throws IOException
Iterates through the given stream line by line

Parameters:
stream - a stream
closure - a closure
Throws:
IOException

eachLine

public static void eachLine(URL url,
                            Closure closure)
                     throws IOException
Iterates through the lines read from the URL's associated input stream

Parameters:
url - a URL to open and read
closure - a closure to apply on each line
Throws:
IOException

withReader

public static void withReader(URL url,
                              Closure closure)
                       throws IOException
Helper method to create a new BufferedReader for a URL and then passes it into the closure and ensures its closed again afterwords

Parameters:
url - a URL
Throws:
FileNotFoundException
IOException

withReader

public static void withReader(InputStream in,
                              Closure closure)
                       throws IOException
Helper method to create a new BufferedReader for a stream and then passes it into the closure and ensures its closed again afterwords

Parameters:
in - a stream
Throws:
FileNotFoundException
IOException

withWriter

public static void withWriter(OutputStream stream,
                              Closure closure)
                       throws IOException
Allows an output stream to be used, calling the closure with the output stream and then ensuring that the output stream is closed down again irrespective of whether exceptions occur

Parameters:
stream - the stream which is used and then closed
closure - the closure that the writer is passed into
Throws:
IOException

withWriter

public static void withWriter(OutputStream stream,
                              String charset,
                              Closure closure)
                       throws IOException
Allows an output stream to be used, calling the closure with the output stream and then ensuring that the output stream is closed down again irrespective of whether exceptions occur.

Parameters:
stream - the stream which is used and then closed
charset - the charset used
closure - the closure that the writer is passed into
Throws:
IOException

withStream

public static void withStream(OutputStream stream,
                              Closure closure)
                       throws IOException
Allows a OutputStream to be used, calling the closure with the stream and then ensuring that the stream is closed down again irrespective of whether exceptions occur.

Parameters:
stream - the stream which is used and then closed
closure - the closure that the stream is passed into
Throws:
IOException

newInputStream

public static BufferedInputStream newInputStream(File file)
                                          throws FileNotFoundException
Helper method to create a buffered input stream for a file

Parameters:
file - a File
Returns:
a BufferedInputStream of the file
Throws:
FileNotFoundException

eachByte

public static void eachByte(File self,
                            Closure closure)
                     throws IOException
Traverse through each byte of the specified File

Parameters:
self - a File
closure - a closure
Throws:
IOException

eachByte

public static void eachByte(InputStream is,
                            Closure closure)
                     throws IOException
Traverse through each byte of the specified stream

Parameters:
is - stream to iterate over
closure - closure to apply to each byte
Throws:
IOException

eachByte

public static void eachByte(URL url,
                            Closure closure)
                     throws IOException
Traverse through each byte of the specified URL

Parameters:
url - url to iterate over
closure - closure to apply to each byte
Throws:
IOException

transformChar

public static void transformChar(Reader reader,
                                 Writer writer,
                                 Closure closure)
Transforms the characters from a reader with a Closure and write them to a writer

Parameters:
reader -
writer -
closure -

transformLine

public static void transformLine(Reader reader,
                                 Writer writer,
                                 Closure closure)
                          throws IOException
Transforms the lines from a reader with a Closure and write them to a writer

Parameters:
reader -
writer -
closure -
Throws:
IOException

filterLine

public static void filterLine(Reader reader,
                              Writer writer,
                              Closure closure)
                       throws IOException
Filter the lines from a reader and write them on the writer, according to a closure which returns true or false.

Parameters:
reader - a reader
writer - a writer
closure - the closure which returns booleans
Throws:
IOException

filterLine

public static Writable filterLine(Reader reader,
                                  Closure closure)
Filter the lines of a Reader and create a Writable in return to stream the filtered lines

Parameters:
reader - a reader
closure - a closure returning a boolean indicating to filter or not a line
Returns:
a Writable closure

readBytes

public static byte[] readBytes(File file)
                        throws IOException
Reads the content of the file into an array of byte

Parameters:
file - a File
Returns:
a List of Bytes
Throws:
IOException

withStreams

public static void withStreams(Socket socket,
                               Closure closure)
                        throws IOException
Allows an InputStream and an OutputStream from a Socket to be used, calling the closure with the streams and then ensuring that the streams are closed down again irrespective of whether exceptions occur.

Parameters:
socket - a Socket
closure - a Closure
Throws:
IOException

accept

public static Socket accept(ServerSocket serverSocket,
                            Closure closure)
                     throws IOException
Allow to pass a Closure to the accept methods of ServerSocket

Parameters:
serverSocket - a ServerSocket
closure - a Closure
Returns:
a Socket
Throws:
IOException

asWritable

public static File asWritable(File file)
Parameters:
file - a File
Returns:
a File which wraps the input file and which implements Writable

asWritable

public static File asWritable(File file,
                              String encoding)
Parameters:
file - a File
encoding - the encoding to be used when reading the file's contents
Returns:
File which wraps the input file and which implements Writable

toList

public static List toList(String self)
Converts the given String into a List of strings of one character

Parameters:
self - a String
Returns:
a List of characters (a 1-character String)

getIn

public static InputStream getIn(Process self)
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way

Returns:
an InputStream

getText

public static String getText(Process self)
                      throws IOException
Read the text of the output stream of the Process.

Parameters:
self - a Process
Returns:
the text of the output
Throws:
IOException

getErr

public static InputStream getErr(Process self)
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way

Returns:
an InputStream

getOut

public static OutputStream getOut(Process self)
An alias method so that a process appears similar to System.out, System.in, System.err; you can use process.in, process.out, process.err in a similar way

Returns:
an OutputStream

waitForOrKill

public static void waitForOrKill(Process self,
                                 long numberOfMillis)
Wait for the process to finish during a certain amount of time, otherwise stops the process.

Parameters:
self - a Process
numberOfMillis - the number of milliseconds to wait before stopping the process

eachMatch

public static void eachMatch(String str,
                             String regex,
                             Closure closure)
process each regex matched substring of a string object. The object passed to the closure is a matcher with rich information of the last successful match

Parameters:
str - the target string
regex - a Regex string
closure - a closure

findIndexOf

public static int findIndexOf(Object self,
                              Closure closure)
Iterates over every element of the collection and return the index of the first object that matches the condition specified in the closure

Parameters:
self - the iteration object over which we iterate
closure - the filter to perform a match on the collection
Returns:
an integer that is the index of the first macthed object.