|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.ConfigurableProcessor
de.fu_berlin.ties.CollectingProcessor
de.fu_berlin.ties.eval.ShuffleGenerator
public class ShuffleGenerator
Arranges all input arguments (for example, files or URLs) in random
"shuffles", so they can subsequently processed in random (but fixed) order.
This helps generating input data for experiments. Each random shuffle will
be stored in a file; each line of the file will contain one of the input
arguments; the order of input arguments will be random. If the input
arguments are URIs/URLs, this format correspondings to the
text/uri-list
media type defined in
RFC 2483; it can be
read using the IOUtils.readURIList(CharSequence)
methods.
Also contains the static shuffle(List)
method so it can
be used as a static utility class.
Constructor Summary | |
---|---|
ShuffleGenerator()
Creates a new instance from the standard configuration. |
|
ShuffleGenerator(int firstNum,
int num,
String filePrefix,
String fileExt,
TiesConfiguration conf)
Creates a new instance from the provided configuration. |
|
ShuffleGenerator(TiesConfiguration conf)
Creates a new instance from the provided configuration. |
Method Summary | ||
---|---|---|
void |
process(List<String> collected,
ContextMap context)
Processes the collected input arguments. |
|
static
|
shuffle(List<T> input)
Static utility method that "shuffles" a list by re-arranging its elements in random order. |
|
String |
toString()
Returns a string representation of this object. |
Methods inherited from class de.fu_berlin.ties.CollectingProcessor |
---|
close, process |
Methods inherited from class de.fu_berlin.ties.ConfigurableProcessor |
---|
getConfig |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ShuffleGenerator()
public ShuffleGenerator(TiesConfiguration conf)
conf
- used to configure this instance; must not be
null
public ShuffleGenerator(int firstNum, int num, String filePrefix, String fileExt, TiesConfiguration conf)
filePrefixNUMBER.fileExt
,
where NUMBER
is a number from firstNum
to firstNum + num - 1; if necessary, numbers will be padded
with leading zeros so all numbers are of the same length
(e.g. 01 to 10).
firstNum
- The number used in the name of the first generated
shuffle file (typically 1)num
- The number of random shuffles to generatefilePrefix
- Prefix used for the generated random shuffle filesfileExt
- Extension used for the generated random shuffle filesconf
- passed to the superclass; if null
,
the standard configuration is usedMethod Detail |
---|
public static <T> List<T> shuffle(List<T> input)
LinkedList
(and not a ArrayList
) as input
argument because iteratively deleting elements from ArrayList
s
is very inefficient.
T
- the type of the listinput
- the list of elements to shuffle; should be a
LinkedList
for efficiency; will be destroyed by this method
(i.e. it might be empty after this method returns)
input
in random orderpublic void process(List<String> collected, ContextMap context) throws IOException
process
in class CollectingProcessor
collected
- a list of Strings containing the collected input
argumentscontext
- a map of objects that are made available for processing;
will be empty when called from the CollectingProcessor.close(int)
method in this
class
IOException
- if an I/O error occurspublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |