Skip to content

Instantly share code, notes, and snippets.

@riginding
Created April 13, 2011 15:36
Show Gist options
  • Save riginding/917770 to your computer and use it in GitHub Desktop.
Save riginding/917770 to your computer and use it in GitHub Desktop.
Class AsciiImage {
public boolean addLine(String line){
boolean check = true;
if (this.length != 0) {
if (this.length != line.length) {
check = false;
} else {
addLineReal(line);
}
} else {
if (line.length() >= 1){
addLineReal(line);
this.length = line.length();
} else {
check = false;
}
}
return check;
}
private void addLineReal(String line){
ascii += line;
lineCounter ++;
}
public int getWidth(){
return this.length;
}
bild = AsciiShop.new
wert = bild.getWidth(); => 0
bild.addLine("hallo");
wert = bild.getWidth();
bild.addLine("lkjkk");
wert = bild.getWidth();
System.out.println(wert); => 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment