public class AbusingTheSource {
public static void main(String args[]) {
// inheritance from our past
java.util.Random generator
= new java.util.Random();
String[] visionaries = {"Wittgenstein",
"Beethoven", "Kierkegaard", "Einstein",
"Nietzsche"}; // etc.
// current reality
String[] academicians
= newBatchOfAcademicians();
String person = newPerson();
boolean isGriswoldHeard = false;
// the foreseeable future
do {
// the source of academic wealth
String visionary = visionaries[
generator.nextInt(visionaries.length)];
// demonstrate one-to-one correspondence
// of something to nothing
System.out.println("\n" + person +
" inspired by " + visionary);
System.out.println("-----------");
for (String academician: academicians) {
System.out.println(academician +
" explicating " + visionary);
}
// prepare for tommorow
academicians = newBatchOfAcademicians();
person = newPerson();
if (isGriswoldHeard) {
academicians =
removeOneAcademician(academicians);
}
if (academicians.length < 1000) {
isGriswoldHeard = true;
}
} while (academicians.length > 999);
}
private static String[]
newBatchOfAcademicians() {
// factory work -- suitable for a machine
String[] newBatch = new String[1000];
for (int i = 0; i < 1000; i++) {
newBatch[i] = "Academician " + (i + 1);
}
return newBatch;
}
private static String newPerson() {
// simplicity personified
return "Person";
}
private static String[] removeOneAcademician(
String[] academicians) {
// an arduous task
// (TO DO: stress test the hardware)
String[] aMoreQuietBatch =
new String[academicians.length - 1];
for (int i = 0;
i < aMoreQuietBatch.length; i++) {
aMoreQuietBatch[i] = academicians[i];
}
return aMoreQuietBatch;
}
}
Sunday, June 29, 2008
Abusing the Source – The Program
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment