pt.compiler.helper
Class SourceHelper

java.lang.Object
  extended by pt.compiler.helper.SourceHelper

public class SourceHelper
extends java.lang.Object


Constructor Summary
SourceHelper()
           
 
Method Summary
static
<T> java.util.List<java.lang.Integer>
findMatchingIndexes(T[] array, T match)
          Returns a list of all indexes of 'array' that equal 'match'.
static
<T> java.lang.String
join(java.lang.Iterable<T> iterable)
          Combines an iterable set of elements into a string with each element separated by the string ", ".
static
<T> java.lang.String
join(java.lang.Iterable<T> iterable, java.lang.String separator, Func<java.lang.String,T> map)
          Combines an iterable set of elements into a string with each element separated by the specified separator.
static java.lang.String makeBoxedIfPrimitive(Type type)
          Returns the given type as a boxed type if possible.
static java.lang.String makeGeneric(java.lang.String type, java.lang.String param)
          Returns 'type' genericised with type 'param' as a string.
static void printFormattedCode(SourcePrinter printer, java.lang.String[] lines)
          Prints code such that lines after a line ending with '{' are indented by one level and lines beginning with '}' are unindented by one level.
static java.lang.String stripGenerics(java.lang.String type)
          Completely unreliable way to strip generic parameters from the name of a type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceHelper

public SourceHelper()
Method Detail

join

public static <T> java.lang.String join(java.lang.Iterable<T> iterable,
                                        java.lang.String separator,
                                        Func<java.lang.String,T> map)
Combines an iterable set of elements into a string with each element separated by the specified separator.


join

public static <T> java.lang.String join(java.lang.Iterable<T> iterable)
Combines an iterable set of elements into a string with each element separated by the string ", ".


makeGeneric

public static java.lang.String makeGeneric(java.lang.String type,
                                           java.lang.String param)
Returns 'type' genericised with type 'param' as a string.


makeBoxedIfPrimitive

public static java.lang.String makeBoxedIfPrimitive(Type type)
Returns the given type as a boxed type if possible.


stripGenerics

public static java.lang.String stripGenerics(java.lang.String type)
Completely unreliable way to strip generic parameters from the name of a type.


findMatchingIndexes

public static <T> java.util.List<java.lang.Integer> findMatchingIndexes(T[] array,
                                                                        T match)
Returns a list of all indexes of 'array' that equal 'match'.


printFormattedCode

public static void printFormattedCode(SourcePrinter printer,
                                      java.lang.String[] lines)
Prints code such that lines after a line ending with '{' are indented by one level and lines beginning with '}' are unindented by one level.