|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.ie.pcfg.Util
Provides basic utility operations
Constructor Summary | |
Util()
|
Method Summary | |
static void |
Beep()
beep. |
static int |
C(int n,
int r)
calculates choose(n, r) |
static List |
Disjunction(List list1,
List list2)
Gets the disjunction of the two "sets", list1 and list2. |
static double |
Exp(double a,
double b)
calculates a ^ b. |
static int |
Exp(int a,
int b)
calculates a ^ b. |
static int |
F(int n)
Calculates the "n"th Fibonacci number. |
static List |
GetAllCombinations(List list)
Gets all possible combinations of the elements in a list. |
static List |
GetAllCombinations(List list,
int max,
boolean allowDuplicates)
Gets all possible combinations of the elements in a list. |
static List |
GetCombinations(List list,
int size,
boolean allowDuplicates)
Gets all possible combinations of the elements in a list. |
static double |
GetElapsedTime(long start)
Gets the difference between current time and "start". |
static List |
GetPermutations(List list)
Gets all possible combinations of the elements in a list. |
static List |
GetPermutations(List list,
int size,
boolean allowDuplicates)
Gets all possible permuations of the elements in a list. |
static int |
IndexOf(List l,
Object o)
Gets the index of an index of an object within a list. |
static List |
Intersection(List list1,
List list2)
calculates the intersection of list1 and list2. |
static void |
main(String[] args)
|
static int |
Max(int a,
int b)
Max |
static int |
Min(int a,
int b)
Min |
static List |
RemoveDuplicates(List list)
removes duplicates from a list. |
static List |
RemoveOneOccurrence(List list,
Object o)
removes the first occurrence of o in list. |
static void |
WriteLine(String s,
BufferedWriter bw)
writes a single-line string plus newline out to a buffered writer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Util()
Method Detail |
public static void WriteLine(String s, BufferedWriter bw) throws IOException
IOException
public static List Disjunction(List list1, List list2)
public static int IndexOf(List l, Object o)
public static List GetCombinations(List list, int size, boolean allowDuplicates)
size
- all of the combination sets found by this method
must contain exactly "size" elementsallowDuplicates
- if the method should return combination sets
that contain duplicates (each element in the list is assumed to
be unique. so even if allowDuplicates is false, it would still
be possible for combination sets to contain duplicates if the original
list contained duplicates).public static List GetAllCombinations(List list, int max, boolean allowDuplicates)
max
- all of the combination sets found by this method
must contain at most "size" elementsallowDuplicates
- if the method should return combination sets
that contain duplicates (each element in the list is assumed to
be unique. so even if allowDuplicates is false, it would still
be possible for combination sets to contain duplicates if the original
list contained duplicates).public static List GetAllCombinations(List list)
public static List RemoveDuplicates(List list)
public static List RemoveOneOccurrence(List list, Object o)
public static List GetPermutations(List list, int size, boolean allowDuplicates)
size
- all of the permutation sets found by this method
must contain exactly "size" elementsallowDuplicates
- if the method should return permutation sets
that contain duplicates (each element in the list is assumed to
be unique. so even if allowDuplicates is false, it would still
be possible for permutation sets to contain duplicates if the original
list contained duplicates).public static List GetPermutations(List list)
public static double GetElapsedTime(long start)
public static void Beep()
public static int F(int n)
public static int C(int n, int r)
public static int Exp(int a, int b)
public static double Exp(double a, double b)
public static int Min(int a, int b)
public static int Max(int a, int b)
public static List Intersection(List list1, List list2)
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |