Assignment #3:

For assignment #3 i was attempting to make use of the random lines code and the Negative space code. What i wanted to do was to get then empty spaces in a piece of text and then replace the blanks with random characters and then randomize the lines so that I would get some abstract patterns.

import java.util.regex.*;
import java.util.ArrayList;
import com.decontextualize.a2z.TextFilter;

public class NegativeSpace2 extends TextFilter {
public static void main(String[] args) {
new NegativeSpace2().run();

private int longestLineLength = 0;

private ArrayList<String> lines = new ArrayList<String>();

private String[] chars = { “3″, “*”, “o”, “0″ };

//private char[] chars = new char[]{’3′,’*',’o',’0′};
int r = (int)(Math.random()*chars.length);

String randomChar = chars[r];

public void eachLine(String line) {
if (line.length() > longestLineLength) {
longestLineLength = line.length();

public void end() {
for (String line: lines) { while (lines.size() > 0) {
int randomIndex = (int)(Math.random() * lines.size());


line = line.replaceAll(”\\W”, chars[r]);
line = line.replaceAll(”\\w”, ” “);

When i compile i get no errors . But when i execute it (ctrl d) i get nothing. All i get is a ^D on the screen and it doesn’t do anything else.

This entry was posted on Friday, February 13th, 2009 at 2:05 pm and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply