Version 1.0.0 (2024-12-29): Material ZPG (2019)
This commit is contained in:
parent
7835d8e99a
commit
67d0889188
825 changed files with 391265 additions and 3 deletions
BIN
01_hintergrund/00_alg_stoffverteilungsplan.odt
Normal file
BIN
01_hintergrund/00_alg_stoffverteilungsplan.odt
Normal file
Binary file not shown.
BIN
01_hintergrund/01_alg_hintergrund_unterrichtsverlauf.odt
Normal file
BIN
01_hintergrund/01_alg_hintergrund_unterrichtsverlauf.odt
Normal file
Binary file not shown.
|
|
@ -0,0 +1,699 @@
|
||||||
|
import java.awt.image.*;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.BasicStroke;
|
||||||
|
import java.util.Vector;
|
||||||
|
import javax.imageio.*;
|
||||||
|
import java.io.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Bildklasse für die Simulation von Processing-Befehlen
|
||||||
|
*
|
||||||
|
* Diese Klasse stellt ein BufferedImage bereit, in das mit Processing-Befehlen gezeichnet
|
||||||
|
* werden kann.
|
||||||
|
* Zusätzlich kann ein Bildanzeiger über jede Änderung des Bildes informiert werden,
|
||||||
|
* um "Zurück"-Befehle zu ermöglichen. Der Bildanzeiger ist entweder eine normale Java
|
||||||
|
* ScrollPane oder ein Actor aus Greenfoot.
|
||||||
|
* Die Dokumentation der einzelnen Zeichenmethoden ist der Processing-Reference
|
||||||
|
* (https://processing.org/reference/ steht unter CC-Lizenz: https://creativecommons.org/)
|
||||||
|
* entnommen und mit Deepl.com ins Deutsche übersetzt.
|
||||||
|
*
|
||||||
|
* @version 1.0 from 23.01.2019
|
||||||
|
* @author Thomas Schaller (ZPG Informatik Klasse 9)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Picture{
|
||||||
|
|
||||||
|
// Einstellungmöglichkeiten für das Zeichnen von Rechtecken und Ellipsen
|
||||||
|
// RADIUS = Mittelpunkt+Radius wird gegeben, CENTER = Mittelpunkt und Breite/Höhe wird gegeben,
|
||||||
|
// CORNER = Linke obere Ecke + Breite/Höhe, CORNERS = Linke obere und rechte untere Ecke
|
||||||
|
public static final int RADIUS = 1;
|
||||||
|
public static final int CENTER = 2;
|
||||||
|
public static final int CORNER = 3;
|
||||||
|
public static final int CORNERS = 4;
|
||||||
|
|
||||||
|
// gespeichertes Bild,
|
||||||
|
private BufferedImage image;
|
||||||
|
|
||||||
|
// aktuelle Farbeinstellungen
|
||||||
|
private Color background;
|
||||||
|
private Color pencolor;
|
||||||
|
private Color fillcolor;
|
||||||
|
|
||||||
|
// aktuelle Stiftdicke
|
||||||
|
private double stroke;
|
||||||
|
|
||||||
|
// akkteller Koordinatenmodus von Rechtecken und Ellipsen
|
||||||
|
private int ellipseMode = CENTER;
|
||||||
|
private int rectMode = CORNER;
|
||||||
|
|
||||||
|
// aktueller Font
|
||||||
|
private Font textfont = null;
|
||||||
|
|
||||||
|
// muss ein Bildanzeiger benachrichtigt werden
|
||||||
|
private PictureViewer observer = null;
|
||||||
|
private boolean autorefresh = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein Bild mit Standardgröße 500x400
|
||||||
|
*/
|
||||||
|
public Picture() {
|
||||||
|
this(500,400);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein Bild der angegeben Größe
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public Picture(int width, int height) {
|
||||||
|
this(width,height, "D0D0D0");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein Bild aus einer Datei
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public Picture(String filename) {
|
||||||
|
load(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein Bild der angegebenen Größe mit festgelegtem Hintergrund
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
* @param background Farbe des Hintergrunds
|
||||||
|
*/
|
||||||
|
public Picture(int width, int height, String background) {
|
||||||
|
this.image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
this.background = decode(background);
|
||||||
|
this.pencolor = new Color(0,0,0);
|
||||||
|
this.stroke = 1;
|
||||||
|
this.fillcolor = null;
|
||||||
|
Graphics2D g = (Graphics2D) this.image.getGraphics();
|
||||||
|
g.setColor(this.background);
|
||||||
|
g.fillRect(0,0,width-1, height-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt fest, wer das Bild anzeigt.
|
||||||
|
* Diese ermöglicht die Benachrichtung des Observers, wenn sich das Bild ändert.
|
||||||
|
* @param observer Anzeiger des Bildes
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void setObserver(PictureViewer observer) {
|
||||||
|
this.observer= observer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Direktes Setzen des Bildes (für interne Zwecke)
|
||||||
|
* @param b Bild, das gespeichert werden soll.
|
||||||
|
*/
|
||||||
|
public void setImage(BufferedImage b) {
|
||||||
|
image = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Direktes Abfragen des Bildes (für interne Zwecke)
|
||||||
|
* @return Bild, das gerade gespeichert ist.
|
||||||
|
*/
|
||||||
|
public BufferedImage getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Definiert die Dimension der Breite und Höhe des Anzeigefensters in Pixeleinheiten.
|
||||||
|
* Die eingebauten Variablen Breite und Höhe werden durch die an diese Funktion übergebenen Parameter festgelegt. So weist beispielsweise
|
||||||
|
* der Befehl size(640, 480) der Variablen Breite 640 und der Variablen Höhe 480 zu.
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public void size(int width, int height){
|
||||||
|
pushImage();
|
||||||
|
this.image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
Graphics2D g = (Graphics2D) this.image.getGraphics();
|
||||||
|
g.setColor(background);
|
||||||
|
g.fillRect(0,0,width-1, height-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Breite des Bildes zurück.
|
||||||
|
* @return Breite des Bildes
|
||||||
|
*/
|
||||||
|
public int getWidth() {
|
||||||
|
return image.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Höhe des Bildes zurück.
|
||||||
|
* @return Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public int getHeight() {
|
||||||
|
return image.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt eine Kopie des Bildes und übergibt sie an den Observer (falls existent), damit dieser die Versionen speichern kann
|
||||||
|
*/
|
||||||
|
private void pushImage() {
|
||||||
|
if(observer != null) {
|
||||||
|
observer.pushImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt fest, ob nach jedem Zeichenbefehl automatisch das Bild auch in
|
||||||
|
* der Oberfläche aktualisiert wird. Die Einstellung "false" beschleunigt
|
||||||
|
* das Zeichnen aufwändiger Bilder und verhindert "Flackern".
|
||||||
|
* Das Neuzeichnen kann durch die Methode "refresh" gezielt ausgelöst werden.
|
||||||
|
* @param autorefresh true = nach jedem Zeichenbefehl die Anzeige aktualisieren, false= nur durch die Methode refresh neu zeichnen
|
||||||
|
*/
|
||||||
|
public void setAutoRefresh(boolean autoRefresh) {
|
||||||
|
this.autorefresh = autoRefresh;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auch die anzeigenden Klasse wird zum Neuzeichnen aufgefordert.
|
||||||
|
*/
|
||||||
|
private void repaint() {
|
||||||
|
if(observer != null && autorefresh) {
|
||||||
|
observer.repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auch die anzeigenden Klasse wird zum Neuzeichnen aufgefordert.
|
||||||
|
*/
|
||||||
|
public void refresh() {
|
||||||
|
if(observer != null) {
|
||||||
|
observer.repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------- Zeichenfunktionen -----------------------------------------------
|
||||||
|
/**
|
||||||
|
* Löscht den Inhalt des Bildes.
|
||||||
|
* Der Hintergrund wird mit der Hintergrundfarbe neu gefüllt.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void clear(){
|
||||||
|
pushImage();
|
||||||
|
image = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
|
||||||
|
Graphics2D g = (Graphics2D) this.image.getGraphics();
|
||||||
|
g.setColor(background);
|
||||||
|
g.fillRect(0,0,image.getWidth()-1, image.getHeight()-1);
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konvertiert die in einem bestimmten Modus gegebenen Koordinaten in die Java-übliche Links_Oben_Breite_Höhe Version
|
||||||
|
* Die Änderungen werden direkt im Array vorgenommen
|
||||||
|
* @param coord Array mit vier Koordinateneinträgen im gegebenen Modus
|
||||||
|
* @param mode Modus der Koordinaten (CORNER, CORNERS, RADIUS oder CENTER)
|
||||||
|
*/
|
||||||
|
private void convert(int[] coord, int mode) {
|
||||||
|
switch(mode) {
|
||||||
|
case CORNER: break;
|
||||||
|
case CORNERS: coord[2] -= coord[0]; coord[3] -= coord[1]; break;
|
||||||
|
case RADIUS: coord[2] *= 2; coord[3] *=2;
|
||||||
|
case CENTER: coord[0] -= coord[2]/2; coord[1] -= coord[3]/2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ändert den Koordinaten-Modus beim Zeichnen von Rechtecken.
|
||||||
|
* Ändert die Position, von der aus Rechtecke gezeichnet werden, indem es die Art und Weise ändert, wie Parameter, die an rect() übergeben werden, interpretiert werden.
|
||||||
|
* Der Standardmodus ist rectMode(Bild.CORNER), der die ersten beiden Parameter von rect() als die linke obere Ecke der Form interpretiert,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* rectMode(Bild.CORNERS) interpretiert die ersten beiden Parameter von rect() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als die Position der gegenüberliegenden Ecke.
|
||||||
|
* rectMode(Bild.CENTER) interpretiert die ersten beiden Parameter von rect() als Mittelpunkt der Form,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* rectMode(RADIUS) verwendet auch die ersten beiden Parameter von rect() als Mittelpunkt der Form,
|
||||||
|
* verwendet aber den dritten und vierten Parameter, um die Hälfte der Breite und Höhe der Formen festzulegen.
|
||||||
|
* @param mode Modus der Koordinateninterpretation (CORNER, CORNERS, CENTER oder RADIUS)
|
||||||
|
*/
|
||||||
|
public void rectMode(int mode) {
|
||||||
|
rectMode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ändert den Koordinaten-Modus beim Zeichnen von Kreisen/Ellipsen.
|
||||||
|
* Ändert die Position, von der aus Kreise/Ellipsen gezeichnet werden, indem es die Art und Weise ändert, wie Parameter, die an ellipse() übergeben werden, interpretiert werden.
|
||||||
|
* Der Standardmodus ist ellipseMode(Bild.CENTER), der die ersten beiden Parameter von ellipse() als Mittelpunkt der Form interpretiert,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* ellipseMode(Bild.CORNER) interpretiert die ersten beiden Parameter von ellipse() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als Breite und Höhe der Form.
|
||||||
|
* ellipseMode(Bild.CORNERS) interpretiert die ersten beiden Parameter von ellipse() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als die Position der gegenüberliegenden Ecke.
|
||||||
|
* ellipseMode(RADIUS) verwendet auch die ersten beiden Parameter von ellipse() als Mittelpunkt der Form,
|
||||||
|
* verwendet aber den dritten und vierten Parameter, um die Hälfte der Breite und Höhe der Formen festzulegen.
|
||||||
|
* @param mode Modus der Koordinateninterpretation (CORNER, CORNERS, CENTER oder RADIUS)
|
||||||
|
*/
|
||||||
|
public void ellipseMode(int mode) {
|
||||||
|
ellipseMode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet eine Linie (einen direkten Weg zwischen zwei Punkten) auf den Bildschirm.
|
||||||
|
* Um eine Linie einzufärben, verwenden Sie die {@link #stroke(int, int, int) stroke()} Funktion. Eine Zeile kann nicht gefüllt werden, daher hat die Funktion fill() keinen
|
||||||
|
* Einfluss auf die Farbe einer Zeile. Linien werden standardmäßig mit einer Breite von einem Pixel gezeichnet, dies kann jedoch mit der Funktion
|
||||||
|
* {@link #strokeWeight(double) strokeWeight()} geändert werden.
|
||||||
|
* @param x1 x-Koordinate des 1. Punktes
|
||||||
|
* @param y1 y-Koordinate des 1. Punktes
|
||||||
|
* @param x2 x-Koordinate des 2. Punktes
|
||||||
|
* @param y2 y-Koordinate des 2. Punktes
|
||||||
|
*/
|
||||||
|
public void line(int x1, int y1, int x2, int y2) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
if (stroke > 0) {
|
||||||
|
g.setColor(pencolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.drawLine(x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Rechteck auf das Bild.
|
||||||
|
* Standardmäßig legen die ersten beiden Parameter die Position der linken oberen Ecke fest, der dritte die Breite und der vierte die Höhe.
|
||||||
|
* Die Art und Weise, wie diese Parameter interpretiert werden, kann jedoch mit der Funktion {@link #rectMode(int) rectMode()} geändert werden.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param a meist die x-Koordinate der linken oberen Ecke (kann durch rectMode() geändert werden).
|
||||||
|
* @param b meist die y-Koordinate der linken oberen Ecke (kann durch rectMode() geändert werden).
|
||||||
|
* @param c meist die Breite des Rechtecks (kann durch rectMode() geändert werden).
|
||||||
|
* @param d meist die Höhe des Rechtecks (kann durch rectMode() geändert werden).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void rect(int a, int b, int c, int d) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
int[] coord = {a,b,c,d};
|
||||||
|
convert(coord, rectMode);
|
||||||
|
if(fillcolor != null) {
|
||||||
|
g.setColor(fillcolor);
|
||||||
|
g.fillRect(coord[0], coord[1], coord[2], coord[3]);
|
||||||
|
}
|
||||||
|
if(pencolor != null) {
|
||||||
|
g.setColor(pencolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.drawRect(coord[0], coord[1], coord[2], coord[3]);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet eine Ellipse/Kreis auf das Bild.
|
||||||
|
* Standardmäßig legen die ersten beiden Parameter die Position des Mittelpunkts fest, der dritte die Breite und der vierte die Höhe.
|
||||||
|
* Die Art und Weise, wie diese Parameter interpretiert werden, kann jedoch mit der Funktion {@link #ellipseMode(int) ellipseMode()} geändert werden.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param a meist die x-Koordinate des Mittelpunkts (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param b meist die y-Koordinate des Mittelpunkts (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param c meist die Breite des Rechtecks (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param d meist die Höhe des Rechtecks (kann durch ellipseMode() geändert werden).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void ellipse(int a, int b, int c, int d) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
int[] coord = {a,b,c,d};
|
||||||
|
convert(coord, ellipseMode);
|
||||||
|
if(fillcolor != null) {
|
||||||
|
g.setColor(fillcolor);
|
||||||
|
g.fillOval(coord[0], coord[1], coord[2], coord[3]);
|
||||||
|
}
|
||||||
|
if(pencolor != null) {
|
||||||
|
g.setColor(pencolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.drawOval(coord[0], coord[1], coord[2], coord[3]);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Dreieck auf das Bild.
|
||||||
|
* Ein Dreieck ist eine Ebene, die durch die Verbindung von drei Punkten entsteht. Die ersten beiden Argumente spezifizieren den
|
||||||
|
* ersten Punkt, die mittleren beiden Argumente spezifizieren den zweiten Punkt und die letzten beiden Argumente spezifizieren den dritten Punkt.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x1 meist die x-Koordinate des 1. Punkts.
|
||||||
|
* @param y1 meist die y-Koordinate des 1. Punkts.
|
||||||
|
* @param x2 meist die x-Koordinate des 2. Punkts.
|
||||||
|
* @param y2 meist die y-Koordinate des 2. Punkts.
|
||||||
|
* @param x3 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y3 meist die y-Koordinate des 3. Punkts.
|
||||||
|
*/
|
||||||
|
public void triangle(int x1, int y1, int x2, int y2, int x3, int y3) {
|
||||||
|
int px[] = {x1, x2, x3};
|
||||||
|
int py[] = {y1, y2, y3};
|
||||||
|
polygon(px, py);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Viereck auf das Bild.
|
||||||
|
* Ein Viereck ist ein vierseitiges Polygon. Es ist ähnlich wie ein Rechteck, aber die Winkel zwischen seinen Kanten
|
||||||
|
* sind nicht auf neunzig Grad beschränkt. Das erste Paar von Parametern (x1,y1) setzt den ersten Scheitelpunkt und die nachfolgenden
|
||||||
|
* Paare sollten im Uhrzeigersinn oder gegen den Uhrzeigersinn um die definierte Form herum verlaufen.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x1 meist die x-Koordinate des 1. Punkts.
|
||||||
|
* @param y1 meist die y-Koordinate des 1. Punkts.
|
||||||
|
* @param x2 meist die x-Koordinate des 2. Punkts.
|
||||||
|
* @param y2 meist die y-Koordinate des 2. Punkts.
|
||||||
|
* @param x3 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y3 meist die y-Koordinate des 3. Punkts.
|
||||||
|
* @param x4 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y4 meist die y-Koordinate des 3. Punkts.
|
||||||
|
*/
|
||||||
|
public void quad(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
|
||||||
|
|
||||||
|
int px[] = {x1, x2, x3, x4};
|
||||||
|
int py[] = {y1, y2, y3, y4};
|
||||||
|
polygon(px, py);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Polygon auf das Bild.
|
||||||
|
* Gleich lange Listen von x und y-Koordinaten bestimmen die Eckpunkte des Polygons.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x Liste der x-Koordinaten der Punkte.
|
||||||
|
* @param y Liste der y-Koordinaten der Punkte.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void polygon(int[] x, int[] y) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
|
||||||
|
if(fillcolor != null) {
|
||||||
|
|
||||||
|
g.setColor(fillcolor);
|
||||||
|
g.fillPolygon(x,y, y.length);
|
||||||
|
}
|
||||||
|
if(pencolor != null) {
|
||||||
|
g.setColor(pencolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.drawPolygon(x, y, x.length);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet einen Punkt, d.h. einen Kreis in der Dimension eines Pixels.
|
||||||
|
* Der erste Parameter ist der x-Wert für den Punkt, der zweite Wert ist der y-Wert für den Punkt.
|
||||||
|
* @param x x-Koordinate des Punktes
|
||||||
|
* @param y y-Koordinate des Punktes
|
||||||
|
*/
|
||||||
|
public void point(int x, int y) {
|
||||||
|
ellipse(x,y,1, 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------- Schriftdarstellung -----------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt einen Text an den gegebenen Koordinaten aus
|
||||||
|
* Zur Ausgabe des Textes wird der ausgewählte Font verwendet. Dieser muss vorher mit {@link #textFont(Font) textFont() } festgelegt.
|
||||||
|
* @param s Text, der angezeigt werden soll
|
||||||
|
* @param x x-Koordinate des Textanfangs
|
||||||
|
* @param y y-Koordinate der Grundlinie des Textes.
|
||||||
|
*/
|
||||||
|
public void text(String s, int x, int y) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
|
||||||
|
if(pencolor != null) {
|
||||||
|
g.setColor(fillcolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.setFont(textfont);
|
||||||
|
g.drawString(s, x, y);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Schriftart für Textausgaben fest.
|
||||||
|
* Jeder übliche Java-Font kann verwendet werden. Er kann mit z.B. Font f = new Font( "Arial", Font.PLAIN, 14 ); definiert werden.
|
||||||
|
* @param font ein Font-Objekt
|
||||||
|
*/
|
||||||
|
public void textFont(Font font) {
|
||||||
|
this.textfont = font;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------- Farbfestlegungen -----------------------------------------------
|
||||||
|
/**
|
||||||
|
* Hilfsfunktion zur Interpretation von Farben
|
||||||
|
*/
|
||||||
|
private Color decode(String color) {
|
||||||
|
try{
|
||||||
|
return new Color(
|
||||||
|
Integer.valueOf( color.substring( 0, 2 ), 16 ),
|
||||||
|
Integer.valueOf( color.substring( 2, 4 ), 16 ),
|
||||||
|
Integer.valueOf( color.substring( 4, 6 ), 16 ) );
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Falscher Farbcode");
|
||||||
|
return Color.BLACK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hilfsfunktion zur Interpretation von Farben
|
||||||
|
*/
|
||||||
|
private Color decode(int color) {
|
||||||
|
try{
|
||||||
|
if(color >=0 && color < 256) {
|
||||||
|
return new Color(color,color,color);
|
||||||
|
} else {
|
||||||
|
int r = color / 0x010000 % 0xFF;
|
||||||
|
int g = color / 0x000100 % 0xFF;
|
||||||
|
int b = color % 0xFF;
|
||||||
|
System.out.println(""+r+","+g+","+b);
|
||||||
|
return new Color(r, g, b );
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Falscher Farbcode");
|
||||||
|
return Color.BLACK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird hexadezimal in Form der RGB angegeben: z.B. "CCFFAA" oder "004E23". Die Syntax verwendet sechs Ziffern - je zwei für die roten, grünen und blauen Komponenten,
|
||||||
|
* um eine Farbe anzugeben (genau wie Farben typischerweise in HTML und CSS angegeben werden).
|
||||||
|
* @param pencolor Stiftfarbe in Hexadezimaldarstellung
|
||||||
|
*/
|
||||||
|
public void stroke(String pencolor) {
|
||||||
|
this.pencolor = decode(pencolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird entweder als Graustufe (0-255) oder als 3-Byte RGB-Wert angegeben
|
||||||
|
* @param pencolor Stiftfarbe (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void stroke(int pencolor) {
|
||||||
|
this.pencolor=decode(pencolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird komponentenweise als RGB-Wert angegeben
|
||||||
|
* @param r Rotanteil (0-255) der Stiftfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Stiftfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Stiftfarbe
|
||||||
|
*/
|
||||||
|
public void stroke(int r, int g, int b) {
|
||||||
|
this.pencolor = new Color(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt fest, dass keine Linien oder Ränder um Formen gezeichnet werden soll.
|
||||||
|
*/
|
||||||
|
public void noStroke() {
|
||||||
|
this.pencolor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Breite des Strichs für Linien, Punkte und den Rand um Formen fest.
|
||||||
|
* Alle Breiten werden in Pixeleinheiten angegeben.
|
||||||
|
* @param width Breite in Pixel
|
||||||
|
*/
|
||||||
|
public void strokeWeight(double width) {
|
||||||
|
this.stroke = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird hexadezimal in Form der RGB angegeben: z.B. "CCFFAA" oder "004E23". Die Syntax verwendet sechs Ziffern - je zwei für die roten, grünen und blauen Komponenten,
|
||||||
|
* um eine Farbe anzugeben (genau wie Farben typischerweise in HTML und CSS angegeben werden).
|
||||||
|
* @param fillcolor Füllfarbe in Hexadezimaldarstellung
|
||||||
|
*/
|
||||||
|
public void fill(String fillcolor) {
|
||||||
|
this.fillcolor = decode(fillcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird entweder als Graustufe (0-255) oder als 3-Byte RGB-Wert angegeben.
|
||||||
|
* @param fillcolor Füllfarbe (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void fill(int fillcolor) {
|
||||||
|
this.fillcolor=decode(fillcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird komponentenweise als RGB-Wert angegeben.
|
||||||
|
* @param r Rotanteil (0-255) der Füllfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Füllfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Füllfarbe
|
||||||
|
*/
|
||||||
|
public void fill(int r, int g, int b) {
|
||||||
|
this.fillcolor = new Color(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Legt fest, dass die Formen nicht gefüllt werden sollen.
|
||||||
|
*/
|
||||||
|
public void noFill() {
|
||||||
|
this.fillcolor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Funktion background() setzt die Farbe, die für den Hintergrund des Bildes verwendet wird. Der Standardhintergrund ist hellgrau.
|
||||||
|
* Es ist nicht möglich, den Alpha-Parameter Transparenz mit Hintergrundfarben auf der Hauptzeichnungsoberfläche zu verwenden.
|
||||||
|
* @param c Farbe für den Hintergrund (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void background(int c) {
|
||||||
|
if(c < 256) {
|
||||||
|
this.background=new Color(c,c,c);
|
||||||
|
} else {
|
||||||
|
int r = c / 0x010000;
|
||||||
|
int g = c / 0x000100 % 0xFF;
|
||||||
|
int b = c % 0xFF;
|
||||||
|
this.background= new Color(r, g, b );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Funktion background() setzt die Farbe, die für den Hintergrund des Bildes verwendet wird. Der Standardhintergrund ist hellgrau.
|
||||||
|
* Es ist nicht möglich, den Alpha-Parameter Transparenz mit Hintergrundfarben auf der Hauptzeichnungsoberfläche zu verwenden.
|
||||||
|
* @param r Rotanteil (0-255) der Hintergrundfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Hintergrundfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Hintergrundfarbe
|
||||||
|
*/
|
||||||
|
public void background(int r, int g, int b) {
|
||||||
|
this.background=new Color(r,g,b);
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------- Dateioperationen -----------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lädt ein Bild aus dem Dateisystem.
|
||||||
|
* Lädt ein Bild von einem Datenträger und setzt Stiftfarbe und Füllfarbe auf Standardwerte zurück.
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public void load(String filename) {
|
||||||
|
try{
|
||||||
|
this.image = ImageIO.read(new File(filename));
|
||||||
|
this.background = decode("D0D0D0");
|
||||||
|
this.pencolor = new Color(0,0,0);
|
||||||
|
this.fillcolor = null;
|
||||||
|
this.stroke = 1;
|
||||||
|
this.repaint();
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
System.out.println("Fehler beim Einlesen der Bilddatei");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert ein Bild.
|
||||||
|
* Speichert ein Bild auf einem Datenträger. Zulässig sind die Dateiformate PNG und GIF. Die Dateiendung legt den Typ fest.
|
||||||
|
* Standardmäßig wird die Dateiendung .png ergänzt, wenn keine angegeben ist.
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public void save(String filename) {
|
||||||
|
try{
|
||||||
|
String[] fn = filename.split("\\.");
|
||||||
|
if (fn.length== 1) {
|
||||||
|
ImageIO.write(image, "PNG", new File(filename+".png"));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (fn.length == 2 && (fn[1].toUpperCase().equals("PNG") ||
|
||||||
|
fn[1].toUpperCase().equals("GIF"))){
|
||||||
|
ImageIO.write(image, fn[1], new File(filename));
|
||||||
|
}else {
|
||||||
|
System.out.println("Unbekanntes Bildformat");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
System.out.println("Fehler beim Speichern");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------- Sonstiges -----------------------------------------------
|
||||||
|
/**
|
||||||
|
* Liefert das Bild als zweidimensionales Pixel-Array.
|
||||||
|
* @return zweidimensionales Array von Color-Objekten, die den Pixeln des Bildes entsprechen.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Color[][] getPixelArray() {
|
||||||
|
Color[][] pixel = new Color[image.getWidth()][image.getHeight()];
|
||||||
|
for(int x=0; x < image.getWidth(); x++){
|
||||||
|
for(int y=0; y < image.getHeight(); y++) {
|
||||||
|
pixel[x][y] = new java.awt.Color(image.getRGB(x,y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt das Bild neu auf Basis des Pixel-Arrays.
|
||||||
|
* Die Größe des Bildes wird nicht automatisch an das Array angepasst.
|
||||||
|
* @param pixel zweidimensionales Array von Color-Objekten
|
||||||
|
*/
|
||||||
|
public void setPixelArray(Color[][] pixel) {
|
||||||
|
size(pixel.length,pixel[0].length);
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
for(int x=0; x < image.getWidth(); x++){
|
||||||
|
for(int y=0; y < image.getHeight(); y++) {
|
||||||
|
g.setColor(pixel[x][y]);
|
||||||
|
g.fillRect(x, y, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hilfsfunktion zum Verzögern der Ausgabe
|
||||||
|
* @param millis Wartezeit in Millisekunden
|
||||||
|
*/
|
||||||
|
public void delay(int millis) {
|
||||||
|
try{
|
||||||
|
Thread.sleep(millis);
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,499 @@
|
||||||
|
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot und MouseInfo)
|
||||||
|
import java.awt.image.*;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.BasicStroke;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.util.Vector;
|
||||||
|
import java.awt.Color;
|
||||||
|
import javax.imageio.*;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Der PictureViewer ist ein Actor, der in der Lage ist ein
|
||||||
|
* Objekt der Klasse Picture anzuzeigen. Zusätzlich können
|
||||||
|
* mehrere Verarbeitungsschritte gespeichert werden, um ein
|
||||||
|
* "zurück"-Funktion zu ermöglichen.
|
||||||
|
*
|
||||||
|
* @author Thomas Schaller
|
||||||
|
* @version V1.0 vom 10.02.2019
|
||||||
|
*/
|
||||||
|
public class PictureViewer extends Actor
|
||||||
|
{
|
||||||
|
public static final int FIT = -1;
|
||||||
|
public static final int NORMAL = 1;
|
||||||
|
|
||||||
|
private static final int ANZ_BACK = 0;
|
||||||
|
|
||||||
|
private double zoom;
|
||||||
|
protected Picture picture = null;
|
||||||
|
private Vector<BufferedImage> history;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein ScrollPanel mit integriertem Bild der Größe 500x400
|
||||||
|
*/
|
||||||
|
public PictureViewer() {
|
||||||
|
this(500,400);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein ScrollPanel mit integriertem Bild der angegebenen Größe
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public PictureViewer(int width, int height) {
|
||||||
|
this(width,height, "D0D0D0");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein ScrollPanel mit integriertem Bild der angegebenen Größe
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
* @param background Farbe des Hintergrunds als HEX-String (z.B. "FF3A45")
|
||||||
|
*/
|
||||||
|
public PictureViewer(int width, int height, String background) {
|
||||||
|
picture = new Picture(width,height, background);
|
||||||
|
picture.setObserver(this);
|
||||||
|
this.history = new Vector<BufferedImage>();
|
||||||
|
this.zoom = NORMAL;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein ScrollPanel mit integriertem Bild aus einer Bilddatei
|
||||||
|
* @param filename Name des Bildes
|
||||||
|
*/
|
||||||
|
public PictureViewer(String filename) {
|
||||||
|
picture = new Picture(filename);
|
||||||
|
picture.setObserver(this);
|
||||||
|
this.history = new Vector<BufferedImage>();
|
||||||
|
this.zoom = NORMAL;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert das übergebene Bild in der History.
|
||||||
|
* @param b zu speicherndes Bild
|
||||||
|
*/
|
||||||
|
public void pushImage() {
|
||||||
|
if( this.ANZ_BACK > 0) {
|
||||||
|
if(history.size() == this.ANZ_BACK) {
|
||||||
|
history.removeElementAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferedImage b = new BufferedImage(picture.getWidth(), picture.getHeight(), picture.getImage().getType());
|
||||||
|
Graphics g = b.getGraphics();
|
||||||
|
g.drawImage(picture.getImage(), 0, 0, null);
|
||||||
|
g.dispose();
|
||||||
|
|
||||||
|
history.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ruft das letzte abgespeicherte Bild aus der History wieder auf.
|
||||||
|
*/
|
||||||
|
private void popImage() {
|
||||||
|
int anz = history.size();
|
||||||
|
if(anz>0) {
|
||||||
|
BufferedImage i = history.get(anz-1);
|
||||||
|
history.removeElementAt(anz-1);
|
||||||
|
picture.setImage(i);
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ruft das letzte abgespeicherte Bild aus der History wieder auf.
|
||||||
|
*/
|
||||||
|
public void back() {
|
||||||
|
popImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Zoom-Faktor für das Bild.
|
||||||
|
* Als Zoomfaktor sind auch die Konstanten Bildanzeiger.FIT (auf Bildschirmgröße zoomen) und Bildanzeiger.NORMAL (100%) möglich.
|
||||||
|
* @param factor Zoomfaktor (1.0 = 100%).
|
||||||
|
*/
|
||||||
|
public void setZoom(double zoom) {
|
||||||
|
this.zoom = zoom;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt die automatische Neuanzeige des Bildes.
|
||||||
|
* Mit dieser Methode kann man einstellen, ob nach jedem Zeichenbefehl
|
||||||
|
* die Anzeige auf dem Bildschirm aktualisiert werden soll. Bei sehr
|
||||||
|
* vielen Zeichenbefehlen wird die Ausgabe dadurch sehr langsam. Es reicht
|
||||||
|
* eine Anzeige am Ende der Zeichenbefehle. Rufen Sie dann für das Neuzeichnen
|
||||||
|
* die Methode refresh() auf.
|
||||||
|
* @param autoRefresh true, wenn nach jedem Zeichenbefehl die Anzeige aktualisiert werden soll.
|
||||||
|
*/
|
||||||
|
public void setAutoRefresh(boolean autoRefresh) {
|
||||||
|
picture.setAutoRefresh(autoRefresh);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorgt für die Aktualisierung der Bildschrimanzeige. Das aktuelle Bild
|
||||||
|
* wird dadurch angezeigt. Durch Einstellung von autoRefresh kann die
|
||||||
|
* Anzeige automatisiert werden.
|
||||||
|
*/
|
||||||
|
public void refresh() {
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt das angezeigt Bild neu und beachtet dabei den Zoomfaktor.
|
||||||
|
*/
|
||||||
|
public void repaint() {
|
||||||
|
double faktor = zoom;
|
||||||
|
|
||||||
|
if (zoom == FIT) {
|
||||||
|
double faktorw = (double) this.getWorld().getWidth() / picture.getWidth();
|
||||||
|
double faktorh = (double) this.getWorld().getHeight() / picture.getHeight();
|
||||||
|
faktor = Math.min(faktorw, faktorh);
|
||||||
|
}
|
||||||
|
int gfi_width = (int) (picture.getWidth()*faktor);
|
||||||
|
int gfi_height = (int) (picture.getHeight()*faktor);
|
||||||
|
|
||||||
|
setImage(new GreenfootImage(gfi_width, gfi_height));
|
||||||
|
Graphics2D g = (Graphics2D) this.getImage().getAwtImage().getGraphics();
|
||||||
|
g.drawImage(picture.getImage(),0,0,gfi_width-1, gfi_height-1, 0, 0, picture.getWidth(), picture.getHeight(), null);
|
||||||
|
g.setColor(new java.awt.Color(0,0,0));
|
||||||
|
g.setStroke(new BasicStroke((float) 1));
|
||||||
|
g.drawRect(0,0,gfi_width-1, gfi_height-1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrappermethoden
|
||||||
|
/**
|
||||||
|
* Definiert die Dimension der Breite und Höhe des Anzeigefensters in Pixeleinheiten.
|
||||||
|
* Die eingebauten Variablen Breite und Höhe werden durch die an diese Funktion übergebenen Parameter festgelegt. So weist beispielsweise
|
||||||
|
* der Befehl size(640, 480) der Variablen Breite 640 und der Variablen Höhe 480 zu.
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public void size(int width, int height){
|
||||||
|
picture.size(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Breite des Bildes zurück.
|
||||||
|
* @return Breite des Bildes
|
||||||
|
*/
|
||||||
|
public int getImageWidth() {
|
||||||
|
return picture.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Höhe des Bildes zurück.
|
||||||
|
* @return Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public int getImageHeight() {
|
||||||
|
return picture.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Funktion background() setzt die Farbe, die für den Hintergrund des Bildes verwendet wird. Der Standardhintergrund ist hellgrau.
|
||||||
|
* Es ist nicht möglich, den Alpha-Parameter Transparenz mit Hintergrundfarben auf der Hauptzeichnungsoberfläche zu verwenden.
|
||||||
|
* @param c Farbe für den Hintergrund (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void background(int c) {
|
||||||
|
picture.background(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Funktion background() setzt die Farbe, die für den Hintergrund des Bildes verwendet wird. Der Standardhintergrund ist hellgrau.
|
||||||
|
* Es ist nicht möglich, den Alpha-Parameter Transparenz mit Hintergrundfarben auf der Hauptzeichnungsoberfläche zu verwenden.
|
||||||
|
* @param r Rotanteil (0-255) der Hintergrundfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Hintergrundfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Hintergrundfarbe
|
||||||
|
*/
|
||||||
|
public void background(int r, int g, int b) {
|
||||||
|
picture.background(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet eine Linie (einen direkten Weg zwischen zwei Punkten) auf den Bildschirm.
|
||||||
|
* Um eine Linie einzufärben, verwenden Sie die {@link #stroke(int, int, int) stroke()} Funktion. Eine Zeile kann nicht gefüllt werden, daher hat die Funktion fill() keinen
|
||||||
|
* Einfluss auf die Farbe einer Zeile. Linien werden standardmäßig mit einer Breite von einem Pixel gezeichnet, dies kann jedoch mit der Funktion
|
||||||
|
* {@link #strokeWeight(double) strokeWeight()} geändert werden.
|
||||||
|
* @param x1 x-Koordinate des 1. Punktes
|
||||||
|
* @param y1 y-Koordinate des 1. Punktes
|
||||||
|
* @param x2 x-Koordinate des 2. Punktes
|
||||||
|
* @param y2 y-Koordinate des 2. Punktes
|
||||||
|
*/
|
||||||
|
public void line(int x1, int y1, int x2, int y2) {
|
||||||
|
picture.line(x1,y1,x2,y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Rechteck auf das Bild.
|
||||||
|
* Standardmäßig legen die ersten beiden Parameter die Position der linken oberen Ecke fest, der dritte die Breite und der vierte die Höhe.
|
||||||
|
* Die Art und Weise, wie diese Parameter interpretiert werden, kann jedoch mit der Funktion {@link #rectMode(int) rectMode()} geändert werden.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param a meist die x-Koordinate der linken oberen Ecke (kann durch rectMode() geändert werden).
|
||||||
|
* @param b meist die y-Koordinate der linken oberen Ecke (kann durch rectMode() geändert werden).
|
||||||
|
* @param c meist die Breite des Rechtecks (kann durch rectMode() geändert werden).
|
||||||
|
* @param d meist die Höhe des Rechtecks (kann durch rectMode() geändert werden).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void rect(int a, int b, int c, int d) {
|
||||||
|
picture.rect(a,b,c,d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet eine Ellipse/Kreis auf das Bild.
|
||||||
|
* Standardmäßig legen die ersten beiden Parameter die Position des Mittelpunkts fest, der dritte die Breite und der vierte die Höhe.
|
||||||
|
* Die Art und Weise, wie diese Parameter interpretiert werden, kann jedoch mit der Funktion {@link #ellipseMode(int) ellipseMode()} geändert werden.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param a meist die x-Koordinate des Mittelpunkts (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param b meist die y-Koordinate des Mittelpunkts (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param c meist die Breite des Rechtecks (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param d meist die Höhe des Rechtecks (kann durch ellipseMode() geändert werden).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void ellipse(int a, int b, int c, int d) {
|
||||||
|
picture.ellipse(a,b,c,d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Dreieck auf das Bild.
|
||||||
|
* Ein Dreieck ist eine Ebene, die durch die Verbindung von drei Punkten entsteht. Die ersten beiden Argumente spezifizieren den
|
||||||
|
* ersten Punkt, die mittleren beiden Argumente spezifizieren den zweiten Punkt und die letzten beiden Argumente spezifizieren den dritten Punkt.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x1 meist die x-Koordinate des 1. Punkts.
|
||||||
|
* @param y1 meist die y-Koordinate des 1. Punkts.
|
||||||
|
* @param x2 meist die x-Koordinate des 2. Punkts.
|
||||||
|
* @param y2 meist die y-Koordinate des 2. Punkts.
|
||||||
|
* @param x3 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y3 meist die y-Koordinate des 3. Punkts.
|
||||||
|
*/
|
||||||
|
public void triangle(int x1, int y1, int x2, int y2, int x3, int y3) {
|
||||||
|
picture.triangle(x1,y1,x2,y2,x3,y3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Viereck auf das Bild.
|
||||||
|
* Ein Viereck ist ein vierseitiges Polygon. Es ist ähnlich wie ein Rechteck, aber die Winkel zwischen seinen Kanten
|
||||||
|
* sind nicht auf neunzig Grad beschränkt. Das erste Paar von Parametern (x1,y1) setzt den ersten Scheitelpunkt und die nachfolgenden
|
||||||
|
* Paare sollten im Uhrzeigersinn oder gegen den Uhrzeigersinn um die definierte Form herum verlaufen.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x1 meist die x-Koordinate des 1. Punkts.
|
||||||
|
* @param y1 meist die y-Koordinate des 1. Punkts.
|
||||||
|
* @param x2 meist die x-Koordinate des 2. Punkts.
|
||||||
|
* @param y2 meist die y-Koordinate des 2. Punkts.
|
||||||
|
* @param x3 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y3 meist die y-Koordinate des 3. Punkts.
|
||||||
|
* @param x4 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y4 meist die y-Koordinate des 3. Punkts.
|
||||||
|
*/
|
||||||
|
public void quad(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
|
||||||
|
picture.quad(x1,y1,x2,y2,x3,y3,x4,y4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Polygon auf das Bild.
|
||||||
|
* Gleich lange Listen von x und y-Koordinaten bestimmen die Eckpunkte des Polygons.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x Liste der x-Koordinaten der Punkte.
|
||||||
|
* @param y Liste der y-Koordinaten der Punkte.
|
||||||
|
*/
|
||||||
|
public void polygon(int[] x, int[] y) {
|
||||||
|
picture.polygon(x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet einen Punkt, d.h. einen Kreis in der Dimension eines Pixels.
|
||||||
|
* Der erste Parameter ist der x-Wert für den Punkt, der zweite Wert ist der y-Wert für den Punkt.
|
||||||
|
* @param x x-Koordinate des Punktes
|
||||||
|
* @param y y-Koordinate des Punktes
|
||||||
|
*/
|
||||||
|
public void point(int x, int y) {
|
||||||
|
picture.point(x,y);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ändert den Koordinaten-Modus beim Zeichnen von Rechtecken.
|
||||||
|
* Ändert die Position, von der aus Rechtecke gezeichnet werden, indem es die Art und Weise ändert, wie Parameter, die an rect() übergeben werden, interpretiert werden.
|
||||||
|
* Der Standardmodus ist rectMode(Bild.CORNER), der die ersten beiden Parameter von rect() als die linke obere Ecke der Form interpretiert,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* rectMode(Bild.CORNERS) interpretiert die ersten beiden Parameter von rect() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als die Position der gegenüberliegenden Ecke.
|
||||||
|
* rectMode(Bild.CENTER) interpretiert die ersten beiden Parameter von rect() als Mittelpunkt der Form,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* rectMode(RADIUS) verwendet auch die ersten beiden Parameter von rect() als Mittelpunkt der Form,
|
||||||
|
* verwendet aber den dritten und vierten Parameter, um die Hälfte der Breite und Höhe der Formen festzulegen.
|
||||||
|
* @param mode Modus der Koordinateninterpretation (CORNER, CORNERS, CENTER oder RADIUS)
|
||||||
|
*/
|
||||||
|
public void rectMode(int mode) {
|
||||||
|
picture.rectMode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ändert den Koordinaten-Modus beim Zeichnen von Kreisen/Ellipsen.
|
||||||
|
* Ändert die Position, von der aus Kreise/Ellipsen gezeichnet werden, indem es die Art und Weise ändert, wie Parameter, die an ellipse() übergeben werden, interpretiert werden.
|
||||||
|
* Der Standardmodus ist ellipseMode(Bild.CENTER), der die ersten beiden Parameter von ellipse() als Mittelpunkt der Form interpretiert,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* ellipseMode(Bild.CORNER) interpretiert die ersten beiden Parameter von ellipse() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als Breite und Höhe der Form.
|
||||||
|
* ellipseMode(Bild.CORNERS) interpretiert die ersten beiden Parameter von ellipse() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als die Position der gegenüberliegenden Ecke.
|
||||||
|
* ellipseMode(RADIUS) verwendet auch die ersten beiden Parameter von ellipse() als Mittelpunkt der Form,
|
||||||
|
* verwendet aber den dritten und vierten Parameter, um die Hälfte der Breite und Höhe der Formen festzulegen.
|
||||||
|
* @param mode Modus der Koordinateninterpretation (CORNER, CORNERS, CENTER oder RADIUS)
|
||||||
|
*/
|
||||||
|
public void ellipseMode(int mode) {
|
||||||
|
picture.ellipseMode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird hexadezimal in Form der RGB angegeben: z.B. "CCFFAA" oder "004E23". Die Syntax verwendet sechs Ziffern - je zwei für die roten, grünen und blauen Komponenten,
|
||||||
|
* um eine Farbe anzugeben (genau wie Farben typischerweise in HTML und CSS angegeben werden).
|
||||||
|
* @param pencolor Stiftfarbe in Hexadezimaldarstellung
|
||||||
|
*/
|
||||||
|
public void stroke(String pencolor) {
|
||||||
|
picture.stroke(pencolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird entweder als Graustufe (0-255) oder als 3-Byte RGB-Wert angegeben
|
||||||
|
* @param pencolor Stiftfarbe (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void stroke(int pencolor) {
|
||||||
|
picture.stroke(pencolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird komponentenweise als RGB-Wert angegeben
|
||||||
|
* @param r Rotanteil (0-255) der Stiftfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Stiftfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Stiftfarbe
|
||||||
|
*/
|
||||||
|
public void stroke(int r, int g, int b) {
|
||||||
|
picture.stroke(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt fest, dass keine Linien oder Ränder um Formen gezeichnet werden soll.
|
||||||
|
*/
|
||||||
|
public void noStroke() {
|
||||||
|
picture.noStroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Breite des Strichs für Linien, Punkte und den Rand um Formen fest.
|
||||||
|
* Alle Breiten werden in Pixeleinheiten angegeben.
|
||||||
|
* @param width Breite in Pixel
|
||||||
|
*/
|
||||||
|
public void strokeWeight(double width) {
|
||||||
|
picture.strokeWeight(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird hexadezimal in Form der RGB angegeben: z.B. "CCFFAA" oder "004E23". Die Syntax verwendet sechs Ziffern - je zwei für die roten, grünen und blauen Komponenten,
|
||||||
|
* um eine Farbe anzugeben (genau wie Farben typischerweise in HTML und CSS angegeben werden).
|
||||||
|
* @param fillcolor Füllfarbe in Hexadezimaldarstellung
|
||||||
|
*/
|
||||||
|
public void fill(String fillcolor) {
|
||||||
|
picture.fill(fillcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird entweder als Graustufe (0-255) oder als 3-Byte RGB-Wert angegeben.
|
||||||
|
* @param fillcolor Füllfarbe (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void fill(int fillcolor) {
|
||||||
|
picture.fill(fillcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird komponentenweise als RGB-Wert angegeben.
|
||||||
|
* @param r Rotanteil (0-255) der Füllfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Füllfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Füllfarbe
|
||||||
|
*/
|
||||||
|
public void fill(int r, int g, int b) {
|
||||||
|
picture.fill(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Legt fest, dass die Formen nicht gefüllt werden sollen.
|
||||||
|
*/
|
||||||
|
public void noFill() {
|
||||||
|
picture.noFill();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht den Inhalt des Bildes.
|
||||||
|
* Der Hintergrund wird mit der Hintergrundfarbe neu gefüllt.
|
||||||
|
*/
|
||||||
|
public void clear(){
|
||||||
|
picture.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lädt ein Bild aus dem Dateisystem.
|
||||||
|
* Lädt ein Bild von einem Datenträger und setzt Stiftfarbe und Füllfarbe auf Standardwerte zurück.
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public void load(String filename) {
|
||||||
|
picture.load(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert ein Bild.
|
||||||
|
* Speichert ein Bild auf einem Datenträger. Zulässig sind die Dateiformate PNG und GIF. Die Dateiendung legt den Typ fest.
|
||||||
|
* Standardmäßig wird die Dateiendung .png ergänzt, wenn keine angegeben ist.
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public void save(String filename) {
|
||||||
|
picture.save(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt einen Text an den gegebenen Koordinaten aus
|
||||||
|
* Zur Ausgabe des Textes wird der ausgewählte Font verwendet. Dieser muss vorher mit {@link #textFont(Font) textFont() } festgelegt.
|
||||||
|
* @param t Text, der angezeigt werden soll
|
||||||
|
* @param x x-Koordinate des Textanfangs
|
||||||
|
* @param y y-Koordinate der Grundlinie des Textes.
|
||||||
|
*/
|
||||||
|
public void text(String t, int x, int y) {
|
||||||
|
picture.text(t,x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Schriftart für Textausgaben fest.
|
||||||
|
* Jeder übliche Java-Font kann verwendet werden. Er kann mit z.B. Font f = new Font( "Arial", Font.PLAIN, 14 ); definiert werden.
|
||||||
|
* @param font ein Font-Objekt
|
||||||
|
*/
|
||||||
|
public void textFont(Font font) {
|
||||||
|
picture.textFont(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert das Bild als zweidimensionales Pixel-Array.
|
||||||
|
* @return zweidimensionales Array von Color-Objekten, die den Pixeln des Bildes entsprechen.
|
||||||
|
*/
|
||||||
|
public Color[][] getPixelArray() {
|
||||||
|
return picture.getPixelArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt das Bild neu auf Basis des Pixel-Arrays.
|
||||||
|
* Die Größe des Bildes wird nicht automatisch an das Array angepasst.
|
||||||
|
* @param pixel zweidimensionales Array von Color-Objekten
|
||||||
|
*/
|
||||||
|
public void setPixelArray(Color[][] pixel) {
|
||||||
|
picture.setPixelArray(pixel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,894 @@
|
||||||
|
/**
|
||||||
|
* Die Klasse Table vereinfacht den Zugriff auf CSV-Dateien.
|
||||||
|
* Die Klassen Table und TableRow ermöglichen einen einfachen Zugriff auf tabellenbasierte
|
||||||
|
* Dokumente.
|
||||||
|
*
|
||||||
|
* @author Thomas Schaller
|
||||||
|
* @version 1.0 vom 01.02.2019
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.jdom.Document;
|
||||||
|
import org.jdom.Element;
|
||||||
|
import org.jdom.Attribute;
|
||||||
|
import org.jdom.JDOMException;
|
||||||
|
import org.jdom.input.SAXBuilder;
|
||||||
|
import org.jdom.output.XMLOutputter;
|
||||||
|
import org.jdom.output.Format;
|
||||||
|
|
||||||
|
public class Table
|
||||||
|
{
|
||||||
|
// Standardtrennzeichen für Spalten
|
||||||
|
private static final char DEFAULT_SEPARATOR = ';';
|
||||||
|
// Standardmarkierung für Texte
|
||||||
|
private static final char DEFAULT_QUOTE = '"';
|
||||||
|
// Standardtrennzeichen für Dezimalzahlen
|
||||||
|
private static final char DEFAULT_COMMA = ',';
|
||||||
|
|
||||||
|
// mögliche Spaltentypen
|
||||||
|
private static final String UNKNOWN ="UNKOWN";
|
||||||
|
private static final String INT = "INTEGER";
|
||||||
|
private static final String DOUBLE = "DOUBLE";
|
||||||
|
private static final String FLOAT = "FLOAT";
|
||||||
|
|
||||||
|
// interne Verwaltung des Dokuments als JDOM-Document-Objekt
|
||||||
|
private Document doc;
|
||||||
|
// Verweis auf Element für Kopfzeile
|
||||||
|
private Element header;
|
||||||
|
// Ende Attribute
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt leeres Tabellen-Dokument.
|
||||||
|
*/
|
||||||
|
public Table() {
|
||||||
|
this.doc = new Document();
|
||||||
|
doc.setRootElement(new Element("CSV-Data"));
|
||||||
|
this.header = new Element("Header");
|
||||||
|
doc.getRootElement().addContent(header);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt Tabellen-Dokument aus einer CSV-Datei.
|
||||||
|
* Liest den Inhalt einer Datei und erstellt ein Tabellenobjekt mit seinen Werten.
|
||||||
|
* Wenn die Datei eine Kopfzeile enthält, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile hat,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile enthält.
|
||||||
|
* @param separator Trennzeichen für Spalten (meist ';' oder ',' oder '\t' für Tab)
|
||||||
|
* @param quote Kennung für Texte (meist '"').
|
||||||
|
*/
|
||||||
|
public Table(String filename, String options, char separator, char quote) {
|
||||||
|
loadCSV(filename, options, separator, quote);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt Tabellen-Dokument aus einer CSV-Datei.
|
||||||
|
* Liest den Inhalt einer Datei und erstellt ein Tabellenobjekt mit seinen Werten (Separator = ';', Kennung für Text = '"').
|
||||||
|
* Wenn die Datei eine Kopfzeile enthält, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile hat,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile enthält.
|
||||||
|
*/
|
||||||
|
public Table(String filename, String options) {
|
||||||
|
loadCSV(filename, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt Tabellen-Dokument aus einer CSV-Datei.
|
||||||
|
* Liest den Inhalt einer Datei ohne Kopfzeile und erstellt ein Tabellenobjekt mit seinen Werten (Separator = ';', Kennung für Text = '"').
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
*/
|
||||||
|
public Table(String filename) {
|
||||||
|
loadCSV(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Anfang Methoden
|
||||||
|
/**
|
||||||
|
* Liest den Inhalt einer CSV-Datei ohne Kopfzeile (Separator = ';', Kennung für Text = '"').
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
*/
|
||||||
|
public void loadCSV(String filename) {
|
||||||
|
loadCSV(filename, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liest den Inhalt einer CSV-Datei (Separator = ';', Kennung für Text = '"').
|
||||||
|
* Wenn die Datei eine Kopfzeile enthält, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile hat,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile enthält.
|
||||||
|
*/
|
||||||
|
public void loadCSV(String filename, String options) {
|
||||||
|
loadCSV(filename, options, DEFAULT_SEPARATOR, DEFAULT_QUOTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liest den Inhalt einer CSV-Datei.
|
||||||
|
* Wenn die Datei eine Kopfzeile enthält, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile hat,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile enthält.
|
||||||
|
* @param separator Trennzeichen für Spalten (meist ';' oder ',' oder '\t' für Tab)
|
||||||
|
* @param quote Kennung für Texte (meist '"').
|
||||||
|
*/
|
||||||
|
public void loadCSV(String filename, String options, char separator, char quote) {
|
||||||
|
doc = new Document();
|
||||||
|
doc.setRootElement(new Element("CSV-Data"));
|
||||||
|
header = new Element("Header");
|
||||||
|
doc.getRootElement().addContent(header);
|
||||||
|
try {
|
||||||
|
File f = new File(filename);
|
||||||
|
Scanner scanner = new Scanner(new File(filename));
|
||||||
|
if(options.toLowerCase().contains("header") && scanner.hasNext()) {
|
||||||
|
List<String> entries = parseLine(scanner.nextLine(), separator, quote);
|
||||||
|
int i= 0;
|
||||||
|
for(String s : entries) {
|
||||||
|
Element entry = new Element("Column");
|
||||||
|
header.addContent(entry);
|
||||||
|
entry.setText(s);
|
||||||
|
entry.setAttribute("type", "unknown");
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Element> cols = header.getChildren();
|
||||||
|
|
||||||
|
while (scanner.hasNext()) {
|
||||||
|
Element line = new Element("Row");
|
||||||
|
doc.getRootElement().addContent(line);
|
||||||
|
List<String> entries = parseLine(scanner.nextLine(), separator, quote);
|
||||||
|
int i= 0;
|
||||||
|
|
||||||
|
for(String s : entries) {
|
||||||
|
|
||||||
|
if(i==cols.size()) {
|
||||||
|
Element entry = new Element("Column");
|
||||||
|
entry.setAttribute("type", "unknown");
|
||||||
|
header.addContent(entry);
|
||||||
|
cols = header.getChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
Element entry = new Element("Entry");
|
||||||
|
entry.setText(s);
|
||||||
|
line.addContent(entry);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scanner.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Fehler beim Lesen der CSV-Datei");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert das aktuelle Dokument als CSV-Datei ohne Kopfzeile (Separator = ';', Kennung für Text = '"').
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
*/
|
||||||
|
public void saveCSV(String filename) {
|
||||||
|
saveCSV(filename, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert das aktuelle Dokument als CSV-Datei (Separator = ';', Kennung für Text = '"').
|
||||||
|
* Wenn die Datei eine Kopfzeile enthalten, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile haben soll,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile haben soll.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
*/
|
||||||
|
public void saveCSV(String filename, String options) {
|
||||||
|
saveCSV(filename, options, DEFAULT_SEPARATOR, DEFAULT_QUOTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert das aktuelle Dokument als CSV-Datei.
|
||||||
|
* Wenn die Datei eine Kopfzeile enthalten, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile haben soll,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile haben soll.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param separator Trennzeichen für Spalten (meist ';' oder ',' oder '\t' für Tab)
|
||||||
|
* @param quote Kennung für Texte (meist '"').
|
||||||
|
*/
|
||||||
|
public void saveCSV(String filename, String options, char separator, char quote){
|
||||||
|
try{
|
||||||
|
File f = new File(filename);
|
||||||
|
PrintStream outputFile = new PrintStream (f);
|
||||||
|
System.out.println("Speicher in : "+f.getAbsolutePath());
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
String sq = ""+quote;
|
||||||
|
String ss = ""+separator;
|
||||||
|
if(quote =='"') sq = "\"";
|
||||||
|
if(separator =='"') ss = "\"";
|
||||||
|
|
||||||
|
if(options.toLowerCase().contains("header")) {
|
||||||
|
String h = "";
|
||||||
|
for(Element c : columns) {
|
||||||
|
h += ss + sq + c.getText()+sq;
|
||||||
|
}
|
||||||
|
outputFile.println(h.substring(1));
|
||||||
|
}
|
||||||
|
for(int i = 0; i<getRowCount(); i++) {
|
||||||
|
String l = "";
|
||||||
|
for(String s: getStringRow(i)) {
|
||||||
|
|
||||||
|
if(s.contains(""+separator)) {
|
||||||
|
if(quote == '"' && s.contains("\"")) {
|
||||||
|
s = s.replace("\"","\"\"");
|
||||||
|
}
|
||||||
|
l += ss + sq + s+sq;
|
||||||
|
} else {
|
||||||
|
l += ss+s;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
outputFile.println(l.substring(1));
|
||||||
|
}
|
||||||
|
outputFile.close();
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
System.out.println("Fehler beim Schreiben der Datei");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Speichert die Tabelle als XML-Dokument.
|
||||||
|
* @param filename Dateiname des XML-Files
|
||||||
|
*/
|
||||||
|
public void saveXML(String filename) {
|
||||||
|
try {
|
||||||
|
// new XMLOutputter().output(doc, System.out);
|
||||||
|
XMLOutputter xmlOutput = new XMLOutputter();
|
||||||
|
|
||||||
|
// display nice nice
|
||||||
|
xmlOutput.setFormat(Format.getPrettyFormat());
|
||||||
|
File f = new File(filename);
|
||||||
|
FileOutputStream outputFile = new FileOutputStream(f);
|
||||||
|
System.out.println("Speicher in : "+f.getAbsolutePath() );
|
||||||
|
xmlOutput.output(doc, outputFile);
|
||||||
|
outputFile.close();
|
||||||
|
System.out.println("File Saved!");
|
||||||
|
} catch (IOException io) {
|
||||||
|
System.out.println(io.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------- Zeigerbewegungen --------------------------------------------------
|
||||||
|
|
||||||
|
/** HIlfsfunktion für die Analyse einer Dateizeile
|
||||||
|
* @param cvsLine Zeile aus der Datei
|
||||||
|
* @return Liste von String für die einzelnen Spalten
|
||||||
|
*/
|
||||||
|
private List<String> parseLine(String cvsLine) {
|
||||||
|
return parseLine(cvsLine, DEFAULT_SEPARATOR, DEFAULT_QUOTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** HIlfsfunktion für die Analyse einer Dateizeile
|
||||||
|
* @param cvsLine Zeile aus der Datei
|
||||||
|
* @param sparator Trennzeichen für die Spalten
|
||||||
|
* @return Liste von String für die einzelnen Spalten
|
||||||
|
*/
|
||||||
|
private List<String> parseLine(String cvsLine, char separator) {
|
||||||
|
return parseLine(cvsLine, separator, DEFAULT_QUOTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** HIlfsfunktion für die Analyse einer Dateizeile
|
||||||
|
* @param cvsLine Zeile aus der Datei
|
||||||
|
* @param sparator Trennzeichen für die Spalten
|
||||||
|
* @param customQuote Kennung für Strings
|
||||||
|
* @return Liste von String für die einzelnen Spalten
|
||||||
|
*/
|
||||||
|
private List<String> parseLine(String cvsLine, char separator, char customQuote) {
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
|
||||||
|
//if empty, return!
|
||||||
|
if (cvsLine == null && cvsLine.isEmpty()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ggf. Default-Value laden
|
||||||
|
if (customQuote == ' ') {
|
||||||
|
customQuote = DEFAULT_QUOTE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (separator == ' ') {
|
||||||
|
separator = DEFAULT_SEPARATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer curVal = new StringBuffer();
|
||||||
|
boolean inQuotes = false;
|
||||||
|
boolean startCollectChar = false;
|
||||||
|
boolean doubleQuotesInColumn = false;
|
||||||
|
|
||||||
|
char[] chars = cvsLine.toCharArray();
|
||||||
|
|
||||||
|
for (char ch : chars) {
|
||||||
|
|
||||||
|
if (inQuotes) { // aktueller Text ist in Quotes eingeschlossen
|
||||||
|
startCollectChar = true;
|
||||||
|
|
||||||
|
if (ch == customQuote) { // Quotes werden beendet, aber Achtung bei "" => Metazeichen
|
||||||
|
inQuotes = false;
|
||||||
|
if (ch == '\"') {
|
||||||
|
doubleQuotesInColumn = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (ch == '\"' && !doubleQuotesInColumn) {
|
||||||
|
doubleQuotesInColumn = true;
|
||||||
|
} else {
|
||||||
|
curVal.append(ch);
|
||||||
|
doubleQuotesInColumn = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ch == customQuote) {
|
||||||
|
|
||||||
|
inQuotes = true;
|
||||||
|
|
||||||
|
//Fixed : allow "" in empty quote enclosed
|
||||||
|
if (ch == '\"'){
|
||||||
|
if(doubleQuotesInColumn) {
|
||||||
|
curVal.append('"');
|
||||||
|
doubleQuotesInColumn = false;
|
||||||
|
} else doubleQuotesInColumn = true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
doubleQuotesInColumn = false;
|
||||||
|
if (ch == separator) {
|
||||||
|
|
||||||
|
result.add(curVal.toString());
|
||||||
|
|
||||||
|
curVal = new StringBuffer();
|
||||||
|
startCollectChar = false;
|
||||||
|
|
||||||
|
} else if (ch == '\r') {
|
||||||
|
//ignore LF characters
|
||||||
|
continue;
|
||||||
|
} else if (ch == '\n') {
|
||||||
|
//the end, break!
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
curVal.append(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
result.add(curVal.toString());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sucht die Nummer einer durch Namen gegebenen Spalte.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Nummer der Spalte
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int findColumnNumber(String name) {
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
int i = 0;
|
||||||
|
for(Element c : columns) {
|
||||||
|
if (c.getText().toLowerCase().equals(name.toLowerCase())) {
|
||||||
|
return i;
|
||||||
|
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine neue Spalte am Ende der Tabelle an.
|
||||||
|
*/
|
||||||
|
public void addColumn() {
|
||||||
|
Element entry = new Element("Column");
|
||||||
|
entry.setAttribute("type", Table.UNKNOWN);
|
||||||
|
header.addContent(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine neue Spalte am Ende der Tabelle an und benennt sie.
|
||||||
|
* @param title Bezeichnung der Spalte
|
||||||
|
*/
|
||||||
|
public void addColumn(String title) {
|
||||||
|
addColumn();
|
||||||
|
Element nc = ((List<Element>)(header.getChildren())).get(header.getChildren().size()-1);
|
||||||
|
nc.setText(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine neue Spalte am Ende der Tabelle an und benennt und typisiert sie.
|
||||||
|
* @param title Bezeichnung der Spalte
|
||||||
|
* @param type Typ der Spalte (UNKNOWN, DOUBLE, INTEGER, FLOAT)
|
||||||
|
*/
|
||||||
|
public void addColumn(String title, String type) {
|
||||||
|
addColumn(title);
|
||||||
|
Element nc = ((List<Element>)(header.getChildren())).get(header.getChildren().size()-1);
|
||||||
|
nc.setAttribute("type", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht eine Spalte.
|
||||||
|
* @param i Nummer der Spalte.
|
||||||
|
*/
|
||||||
|
public void removeColumn(int i) {
|
||||||
|
List<Element> lines = doc.getRootElement().getChildren();
|
||||||
|
for(Element l : lines) {
|
||||||
|
if(l.getChildren().size()>i) l.removeContent(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht eine Spalte
|
||||||
|
* @param name Name der Spalte
|
||||||
|
*/
|
||||||
|
public void removeColumn(String name) {
|
||||||
|
try{
|
||||||
|
removeColumn(findColumnNumber(name));
|
||||||
|
} catch(Exception e) { System.out.println("Unbekannter Spaltenname");}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Anzahl der Spalten in der Tabelle
|
||||||
|
* @return Anzahl der Spalten
|
||||||
|
*/
|
||||||
|
public int getColumnCount() {
|
||||||
|
return header.getChildren().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Anzahl der Zeilen in der Tabelle
|
||||||
|
* @return Anzahl der Zeilen
|
||||||
|
*/
|
||||||
|
public int getRowCount() {
|
||||||
|
return doc.getRootElement().getChildren().size()-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht alle Zeilen der Tabelle.
|
||||||
|
* Die Spaltenüberschriften und Typen bleiben erhalten.
|
||||||
|
*/
|
||||||
|
public void clearRows() {
|
||||||
|
doc.getRootElement().removeChildren("Row");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine neue Zeile an das Ende der Tabelle an.
|
||||||
|
* @return ein TableRow-Objekt für diese neue Zeile
|
||||||
|
*/
|
||||||
|
public TableRow addRow() {
|
||||||
|
Element row = new Element("Row");
|
||||||
|
doc.getRootElement().addContent(row);
|
||||||
|
return new TableRow(doc, row);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht eine Zeile
|
||||||
|
* @param i Nummer der Zeile
|
||||||
|
*/
|
||||||
|
public void removeRow(int i) {
|
||||||
|
if(i<getRowCount()) {
|
||||||
|
doc.getRootElement().removeContent(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert eine Zeile der Tabelle
|
||||||
|
* @param i Nummer der Zeile
|
||||||
|
* @return TableRow-Objekt für diese Zeile
|
||||||
|
*/
|
||||||
|
public TableRow getRow(int i) {
|
||||||
|
if(i<getRowCount()) {
|
||||||
|
List<Element> rows = doc.getRootElement().getChildren();
|
||||||
|
return new TableRow(doc, rows.get(i+1));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die ganze Tabelle als Array von TableRow-Objekten
|
||||||
|
* @return Array von TableRow-Objekten
|
||||||
|
*/
|
||||||
|
public TableRow[] rows() {
|
||||||
|
TableRow[] rows = new TableRow[getRowCount()];
|
||||||
|
for(int i = 0; i < getRowCount(); i++) {
|
||||||
|
rows[i] = getRow(i);
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Integer-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public int getInt(int row, int column) {
|
||||||
|
return getRow(row).getInt(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Integer-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public int getInt(int row, String name) {
|
||||||
|
return getRow(row).getInt(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Integer-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setInt(int row, int column,int value) {
|
||||||
|
getRow(row).setInt(column, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Integer-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setInt(int row, String name, int value) {
|
||||||
|
getRow(row).setInt(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Zeile als Integer-Array.
|
||||||
|
* @param row Nummer der Zeile
|
||||||
|
* @return int-Array, dass alle Werte der Zeile enthält
|
||||||
|
*/
|
||||||
|
public int[] getIntRow(int row) {
|
||||||
|
try{
|
||||||
|
TableRow trow = getRow(row);
|
||||||
|
int anz = getColumnCount();
|
||||||
|
int[] r = new int[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = trow.getInt(i);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Integer-Array.
|
||||||
|
* @param column Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public int[] getIntColumn(int column) {
|
||||||
|
try{
|
||||||
|
int anz = getRowCount();
|
||||||
|
int[] r = new int[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = getInt(i, column);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Integer-Array.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public int[] getIntColumn(String name) {
|
||||||
|
return getIntColumn(findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public float getFloat(int row, int column) {
|
||||||
|
return getRow(row).getFloat(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public float getFloat(int row, String name) {
|
||||||
|
return getRow(row).getFloat(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setFloat(int row, int column,float value) {
|
||||||
|
getRow(row).setFloat(column, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setFloat(int row, String name, float value) {
|
||||||
|
getRow(row).setFloat(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Zeile als Float-Array.
|
||||||
|
* @param row Nummer der Zeile
|
||||||
|
* @return int-Array, dass alle Werte der Zeile enthält
|
||||||
|
*/
|
||||||
|
public float[] getFloatRow(int row) {
|
||||||
|
try{
|
||||||
|
TableRow trow = getRow(row);
|
||||||
|
int anz = getColumnCount();
|
||||||
|
float[] r = new float[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = trow.getFloat(i);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Float-Array.
|
||||||
|
* @param column Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public float[] getFloatColumn(int column) {
|
||||||
|
try{
|
||||||
|
int anz = getRowCount();
|
||||||
|
float[] r = new float[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = getFloat(i, column);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Float-Array.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public float[] getFloatColumn(String name) {
|
||||||
|
return getFloatColumn(findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public double getDouble(int row, int column) {
|
||||||
|
return getRow(row).getDouble(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public double getDouble(int row, String name) {
|
||||||
|
return getRow(row).getDouble(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setDouble(int row, int column,double value) {
|
||||||
|
getRow(row).setDouble(column, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setDouble(int row, String name, double value) {
|
||||||
|
getRow(row).setDouble(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Double-Array.
|
||||||
|
* @param row Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public double[] getDoubleRow(int row) {
|
||||||
|
try{
|
||||||
|
TableRow trow = getRow(row);
|
||||||
|
int anz = getColumnCount();
|
||||||
|
double[] r = new double[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = trow.getDouble(i);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Double-Array.
|
||||||
|
* @param column Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public double[] getDoubleColumn(int column) {
|
||||||
|
try{
|
||||||
|
int anz = getRowCount();
|
||||||
|
double[] r = new double[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = getDouble(i, column);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Double-Array.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public double[] getDoubleColumn(String name) {
|
||||||
|
return getDoubleColumn(findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als String
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public String getString(int row, int column) {
|
||||||
|
return getRow(row).getString(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als String
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public String getString(int row, String name) {
|
||||||
|
return getRow(row).getString(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als String
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @param text neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setString(int row, int column,String text) {
|
||||||
|
getRow(row).setString(column, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als String
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param text neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setString(int row, String name, String text) {
|
||||||
|
getRow(row).setString(name, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als String-Array.
|
||||||
|
* @param row Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public String[] getStringRow(int row) {
|
||||||
|
try{
|
||||||
|
TableRow trow = getRow(row);
|
||||||
|
int anz = getColumnCount();
|
||||||
|
String[] r = new String[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = trow.getString(i);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als String-Array.
|
||||||
|
* @param column Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public String[] getStringColumn(int column) {
|
||||||
|
try{
|
||||||
|
int anz = getRowCount();
|
||||||
|
String[] r = new String[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = getString(i, column);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als String-Array.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public String[] getStringColumn(String name) {
|
||||||
|
return getStringColumn(findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sucht nach einem bestimmtem Wert in einer Zeile.
|
||||||
|
* @param value Wert der gesucht werden soll
|
||||||
|
* @param column Nummer der Spalte, die durchsucht werden soll
|
||||||
|
* @return TableRow-Objekt der Zeile, wenn der Wert gefunden wurde, sonst null
|
||||||
|
*/
|
||||||
|
public TableRow findRow(String value, int column) {
|
||||||
|
for(int i=0; i<getRowCount(); i++) {
|
||||||
|
if(getString(i,column).equals(value)){
|
||||||
|
return getRow(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sucht nach einem bestimmtem Wert in einer Zeile.
|
||||||
|
* @param value Wert der gesucht werden soll
|
||||||
|
* @param name Name der Spalte, die durchsucht werden soll
|
||||||
|
* @return TableRow-Objekt der Zeile, wenn der Wert gefunden wurde, sonst null
|
||||||
|
*/
|
||||||
|
public TableRow findRow(String value, String name) {
|
||||||
|
return findRow(value, findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kürzt alle Einträge der Tabelle um unnötige Leerzeichen am Anfang oder Ende
|
||||||
|
*/
|
||||||
|
public void trim() {
|
||||||
|
for(int y=0; y<getRowCount(); y++) {
|
||||||
|
for (int x =0; x<getColumnCount(); x++) {
|
||||||
|
setString(y,x,getString(y,x).trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,312 @@
|
||||||
|
/**
|
||||||
|
* Repräsentiert eine Zeile eines Table-Objekts.
|
||||||
|
* Erlaubt einen einfachen Zugriff auf die einzelnen Einträge in dieser Zeile.
|
||||||
|
*
|
||||||
|
* @author Thomas Schaller
|
||||||
|
* @version V1.0 vom 01.02.2019
|
||||||
|
*/
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.jdom.Document;
|
||||||
|
import org.jdom.Element;
|
||||||
|
import org.jdom.Attribute;
|
||||||
|
import org.jdom.JDOMException;
|
||||||
|
import org.jdom.input.SAXBuilder;
|
||||||
|
import org.jdom.output.XMLOutputter;
|
||||||
|
import org.jdom.output.Format;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
|
||||||
|
public class TableRow
|
||||||
|
{
|
||||||
|
// Verweis auf das ganze Dokument
|
||||||
|
private Document doc;
|
||||||
|
// Verweis auf die Zeile, für die dieses Objekt steht
|
||||||
|
private Element current;
|
||||||
|
// Verweis auf die Kopfzeile
|
||||||
|
private Element header;
|
||||||
|
// Für die Interpretation von Zahlenwerten
|
||||||
|
NumberFormat format = NumberFormat.getInstance();
|
||||||
|
|
||||||
|
// Ende Attribute
|
||||||
|
/**
|
||||||
|
* Erzeugt ein TableRow-Objekt.
|
||||||
|
* Diese Methode ist für den internen Gebraucht. Einige Methode der Table-Klasse erzeugen mit diesem Konstruktor TableRow-Objekte.
|
||||||
|
* @param doc JDOM-Dokument, das für die ganze Tabelle steht.
|
||||||
|
* @param row JDOM-Element, das für die aktuelle Zeile steht.
|
||||||
|
*/
|
||||||
|
public TableRow(Document doc, Element row) {
|
||||||
|
this.doc = doc;
|
||||||
|
this.current = row;
|
||||||
|
this.header = doc.getRootElement().getChild("Header");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Anzahl der Spalten der Zeile.
|
||||||
|
* @return Anzahl der Spalten
|
||||||
|
*/
|
||||||
|
public int getColumnCount() {
|
||||||
|
return header.getChildren().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Titel einer Spalte
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Name der Spalte
|
||||||
|
*/
|
||||||
|
public String getColumnTitle(int i) {
|
||||||
|
if(i< getColumnCount()) {
|
||||||
|
return ((List<Element>) (header.getChildren())).get(i).getText();
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Nummer einer Spalte
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Nummer der Spalte
|
||||||
|
*/
|
||||||
|
public int getColumn(String name) {
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
int i = 0;
|
||||||
|
while (i < columns.size()) {
|
||||||
|
if (columns.get(i).getText().toLowerCase().equals(name.toLowerCase())) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
} // end of while
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt eine neue Zeile mit i Spalten
|
||||||
|
* Wenn bisher nicht genügend Spalten vorhanden sind, werden automatisch neue Spalten hinzugefügt (auch zum Header)
|
||||||
|
* @param i Anzahl der Spalten
|
||||||
|
*/
|
||||||
|
private Element buildRow(int i) {
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
Element entry=null;
|
||||||
|
for(int j=0; j<=i; j++) {
|
||||||
|
|
||||||
|
if(j==columns.size()) {
|
||||||
|
Element h = new Element("Column");
|
||||||
|
h.setAttribute("type", "unknown");
|
||||||
|
header.addContent(h);
|
||||||
|
columns = header.getChildren();
|
||||||
|
}
|
||||||
|
if(j==current.getChildren().size()) {
|
||||||
|
entry = new Element("Entry");
|
||||||
|
current.addContent(entry);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt eine neue Zeile.
|
||||||
|
* Es werden genügend Spalten erzeugt, dass ein Wert in Spalte "name" eingetragen werden kann
|
||||||
|
* @param name Name der Spalte
|
||||||
|
*/
|
||||||
|
private Element buildRow(String name) {
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
int i = 0;
|
||||||
|
for(Element c: columns) {
|
||||||
|
|
||||||
|
if(c.getText().toLowerCase().equals(name.toLowerCase())) {
|
||||||
|
return buildRow(i);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als String
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public String getString(int i) {
|
||||||
|
if(i >= current.getContent().size()) return "";
|
||||||
|
Element e = (Element) current.getContent(i) ;
|
||||||
|
if(e!=null) {
|
||||||
|
return e.getText();
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als String
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public String getString(String name) {
|
||||||
|
return getString(getColumn(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als String
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @param text neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setString(int i, String text) {
|
||||||
|
|
||||||
|
Element e = buildRow(i);
|
||||||
|
if(e!=null) e.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als String
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param text neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setString(String name, String text) {
|
||||||
|
Element e = buildRow(name);
|
||||||
|
if(e!=null) e.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Int-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public int getInt(int i) {
|
||||||
|
try{
|
||||||
|
Element e = (Element) current.getContent(i) ;
|
||||||
|
return Integer.parseInt(e.getText());
|
||||||
|
} catch(Exception e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Int-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public int getInt(String name) {
|
||||||
|
return getInt(getColumn(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Int-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setInt(int i,int value) {
|
||||||
|
|
||||||
|
Element e = buildRow(i);
|
||||||
|
if(e!=null) e.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Int-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setInt(String name, int value) {
|
||||||
|
Element e = buildRow(name);
|
||||||
|
if(e!=null) e.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public float getFloat(int i) {
|
||||||
|
try{
|
||||||
|
Element e = (Element) current.getContent(i) ;
|
||||||
|
return Float.parseFloat(e.getText().replace(",","."));
|
||||||
|
} catch(Exception e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public float getFloat(String name) {
|
||||||
|
return getFloat(getColumn(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setFloat(int i,float value) {
|
||||||
|
|
||||||
|
Element e = buildRow(i);
|
||||||
|
if(e!=null) e.setText(format.format(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setFloat(String name, float value) {
|
||||||
|
Element e = buildRow(name);
|
||||||
|
if(e!=null) e.setText(format.format(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public double getDouble(int i) {
|
||||||
|
try{
|
||||||
|
Element e = (Element) current.getContent(i) ;
|
||||||
|
return Double.parseDouble(e.getText().replace(",","."));
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public double getDouble(String name) {
|
||||||
|
return getDouble(getColumn(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setDouble(int i,double value) {
|
||||||
|
|
||||||
|
Element e = buildRow(i);
|
||||||
|
if(e!=null) e.setText(format.format(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setDouble(String name, double value) {
|
||||||
|
Element e = buildRow(name);
|
||||||
|
if(e!=null) e.setText(format.format(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,637 @@
|
||||||
|
/**
|
||||||
|
* Klasse zum Vereinfachten Zugriff auf XML-Dokumente
|
||||||
|
* Diese Klasse ist für den Einsatz in der Schule gedacht und soll den Schülern
|
||||||
|
* einen einfachen Zugriff auf XML-Dokumente ermöglichen. Die zur Verfügung
|
||||||
|
* stehenden Befehle sind wie in Processing realisiert.
|
||||||
|
* Dabei ist jeder Teilbaum des Dokuments wieder als XML-Objekt zugreifbar, das
|
||||||
|
* intern auf die gleiche XML-Dokumentstruktur zugreift.
|
||||||
|
* Dies ermöglicht bei unsachgemäßem Gebrauch die XML-Struktur zu zerstören. Im
|
||||||
|
* normalen Gebrauch sollte dies aber nicht relevant sein.
|
||||||
|
*
|
||||||
|
* Benötigt: jdom-1.1.3.jar
|
||||||
|
|
||||||
|
* @author Thomas Schaller
|
||||||
|
* @version 1.0 vom 31.01.2019
|
||||||
|
*/
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
import org.jdom.Document;
|
||||||
|
import org.jdom.Element;
|
||||||
|
import org.jdom.Attribute;
|
||||||
|
import org.jdom.JDOMException;
|
||||||
|
import org.jdom.input.SAXBuilder;
|
||||||
|
import org.jdom.output.XMLOutputter;
|
||||||
|
import org.jdom.output.Format;
|
||||||
|
|
||||||
|
public class XML {
|
||||||
|
// Anfang Attribute
|
||||||
|
// XML-Dokumentstruktur
|
||||||
|
private Document doc;
|
||||||
|
// Zeiger auf das aktuelle Element
|
||||||
|
private Element current;
|
||||||
|
// Ende Attribute
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein leeres XMLDokument
|
||||||
|
*/
|
||||||
|
public XML() {
|
||||||
|
this.doc = new Document();
|
||||||
|
this.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein XML-Dokument aus einer Datei
|
||||||
|
* @param filename Dateiname der XML-Datei
|
||||||
|
*/
|
||||||
|
public XML(String filename) {
|
||||||
|
loadXML(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interner Konstruktor, um ein XML Objekt zu erzeugen, das auf einen bestimmten Knoten verweist
|
||||||
|
* @param doc die XML-Dokumentstruktur
|
||||||
|
* @param current Zeiger auf das aktuelle Element
|
||||||
|
*/
|
||||||
|
private XML(Document doc, Element current) {
|
||||||
|
this.doc = doc;
|
||||||
|
this.current = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Anfang Methoden
|
||||||
|
/** Öffnet das durch den Dateinamen gegebene Dokument
|
||||||
|
* @param filename Dateiname des XML-Files
|
||||||
|
*/
|
||||||
|
public void loadXML(String filename) {
|
||||||
|
doc = null;
|
||||||
|
File f = new File(filename);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Das Dokument erstellen
|
||||||
|
SAXBuilder builder = new SAXBuilder();
|
||||||
|
doc = builder.build(f);
|
||||||
|
|
||||||
|
} catch (JDOMException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// Zeiger im Baum auf Root-Element
|
||||||
|
current = doc.getRootElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Speichert den XML-Baum im angegebenen Dateinamen
|
||||||
|
* @param filename Dateiname des XML-Files
|
||||||
|
*/
|
||||||
|
public void saveXML(String filename) {
|
||||||
|
try {
|
||||||
|
// new XMLOutputter().output(doc, System.out);
|
||||||
|
XMLOutputter xmlOutput = new XMLOutputter();
|
||||||
|
|
||||||
|
// display nice nice
|
||||||
|
xmlOutput.setFormat(Format.getPrettyFormat());
|
||||||
|
File f = new File(filename);
|
||||||
|
FileOutputStream outputFile = new FileOutputStream(f);
|
||||||
|
System.out.println("Speicher in : "+f.getAbsolutePath() );
|
||||||
|
xmlOutput.output(doc, outputFile);
|
||||||
|
outputFile.close();
|
||||||
|
System.out.println("File Saved!");
|
||||||
|
} catch (IOException io) {
|
||||||
|
System.out.println(io.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------- Zeigerbewegungen --------------------------------------------------
|
||||||
|
/**
|
||||||
|
* liefert ein XML-Objekt, das auf den Vaterknoten des aktuellen Elements zeigt.
|
||||||
|
* @return Vater des aktuellen Objekts.
|
||||||
|
*/
|
||||||
|
public XML getParent() {
|
||||||
|
if(current != null) {
|
||||||
|
Element parent = current.getParentElement();
|
||||||
|
if (parent == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return new XML(doc, parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Überprüft, ob das Element irgendwelche Kinder hat oder nicht, und gibt das Ergebnis als boolean zurück.
|
||||||
|
* @return true, wenn Kinder vorhanden sind, sonst false
|
||||||
|
*/
|
||||||
|
public boolean hasChildren() {
|
||||||
|
if (current == null) {
|
||||||
|
return doc.hasRootElement();
|
||||||
|
} else {
|
||||||
|
return current.getChildren().size()>0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ermittelt die Namen aller Kinder des Elements und gibt die Namen als ein Array von Strings zurück.
|
||||||
|
* Dies ist dasselbe wie das Durchlaufen und Aufrufen von getName() auf jedem untergeordneten Element einzeln.
|
||||||
|
* @return Liste aller Namen der Kinder
|
||||||
|
*/
|
||||||
|
public String[] listChildren() {
|
||||||
|
if (current == null) {
|
||||||
|
if(doc.hasRootElement()) {
|
||||||
|
String[] names = new String[0];
|
||||||
|
names[0] = doc.getRootElement().getName();
|
||||||
|
return names;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<Element> ch_element = current.getChildren();
|
||||||
|
String[] names = new String[ch_element.size()];
|
||||||
|
for(int i=0; i < ch_element.size() ; i++) {
|
||||||
|
names[i] = ch_element.get(i).getName();
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Kinder des Elements als Array von XML-Objekten.
|
||||||
|
* @return Array der Kinder als XML-Objekte
|
||||||
|
*/
|
||||||
|
public XML[] getChildren() {
|
||||||
|
if (current == null) {
|
||||||
|
if(doc.hasRootElement()) {
|
||||||
|
XML[] ch_xml = new XML[1];
|
||||||
|
ch_xml[0] = new XML(doc, doc.getRootElement());
|
||||||
|
return ch_xml;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<Element> ch_element = current.getChildren();
|
||||||
|
XML[] ch_xml = new XML[ch_element.size()];
|
||||||
|
for(int i=0; i < ch_element.size() ; i++) {
|
||||||
|
ch_xml[i] = new XML(doc, ch_element.get(i));
|
||||||
|
}
|
||||||
|
return ch_xml;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert bestimmte Kinder des Elements als Array von XML-Objekten.
|
||||||
|
* Die Methode gibt dabei alle Kinder zurück, die dem angegebenen Namen entsprechen.
|
||||||
|
* @param name Name der gesuchten Kind-Objekte
|
||||||
|
* @return Array der Kinder als XML-Objekte
|
||||||
|
*/
|
||||||
|
public XML[] getChildren(String name) {
|
||||||
|
if (current == null) {
|
||||||
|
if(doc.hasRootElement()) {
|
||||||
|
XML[] ch_xml = new XML[1];
|
||||||
|
ch_xml[0] = new XML(doc, doc.getRootElement());
|
||||||
|
if(doc.getRootElement().getName().equals(name)){
|
||||||
|
return ch_xml;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<Element> ch_element = current.getChildren(name);
|
||||||
|
XML[] ch_xml = new XML[ch_element.size()];
|
||||||
|
for(int i=0; i < ch_element.size() ; i++) {
|
||||||
|
ch_xml[i] = new XML(doc, ch_element.get(i));
|
||||||
|
}
|
||||||
|
return ch_xml;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert das erste Kind des Elements mit einem bestimmten Namen.
|
||||||
|
* Die Methode gibt das erste Kind zurück, das dem angegebenen Namen entsprechen.
|
||||||
|
* @param name Name des gesuchten Kind-Objektes
|
||||||
|
* @return Kind als XML-Objekt
|
||||||
|
*/
|
||||||
|
|
||||||
|
public XML getChild(String name) {
|
||||||
|
if (current == null) {
|
||||||
|
Element e = doc.getRootElement();
|
||||||
|
if (e.getName().equals(name)) {
|
||||||
|
return new XML(doc, e);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String[] names = name.split("/");
|
||||||
|
Element e = current;
|
||||||
|
int i = 0;
|
||||||
|
while(i < names.length) {
|
||||||
|
e = e.getChild(names[i]);
|
||||||
|
if (e==null) return null;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return new XML(doc, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert das i. Kind des Elements.
|
||||||
|
* Die Methode gibt das i. Kind des aktuellen Elements zurück.
|
||||||
|
* @param i Nummer des Kindes
|
||||||
|
* @return Kind als XML-Objekt
|
||||||
|
*/
|
||||||
|
public XML getChild(int i) {
|
||||||
|
if (current == null) {
|
||||||
|
return new XML(doc, doc.getRootElement());
|
||||||
|
} else {
|
||||||
|
List<Element> ch_element = current.getChildren();
|
||||||
|
if (i>=ch_element.size()) return null;
|
||||||
|
return new XML(doc, ch_element.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------- Methoden für das aktuelle Element -------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Frage den Namen des aktuellen Elements ab
|
||||||
|
* @return Namen des Elements
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
if (current==null) return "";
|
||||||
|
return current.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setze den Namen des aktuellen Elements.
|
||||||
|
* @param name Neuer Name des Elements
|
||||||
|
*/
|
||||||
|
public void setName(String name) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* liefert die Anzahl der Attribute eines Elements.
|
||||||
|
* @return Anzahl des Attribute
|
||||||
|
*/
|
||||||
|
public int getAttributeCount() {
|
||||||
|
if (current == null) return 0;
|
||||||
|
return current.getAttributes().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* liefert zurück, ob das aktuelle Element Attribute hat .
|
||||||
|
* @return true, wenn es Attribute gibt
|
||||||
|
*/
|
||||||
|
public boolean hasAttribute() {
|
||||||
|
if (current == null) return false;
|
||||||
|
return current.getAttributes().size()>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ruft alle Attribute des angegebenen Elements ab und gibt sie als Array von Strings zurück.
|
||||||
|
* @return Liste der Attributnamen
|
||||||
|
*/
|
||||||
|
public String[] listAttributes() {
|
||||||
|
if (current == null) return null;
|
||||||
|
List<Attribute> attr = current.getAttributes();
|
||||||
|
String[] names = new String[attr.size()];
|
||||||
|
for(int i=0; i < attr.size() ; i++) {
|
||||||
|
names[i] = attr.get(i).getName();
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @return Wert des Attributs
|
||||||
|
*/
|
||||||
|
public String getString(String attribute) {
|
||||||
|
if (current==null) return "";
|
||||||
|
return current.getAttributeValue(attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* Sollte es das Attribut nicht geben, wird ein default-Wert zurückgegeben
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param defaultValue Standardwert, falls es das Attribut nicht gibt
|
||||||
|
* @return Wert des Attributs
|
||||||
|
*/
|
||||||
|
public String getString(String attribute, String defaultValue) {
|
||||||
|
if (current==null) return defaultValue;
|
||||||
|
return current.getAttributeValue(attribute,defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt einen Attributwert des aktuellen Elements
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param text neuer Wert des Attributs
|
||||||
|
*/
|
||||||
|
public void setString(String attribute, String text) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setAttribute(attribute, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @return Wert des Attributs als Integer-Zahl
|
||||||
|
*/
|
||||||
|
public int getInt(String attribute) {
|
||||||
|
if (current==null) return 0;
|
||||||
|
try{
|
||||||
|
int i = Integer.parseInt(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* Sollte es das Attribut nicht geben, wird ein default-Wert zurückgegeben
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param defaultValue Standardwert, falls es das Attribut nicht gibt
|
||||||
|
* @return Wert des Attributs als Integer-Zahl
|
||||||
|
*/
|
||||||
|
public int getInt(String attribute, int defaultValue) {
|
||||||
|
if (current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
int i = Integer.parseInt(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt einen Attributwert des aktuellen Elements
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param value neuer Wert des Attributs
|
||||||
|
*/
|
||||||
|
public void setInt(String attribute, int value) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setAttribute(attribute, ""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @return Wert des Attributs als Float-Zahl
|
||||||
|
*/
|
||||||
|
public float getFloat(String attribute) {
|
||||||
|
if (current==null) return 0;
|
||||||
|
try{
|
||||||
|
float i = Float.parseFloat(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* Sollte es das Attribut nicht geben, wird ein default-Wert zurückgegeben
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param defaultValue Standardwert, falls es das Attribut nicht gibt
|
||||||
|
* @return Wert des Attributs als Float-Zahl
|
||||||
|
*/
|
||||||
|
public float getFloat(String attribute, float defaultValue) {
|
||||||
|
if (current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
float i = Float.parseFloat(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt einen Attributwert des aktuellen Elements
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param value neuer Wert des Attributs
|
||||||
|
*/
|
||||||
|
public void setFloat(String attribute, float value) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setAttribute(attribute, ""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @return Wert des Attributs als Double-Zahl
|
||||||
|
*/
|
||||||
|
public double getDouble(String attribute) {
|
||||||
|
if (current==null) return 0;
|
||||||
|
try{
|
||||||
|
double i = Double.parseDouble(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* Sollte es das Attribut nicht geben, wird ein default-Wert zurückgegeben
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param defaultValue Standardwert, falls es das Attribut nicht gibt
|
||||||
|
* @return Wert des Attributs als double-Zahl
|
||||||
|
*/
|
||||||
|
public double getDouble(String attribute, double defaultValue) {
|
||||||
|
if (current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
double i = Double.parseDouble(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt einen Attributwert des aktuellen Elements
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param value neuer Wert des Attributs
|
||||||
|
*/
|
||||||
|
public void setDouble(String attribute, double value) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setAttribute(attribute, ""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt/Text des aktuellen Elements ab
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public String getContent() {
|
||||||
|
if ( current==null) return "";
|
||||||
|
|
||||||
|
return current.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt/Text des aktuellen Elements ab
|
||||||
|
* Hat das Element keinen Inhalt wird der defaultValue zurückgegeben.
|
||||||
|
* @param defaultValue Standardtext
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public String getContent(String defaultValue) {
|
||||||
|
if ( current==null) return defaultValue;
|
||||||
|
String t = current.getText();
|
||||||
|
if(t.equals("")) t = defaultValue;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Inhalt/Text des aktuellen Elements
|
||||||
|
* @param text Neuer Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public void setContent(String text) {
|
||||||
|
if ( current==null) return;
|
||||||
|
current.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Integerzahl ab
|
||||||
|
* Hat das Element keinen Inhalt wird der defaultValue zurückgegeben.
|
||||||
|
* @param defaultValue Standardwert
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/ public int getIntContent(int defaultValue) {
|
||||||
|
if ( current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
int i = Integer.parseInt(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Integerzahl ab
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public int getIntContent() {
|
||||||
|
if ( current==null) return 0;
|
||||||
|
try{
|
||||||
|
int i = Integer.parseInt(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Inhalt des aktuellen Elements
|
||||||
|
* @param value Neuer Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public void setIntContent(int value) {
|
||||||
|
if ( current==null) return;
|
||||||
|
current.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Floatzahl ab
|
||||||
|
* Hat das Element keinen Inhalt wird der defaultValue zurückgegeben.
|
||||||
|
* @param defaultValue Standardwert
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public float getFloatContent(float defaultValue) {
|
||||||
|
if ( current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
float i = Float.parseFloat(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Floatzahl ab
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public float getFloatContent() {
|
||||||
|
if ( current==null) return 0;
|
||||||
|
try{
|
||||||
|
float i = Float.parseFloat(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Inhalt des aktuellen Elements
|
||||||
|
* @param value Neuer Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public void setFloatContent(float value) {
|
||||||
|
if ( current==null) return;
|
||||||
|
current.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Doublezahl ab
|
||||||
|
* Hat das Element keinen Inhalt wird der defaultValue zurückgegeben.
|
||||||
|
* @param defaultValue Standardwert
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public double getDoubleContent(double defaultValue) {
|
||||||
|
if ( current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
double i = Double.parseDouble(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Doublezahl ab
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public double getDoubleContent() {
|
||||||
|
if ( current==null) return 0;
|
||||||
|
try{
|
||||||
|
double i = Double.parseDouble(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Inhalt des aktuellen Elements
|
||||||
|
* @param value Neuer Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public void setDoubleContent(double value) {
|
||||||
|
if ( current==null) return;
|
||||||
|
current.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------- XML-Struktur aufbauen ------------------------------------------------
|
||||||
|
/** Erzeuge neues Element nach der aktuellen Position und setze dieses als aktuelles Element
|
||||||
|
* @param name Name des neuen Elements
|
||||||
|
* @return neues Element als XML-Objekt
|
||||||
|
*/
|
||||||
|
public XML addChild(String name) {
|
||||||
|
Element e = new Element(name);
|
||||||
|
if(current == null){ // man ist auf Root-Ebene
|
||||||
|
doc.setRootElement(e);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
current.addContent(e);
|
||||||
|
} // end of if-else
|
||||||
|
return new XML(doc, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* liefert das aktuelle Element als jdom-Element-Objekt
|
||||||
|
* @return aktuelles Element
|
||||||
|
*/
|
||||||
|
private Element getCurrent() {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* löscht ein Kind des aktuellen Knotens.
|
||||||
|
* Ist kid kein Kind des aktuellen Elements passiert gar nichts.
|
||||||
|
* @param kid XML-Objekt des Kindes
|
||||||
|
*/
|
||||||
|
public void removeChild(XML kid) {
|
||||||
|
if (current == null) return;
|
||||||
|
Element e = kid.getCurrent();
|
||||||
|
int index = current.indexOf(e);
|
||||||
|
if(index >= 0) { current.removeContent(e);}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,699 @@
|
||||||
|
import java.awt.image.*;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.BasicStroke;
|
||||||
|
import java.util.Vector;
|
||||||
|
import javax.imageio.*;
|
||||||
|
import java.io.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Bildklasse für die Simulation von Processing-Befehlen
|
||||||
|
*
|
||||||
|
* Diese Klasse stellt ein BufferedImage bereit, in das mit Processing-Befehlen gezeichnet
|
||||||
|
* werden kann.
|
||||||
|
* Zusätzlich kann ein Bildanzeiger über jede Änderung des Bildes informiert werden,
|
||||||
|
* um "Zurück"-Befehle zu ermöglichen. Der Bildanzeiger ist entweder eine normale Java
|
||||||
|
* ScrollPane oder ein Actor aus Greenfoot.
|
||||||
|
* Die Dokumentation der einzelnen Zeichenmethoden ist der Processing-Reference
|
||||||
|
* (https://processing.org/reference/ steht unter CC-Lizenz: https://creativecommons.org/)
|
||||||
|
* entnommen und mit Deepl.com ins Deutsche übersetzt.
|
||||||
|
*
|
||||||
|
* @version 1.0 from 23.01.2019
|
||||||
|
* @author Thomas Schaller (ZPG Informatik Klasse 9)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Picture{
|
||||||
|
|
||||||
|
// Einstellungmöglichkeiten für das Zeichnen von Rechtecken und Ellipsen
|
||||||
|
// RADIUS = Mittelpunkt+Radius wird gegeben, CENTER = Mittelpunkt und Breite/Höhe wird gegeben,
|
||||||
|
// CORNER = Linke obere Ecke + Breite/Höhe, CORNERS = Linke obere und rechte untere Ecke
|
||||||
|
public static final int RADIUS = 1;
|
||||||
|
public static final int CENTER = 2;
|
||||||
|
public static final int CORNER = 3;
|
||||||
|
public static final int CORNERS = 4;
|
||||||
|
|
||||||
|
// gespeichertes Bild,
|
||||||
|
private BufferedImage image;
|
||||||
|
|
||||||
|
// aktuelle Farbeinstellungen
|
||||||
|
private Color background;
|
||||||
|
private Color pencolor;
|
||||||
|
private Color fillcolor;
|
||||||
|
|
||||||
|
// aktuelle Stiftdicke
|
||||||
|
private double stroke;
|
||||||
|
|
||||||
|
// akkteller Koordinatenmodus von Rechtecken und Ellipsen
|
||||||
|
private int ellipseMode = CENTER;
|
||||||
|
private int rectMode = CORNER;
|
||||||
|
|
||||||
|
// aktueller Font
|
||||||
|
private Font textfont = null;
|
||||||
|
|
||||||
|
// muss ein Bildanzeiger benachrichtigt werden
|
||||||
|
private PictureViewer observer = null;
|
||||||
|
private boolean autorefresh = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein Bild mit Standardgröße 500x400
|
||||||
|
*/
|
||||||
|
public Picture() {
|
||||||
|
this(500,400);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein Bild der angegeben Größe
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public Picture(int width, int height) {
|
||||||
|
this(width,height, "D0D0D0");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein Bild aus einer Datei
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public Picture(String filename) {
|
||||||
|
load(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein Bild der angegebenen Größe mit festgelegtem Hintergrund
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
* @param background Farbe des Hintergrunds
|
||||||
|
*/
|
||||||
|
public Picture(int width, int height, String background) {
|
||||||
|
this.image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
this.background = decode(background);
|
||||||
|
this.pencolor = new Color(0,0,0);
|
||||||
|
this.stroke = 1;
|
||||||
|
this.fillcolor = null;
|
||||||
|
Graphics2D g = (Graphics2D) this.image.getGraphics();
|
||||||
|
g.setColor(this.background);
|
||||||
|
g.fillRect(0,0,width-1, height-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt fest, wer das Bild anzeigt.
|
||||||
|
* Diese ermöglicht die Benachrichtung des Observers, wenn sich das Bild ändert.
|
||||||
|
* @param observer Anzeiger des Bildes
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void setObserver(PictureViewer observer) {
|
||||||
|
this.observer= observer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Direktes Setzen des Bildes (für interne Zwecke)
|
||||||
|
* @param b Bild, das gespeichert werden soll.
|
||||||
|
*/
|
||||||
|
public void setImage(BufferedImage b) {
|
||||||
|
image = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Direktes Abfragen des Bildes (für interne Zwecke)
|
||||||
|
* @return Bild, das gerade gespeichert ist.
|
||||||
|
*/
|
||||||
|
public BufferedImage getImage() {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Definiert die Dimension der Breite und Höhe des Anzeigefensters in Pixeleinheiten.
|
||||||
|
* Die eingebauten Variablen Breite und Höhe werden durch die an diese Funktion übergebenen Parameter festgelegt. So weist beispielsweise
|
||||||
|
* der Befehl size(640, 480) der Variablen Breite 640 und der Variablen Höhe 480 zu.
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public void size(int width, int height){
|
||||||
|
pushImage();
|
||||||
|
this.image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
Graphics2D g = (Graphics2D) this.image.getGraphics();
|
||||||
|
g.setColor(background);
|
||||||
|
g.fillRect(0,0,width-1, height-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Breite des Bildes zurück.
|
||||||
|
* @return Breite des Bildes
|
||||||
|
*/
|
||||||
|
public int getWidth() {
|
||||||
|
return image.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Höhe des Bildes zurück.
|
||||||
|
* @return Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public int getHeight() {
|
||||||
|
return image.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt eine Kopie des Bildes und übergibt sie an den Observer (falls existent), damit dieser die Versionen speichern kann
|
||||||
|
*/
|
||||||
|
private void pushImage() {
|
||||||
|
if(observer != null) {
|
||||||
|
observer.pushImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt fest, ob nach jedem Zeichenbefehl automatisch das Bild auch in
|
||||||
|
* der Oberfläche aktualisiert wird. Die Einstellung "false" beschleunigt
|
||||||
|
* das Zeichnen aufwändiger Bilder und verhindert "Flackern".
|
||||||
|
* Das Neuzeichnen kann durch die Methode "refresh" gezielt ausgelöst werden.
|
||||||
|
* @param autorefresh true = nach jedem Zeichenbefehl die Anzeige aktualisieren, false= nur durch die Methode refresh neu zeichnen
|
||||||
|
*/
|
||||||
|
public void setAutoRefresh(boolean autoRefresh) {
|
||||||
|
this.autorefresh = autoRefresh;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auch die anzeigenden Klasse wird zum Neuzeichnen aufgefordert.
|
||||||
|
*/
|
||||||
|
private void repaint() {
|
||||||
|
if(observer != null && autorefresh) {
|
||||||
|
observer.repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auch die anzeigenden Klasse wird zum Neuzeichnen aufgefordert.
|
||||||
|
*/
|
||||||
|
public void refresh() {
|
||||||
|
if(observer != null) {
|
||||||
|
observer.repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------- Zeichenfunktionen -----------------------------------------------
|
||||||
|
/**
|
||||||
|
* Löscht den Inhalt des Bildes.
|
||||||
|
* Der Hintergrund wird mit der Hintergrundfarbe neu gefüllt.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void clear(){
|
||||||
|
pushImage();
|
||||||
|
image = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
|
||||||
|
Graphics2D g = (Graphics2D) this.image.getGraphics();
|
||||||
|
g.setColor(background);
|
||||||
|
g.fillRect(0,0,image.getWidth()-1, image.getHeight()-1);
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Konvertiert die in einem bestimmten Modus gegebenen Koordinaten in die Java-übliche Links_Oben_Breite_Höhe Version
|
||||||
|
* Die Änderungen werden direkt im Array vorgenommen
|
||||||
|
* @param coord Array mit vier Koordinateneinträgen im gegebenen Modus
|
||||||
|
* @param mode Modus der Koordinaten (CORNER, CORNERS, RADIUS oder CENTER)
|
||||||
|
*/
|
||||||
|
private void convert(int[] coord, int mode) {
|
||||||
|
switch(mode) {
|
||||||
|
case CORNER: break;
|
||||||
|
case CORNERS: coord[2] -= coord[0]; coord[3] -= coord[1]; break;
|
||||||
|
case RADIUS: coord[2] *= 2; coord[3] *=2;
|
||||||
|
case CENTER: coord[0] -= coord[2]/2; coord[1] -= coord[3]/2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ändert den Koordinaten-Modus beim Zeichnen von Rechtecken.
|
||||||
|
* Ändert die Position, von der aus Rechtecke gezeichnet werden, indem es die Art und Weise ändert, wie Parameter, die an rect() übergeben werden, interpretiert werden.
|
||||||
|
* Der Standardmodus ist rectMode(Bild.CORNER), der die ersten beiden Parameter von rect() als die linke obere Ecke der Form interpretiert,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* rectMode(Bild.CORNERS) interpretiert die ersten beiden Parameter von rect() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als die Position der gegenüberliegenden Ecke.
|
||||||
|
* rectMode(Bild.CENTER) interpretiert die ersten beiden Parameter von rect() als Mittelpunkt der Form,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* rectMode(RADIUS) verwendet auch die ersten beiden Parameter von rect() als Mittelpunkt der Form,
|
||||||
|
* verwendet aber den dritten und vierten Parameter, um die Hälfte der Breite und Höhe der Formen festzulegen.
|
||||||
|
* @param mode Modus der Koordinateninterpretation (CORNER, CORNERS, CENTER oder RADIUS)
|
||||||
|
*/
|
||||||
|
public void rectMode(int mode) {
|
||||||
|
rectMode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ändert den Koordinaten-Modus beim Zeichnen von Kreisen/Ellipsen.
|
||||||
|
* Ändert die Position, von der aus Kreise/Ellipsen gezeichnet werden, indem es die Art und Weise ändert, wie Parameter, die an ellipse() übergeben werden, interpretiert werden.
|
||||||
|
* Der Standardmodus ist ellipseMode(Bild.CENTER), der die ersten beiden Parameter von ellipse() als Mittelpunkt der Form interpretiert,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* ellipseMode(Bild.CORNER) interpretiert die ersten beiden Parameter von ellipse() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als Breite und Höhe der Form.
|
||||||
|
* ellipseMode(Bild.CORNERS) interpretiert die ersten beiden Parameter von ellipse() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als die Position der gegenüberliegenden Ecke.
|
||||||
|
* ellipseMode(RADIUS) verwendet auch die ersten beiden Parameter von ellipse() als Mittelpunkt der Form,
|
||||||
|
* verwendet aber den dritten und vierten Parameter, um die Hälfte der Breite und Höhe der Formen festzulegen.
|
||||||
|
* @param mode Modus der Koordinateninterpretation (CORNER, CORNERS, CENTER oder RADIUS)
|
||||||
|
*/
|
||||||
|
public void ellipseMode(int mode) {
|
||||||
|
ellipseMode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet eine Linie (einen direkten Weg zwischen zwei Punkten) auf den Bildschirm.
|
||||||
|
* Um eine Linie einzufärben, verwenden Sie die {@link #stroke(int, int, int) stroke()} Funktion. Eine Zeile kann nicht gefüllt werden, daher hat die Funktion fill() keinen
|
||||||
|
* Einfluss auf die Farbe einer Zeile. Linien werden standardmäßig mit einer Breite von einem Pixel gezeichnet, dies kann jedoch mit der Funktion
|
||||||
|
* {@link #strokeWeight(double) strokeWeight()} geändert werden.
|
||||||
|
* @param x1 x-Koordinate des 1. Punktes
|
||||||
|
* @param y1 y-Koordinate des 1. Punktes
|
||||||
|
* @param x2 x-Koordinate des 2. Punktes
|
||||||
|
* @param y2 y-Koordinate des 2. Punktes
|
||||||
|
*/
|
||||||
|
public void line(int x1, int y1, int x2, int y2) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
if (stroke > 0) {
|
||||||
|
g.setColor(pencolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.drawLine(x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Rechteck auf das Bild.
|
||||||
|
* Standardmäßig legen die ersten beiden Parameter die Position der linken oberen Ecke fest, der dritte die Breite und der vierte die Höhe.
|
||||||
|
* Die Art und Weise, wie diese Parameter interpretiert werden, kann jedoch mit der Funktion {@link #rectMode(int) rectMode()} geändert werden.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param a meist die x-Koordinate der linken oberen Ecke (kann durch rectMode() geändert werden).
|
||||||
|
* @param b meist die y-Koordinate der linken oberen Ecke (kann durch rectMode() geändert werden).
|
||||||
|
* @param c meist die Breite des Rechtecks (kann durch rectMode() geändert werden).
|
||||||
|
* @param d meist die Höhe des Rechtecks (kann durch rectMode() geändert werden).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void rect(int a, int b, int c, int d) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
int[] coord = {a,b,c,d};
|
||||||
|
convert(coord, rectMode);
|
||||||
|
if(fillcolor != null) {
|
||||||
|
g.setColor(fillcolor);
|
||||||
|
g.fillRect(coord[0], coord[1], coord[2], coord[3]);
|
||||||
|
}
|
||||||
|
if(pencolor != null) {
|
||||||
|
g.setColor(pencolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.drawRect(coord[0], coord[1], coord[2], coord[3]);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet eine Ellipse/Kreis auf das Bild.
|
||||||
|
* Standardmäßig legen die ersten beiden Parameter die Position des Mittelpunkts fest, der dritte die Breite und der vierte die Höhe.
|
||||||
|
* Die Art und Weise, wie diese Parameter interpretiert werden, kann jedoch mit der Funktion {@link #ellipseMode(int) ellipseMode()} geändert werden.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param a meist die x-Koordinate des Mittelpunkts (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param b meist die y-Koordinate des Mittelpunkts (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param c meist die Breite des Rechtecks (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param d meist die Höhe des Rechtecks (kann durch ellipseMode() geändert werden).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void ellipse(int a, int b, int c, int d) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
int[] coord = {a,b,c,d};
|
||||||
|
convert(coord, ellipseMode);
|
||||||
|
if(fillcolor != null) {
|
||||||
|
g.setColor(fillcolor);
|
||||||
|
g.fillOval(coord[0], coord[1], coord[2], coord[3]);
|
||||||
|
}
|
||||||
|
if(pencolor != null) {
|
||||||
|
g.setColor(pencolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.drawOval(coord[0], coord[1], coord[2], coord[3]);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Dreieck auf das Bild.
|
||||||
|
* Ein Dreieck ist eine Ebene, die durch die Verbindung von drei Punkten entsteht. Die ersten beiden Argumente spezifizieren den
|
||||||
|
* ersten Punkt, die mittleren beiden Argumente spezifizieren den zweiten Punkt und die letzten beiden Argumente spezifizieren den dritten Punkt.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x1 meist die x-Koordinate des 1. Punkts.
|
||||||
|
* @param y1 meist die y-Koordinate des 1. Punkts.
|
||||||
|
* @param x2 meist die x-Koordinate des 2. Punkts.
|
||||||
|
* @param y2 meist die y-Koordinate des 2. Punkts.
|
||||||
|
* @param x3 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y3 meist die y-Koordinate des 3. Punkts.
|
||||||
|
*/
|
||||||
|
public void triangle(int x1, int y1, int x2, int y2, int x3, int y3) {
|
||||||
|
int px[] = {x1, x2, x3};
|
||||||
|
int py[] = {y1, y2, y3};
|
||||||
|
polygon(px, py);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Viereck auf das Bild.
|
||||||
|
* Ein Viereck ist ein vierseitiges Polygon. Es ist ähnlich wie ein Rechteck, aber die Winkel zwischen seinen Kanten
|
||||||
|
* sind nicht auf neunzig Grad beschränkt. Das erste Paar von Parametern (x1,y1) setzt den ersten Scheitelpunkt und die nachfolgenden
|
||||||
|
* Paare sollten im Uhrzeigersinn oder gegen den Uhrzeigersinn um die definierte Form herum verlaufen.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x1 meist die x-Koordinate des 1. Punkts.
|
||||||
|
* @param y1 meist die y-Koordinate des 1. Punkts.
|
||||||
|
* @param x2 meist die x-Koordinate des 2. Punkts.
|
||||||
|
* @param y2 meist die y-Koordinate des 2. Punkts.
|
||||||
|
* @param x3 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y3 meist die y-Koordinate des 3. Punkts.
|
||||||
|
* @param x4 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y4 meist die y-Koordinate des 3. Punkts.
|
||||||
|
*/
|
||||||
|
public void quad(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
|
||||||
|
|
||||||
|
int px[] = {x1, x2, x3, x4};
|
||||||
|
int py[] = {y1, y2, y3, y4};
|
||||||
|
polygon(px, py);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Polygon auf das Bild.
|
||||||
|
* Gleich lange Listen von x und y-Koordinaten bestimmen die Eckpunkte des Polygons.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x Liste der x-Koordinaten der Punkte.
|
||||||
|
* @param y Liste der y-Koordinaten der Punkte.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void polygon(int[] x, int[] y) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
|
||||||
|
if(fillcolor != null) {
|
||||||
|
|
||||||
|
g.setColor(fillcolor);
|
||||||
|
g.fillPolygon(x,y, y.length);
|
||||||
|
}
|
||||||
|
if(pencolor != null) {
|
||||||
|
g.setColor(pencolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.drawPolygon(x, y, x.length);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet einen Punkt, d.h. einen Kreis in der Dimension eines Pixels.
|
||||||
|
* Der erste Parameter ist der x-Wert für den Punkt, der zweite Wert ist der y-Wert für den Punkt.
|
||||||
|
* @param x x-Koordinate des Punktes
|
||||||
|
* @param y y-Koordinate des Punktes
|
||||||
|
*/
|
||||||
|
public void point(int x, int y) {
|
||||||
|
ellipse(x,y,1, 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------- Schriftdarstellung -----------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt einen Text an den gegebenen Koordinaten aus
|
||||||
|
* Zur Ausgabe des Textes wird der ausgewählte Font verwendet. Dieser muss vorher mit {@link #textFont(Font) textFont() } festgelegt.
|
||||||
|
* @param s Text, der angezeigt werden soll
|
||||||
|
* @param x x-Koordinate des Textanfangs
|
||||||
|
* @param y y-Koordinate der Grundlinie des Textes.
|
||||||
|
*/
|
||||||
|
public void text(String s, int x, int y) {
|
||||||
|
pushImage();
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
|
||||||
|
if(pencolor != null) {
|
||||||
|
g.setColor(fillcolor);
|
||||||
|
g.setStroke(new BasicStroke((float) stroke));
|
||||||
|
g.setFont(textfont);
|
||||||
|
g.drawString(s, x, y);
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Schriftart für Textausgaben fest.
|
||||||
|
* Jeder übliche Java-Font kann verwendet werden. Er kann mit z.B. Font f = new Font( "Arial", Font.PLAIN, 14 ); definiert werden.
|
||||||
|
* @param font ein Font-Objekt
|
||||||
|
*/
|
||||||
|
public void textFont(Font font) {
|
||||||
|
this.textfont = font;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------- Farbfestlegungen -----------------------------------------------
|
||||||
|
/**
|
||||||
|
* Hilfsfunktion zur Interpretation von Farben
|
||||||
|
*/
|
||||||
|
private Color decode(String color) {
|
||||||
|
try{
|
||||||
|
return new Color(
|
||||||
|
Integer.valueOf( color.substring( 0, 2 ), 16 ),
|
||||||
|
Integer.valueOf( color.substring( 2, 4 ), 16 ),
|
||||||
|
Integer.valueOf( color.substring( 4, 6 ), 16 ) );
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Falscher Farbcode");
|
||||||
|
return Color.BLACK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hilfsfunktion zur Interpretation von Farben
|
||||||
|
*/
|
||||||
|
private Color decode(int color) {
|
||||||
|
try{
|
||||||
|
if(color >=0 && color < 256) {
|
||||||
|
return new Color(color,color,color);
|
||||||
|
} else {
|
||||||
|
int r = color / 0x010000 % 0xFF;
|
||||||
|
int g = color / 0x000100 % 0xFF;
|
||||||
|
int b = color % 0xFF;
|
||||||
|
System.out.println(""+r+","+g+","+b);
|
||||||
|
return new Color(r, g, b );
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Falscher Farbcode");
|
||||||
|
return Color.BLACK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird hexadezimal in Form der RGB angegeben: z.B. "CCFFAA" oder "004E23". Die Syntax verwendet sechs Ziffern - je zwei für die roten, grünen und blauen Komponenten,
|
||||||
|
* um eine Farbe anzugeben (genau wie Farben typischerweise in HTML und CSS angegeben werden).
|
||||||
|
* @param pencolor Stiftfarbe in Hexadezimaldarstellung
|
||||||
|
*/
|
||||||
|
public void stroke(String pencolor) {
|
||||||
|
this.pencolor = decode(pencolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird entweder als Graustufe (0-255) oder als 3-Byte RGB-Wert angegeben
|
||||||
|
* @param pencolor Stiftfarbe (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void stroke(int pencolor) {
|
||||||
|
this.pencolor=decode(pencolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird komponentenweise als RGB-Wert angegeben
|
||||||
|
* @param r Rotanteil (0-255) der Stiftfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Stiftfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Stiftfarbe
|
||||||
|
*/
|
||||||
|
public void stroke(int r, int g, int b) {
|
||||||
|
this.pencolor = new Color(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt fest, dass keine Linien oder Ränder um Formen gezeichnet werden soll.
|
||||||
|
*/
|
||||||
|
public void noStroke() {
|
||||||
|
this.pencolor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Breite des Strichs für Linien, Punkte und den Rand um Formen fest.
|
||||||
|
* Alle Breiten werden in Pixeleinheiten angegeben.
|
||||||
|
* @param width Breite in Pixel
|
||||||
|
*/
|
||||||
|
public void strokeWeight(double width) {
|
||||||
|
this.stroke = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird hexadezimal in Form der RGB angegeben: z.B. "CCFFAA" oder "004E23". Die Syntax verwendet sechs Ziffern - je zwei für die roten, grünen und blauen Komponenten,
|
||||||
|
* um eine Farbe anzugeben (genau wie Farben typischerweise in HTML und CSS angegeben werden).
|
||||||
|
* @param fillcolor Füllfarbe in Hexadezimaldarstellung
|
||||||
|
*/
|
||||||
|
public void fill(String fillcolor) {
|
||||||
|
this.fillcolor = decode(fillcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird entweder als Graustufe (0-255) oder als 3-Byte RGB-Wert angegeben.
|
||||||
|
* @param fillcolor Füllfarbe (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void fill(int fillcolor) {
|
||||||
|
this.fillcolor=decode(fillcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird komponentenweise als RGB-Wert angegeben.
|
||||||
|
* @param r Rotanteil (0-255) der Füllfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Füllfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Füllfarbe
|
||||||
|
*/
|
||||||
|
public void fill(int r, int g, int b) {
|
||||||
|
this.fillcolor = new Color(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Legt fest, dass die Formen nicht gefüllt werden sollen.
|
||||||
|
*/
|
||||||
|
public void noFill() {
|
||||||
|
this.fillcolor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Funktion background() setzt die Farbe, die für den Hintergrund des Bildes verwendet wird. Der Standardhintergrund ist hellgrau.
|
||||||
|
* Es ist nicht möglich, den Alpha-Parameter Transparenz mit Hintergrundfarben auf der Hauptzeichnungsoberfläche zu verwenden.
|
||||||
|
* @param c Farbe für den Hintergrund (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void background(int c) {
|
||||||
|
if(c < 256) {
|
||||||
|
this.background=new Color(c,c,c);
|
||||||
|
} else {
|
||||||
|
int r = c / 0x010000;
|
||||||
|
int g = c / 0x000100 % 0xFF;
|
||||||
|
int b = c % 0xFF;
|
||||||
|
this.background= new Color(r, g, b );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Funktion background() setzt die Farbe, die für den Hintergrund des Bildes verwendet wird. Der Standardhintergrund ist hellgrau.
|
||||||
|
* Es ist nicht möglich, den Alpha-Parameter Transparenz mit Hintergrundfarben auf der Hauptzeichnungsoberfläche zu verwenden.
|
||||||
|
* @param r Rotanteil (0-255) der Hintergrundfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Hintergrundfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Hintergrundfarbe
|
||||||
|
*/
|
||||||
|
public void background(int r, int g, int b) {
|
||||||
|
this.background=new Color(r,g,b);
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------- Dateioperationen -----------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lädt ein Bild aus dem Dateisystem.
|
||||||
|
* Lädt ein Bild von einem Datenträger und setzt Stiftfarbe und Füllfarbe auf Standardwerte zurück.
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public void load(String filename) {
|
||||||
|
try{
|
||||||
|
this.image = ImageIO.read(new File(filename));
|
||||||
|
this.background = decode("D0D0D0");
|
||||||
|
this.pencolor = new Color(0,0,0);
|
||||||
|
this.fillcolor = null;
|
||||||
|
this.stroke = 1;
|
||||||
|
this.repaint();
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
System.out.println("Fehler beim Einlesen der Bilddatei");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert ein Bild.
|
||||||
|
* Speichert ein Bild auf einem Datenträger. Zulässig sind die Dateiformate PNG und GIF. Die Dateiendung legt den Typ fest.
|
||||||
|
* Standardmäßig wird die Dateiendung .png ergänzt, wenn keine angegeben ist.
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public void save(String filename) {
|
||||||
|
try{
|
||||||
|
String[] fn = filename.split("\\.");
|
||||||
|
if (fn.length== 1) {
|
||||||
|
ImageIO.write(image, "PNG", new File(filename+".png"));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (fn.length == 2 && (fn[1].toUpperCase().equals("PNG") ||
|
||||||
|
fn[1].toUpperCase().equals("GIF"))){
|
||||||
|
ImageIO.write(image, fn[1], new File(filename));
|
||||||
|
}else {
|
||||||
|
System.out.println("Unbekanntes Bildformat");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
System.out.println("Fehler beim Speichern");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------- Sonstiges -----------------------------------------------
|
||||||
|
/**
|
||||||
|
* Liefert das Bild als zweidimensionales Pixel-Array.
|
||||||
|
* @return zweidimensionales Array von Color-Objekten, die den Pixeln des Bildes entsprechen.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Color[][] getPixelArray() {
|
||||||
|
Color[][] pixel = new Color[image.getWidth()][image.getHeight()];
|
||||||
|
for(int x=0; x < image.getWidth(); x++){
|
||||||
|
for(int y=0; y < image.getHeight(); y++) {
|
||||||
|
pixel[x][y] = new java.awt.Color(image.getRGB(x,y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt das Bild neu auf Basis des Pixel-Arrays.
|
||||||
|
* Die Größe des Bildes wird nicht automatisch an das Array angepasst.
|
||||||
|
* @param pixel zweidimensionales Array von Color-Objekten
|
||||||
|
*/
|
||||||
|
public void setPixelArray(Color[][] pixel) {
|
||||||
|
size(pixel.length,pixel[0].length);
|
||||||
|
Graphics2D g = (Graphics2D) image.getGraphics();
|
||||||
|
for(int x=0; x < image.getWidth(); x++){
|
||||||
|
for(int y=0; y < image.getHeight(); y++) {
|
||||||
|
g.setColor(pixel[x][y]);
|
||||||
|
g.fillRect(x, y, 1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hilfsfunktion zum Verzögern der Ausgabe
|
||||||
|
* @param millis Wartezeit in Millisekunden
|
||||||
|
*/
|
||||||
|
public void delay(int millis) {
|
||||||
|
try{
|
||||||
|
Thread.sleep(millis);
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,505 @@
|
||||||
|
/**
|
||||||
|
* Zeigt ein Bild in einem Scrollbereich an.
|
||||||
|
* Es ist möglich das Bild zu zoomen und mehrere Versionen des Bildes zu speichern, um eine "Rückgängig" Operation durchzuführen.
|
||||||
|
* @author Thomas Schaller
|
||||||
|
* @version 1.0 vom 01.02.2019
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.image.*;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
public class PictureViewer extends JScrollPane
|
||||||
|
{
|
||||||
|
|
||||||
|
// das aktuelle Bild
|
||||||
|
private Picture picture;
|
||||||
|
|
||||||
|
// Bilder für den Züruck-Modus speichern
|
||||||
|
private static final int ANZ_BACK = 20;
|
||||||
|
private Vector<BufferedImage> history;
|
||||||
|
|
||||||
|
// Zeichenfläche
|
||||||
|
private ImageIcon scrollImageIcon;
|
||||||
|
private JLabel imageLabel;
|
||||||
|
|
||||||
|
// Zoom Faktor
|
||||||
|
private double zoomFactor;
|
||||||
|
public static final int FIT = -1;
|
||||||
|
public static final int NORMAL = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein ScrollPanel mit integriertem Bild der Größe 1000x1000
|
||||||
|
*/
|
||||||
|
public PictureViewer() {
|
||||||
|
this(1000,1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein ScrollPanel mit integriertem Bild der angegebenen Größe
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public PictureViewer(int width, int height) {
|
||||||
|
this(width,height, "D0D0D0");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein ScrollPanel mit integriertem Bild der angegebenen Größe
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
* @param background Farbe des Hintergrunds als HEX-String (z.B. "FF3A45")
|
||||||
|
*/
|
||||||
|
public PictureViewer(int width, int height, String background) {
|
||||||
|
this(new Picture(width,height, background));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein ScrollPanel mit integriertem Bild aus einer Bilddatei
|
||||||
|
* @param filename Name des Bildes
|
||||||
|
*/
|
||||||
|
public PictureViewer(String filename) {
|
||||||
|
this(new Picture(filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein ScrollPanel und zeigt das Bild-Objekt an
|
||||||
|
* @param picture anzuzeigendes Bild
|
||||||
|
*/
|
||||||
|
public PictureViewer(Picture picture)
|
||||||
|
{
|
||||||
|
this.picture=picture;
|
||||||
|
|
||||||
|
zoomFactor=1;
|
||||||
|
|
||||||
|
scrollImageIcon = new ImageIcon(picture.getImage().getScaledInstance(picture.getImage().getWidth(), picture.getImage().getHeight(), Image.SCALE_FAST));
|
||||||
|
imageLabel = new JLabel(scrollImageIcon);
|
||||||
|
imageLabel.setVerticalAlignment(JLabel.CENTER);
|
||||||
|
imageLabel.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
setViewportView(imageLabel);
|
||||||
|
|
||||||
|
this.setBorder(BorderFactory.createLineBorder(Color.black));
|
||||||
|
picture.setObserver(this);
|
||||||
|
history = new Vector<BufferedImage>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt das anzuzeigende Bild neu
|
||||||
|
* @param picture anzuzeigendes Bild
|
||||||
|
*/
|
||||||
|
public void setImage(Picture picture) {
|
||||||
|
this.history = new Vector<BufferedImage>();
|
||||||
|
this.picture = picture;
|
||||||
|
setZoom(NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert das übergebene Bild in der History.
|
||||||
|
* @param b zu speicherndes Bild
|
||||||
|
*/
|
||||||
|
public void pushImage() {
|
||||||
|
if( this.ANZ_BACK > 0) {
|
||||||
|
if(history.size() == this.ANZ_BACK) {
|
||||||
|
history.removeElementAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferedImage b = new BufferedImage(picture.getWidth(), picture.getHeight(), picture.getImage().getType());
|
||||||
|
Graphics g = b.getGraphics();
|
||||||
|
g.drawImage(picture.getImage(), 0, 0, null);
|
||||||
|
g.dispose();
|
||||||
|
|
||||||
|
history.add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ruft das letzte abgespeicherte Bild aus der History wieder auf.
|
||||||
|
*/
|
||||||
|
private void popImage() {
|
||||||
|
int anz = history.size();
|
||||||
|
if(anz>0) {
|
||||||
|
BufferedImage img = history.get(anz-1);
|
||||||
|
history.removeElementAt(anz-1);
|
||||||
|
picture.setImage(img);
|
||||||
|
setZoom(zoomFactor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ruft das letzte abgespeicherte Bild aus der History wieder auf.
|
||||||
|
*/
|
||||||
|
public void back() {
|
||||||
|
popImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt das angezeigt Bild neu und beachtet dabei den Zoomfaktor.
|
||||||
|
*/
|
||||||
|
public void repaint() {
|
||||||
|
if( picture != null) {
|
||||||
|
double factor= zoomFactor;
|
||||||
|
if (zoomFactor == FIT) {
|
||||||
|
double factorw = ((double) getWidth()-2) / picture.getWidth();
|
||||||
|
double factorh = ((double) getHeight()-2) / picture.getHeight();
|
||||||
|
factor = Math.min(factorw, factorh);
|
||||||
|
}
|
||||||
|
int width = (int) (picture.getWidth()*factor);
|
||||||
|
int height = (int) (picture.getHeight()*factor);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
scrollImageIcon.setImage(picture.getImage().getScaledInstance(width, height, Image.SCALE_DEFAULT));
|
||||||
|
revalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Zoom-Faktor für das Bild.
|
||||||
|
* Als Zoomfaktor sind auch die Konstanten Bildanzeiger.FIT (auf Bildschirmgröße zoomen) und Bildanzeiger.NORMAL (100%) möglich.
|
||||||
|
* @param factor Zoomfaktor (1.0 = 100%).
|
||||||
|
*/
|
||||||
|
public void setZoom(double factor)
|
||||||
|
{
|
||||||
|
zoomFactor = factor;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Wrappermethoden
|
||||||
|
/**
|
||||||
|
* Definiert die Dimension der Breite und Höhe des Anzeigefensters in Pixeleinheiten.
|
||||||
|
* Die eingebauten Variablen Breite und Höhe werden durch die an diese Funktion übergebenen Parameter festgelegt. So weist beispielsweise
|
||||||
|
* der Befehl size(640, 480) der Variablen Breite 640 und der Variablen Höhe 480 zu.
|
||||||
|
* @param width Breite des Bildes
|
||||||
|
* @param height Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public void size(int width, int height){
|
||||||
|
picture.size(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Breite des Bildes zurück.
|
||||||
|
* @return Breite des Bildes
|
||||||
|
*/
|
||||||
|
public int getImageWidth() {
|
||||||
|
return picture.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Höhe des Bildes zurück.
|
||||||
|
* @return Höhe des Bildes
|
||||||
|
*/
|
||||||
|
public int getImageHeight() {
|
||||||
|
return picture.getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Funktion background() setzt die Farbe, die für den Hintergrund des Bildes verwendet wird. Der Standardhintergrund ist hellgrau.
|
||||||
|
* Es ist nicht möglich, den Alpha-Parameter Transparenz mit Hintergrundfarben auf der Hauptzeichnungsoberfläche zu verwenden.
|
||||||
|
* @param c Farbe für den Hintergrund (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void background(int c) {
|
||||||
|
picture.background(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Funktion background() setzt die Farbe, die für den Hintergrund des Bildes verwendet wird. Der Standardhintergrund ist hellgrau.
|
||||||
|
* Es ist nicht möglich, den Alpha-Parameter Transparenz mit Hintergrundfarben auf der Hauptzeichnungsoberfläche zu verwenden.
|
||||||
|
* @param r Rotanteil (0-255) der Hintergrundfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Hintergrundfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Hintergrundfarbe
|
||||||
|
*/
|
||||||
|
public void background(int r, int g, int b) {
|
||||||
|
picture.background(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet eine Linie (einen direkten Weg zwischen zwei Punkten) auf den Bildschirm.
|
||||||
|
* Um eine Linie einzufärben, verwenden Sie die {@link #stroke(int, int, int) stroke()} Funktion. Eine Zeile kann nicht gefüllt werden, daher hat die Funktion fill() keinen
|
||||||
|
* Einfluss auf die Farbe einer Zeile. Linien werden standardmäßig mit einer Breite von einem Pixel gezeichnet, dies kann jedoch mit der Funktion
|
||||||
|
* {@link #strokeWeight(double) strokeWeight()} geändert werden.
|
||||||
|
* @param x1 x-Koordinate des 1. Punktes
|
||||||
|
* @param y1 y-Koordinate des 1. Punktes
|
||||||
|
* @param x2 x-Koordinate des 2. Punktes
|
||||||
|
* @param y2 y-Koordinate des 2. Punktes
|
||||||
|
*/
|
||||||
|
public void line(int x1, int y1, int x2, int y2) {
|
||||||
|
picture.line(x1,y1,x2,y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Rechteck auf das Bild.
|
||||||
|
* Standardmäßig legen die ersten beiden Parameter die Position der linken oberen Ecke fest, der dritte die Breite und der vierte die Höhe.
|
||||||
|
* Die Art und Weise, wie diese Parameter interpretiert werden, kann jedoch mit der Funktion {@link #rectMode(int) rectMode()} geändert werden.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param a meist die x-Koordinate der linken oberen Ecke (kann durch rectMode() geändert werden).
|
||||||
|
* @param b meist die y-Koordinate der linken oberen Ecke (kann durch rectMode() geändert werden).
|
||||||
|
* @param c meist die Breite des Rechtecks (kann durch rectMode() geändert werden).
|
||||||
|
* @param d meist die Höhe des Rechtecks (kann durch rectMode() geändert werden).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void rect(int a, int b, int c, int d) {
|
||||||
|
picture.rect(a,b,c,d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet eine Ellipse/Kreis auf das Bild.
|
||||||
|
* Standardmäßig legen die ersten beiden Parameter die Position des Mittelpunkts fest, der dritte die Breite und der vierte die Höhe.
|
||||||
|
* Die Art und Weise, wie diese Parameter interpretiert werden, kann jedoch mit der Funktion {@link #ellipseMode(int) ellipseMode()} geändert werden.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param a meist die x-Koordinate des Mittelpunkts (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param b meist die y-Koordinate des Mittelpunkts (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param c meist die Breite des Rechtecks (kann durch ellipseMode() geändert werden).
|
||||||
|
* @param d meist die Höhe des Rechtecks (kann durch ellipseMode() geändert werden).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void ellipse(int a, int b, int c, int d) {
|
||||||
|
picture.ellipse(a,b,c,d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Dreieck auf das Bild.
|
||||||
|
* Ein Dreieck ist eine Ebene, die durch die Verbindung von drei Punkten entsteht. Die ersten beiden Argumente spezifizieren den
|
||||||
|
* ersten Punkt, die mittleren beiden Argumente spezifizieren den zweiten Punkt und die letzten beiden Argumente spezifizieren den dritten Punkt.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x1 meist die x-Koordinate des 1. Punkts.
|
||||||
|
* @param y1 meist die y-Koordinate des 1. Punkts.
|
||||||
|
* @param x2 meist die x-Koordinate des 2. Punkts.
|
||||||
|
* @param y2 meist die y-Koordinate des 2. Punkts.
|
||||||
|
* @param x3 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y3 meist die y-Koordinate des 3. Punkts.
|
||||||
|
*/
|
||||||
|
public void triangle(int x1, int y1, int x2, int y2, int x3, int y3) {
|
||||||
|
picture.triangle(x1,y1,x2,y2,x3,y3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Viereck auf das Bild.
|
||||||
|
* Ein Viereck ist ein vierseitiges Polygon. Es ist ähnlich wie ein Rechteck, aber die Winkel zwischen seinen Kanten
|
||||||
|
* sind nicht auf neunzig Grad beschränkt. Das erste Paar von Parametern (x1,y1) setzt den ersten Scheitelpunkt und die nachfolgenden
|
||||||
|
* Paare sollten im Uhrzeigersinn oder gegen den Uhrzeigersinn um die definierte Form herum verlaufen.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x1 meist die x-Koordinate des 1. Punkts.
|
||||||
|
* @param y1 meist die y-Koordinate des 1. Punkts.
|
||||||
|
* @param x2 meist die x-Koordinate des 2. Punkts.
|
||||||
|
* @param y2 meist die y-Koordinate des 2. Punkts.
|
||||||
|
* @param x3 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y3 meist die y-Koordinate des 3. Punkts.
|
||||||
|
* @param x4 meist die x-Koordinate des 3. Punkts.
|
||||||
|
* @param y4 meist die y-Koordinate des 3. Punkts.
|
||||||
|
*/
|
||||||
|
public void quad(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) {
|
||||||
|
picture.quad(x1,y1,x2,y2,x3,y3,x4,y4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet ein Polygon auf das Bild.
|
||||||
|
* Gleich lange Listen von x und y-Koordinaten bestimmen die Eckpunkte des Polygons.
|
||||||
|
* Durch den Befehl {@link #fill(int,int,int) fill()} /{@link #noFill() noFill()} kann die Füllfarbe des Rechtecks gewählt werden, durch {@link #stroke(int, int, int) stroke()}/{@link #noStroke() noStroke()} die Rahmenfarbe.
|
||||||
|
* @param x Liste der x-Koordinaten der Punkte.
|
||||||
|
* @param y Liste der y-Koordinaten der Punkte.
|
||||||
|
*/
|
||||||
|
public void polygon(int[] x, int[] y) {
|
||||||
|
picture.polygon(x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zeichnet einen Punkt, d.h. einen Kreis in der Dimension eines Pixels.
|
||||||
|
* Der erste Parameter ist der x-Wert für den Punkt, der zweite Wert ist der y-Wert für den Punkt.
|
||||||
|
* @param x x-Koordinate des Punktes
|
||||||
|
* @param y y-Koordinate des Punktes
|
||||||
|
*/
|
||||||
|
public void point(int x, int y) {
|
||||||
|
picture.point(x,y);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ändert den Koordinaten-Modus beim Zeichnen von Rechtecken.
|
||||||
|
* Ändert die Position, von der aus Rechtecke gezeichnet werden, indem es die Art und Weise ändert, wie Parameter, die an rect() übergeben werden, interpretiert werden.
|
||||||
|
* Der Standardmodus ist rectMode(Bild.CORNER), der die ersten beiden Parameter von rect() als die linke obere Ecke der Form interpretiert,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* rectMode(Bild.CORNERS) interpretiert die ersten beiden Parameter von rect() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als die Position der gegenüberliegenden Ecke.
|
||||||
|
* rectMode(Bild.CENTER) interpretiert die ersten beiden Parameter von rect() als Mittelpunkt der Form,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* rectMode(RADIUS) verwendet auch die ersten beiden Parameter von rect() als Mittelpunkt der Form,
|
||||||
|
* verwendet aber den dritten und vierten Parameter, um die Hälfte der Breite und Höhe der Formen festzulegen.
|
||||||
|
* @param mode Modus der Koordinateninterpretation (CORNER, CORNERS, CENTER oder RADIUS)
|
||||||
|
*/
|
||||||
|
public void rectMode(int mode) {
|
||||||
|
picture.rectMode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ändert den Koordinaten-Modus beim Zeichnen von Kreisen/Ellipsen.
|
||||||
|
* Ändert die Position, von der aus Kreise/Ellipsen gezeichnet werden, indem es die Art und Weise ändert, wie Parameter, die an ellipse() übergeben werden, interpretiert werden.
|
||||||
|
* Der Standardmodus ist ellipseMode(Bild.CENTER), der die ersten beiden Parameter von ellipse() als Mittelpunkt der Form interpretiert,
|
||||||
|
* während der dritte und vierte Parameter seine Breite und Höhe sind.
|
||||||
|
* ellipseMode(Bild.CORNER) interpretiert die ersten beiden Parameter von ellipse() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als Breite und Höhe der Form.
|
||||||
|
* ellipseMode(Bild.CORNERS) interpretiert die ersten beiden Parameter von ellipse() als die Position einer Ecke
|
||||||
|
* und die dritten und vierten Parameter als die Position der gegenüberliegenden Ecke.
|
||||||
|
* ellipseMode(RADIUS) verwendet auch die ersten beiden Parameter von ellipse() als Mittelpunkt der Form,
|
||||||
|
* verwendet aber den dritten und vierten Parameter, um die Hälfte der Breite und Höhe der Formen festzulegen.
|
||||||
|
* @param mode Modus der Koordinateninterpretation (CORNER, CORNERS, CENTER oder RADIUS)
|
||||||
|
*/
|
||||||
|
public void ellipseMode(int mode) {
|
||||||
|
picture.ellipseMode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird hexadezimal in Form der RGB angegeben: z.B. "CCFFAA" oder "004E23". Die Syntax verwendet sechs Ziffern - je zwei für die roten, grünen und blauen Komponenten,
|
||||||
|
* um eine Farbe anzugeben (genau wie Farben typischerweise in HTML und CSS angegeben werden).
|
||||||
|
* @param pencolor Stiftfarbe in Hexadezimaldarstellung
|
||||||
|
*/
|
||||||
|
public void stroke(String pencolor) {
|
||||||
|
picture.stroke(pencolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird entweder als Graustufe (0-255) oder als 3-Byte RGB-Wert angegeben
|
||||||
|
* @param pencolor Stiftfarbe (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void stroke(int pencolor) {
|
||||||
|
picture.stroke(pencolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Linien und Ränder um Formen gezeichnet werden.
|
||||||
|
* Diese Farbe wird komponentenweise als RGB-Wert angegeben
|
||||||
|
* @param r Rotanteil (0-255) der Stiftfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Stiftfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Stiftfarbe
|
||||||
|
*/
|
||||||
|
public void stroke(int r, int g, int b) {
|
||||||
|
picture.stroke(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt fest, dass keine Linien oder Ränder um Formen gezeichnet werden soll.
|
||||||
|
*/
|
||||||
|
public void noStroke() {
|
||||||
|
picture.noStroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Breite des Strichs für Linien, Punkte und den Rand um Formen fest.
|
||||||
|
* Alle Breiten werden in Pixeleinheiten angegeben.
|
||||||
|
* @param width Breite in Pixel
|
||||||
|
*/
|
||||||
|
public void strokeWeight(double width) {
|
||||||
|
picture.strokeWeight(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird hexadezimal in Form der RGB angegeben: z.B. "CCFFAA" oder "004E23". Die Syntax verwendet sechs Ziffern - je zwei für die roten, grünen und blauen Komponenten,
|
||||||
|
* um eine Farbe anzugeben (genau wie Farben typischerweise in HTML und CSS angegeben werden).
|
||||||
|
* @param fillcolor Füllfarbe in Hexadezimaldarstellung
|
||||||
|
*/
|
||||||
|
public void fill(String fillcolor) {
|
||||||
|
picture.fill(fillcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird entweder als Graustufe (0-255) oder als 3-Byte RGB-Wert angegeben.
|
||||||
|
* @param fillcolor Füllfarbe (0-255: Graustufe zwischen 0 schwarz und 255 weiß, sonst: c wird als 3-Byte RGB-Wert interpretiert)
|
||||||
|
*/
|
||||||
|
public void fill(int fillcolor) {
|
||||||
|
picture.fill(fillcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Farbe fest, mit der Formen gefüllt werden.
|
||||||
|
* Diese Farbe wird komponentenweise als RGB-Wert angegeben.
|
||||||
|
* @param r Rotanteil (0-255) der Füllfarbe
|
||||||
|
* @param g Grünanteil (0-255) der Füllfarbe
|
||||||
|
* @param b Blauanteil (0-255) der Füllfarbe
|
||||||
|
*/
|
||||||
|
public void fill(int r, int g, int b) {
|
||||||
|
picture.fill(r,g,b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Legt fest, dass die Formen nicht gefüllt werden sollen.
|
||||||
|
*/
|
||||||
|
public void noFill() {
|
||||||
|
picture.noFill();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht den Inhalt des Bildes.
|
||||||
|
* Der Hintergrund wird mit der Hintergrundfarbe neu gefüllt.
|
||||||
|
*/
|
||||||
|
public void clear(){
|
||||||
|
picture.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lädt ein Bild aus dem Dateisystem.
|
||||||
|
* Lädt ein Bild von einem Datenträger und setzt Stiftfarbe und Füllfarbe auf Standardwerte zurück.
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public void load(String filename) {
|
||||||
|
picture.load(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert ein Bild.
|
||||||
|
* Speichert ein Bild auf einem Datenträger. Zulässig sind die Dateiformate PNG und GIF. Die Dateiendung legt den Typ fest.
|
||||||
|
* Standardmäßig wird die Dateiendung .png ergänzt, wenn keine angegeben ist.
|
||||||
|
* @param filename Dateiname des Bildes
|
||||||
|
*/
|
||||||
|
public void save(String filename) {
|
||||||
|
picture.save(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt einen Text an den gegebenen Koordinaten aus
|
||||||
|
* Zur Ausgabe des Textes wird der ausgewählte Font verwendet. Dieser muss vorher mit {@link #textFont(Font) textFont() } festgelegt.
|
||||||
|
* @param t Text, der angezeigt werden soll
|
||||||
|
* @param x x-Koordinate des Textanfangs
|
||||||
|
* @param y y-Koordinate der Grundlinie des Textes.
|
||||||
|
*/
|
||||||
|
public void text(String t, int x, int y) {
|
||||||
|
picture.text(t,x,y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legt die Schriftart für Textausgaben fest.
|
||||||
|
* Jeder übliche Java-Font kann verwendet werden. Er kann mit z.B. Font f = new Font( "Arial", Font.PLAIN, 14 ); definiert werden.
|
||||||
|
* @param font ein Font-Objekt
|
||||||
|
*/
|
||||||
|
public void textFont(Font font) {
|
||||||
|
picture.textFont(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert das Bild als zweidimensionales Pixel-Array.
|
||||||
|
* @return zweidimensionales Array von Color-Objekten, die den Pixeln des Bildes entsprechen.
|
||||||
|
*/
|
||||||
|
public Color[][] getPixelArray() {
|
||||||
|
return picture.getPixelArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt das Bild neu auf Basis des Pixel-Arrays.
|
||||||
|
* Die Größe des Bildes wird nicht automatisch an das Array angepasst.
|
||||||
|
* @param pixel zweidimensionales Array von Color-Objekten
|
||||||
|
*/
|
||||||
|
public void setPixelArray(Color[][] pixel) {
|
||||||
|
picture.setPixelArray(pixel);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,894 @@
|
||||||
|
/**
|
||||||
|
* Die Klasse Table vereinfacht den Zugriff auf CSV-Dateien.
|
||||||
|
* Die Klassen Table und TableRow ermöglichen einen einfachen Zugriff auf tabellenbasierte
|
||||||
|
* Dokumente.
|
||||||
|
*
|
||||||
|
* @author Thomas Schaller
|
||||||
|
* @version 1.0 vom 01.02.2019
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.jdom.Document;
|
||||||
|
import org.jdom.Element;
|
||||||
|
import org.jdom.Attribute;
|
||||||
|
import org.jdom.JDOMException;
|
||||||
|
import org.jdom.input.SAXBuilder;
|
||||||
|
import org.jdom.output.XMLOutputter;
|
||||||
|
import org.jdom.output.Format;
|
||||||
|
|
||||||
|
public class Table
|
||||||
|
{
|
||||||
|
// Standardtrennzeichen für Spalten
|
||||||
|
private static final char DEFAULT_SEPARATOR = ';';
|
||||||
|
// Standardmarkierung für Texte
|
||||||
|
private static final char DEFAULT_QUOTE = '"';
|
||||||
|
// Standardtrennzeichen für Dezimalzahlen
|
||||||
|
private static final char DEFAULT_COMMA = ',';
|
||||||
|
|
||||||
|
// mögliche Spaltentypen
|
||||||
|
private static final String UNKNOWN ="UNKOWN";
|
||||||
|
private static final String INT = "INTEGER";
|
||||||
|
private static final String DOUBLE = "DOUBLE";
|
||||||
|
private static final String FLOAT = "FLOAT";
|
||||||
|
|
||||||
|
// interne Verwaltung des Dokuments als JDOM-Document-Objekt
|
||||||
|
private Document doc;
|
||||||
|
// Verweis auf Element für Kopfzeile
|
||||||
|
private Element header;
|
||||||
|
// Ende Attribute
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt leeres Tabellen-Dokument.
|
||||||
|
*/
|
||||||
|
public Table() {
|
||||||
|
this.doc = new Document();
|
||||||
|
doc.setRootElement(new Element("CSV-Data"));
|
||||||
|
this.header = new Element("Header");
|
||||||
|
doc.getRootElement().addContent(header);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt Tabellen-Dokument aus einer CSV-Datei.
|
||||||
|
* Liest den Inhalt einer Datei und erstellt ein Tabellenobjekt mit seinen Werten.
|
||||||
|
* Wenn die Datei eine Kopfzeile enthält, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile hat,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile enthält.
|
||||||
|
* @param separator Trennzeichen für Spalten (meist ';' oder ',' oder '\t' für Tab)
|
||||||
|
* @param quote Kennung für Texte (meist '"').
|
||||||
|
*/
|
||||||
|
public Table(String filename, String options, char separator, char quote) {
|
||||||
|
loadCSV(filename, options, separator, quote);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt Tabellen-Dokument aus einer CSV-Datei.
|
||||||
|
* Liest den Inhalt einer Datei und erstellt ein Tabellenobjekt mit seinen Werten (Separator = ';', Kennung für Text = '"').
|
||||||
|
* Wenn die Datei eine Kopfzeile enthält, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile hat,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile enthält.
|
||||||
|
*/
|
||||||
|
public Table(String filename, String options) {
|
||||||
|
loadCSV(filename, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt Tabellen-Dokument aus einer CSV-Datei.
|
||||||
|
* Liest den Inhalt einer Datei ohne Kopfzeile und erstellt ein Tabellenobjekt mit seinen Werten (Separator = ';', Kennung für Text = '"').
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
*/
|
||||||
|
public Table(String filename) {
|
||||||
|
loadCSV(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Anfang Methoden
|
||||||
|
/**
|
||||||
|
* Liest den Inhalt einer CSV-Datei ohne Kopfzeile (Separator = ';', Kennung für Text = '"').
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
*/
|
||||||
|
public void loadCSV(String filename) {
|
||||||
|
loadCSV(filename, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liest den Inhalt einer CSV-Datei (Separator = ';', Kennung für Text = '"').
|
||||||
|
* Wenn die Datei eine Kopfzeile enthält, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile hat,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile enthält.
|
||||||
|
*/
|
||||||
|
public void loadCSV(String filename, String options) {
|
||||||
|
loadCSV(filename, options, DEFAULT_SEPARATOR, DEFAULT_QUOTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liest den Inhalt einer CSV-Datei.
|
||||||
|
* Wenn die Datei eine Kopfzeile enthält, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile hat,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile enthält.
|
||||||
|
* @param separator Trennzeichen für Spalten (meist ';' oder ',' oder '\t' für Tab)
|
||||||
|
* @param quote Kennung für Texte (meist '"').
|
||||||
|
*/
|
||||||
|
public void loadCSV(String filename, String options, char separator, char quote) {
|
||||||
|
doc = new Document();
|
||||||
|
doc.setRootElement(new Element("CSV-Data"));
|
||||||
|
header = new Element("Header");
|
||||||
|
doc.getRootElement().addContent(header);
|
||||||
|
try {
|
||||||
|
File f = new File(filename);
|
||||||
|
Scanner scanner = new Scanner(new File(filename));
|
||||||
|
if(options.toLowerCase().contains("header") && scanner.hasNext()) {
|
||||||
|
List<String> entries = parseLine(scanner.nextLine(), separator, quote);
|
||||||
|
int i= 0;
|
||||||
|
for(String s : entries) {
|
||||||
|
Element entry = new Element("Column");
|
||||||
|
header.addContent(entry);
|
||||||
|
entry.setText(s);
|
||||||
|
entry.setAttribute("type", "unknown");
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Element> cols = header.getChildren();
|
||||||
|
|
||||||
|
while (scanner.hasNext()) {
|
||||||
|
Element line = new Element("Row");
|
||||||
|
doc.getRootElement().addContent(line);
|
||||||
|
List<String> entries = parseLine(scanner.nextLine(), separator, quote);
|
||||||
|
int i= 0;
|
||||||
|
|
||||||
|
for(String s : entries) {
|
||||||
|
|
||||||
|
if(i==cols.size()) {
|
||||||
|
Element entry = new Element("Column");
|
||||||
|
entry.setAttribute("type", "unknown");
|
||||||
|
header.addContent(entry);
|
||||||
|
cols = header.getChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
Element entry = new Element("Entry");
|
||||||
|
entry.setText(s);
|
||||||
|
line.addContent(entry);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scanner.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Fehler beim Lesen der CSV-Datei");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert das aktuelle Dokument als CSV-Datei ohne Kopfzeile (Separator = ';', Kennung für Text = '"').
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
*/
|
||||||
|
public void saveCSV(String filename) {
|
||||||
|
saveCSV(filename, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert das aktuelle Dokument als CSV-Datei (Separator = ';', Kennung für Text = '"').
|
||||||
|
* Wenn die Datei eine Kopfzeile enthalten, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile haben soll,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile haben soll.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
*/
|
||||||
|
public void saveCSV(String filename, String options) {
|
||||||
|
saveCSV(filename, options, DEFAULT_SEPARATOR, DEFAULT_QUOTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Speichert das aktuelle Dokument als CSV-Datei.
|
||||||
|
* Wenn die Datei eine Kopfzeile enthalten, fügen Sie "header" in den Parameter options ein. Wenn die Datei keine Kopfzeile haben soll,
|
||||||
|
* dann lassen Sie einfach die Option "header" weg.
|
||||||
|
* @param options Geben Sie hier "header" an, wenn die Datei eine Kopfzeile haben soll.
|
||||||
|
* @param filename Dateiname der CSV-Datei.
|
||||||
|
* @param separator Trennzeichen für Spalten (meist ';' oder ',' oder '\t' für Tab)
|
||||||
|
* @param quote Kennung für Texte (meist '"').
|
||||||
|
*/
|
||||||
|
public void saveCSV(String filename, String options, char separator, char quote){
|
||||||
|
try{
|
||||||
|
File f = new File(filename);
|
||||||
|
PrintStream outputFile = new PrintStream (f);
|
||||||
|
System.out.println("Speicher in : "+f.getAbsolutePath());
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
String sq = ""+quote;
|
||||||
|
String ss = ""+separator;
|
||||||
|
if(quote =='"') sq = "\"";
|
||||||
|
if(separator =='"') ss = "\"";
|
||||||
|
|
||||||
|
if(options.toLowerCase().contains("header")) {
|
||||||
|
String h = "";
|
||||||
|
for(Element c : columns) {
|
||||||
|
h += ss + sq + c.getText()+sq;
|
||||||
|
}
|
||||||
|
outputFile.println(h.substring(1));
|
||||||
|
}
|
||||||
|
for(int i = 0; i<getRowCount(); i++) {
|
||||||
|
String l = "";
|
||||||
|
for(String s: getStringRow(i)) {
|
||||||
|
|
||||||
|
if(s.contains(""+separator)) {
|
||||||
|
if(quote == '"' && s.contains("\"")) {
|
||||||
|
s = s.replace("\"","\"\"");
|
||||||
|
}
|
||||||
|
l += ss + sq + s+sq;
|
||||||
|
} else {
|
||||||
|
l += ss+s;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
outputFile.println(l.substring(1));
|
||||||
|
}
|
||||||
|
outputFile.close();
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
System.out.println("Fehler beim Schreiben der Datei");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Speichert die Tabelle als XML-Dokument.
|
||||||
|
* @param filename Dateiname des XML-Files
|
||||||
|
*/
|
||||||
|
public void saveXML(String filename) {
|
||||||
|
try {
|
||||||
|
// new XMLOutputter().output(doc, System.out);
|
||||||
|
XMLOutputter xmlOutput = new XMLOutputter();
|
||||||
|
|
||||||
|
// display nice nice
|
||||||
|
xmlOutput.setFormat(Format.getPrettyFormat());
|
||||||
|
File f = new File(filename);
|
||||||
|
FileOutputStream outputFile = new FileOutputStream(f);
|
||||||
|
System.out.println("Speicher in : "+f.getAbsolutePath() );
|
||||||
|
xmlOutput.output(doc, outputFile);
|
||||||
|
outputFile.close();
|
||||||
|
System.out.println("File Saved!");
|
||||||
|
} catch (IOException io) {
|
||||||
|
System.out.println(io.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------- Zeigerbewegungen --------------------------------------------------
|
||||||
|
|
||||||
|
/** HIlfsfunktion für die Analyse einer Dateizeile
|
||||||
|
* @param cvsLine Zeile aus der Datei
|
||||||
|
* @return Liste von String für die einzelnen Spalten
|
||||||
|
*/
|
||||||
|
private List<String> parseLine(String cvsLine) {
|
||||||
|
return parseLine(cvsLine, DEFAULT_SEPARATOR, DEFAULT_QUOTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** HIlfsfunktion für die Analyse einer Dateizeile
|
||||||
|
* @param cvsLine Zeile aus der Datei
|
||||||
|
* @param sparator Trennzeichen für die Spalten
|
||||||
|
* @return Liste von String für die einzelnen Spalten
|
||||||
|
*/
|
||||||
|
private List<String> parseLine(String cvsLine, char separator) {
|
||||||
|
return parseLine(cvsLine, separator, DEFAULT_QUOTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** HIlfsfunktion für die Analyse einer Dateizeile
|
||||||
|
* @param cvsLine Zeile aus der Datei
|
||||||
|
* @param sparator Trennzeichen für die Spalten
|
||||||
|
* @param customQuote Kennung für Strings
|
||||||
|
* @return Liste von String für die einzelnen Spalten
|
||||||
|
*/
|
||||||
|
private List<String> parseLine(String cvsLine, char separator, char customQuote) {
|
||||||
|
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
|
||||||
|
//if empty, return!
|
||||||
|
if (cvsLine == null && cvsLine.isEmpty()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//ggf. Default-Value laden
|
||||||
|
if (customQuote == ' ') {
|
||||||
|
customQuote = DEFAULT_QUOTE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (separator == ' ') {
|
||||||
|
separator = DEFAULT_SEPARATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer curVal = new StringBuffer();
|
||||||
|
boolean inQuotes = false;
|
||||||
|
boolean startCollectChar = false;
|
||||||
|
boolean doubleQuotesInColumn = false;
|
||||||
|
|
||||||
|
char[] chars = cvsLine.toCharArray();
|
||||||
|
|
||||||
|
for (char ch : chars) {
|
||||||
|
|
||||||
|
if (inQuotes) { // aktueller Text ist in Quotes eingeschlossen
|
||||||
|
startCollectChar = true;
|
||||||
|
|
||||||
|
if (ch == customQuote) { // Quotes werden beendet, aber Achtung bei "" => Metazeichen
|
||||||
|
inQuotes = false;
|
||||||
|
if (ch == '\"') {
|
||||||
|
doubleQuotesInColumn = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (ch == '\"' && !doubleQuotesInColumn) {
|
||||||
|
doubleQuotesInColumn = true;
|
||||||
|
} else {
|
||||||
|
curVal.append(ch);
|
||||||
|
doubleQuotesInColumn = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ch == customQuote) {
|
||||||
|
|
||||||
|
inQuotes = true;
|
||||||
|
|
||||||
|
//Fixed : allow "" in empty quote enclosed
|
||||||
|
if (ch == '\"'){
|
||||||
|
if(doubleQuotesInColumn) {
|
||||||
|
curVal.append('"');
|
||||||
|
doubleQuotesInColumn = false;
|
||||||
|
} else doubleQuotesInColumn = true;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
doubleQuotesInColumn = false;
|
||||||
|
if (ch == separator) {
|
||||||
|
|
||||||
|
result.add(curVal.toString());
|
||||||
|
|
||||||
|
curVal = new StringBuffer();
|
||||||
|
startCollectChar = false;
|
||||||
|
|
||||||
|
} else if (ch == '\r') {
|
||||||
|
//ignore LF characters
|
||||||
|
continue;
|
||||||
|
} else if (ch == '\n') {
|
||||||
|
//the end, break!
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
curVal.append(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
result.add(curVal.toString());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sucht die Nummer einer durch Namen gegebenen Spalte.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Nummer der Spalte
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int findColumnNumber(String name) {
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
int i = 0;
|
||||||
|
for(Element c : columns) {
|
||||||
|
if (c.getText().toLowerCase().equals(name.toLowerCase())) {
|
||||||
|
return i;
|
||||||
|
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine neue Spalte am Ende der Tabelle an.
|
||||||
|
*/
|
||||||
|
public void addColumn() {
|
||||||
|
Element entry = new Element("Column");
|
||||||
|
entry.setAttribute("type", Table.UNKNOWN);
|
||||||
|
header.addContent(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine neue Spalte am Ende der Tabelle an und benennt sie.
|
||||||
|
* @param title Bezeichnung der Spalte
|
||||||
|
*/
|
||||||
|
public void addColumn(String title) {
|
||||||
|
addColumn();
|
||||||
|
Element nc = ((List<Element>)(header.getChildren())).get(header.getChildren().size()-1);
|
||||||
|
nc.setText(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine neue Spalte am Ende der Tabelle an und benennt und typisiert sie.
|
||||||
|
* @param title Bezeichnung der Spalte
|
||||||
|
* @param type Typ der Spalte (UNKNOWN, DOUBLE, INTEGER, FLOAT)
|
||||||
|
*/
|
||||||
|
public void addColumn(String title, String type) {
|
||||||
|
addColumn(title);
|
||||||
|
Element nc = ((List<Element>)(header.getChildren())).get(header.getChildren().size()-1);
|
||||||
|
nc.setAttribute("type", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht eine Spalte.
|
||||||
|
* @param i Nummer der Spalte.
|
||||||
|
*/
|
||||||
|
public void removeColumn(int i) {
|
||||||
|
List<Element> lines = doc.getRootElement().getChildren();
|
||||||
|
for(Element l : lines) {
|
||||||
|
if(l.getChildren().size()>i) l.removeContent(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht eine Spalte
|
||||||
|
* @param name Name der Spalte
|
||||||
|
*/
|
||||||
|
public void removeColumn(String name) {
|
||||||
|
try{
|
||||||
|
removeColumn(findColumnNumber(name));
|
||||||
|
} catch(Exception e) { System.out.println("Unbekannter Spaltenname");}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Anzahl der Spalten in der Tabelle
|
||||||
|
* @return Anzahl der Spalten
|
||||||
|
*/
|
||||||
|
public int getColumnCount() {
|
||||||
|
return header.getChildren().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Anzahl der Zeilen in der Tabelle
|
||||||
|
* @return Anzahl der Zeilen
|
||||||
|
*/
|
||||||
|
public int getRowCount() {
|
||||||
|
return doc.getRootElement().getChildren().size()-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht alle Zeilen der Tabelle.
|
||||||
|
* Die Spaltenüberschriften und Typen bleiben erhalten.
|
||||||
|
*/
|
||||||
|
public void clearRows() {
|
||||||
|
doc.getRootElement().removeChildren("Row");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fügt eine neue Zeile an das Ende der Tabelle an.
|
||||||
|
* @return ein TableRow-Objekt für diese neue Zeile
|
||||||
|
*/
|
||||||
|
public TableRow addRow() {
|
||||||
|
Element row = new Element("Row");
|
||||||
|
doc.getRootElement().addContent(row);
|
||||||
|
return new TableRow(doc, row);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Löscht eine Zeile
|
||||||
|
* @param i Nummer der Zeile
|
||||||
|
*/
|
||||||
|
public void removeRow(int i) {
|
||||||
|
if(i<getRowCount()) {
|
||||||
|
doc.getRootElement().removeContent(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert eine Zeile der Tabelle
|
||||||
|
* @param i Nummer der Zeile
|
||||||
|
* @return TableRow-Objekt für diese Zeile
|
||||||
|
*/
|
||||||
|
public TableRow getRow(int i) {
|
||||||
|
if(i<getRowCount()) {
|
||||||
|
List<Element> rows = doc.getRootElement().getChildren();
|
||||||
|
return new TableRow(doc, rows.get(i+1));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die ganze Tabelle als Array von TableRow-Objekten
|
||||||
|
* @return Array von TableRow-Objekten
|
||||||
|
*/
|
||||||
|
public TableRow[] rows() {
|
||||||
|
TableRow[] rows = new TableRow[getRowCount()];
|
||||||
|
for(int i = 0; i < getRowCount(); i++) {
|
||||||
|
rows[i] = getRow(i);
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Integer-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public int getInt(int row, int column) {
|
||||||
|
return getRow(row).getInt(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Integer-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public int getInt(int row, String name) {
|
||||||
|
return getRow(row).getInt(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Integer-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setInt(int row, int column,int value) {
|
||||||
|
getRow(row).setInt(column, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Integer-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setInt(int row, String name, int value) {
|
||||||
|
getRow(row).setInt(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Zeile als Integer-Array.
|
||||||
|
* @param row Nummer der Zeile
|
||||||
|
* @return int-Array, dass alle Werte der Zeile enthält
|
||||||
|
*/
|
||||||
|
public int[] getIntRow(int row) {
|
||||||
|
try{
|
||||||
|
TableRow trow = getRow(row);
|
||||||
|
int anz = getColumnCount();
|
||||||
|
int[] r = new int[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = trow.getInt(i);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Integer-Array.
|
||||||
|
* @param column Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public int[] getIntColumn(int column) {
|
||||||
|
try{
|
||||||
|
int anz = getRowCount();
|
||||||
|
int[] r = new int[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = getInt(i, column);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Integer-Array.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public int[] getIntColumn(String name) {
|
||||||
|
return getIntColumn(findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public float getFloat(int row, int column) {
|
||||||
|
return getRow(row).getFloat(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public float getFloat(int row, String name) {
|
||||||
|
return getRow(row).getFloat(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setFloat(int row, int column,float value) {
|
||||||
|
getRow(row).setFloat(column, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setFloat(int row, String name, float value) {
|
||||||
|
getRow(row).setFloat(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Zeile als Float-Array.
|
||||||
|
* @param row Nummer der Zeile
|
||||||
|
* @return int-Array, dass alle Werte der Zeile enthält
|
||||||
|
*/
|
||||||
|
public float[] getFloatRow(int row) {
|
||||||
|
try{
|
||||||
|
TableRow trow = getRow(row);
|
||||||
|
int anz = getColumnCount();
|
||||||
|
float[] r = new float[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = trow.getFloat(i);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Float-Array.
|
||||||
|
* @param column Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public float[] getFloatColumn(int column) {
|
||||||
|
try{
|
||||||
|
int anz = getRowCount();
|
||||||
|
float[] r = new float[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = getFloat(i, column);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Float-Array.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public float[] getFloatColumn(String name) {
|
||||||
|
return getFloatColumn(findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public double getDouble(int row, int column) {
|
||||||
|
return getRow(row).getDouble(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public double getDouble(int row, String name) {
|
||||||
|
return getRow(row).getDouble(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setDouble(int row, int column,double value) {
|
||||||
|
getRow(row).setDouble(column, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setDouble(int row, String name, double value) {
|
||||||
|
getRow(row).setDouble(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Double-Array.
|
||||||
|
* @param row Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public double[] getDoubleRow(int row) {
|
||||||
|
try{
|
||||||
|
TableRow trow = getRow(row);
|
||||||
|
int anz = getColumnCount();
|
||||||
|
double[] r = new double[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = trow.getDouble(i);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Double-Array.
|
||||||
|
* @param column Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public double[] getDoubleColumn(int column) {
|
||||||
|
try{
|
||||||
|
int anz = getRowCount();
|
||||||
|
double[] r = new double[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = getDouble(i, column);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als Double-Array.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public double[] getDoubleColumn(String name) {
|
||||||
|
return getDoubleColumn(findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als String
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public String getString(int row, int column) {
|
||||||
|
return getRow(row).getString(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als String
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public String getString(int row, String name) {
|
||||||
|
return getRow(row).getString(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als String
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param column Spaltennummer
|
||||||
|
* @param text neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setString(int row, int column,String text) {
|
||||||
|
getRow(row).setString(column, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als String
|
||||||
|
* @param row Zeilennummer
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param text neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setString(int row, String name, String text) {
|
||||||
|
getRow(row).setString(name, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als String-Array.
|
||||||
|
* @param row Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public String[] getStringRow(int row) {
|
||||||
|
try{
|
||||||
|
TableRow trow = getRow(row);
|
||||||
|
int anz = getColumnCount();
|
||||||
|
String[] r = new String[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = trow.getString(i);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als String-Array.
|
||||||
|
* @param column Nummer der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public String[] getStringColumn(int column) {
|
||||||
|
try{
|
||||||
|
int anz = getRowCount();
|
||||||
|
String[] r = new String[anz];
|
||||||
|
for(int i=0; i<anz; i++) {
|
||||||
|
r[i] = getString(i, column);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Werte einer Spalte als String-Array.
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return int-Array, dass alle Werte der Spalte enthält
|
||||||
|
*/
|
||||||
|
public String[] getStringColumn(String name) {
|
||||||
|
return getStringColumn(findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sucht nach einem bestimmtem Wert in einer Zeile.
|
||||||
|
* @param value Wert der gesucht werden soll
|
||||||
|
* @param column Nummer der Spalte, die durchsucht werden soll
|
||||||
|
* @return TableRow-Objekt der Zeile, wenn der Wert gefunden wurde, sonst null
|
||||||
|
*/
|
||||||
|
public TableRow findRow(String value, int column) {
|
||||||
|
for(int i=0; i<getRowCount(); i++) {
|
||||||
|
if(getString(i,column).equals(value)){
|
||||||
|
return getRow(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sucht nach einem bestimmtem Wert in einer Zeile.
|
||||||
|
* @param value Wert der gesucht werden soll
|
||||||
|
* @param name Name der Spalte, die durchsucht werden soll
|
||||||
|
* @return TableRow-Objekt der Zeile, wenn der Wert gefunden wurde, sonst null
|
||||||
|
*/
|
||||||
|
public TableRow findRow(String value, String name) {
|
||||||
|
return findRow(value, findColumnNumber(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Kürzt alle Einträge der Tabelle um unnötige Leerzeichen am Anfang oder Ende
|
||||||
|
*/
|
||||||
|
public void trim() {
|
||||||
|
for(int y=0; y<getRowCount(); y++) {
|
||||||
|
for (int x =0; x<getColumnCount(); x++) {
|
||||||
|
setString(y,x,getString(y,x).trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,312 @@
|
||||||
|
/**
|
||||||
|
* Repräsentiert eine Zeile eines Table-Objekts.
|
||||||
|
* Erlaubt einen einfachen Zugriff auf die einzelnen Einträge in dieser Zeile.
|
||||||
|
*
|
||||||
|
* @author Thomas Schaller
|
||||||
|
* @version V1.0 vom 01.02.2019
|
||||||
|
*/
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.jdom.Document;
|
||||||
|
import org.jdom.Element;
|
||||||
|
import org.jdom.Attribute;
|
||||||
|
import org.jdom.JDOMException;
|
||||||
|
import org.jdom.input.SAXBuilder;
|
||||||
|
import org.jdom.output.XMLOutputter;
|
||||||
|
import org.jdom.output.Format;
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
|
||||||
|
public class TableRow
|
||||||
|
{
|
||||||
|
// Verweis auf das ganze Dokument
|
||||||
|
private Document doc;
|
||||||
|
// Verweis auf die Zeile, für die dieses Objekt steht
|
||||||
|
private Element current;
|
||||||
|
// Verweis auf die Kopfzeile
|
||||||
|
private Element header;
|
||||||
|
// Für die Interpretation von Zahlenwerten
|
||||||
|
NumberFormat format = NumberFormat.getInstance();
|
||||||
|
|
||||||
|
// Ende Attribute
|
||||||
|
/**
|
||||||
|
* Erzeugt ein TableRow-Objekt.
|
||||||
|
* Diese Methode ist für den internen Gebraucht. Einige Methode der Table-Klasse erzeugen mit diesem Konstruktor TableRow-Objekte.
|
||||||
|
* @param doc JDOM-Dokument, das für die ganze Tabelle steht.
|
||||||
|
* @param row JDOM-Element, das für die aktuelle Zeile steht.
|
||||||
|
*/
|
||||||
|
public TableRow(Document doc, Element row) {
|
||||||
|
this.doc = doc;
|
||||||
|
this.current = row;
|
||||||
|
this.header = doc.getRootElement().getChild("Header");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Anzahl der Spalten der Zeile.
|
||||||
|
* @return Anzahl der Spalten
|
||||||
|
*/
|
||||||
|
public int getColumnCount() {
|
||||||
|
return header.getChildren().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Titel einer Spalte
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Name der Spalte
|
||||||
|
*/
|
||||||
|
public String getColumnTitle(int i) {
|
||||||
|
if(i< getColumnCount()) {
|
||||||
|
return ((List<Element>) (header.getChildren())).get(i).getText();
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert die Nummer einer Spalte
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Nummer der Spalte
|
||||||
|
*/
|
||||||
|
public int getColumn(String name) {
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
int i = 0;
|
||||||
|
while (i < columns.size()) {
|
||||||
|
if (columns.get(i).getText().toLowerCase().equals(name.toLowerCase())) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
} // end of while
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt eine neue Zeile mit i Spalten
|
||||||
|
* Wenn bisher nicht genügend Spalten vorhanden sind, werden automatisch neue Spalten hinzugefügt (auch zum Header)
|
||||||
|
* @param i Anzahl der Spalten
|
||||||
|
*/
|
||||||
|
private Element buildRow(int i) {
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
Element entry=null;
|
||||||
|
for(int j=0; j<=i; j++) {
|
||||||
|
|
||||||
|
if(j==columns.size()) {
|
||||||
|
Element h = new Element("Column");
|
||||||
|
h.setAttribute("type", "unknown");
|
||||||
|
header.addContent(h);
|
||||||
|
columns = header.getChildren();
|
||||||
|
}
|
||||||
|
if(j==current.getChildren().size()) {
|
||||||
|
entry = new Element("Entry");
|
||||||
|
current.addContent(entry);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt eine neue Zeile.
|
||||||
|
* Es werden genügend Spalten erzeugt, dass ein Wert in Spalte "name" eingetragen werden kann
|
||||||
|
* @param name Name der Spalte
|
||||||
|
*/
|
||||||
|
private Element buildRow(String name) {
|
||||||
|
List<Element> columns = header.getChildren();
|
||||||
|
int i = 0;
|
||||||
|
for(Element c: columns) {
|
||||||
|
|
||||||
|
if(c.getText().toLowerCase().equals(name.toLowerCase())) {
|
||||||
|
return buildRow(i);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als String
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public String getString(int i) {
|
||||||
|
if(i >= current.getContent().size()) return "";
|
||||||
|
Element e = (Element) current.getContent(i) ;
|
||||||
|
if(e!=null) {
|
||||||
|
return e.getText();
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als String
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public String getString(String name) {
|
||||||
|
return getString(getColumn(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als String
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @param text neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setString(int i, String text) {
|
||||||
|
|
||||||
|
Element e = buildRow(i);
|
||||||
|
if(e!=null) e.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als String
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param text neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setString(String name, String text) {
|
||||||
|
Element e = buildRow(name);
|
||||||
|
if(e!=null) e.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Int-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public int getInt(int i) {
|
||||||
|
try{
|
||||||
|
Element e = (Element) current.getContent(i) ;
|
||||||
|
return Integer.parseInt(e.getText());
|
||||||
|
} catch(Exception e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Int-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public int getInt(String name) {
|
||||||
|
return getInt(getColumn(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Int-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setInt(int i,int value) {
|
||||||
|
|
||||||
|
Element e = buildRow(i);
|
||||||
|
if(e!=null) e.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Int-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setInt(String name, int value) {
|
||||||
|
Element e = buildRow(name);
|
||||||
|
if(e!=null) e.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public float getFloat(int i) {
|
||||||
|
try{
|
||||||
|
Element e = (Element) current.getContent(i) ;
|
||||||
|
return Float.parseFloat(e.getText().replace(",","."));
|
||||||
|
} catch(Exception e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public float getFloat(String name) {
|
||||||
|
return getFloat(getColumn(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setFloat(int i,float value) {
|
||||||
|
|
||||||
|
Element e = buildRow(i);
|
||||||
|
if(e!=null) e.setText(format.format(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Float-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setFloat(String name, float value) {
|
||||||
|
Element e = buildRow(name);
|
||||||
|
if(e!=null) e.setText(format.format(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public double getDouble(int i) {
|
||||||
|
try{
|
||||||
|
Element e = (Element) current.getContent(i) ;
|
||||||
|
return Double.parseDouble(e.getText().replace(",","."));
|
||||||
|
|
||||||
|
} catch(Exception e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @return Wert der Zelle
|
||||||
|
*/
|
||||||
|
public double getDouble(String name) {
|
||||||
|
return getDouble(getColumn(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param i Nummer der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setDouble(int i,double value) {
|
||||||
|
|
||||||
|
Element e = buildRow(i);
|
||||||
|
if(e!=null) e.setText(format.format(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Wert einer Zelle als Double-Zahl
|
||||||
|
* @param name Name der Spalte
|
||||||
|
* @param value neuer Wert der Zelle
|
||||||
|
*/
|
||||||
|
public void setDouble(String name, double value) {
|
||||||
|
Element e = buildRow(name);
|
||||||
|
if(e!=null) e.setText(format.format(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,637 @@
|
||||||
|
/**
|
||||||
|
* Klasse zum Vereinfachten Zugriff auf XML-Dokumente
|
||||||
|
* Diese Klasse ist für den Einsatz in der Schule gedacht und soll den Schülern
|
||||||
|
* einen einfachen Zugriff auf XML-Dokumente ermöglichen. Die zur Verfügung
|
||||||
|
* stehenden Befehle sind wie in Processing realisiert.
|
||||||
|
* Dabei ist jeder Teilbaum des Dokuments wieder als XML-Objekt zugreifbar, das
|
||||||
|
* intern auf die gleiche XML-Dokumentstruktur zugreift.
|
||||||
|
* Dies ermöglicht bei unsachgemäßem Gebrauch die XML-Struktur zu zerstören. Im
|
||||||
|
* normalen Gebrauch sollte dies aber nicht relevant sein.
|
||||||
|
*
|
||||||
|
* Benötigt: jdom-1.1.3.jar
|
||||||
|
|
||||||
|
* @author Thomas Schaller
|
||||||
|
* @version 1.0 vom 31.01.2019
|
||||||
|
*/
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
import org.jdom.Document;
|
||||||
|
import org.jdom.Element;
|
||||||
|
import org.jdom.Attribute;
|
||||||
|
import org.jdom.JDOMException;
|
||||||
|
import org.jdom.input.SAXBuilder;
|
||||||
|
import org.jdom.output.XMLOutputter;
|
||||||
|
import org.jdom.output.Format;
|
||||||
|
|
||||||
|
public class XML {
|
||||||
|
// Anfang Attribute
|
||||||
|
// XML-Dokumentstruktur
|
||||||
|
private Document doc;
|
||||||
|
// Zeiger auf das aktuelle Element
|
||||||
|
private Element current;
|
||||||
|
// Ende Attribute
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein leeres XMLDokument
|
||||||
|
*/
|
||||||
|
public XML() {
|
||||||
|
this.doc = new Document();
|
||||||
|
this.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erzeugt ein XML-Dokument aus einer Datei
|
||||||
|
* @param filename Dateiname der XML-Datei
|
||||||
|
*/
|
||||||
|
public XML(String filename) {
|
||||||
|
loadXML(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* interner Konstruktor, um ein XML Objekt zu erzeugen, das auf einen bestimmten Knoten verweist
|
||||||
|
* @param doc die XML-Dokumentstruktur
|
||||||
|
* @param current Zeiger auf das aktuelle Element
|
||||||
|
*/
|
||||||
|
private XML(Document doc, Element current) {
|
||||||
|
this.doc = doc;
|
||||||
|
this.current = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Anfang Methoden
|
||||||
|
/** Öffnet das durch den Dateinamen gegebene Dokument
|
||||||
|
* @param filename Dateiname des XML-Files
|
||||||
|
*/
|
||||||
|
public void loadXML(String filename) {
|
||||||
|
doc = null;
|
||||||
|
File f = new File(filename);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Das Dokument erstellen
|
||||||
|
SAXBuilder builder = new SAXBuilder();
|
||||||
|
doc = builder.build(f);
|
||||||
|
|
||||||
|
} catch (JDOMException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// Zeiger im Baum auf Root-Element
|
||||||
|
current = doc.getRootElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Speichert den XML-Baum im angegebenen Dateinamen
|
||||||
|
* @param filename Dateiname des XML-Files
|
||||||
|
*/
|
||||||
|
public void saveXML(String filename) {
|
||||||
|
try {
|
||||||
|
// new XMLOutputter().output(doc, System.out);
|
||||||
|
XMLOutputter xmlOutput = new XMLOutputter();
|
||||||
|
|
||||||
|
// display nice nice
|
||||||
|
xmlOutput.setFormat(Format.getPrettyFormat());
|
||||||
|
File f = new File(filename);
|
||||||
|
FileOutputStream outputFile = new FileOutputStream(f);
|
||||||
|
System.out.println("Speicher in : "+f.getAbsolutePath() );
|
||||||
|
xmlOutput.output(doc, outputFile);
|
||||||
|
outputFile.close();
|
||||||
|
System.out.println("File Saved!");
|
||||||
|
} catch (IOException io) {
|
||||||
|
System.out.println(io.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------- Zeigerbewegungen --------------------------------------------------
|
||||||
|
/**
|
||||||
|
* liefert ein XML-Objekt, das auf den Vaterknoten des aktuellen Elements zeigt.
|
||||||
|
* @return Vater des aktuellen Objekts.
|
||||||
|
*/
|
||||||
|
public XML getParent() {
|
||||||
|
if(current != null) {
|
||||||
|
Element parent = current.getParentElement();
|
||||||
|
if (parent == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return new XML(doc, parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Überprüft, ob das Element irgendwelche Kinder hat oder nicht, und gibt das Ergebnis als boolean zurück.
|
||||||
|
* @return true, wenn Kinder vorhanden sind, sonst false
|
||||||
|
*/
|
||||||
|
public boolean hasChildren() {
|
||||||
|
if (current == null) {
|
||||||
|
return doc.hasRootElement();
|
||||||
|
} else {
|
||||||
|
return current.getChildren().size()>0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ermittelt die Namen aller Kinder des Elements und gibt die Namen als ein Array von Strings zurück.
|
||||||
|
* Dies ist dasselbe wie das Durchlaufen und Aufrufen von getName() auf jedem untergeordneten Element einzeln.
|
||||||
|
* @return Liste aller Namen der Kinder
|
||||||
|
*/
|
||||||
|
public String[] listChildren() {
|
||||||
|
if (current == null) {
|
||||||
|
if(doc.hasRootElement()) {
|
||||||
|
String[] names = new String[0];
|
||||||
|
names[0] = doc.getRootElement().getName();
|
||||||
|
return names;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<Element> ch_element = current.getChildren();
|
||||||
|
String[] names = new String[ch_element.size()];
|
||||||
|
for(int i=0; i < ch_element.size() ; i++) {
|
||||||
|
names[i] = ch_element.get(i).getName();
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert alle Kinder des Elements als Array von XML-Objekten.
|
||||||
|
* @return Array der Kinder als XML-Objekte
|
||||||
|
*/
|
||||||
|
public XML[] getChildren() {
|
||||||
|
if (current == null) {
|
||||||
|
if(doc.hasRootElement()) {
|
||||||
|
XML[] ch_xml = new XML[1];
|
||||||
|
ch_xml[0] = new XML(doc, doc.getRootElement());
|
||||||
|
return ch_xml;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<Element> ch_element = current.getChildren();
|
||||||
|
XML[] ch_xml = new XML[ch_element.size()];
|
||||||
|
for(int i=0; i < ch_element.size() ; i++) {
|
||||||
|
ch_xml[i] = new XML(doc, ch_element.get(i));
|
||||||
|
}
|
||||||
|
return ch_xml;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert bestimmte Kinder des Elements als Array von XML-Objekten.
|
||||||
|
* Die Methode gibt dabei alle Kinder zurück, die dem angegebenen Namen entsprechen.
|
||||||
|
* @param name Name der gesuchten Kind-Objekte
|
||||||
|
* @return Array der Kinder als XML-Objekte
|
||||||
|
*/
|
||||||
|
public XML[] getChildren(String name) {
|
||||||
|
if (current == null) {
|
||||||
|
if(doc.hasRootElement()) {
|
||||||
|
XML[] ch_xml = new XML[1];
|
||||||
|
ch_xml[0] = new XML(doc, doc.getRootElement());
|
||||||
|
if(doc.getRootElement().getName().equals(name)){
|
||||||
|
return ch_xml;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<Element> ch_element = current.getChildren(name);
|
||||||
|
XML[] ch_xml = new XML[ch_element.size()];
|
||||||
|
for(int i=0; i < ch_element.size() ; i++) {
|
||||||
|
ch_xml[i] = new XML(doc, ch_element.get(i));
|
||||||
|
}
|
||||||
|
return ch_xml;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert das erste Kind des Elements mit einem bestimmten Namen.
|
||||||
|
* Die Methode gibt das erste Kind zurück, das dem angegebenen Namen entsprechen.
|
||||||
|
* @param name Name des gesuchten Kind-Objektes
|
||||||
|
* @return Kind als XML-Objekt
|
||||||
|
*/
|
||||||
|
|
||||||
|
public XML getChild(String name) {
|
||||||
|
if (current == null) {
|
||||||
|
Element e = doc.getRootElement();
|
||||||
|
if (e.getName().equals(name)) {
|
||||||
|
return new XML(doc, e);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String[] names = name.split("/");
|
||||||
|
Element e = current;
|
||||||
|
int i = 0;
|
||||||
|
while(i < names.length) {
|
||||||
|
e = e.getChild(names[i]);
|
||||||
|
if (e==null) return null;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return new XML(doc, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liefert das i. Kind des Elements.
|
||||||
|
* Die Methode gibt das i. Kind des aktuellen Elements zurück.
|
||||||
|
* @param i Nummer des Kindes
|
||||||
|
* @return Kind als XML-Objekt
|
||||||
|
*/
|
||||||
|
public XML getChild(int i) {
|
||||||
|
if (current == null) {
|
||||||
|
return new XML(doc, doc.getRootElement());
|
||||||
|
} else {
|
||||||
|
List<Element> ch_element = current.getChildren();
|
||||||
|
if (i>=ch_element.size()) return null;
|
||||||
|
return new XML(doc, ch_element.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------- Methoden für das aktuelle Element -------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Frage den Namen des aktuellen Elements ab
|
||||||
|
* @return Namen des Elements
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
if (current==null) return "";
|
||||||
|
return current.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setze den Namen des aktuellen Elements.
|
||||||
|
* @param name Neuer Name des Elements
|
||||||
|
*/
|
||||||
|
public void setName(String name) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* liefert die Anzahl der Attribute eines Elements.
|
||||||
|
* @return Anzahl des Attribute
|
||||||
|
*/
|
||||||
|
public int getAttributeCount() {
|
||||||
|
if (current == null) return 0;
|
||||||
|
return current.getAttributes().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* liefert zurück, ob das aktuelle Element Attribute hat .
|
||||||
|
* @return true, wenn es Attribute gibt
|
||||||
|
*/
|
||||||
|
public boolean hasAttribute() {
|
||||||
|
if (current == null) return false;
|
||||||
|
return current.getAttributes().size()>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ruft alle Attribute des angegebenen Elements ab und gibt sie als Array von Strings zurück.
|
||||||
|
* @return Liste der Attributnamen
|
||||||
|
*/
|
||||||
|
public String[] listAttributes() {
|
||||||
|
if (current == null) return null;
|
||||||
|
List<Attribute> attr = current.getAttributes();
|
||||||
|
String[] names = new String[attr.size()];
|
||||||
|
for(int i=0; i < attr.size() ; i++) {
|
||||||
|
names[i] = attr.get(i).getName();
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @return Wert des Attributs
|
||||||
|
*/
|
||||||
|
public String getString(String attribute) {
|
||||||
|
if (current==null) return "";
|
||||||
|
return current.getAttributeValue(attribute);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* Sollte es das Attribut nicht geben, wird ein default-Wert zurückgegeben
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param defaultValue Standardwert, falls es das Attribut nicht gibt
|
||||||
|
* @return Wert des Attributs
|
||||||
|
*/
|
||||||
|
public String getString(String attribute, String defaultValue) {
|
||||||
|
if (current==null) return defaultValue;
|
||||||
|
return current.getAttributeValue(attribute,defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt einen Attributwert des aktuellen Elements
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param text neuer Wert des Attributs
|
||||||
|
*/
|
||||||
|
public void setString(String attribute, String text) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setAttribute(attribute, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @return Wert des Attributs als Integer-Zahl
|
||||||
|
*/
|
||||||
|
public int getInt(String attribute) {
|
||||||
|
if (current==null) return 0;
|
||||||
|
try{
|
||||||
|
int i = Integer.parseInt(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* Sollte es das Attribut nicht geben, wird ein default-Wert zurückgegeben
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param defaultValue Standardwert, falls es das Attribut nicht gibt
|
||||||
|
* @return Wert des Attributs als Integer-Zahl
|
||||||
|
*/
|
||||||
|
public int getInt(String attribute, int defaultValue) {
|
||||||
|
if (current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
int i = Integer.parseInt(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt einen Attributwert des aktuellen Elements
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param value neuer Wert des Attributs
|
||||||
|
*/
|
||||||
|
public void setInt(String attribute, int value) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setAttribute(attribute, ""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @return Wert des Attributs als Float-Zahl
|
||||||
|
*/
|
||||||
|
public float getFloat(String attribute) {
|
||||||
|
if (current==null) return 0;
|
||||||
|
try{
|
||||||
|
float i = Float.parseFloat(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* Sollte es das Attribut nicht geben, wird ein default-Wert zurückgegeben
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param defaultValue Standardwert, falls es das Attribut nicht gibt
|
||||||
|
* @return Wert des Attributs als Float-Zahl
|
||||||
|
*/
|
||||||
|
public float getFloat(String attribute, float defaultValue) {
|
||||||
|
if (current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
float i = Float.parseFloat(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt einen Attributwert des aktuellen Elements
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param value neuer Wert des Attributs
|
||||||
|
*/
|
||||||
|
public void setFloat(String attribute, float value) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setAttribute(attribute, ""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @return Wert des Attributs als Double-Zahl
|
||||||
|
*/
|
||||||
|
public double getDouble(String attribute) {
|
||||||
|
if (current==null) return 0;
|
||||||
|
try{
|
||||||
|
double i = Double.parseDouble(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt einen Attributwert des aktuellen Elements ab
|
||||||
|
* Sollte es das Attribut nicht geben, wird ein default-Wert zurückgegeben
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param defaultValue Standardwert, falls es das Attribut nicht gibt
|
||||||
|
* @return Wert des Attributs als double-Zahl
|
||||||
|
*/
|
||||||
|
public double getDouble(String attribute, double defaultValue) {
|
||||||
|
if (current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
double i = Double.parseDouble(current.getAttributeValue(attribute));
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt einen Attributwert des aktuellen Elements
|
||||||
|
* @param attribute Name des Attributs
|
||||||
|
* @param value neuer Wert des Attributs
|
||||||
|
*/
|
||||||
|
public void setDouble(String attribute, double value) {
|
||||||
|
if (current==null) return;
|
||||||
|
current.setAttribute(attribute, ""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt/Text des aktuellen Elements ab
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public String getContent() {
|
||||||
|
if ( current==null) return "";
|
||||||
|
|
||||||
|
return current.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt/Text des aktuellen Elements ab
|
||||||
|
* Hat das Element keinen Inhalt wird der defaultValue zurückgegeben.
|
||||||
|
* @param defaultValue Standardtext
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public String getContent(String defaultValue) {
|
||||||
|
if ( current==null) return defaultValue;
|
||||||
|
String t = current.getText();
|
||||||
|
if(t.equals("")) t = defaultValue;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Inhalt/Text des aktuellen Elements
|
||||||
|
* @param text Neuer Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public void setContent(String text) {
|
||||||
|
if ( current==null) return;
|
||||||
|
current.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Integerzahl ab
|
||||||
|
* Hat das Element keinen Inhalt wird der defaultValue zurückgegeben.
|
||||||
|
* @param defaultValue Standardwert
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/ public int getIntContent(int defaultValue) {
|
||||||
|
if ( current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
int i = Integer.parseInt(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Integerzahl ab
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public int getIntContent() {
|
||||||
|
if ( current==null) return 0;
|
||||||
|
try{
|
||||||
|
int i = Integer.parseInt(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Inhalt des aktuellen Elements
|
||||||
|
* @param value Neuer Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public void setIntContent(int value) {
|
||||||
|
if ( current==null) return;
|
||||||
|
current.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Floatzahl ab
|
||||||
|
* Hat das Element keinen Inhalt wird der defaultValue zurückgegeben.
|
||||||
|
* @param defaultValue Standardwert
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public float getFloatContent(float defaultValue) {
|
||||||
|
if ( current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
float i = Float.parseFloat(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Floatzahl ab
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public float getFloatContent() {
|
||||||
|
if ( current==null) return 0;
|
||||||
|
try{
|
||||||
|
float i = Float.parseFloat(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Inhalt des aktuellen Elements
|
||||||
|
* @param value Neuer Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public void setFloatContent(float value) {
|
||||||
|
if ( current==null) return;
|
||||||
|
current.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Doublezahl ab
|
||||||
|
* Hat das Element keinen Inhalt wird der defaultValue zurückgegeben.
|
||||||
|
* @param defaultValue Standardwert
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public double getDoubleContent(double defaultValue) {
|
||||||
|
if ( current==null) return defaultValue;
|
||||||
|
try{
|
||||||
|
double i = Double.parseDouble(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return defaultValue; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fragt den Inhalt des aktuellen Elements als Doublezahl ab
|
||||||
|
* @return Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public double getDoubleContent() {
|
||||||
|
if ( current==null) return 0;
|
||||||
|
try{
|
||||||
|
double i = Double.parseDouble(current.getText());
|
||||||
|
return i;
|
||||||
|
} catch(Exception e) { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setzt den Inhalt des aktuellen Elements
|
||||||
|
* @param value Neuer Inhalt des Elements
|
||||||
|
*/
|
||||||
|
public void setDoubleContent(double value) {
|
||||||
|
if ( current==null) return;
|
||||||
|
current.setText(""+value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------- XML-Struktur aufbauen ------------------------------------------------
|
||||||
|
/** Erzeuge neues Element nach der aktuellen Position und setze dieses als aktuelles Element
|
||||||
|
* @param name Name des neuen Elements
|
||||||
|
* @return neues Element als XML-Objekt
|
||||||
|
*/
|
||||||
|
public XML addChild(String name) {
|
||||||
|
Element e = new Element(name);
|
||||||
|
if(current == null){ // man ist auf Root-Ebene
|
||||||
|
doc.setRootElement(e);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
current.addContent(e);
|
||||||
|
} // end of if-else
|
||||||
|
return new XML(doc, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* liefert das aktuelle Element als jdom-Element-Objekt
|
||||||
|
* @return aktuelles Element
|
||||||
|
*/
|
||||||
|
private Element getCurrent() {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* löscht ein Kind des aktuellen Knotens.
|
||||||
|
* Ist kid kein Kind des aktuellen Elements passiert gar nichts.
|
||||||
|
* @param kid XML-Objekt des Kindes
|
||||||
|
*/
|
||||||
|
public void removeChild(XML kid) {
|
||||||
|
if (current == null) return;
|
||||||
|
Element e = kid.getCurrent();
|
||||||
|
int index = current.indexOf(e);
|
||||||
|
if(index >= 0) { current.removeContent(e);}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
1293
01_hintergrund/02_dokumentation_java_klassen/Picture.html
Normal file
1293
01_hintergrund/02_dokumentation_java_klassen/Picture.html
Normal file
File diff suppressed because it is too large
Load diff
1365
01_hintergrund/02_dokumentation_java_klassen/PictureViewer.html
Normal file
1365
01_hintergrund/02_dokumentation_java_klassen/PictureViewer.html
Normal file
File diff suppressed because it is too large
Load diff
1481
01_hintergrund/02_dokumentation_java_klassen/Table.html
Normal file
1481
01_hintergrund/02_dokumentation_java_klassen/Table.html
Normal file
File diff suppressed because it is too large
Load diff
689
01_hintergrund/02_dokumentation_java_klassen/TableRow.html
Normal file
689
01_hintergrund/02_dokumentation_java_klassen/TableRow.html
Normal file
|
|
@ -0,0 +1,689 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title>TableRow</title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="TableRow";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10};
|
||||||
|
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
||||||
|
var altColor = "altColor";
|
||||||
|
var rowColor = "rowColor";
|
||||||
|
var tableTab = "tableTab";
|
||||||
|
var activeTableTab = "activeTableTab";
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||||
|
<div class="topNav"><a name="navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.top.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li class="navBarCell1Rev">Class</li>
|
||||||
|
<li><a href="package-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="Table.html" title="class in <Unnamed>"><span class="typeNameLink">Prev Class</span></a></li>
|
||||||
|
<li><a href="XML.html" title="class in <Unnamed>"><span class="typeNameLink">Next Class</span></a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?TableRow.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="TableRow.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_top">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul class="subNavList">
|
||||||
|
<li>Summary: </li>
|
||||||
|
<li>Nested | </li>
|
||||||
|
<li>Field | </li>
|
||||||
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
||||||
|
<li><a href="#method.summary">Method</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="subNavList">
|
||||||
|
<li>Detail: </li>
|
||||||
|
<li>Field | </li>
|
||||||
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
||||||
|
<li><a href="#method.detail">Method</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||||
|
<!-- ======== START OF CLASS DATA ======== -->
|
||||||
|
<div class="header">
|
||||||
|
<h2 title="Class TableRow" class="title">Class TableRow</h2>
|
||||||
|
</div>
|
||||||
|
<div class="contentContainer">
|
||||||
|
<ul class="inheritance">
|
||||||
|
<li>java.lang.Object</li>
|
||||||
|
<li>
|
||||||
|
<ul class="inheritance">
|
||||||
|
<li>TableRow</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="description">
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<hr>
|
||||||
|
<br>
|
||||||
|
<pre>public class <span class="typeNameLabel">TableRow</span>
|
||||||
|
extends java.lang.Object</pre>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="summary">
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="constructor.summary">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Constructor Summary</h3>
|
||||||
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
|
||||||
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
||||||
|
<tr>
|
||||||
|
<th class="colOne" scope="col">Constructor and Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colOne"><code><span class="memberNameLink"><a href="TableRow.html#TableRow-Document-Element-">TableRow</a></span>(Document doc,
|
||||||
|
Element row)</code>
|
||||||
|
<div class="block">Erzeugt ein TableRow-Objekt.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- ========== METHOD SUMMARY =========== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="method.summary">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Method Summary</h3>
|
||||||
|
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
||||||
|
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
|
||||||
|
<tr>
|
||||||
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
||||||
|
<th class="colLast" scope="col">Method and Description</th>
|
||||||
|
</tr>
|
||||||
|
<tr id="i0" class="altColor">
|
||||||
|
<td class="colFirst"><code>int</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getColumn-java.lang.String-">getColumn</a></span>(java.lang.String name)</code>
|
||||||
|
<div class="block">Liefert die Nummer einer Spalte</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i1" class="rowColor">
|
||||||
|
<td class="colFirst"><code>int</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getColumnCount--">getColumnCount</a></span>()</code>
|
||||||
|
<div class="block">Liefert die Anzahl der Spalten der Zeile.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i2" class="altColor">
|
||||||
|
<td class="colFirst"><code>java.lang.String</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getColumnTitle-int-">getColumnTitle</a></span>(int i)</code>
|
||||||
|
<div class="block">Liefert den Titel einer Spalte</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i3" class="rowColor">
|
||||||
|
<td class="colFirst"><code>double</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getDouble-int-">getDouble</a></span>(int i)</code>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Double-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i4" class="altColor">
|
||||||
|
<td class="colFirst"><code>double</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getDouble-java.lang.String-">getDouble</a></span>(java.lang.String name)</code>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Double-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i5" class="rowColor">
|
||||||
|
<td class="colFirst"><code>float</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getFloat-int-">getFloat</a></span>(int i)</code>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Float-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i6" class="altColor">
|
||||||
|
<td class="colFirst"><code>float</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getFloat-java.lang.String-">getFloat</a></span>(java.lang.String name)</code>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Float-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i7" class="rowColor">
|
||||||
|
<td class="colFirst"><code>int</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getInt-int-">getInt</a></span>(int i)</code>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Int-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i8" class="altColor">
|
||||||
|
<td class="colFirst"><code>int</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getInt-java.lang.String-">getInt</a></span>(java.lang.String name)</code>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Int-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i9" class="rowColor">
|
||||||
|
<td class="colFirst"><code>java.lang.String</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getString-int-">getString</a></span>(int i)</code>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als String</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i10" class="altColor">
|
||||||
|
<td class="colFirst"><code>java.lang.String</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#getString-java.lang.String-">getString</a></span>(java.lang.String name)</code>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als String</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i11" class="rowColor">
|
||||||
|
<td class="colFirst"><code>void</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#setDouble-int-double-">setDouble</a></span>(int i,
|
||||||
|
double value)</code>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Double-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i12" class="altColor">
|
||||||
|
<td class="colFirst"><code>void</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#setDouble-java.lang.String-double-">setDouble</a></span>(java.lang.String name,
|
||||||
|
double value)</code>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Double-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i13" class="rowColor">
|
||||||
|
<td class="colFirst"><code>void</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#setFloat-int-float-">setFloat</a></span>(int i,
|
||||||
|
float value)</code>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Float-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i14" class="altColor">
|
||||||
|
<td class="colFirst"><code>void</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#setFloat-java.lang.String-float-">setFloat</a></span>(java.lang.String name,
|
||||||
|
float value)</code>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Float-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i15" class="rowColor">
|
||||||
|
<td class="colFirst"><code>void</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#setInt-int-int-">setInt</a></span>(int i,
|
||||||
|
int value)</code>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Int-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i16" class="altColor">
|
||||||
|
<td class="colFirst"><code>void</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#setInt-java.lang.String-int-">setInt</a></span>(java.lang.String name,
|
||||||
|
int value)</code>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Int-Zahl</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i17" class="rowColor">
|
||||||
|
<td class="colFirst"><code>void</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#setString-int-java.lang.String-">setString</a></span>(int i,
|
||||||
|
java.lang.String text)</code>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als String</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="i18" class="altColor">
|
||||||
|
<td class="colFirst"><code>void</code></td>
|
||||||
|
<td class="colLast"><code><span class="memberNameLink"><a href="TableRow.html#setString-java.lang.String-java.lang.String-">setString</a></span>(java.lang.String name,
|
||||||
|
java.lang.String text)</code>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als String</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Methods inherited from class java.lang.Object</h3>
|
||||||
|
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="details">
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="constructor.detail">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Constructor Detail</h3>
|
||||||
|
<a name="TableRow-Document-Element-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockListLast">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>TableRow</h4>
|
||||||
|
<pre>public TableRow(Document doc,
|
||||||
|
Element row)</pre>
|
||||||
|
<div class="block">Erzeugt ein TableRow-Objekt.
|
||||||
|
Diese Methode ist für den internen Gebraucht. Einige Methode der Table-Klasse erzeugen mit diesem Konstruktor TableRow-Objekte.</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>doc</code> - JDOM-Dokument, das für die ganze Tabelle steht.</dd>
|
||||||
|
<dd><code>row</code> - JDOM-Element, das für die aktuelle Zeile steht.</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- ============ METHOD DETAIL ========== -->
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="method.detail">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Method Detail</h3>
|
||||||
|
<a name="getColumnCount--">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getColumnCount</h4>
|
||||||
|
<pre>public int getColumnCount()</pre>
|
||||||
|
<div class="block">Liefert die Anzahl der Spalten der Zeile.</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Anzahl der Spalten</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getColumnTitle-int-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getColumnTitle</h4>
|
||||||
|
<pre>public java.lang.String getColumnTitle(int i)</pre>
|
||||||
|
<div class="block">Liefert den Titel einer Spalte</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>i</code> - Nummer der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Name der Spalte</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getColumn-java.lang.String-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getColumn</h4>
|
||||||
|
<pre>public int getColumn(java.lang.String name)</pre>
|
||||||
|
<div class="block">Liefert die Nummer einer Spalte</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>name</code> - Name der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Nummer der Spalte</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getString-int-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getString</h4>
|
||||||
|
<pre>public java.lang.String getString(int i)</pre>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als String</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>i</code> - Nummer der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getString-java.lang.String-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getString</h4>
|
||||||
|
<pre>public java.lang.String getString(java.lang.String name)</pre>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als String</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>name</code> - Name der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="setString-int-java.lang.String-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>setString</h4>
|
||||||
|
<pre>public void setString(int i,
|
||||||
|
java.lang.String text)</pre>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als String</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>i</code> - Nummer der Spalte</dd>
|
||||||
|
<dd><code>text</code> - neuer Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="setString-java.lang.String-java.lang.String-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>setString</h4>
|
||||||
|
<pre>public void setString(java.lang.String name,
|
||||||
|
java.lang.String text)</pre>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als String</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>name</code> - Name der Spalte</dd>
|
||||||
|
<dd><code>text</code> - neuer Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getInt-int-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getInt</h4>
|
||||||
|
<pre>public int getInt(int i)</pre>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Int-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>i</code> - Nummer der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getInt-java.lang.String-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getInt</h4>
|
||||||
|
<pre>public int getInt(java.lang.String name)</pre>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Int-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>name</code> - Name der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="setInt-int-int-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>setInt</h4>
|
||||||
|
<pre>public void setInt(int i,
|
||||||
|
int value)</pre>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Int-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>i</code> - Nummer der Spalte</dd>
|
||||||
|
<dd><code>value</code> - neuer Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="setInt-java.lang.String-int-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>setInt</h4>
|
||||||
|
<pre>public void setInt(java.lang.String name,
|
||||||
|
int value)</pre>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Int-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>name</code> - Name der Spalte</dd>
|
||||||
|
<dd><code>value</code> - neuer Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getFloat-int-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getFloat</h4>
|
||||||
|
<pre>public float getFloat(int i)</pre>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Float-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>i</code> - Nummer der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getFloat-java.lang.String-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getFloat</h4>
|
||||||
|
<pre>public float getFloat(java.lang.String name)</pre>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Float-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>name</code> - Name der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="setFloat-int-float-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>setFloat</h4>
|
||||||
|
<pre>public void setFloat(int i,
|
||||||
|
float value)</pre>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Float-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>i</code> - Nummer der Spalte</dd>
|
||||||
|
<dd><code>value</code> - neuer Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="setFloat-java.lang.String-float-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>setFloat</h4>
|
||||||
|
<pre>public void setFloat(java.lang.String name,
|
||||||
|
float value)</pre>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Float-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>name</code> - Name der Spalte</dd>
|
||||||
|
<dd><code>value</code> - neuer Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getDouble-int-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getDouble</h4>
|
||||||
|
<pre>public double getDouble(int i)</pre>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Double-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>i</code> - Nummer der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="getDouble-java.lang.String-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>getDouble</h4>
|
||||||
|
<pre>public double getDouble(java.lang.String name)</pre>
|
||||||
|
<div class="block">Liefert den Wert einer Zelle als Double-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>name</code> - Name der Spalte</dd>
|
||||||
|
<dt><span class="returnLabel">Returns:</span></dt>
|
||||||
|
<dd>Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="setDouble-int-double-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>setDouble</h4>
|
||||||
|
<pre>public void setDouble(int i,
|
||||||
|
double value)</pre>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Double-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>i</code> - Nummer der Spalte</dd>
|
||||||
|
<dd><code>value</code> - neuer Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<a name="setDouble-java.lang.String-double-">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="blockListLast">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>setDouble</h4>
|
||||||
|
<pre>public void setDouble(java.lang.String name,
|
||||||
|
double value)</pre>
|
||||||
|
<div class="block">Setzt den Wert einer Zelle als Double-Zahl</div>
|
||||||
|
<dl>
|
||||||
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||||
|
<dd><code>name</code> - Name der Spalte</dd>
|
||||||
|
<dd><code>value</code> - neuer Wert der Zelle</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- ========= END OF CLASS DATA ========= -->
|
||||||
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||||
|
<div class="bottomNav"><a name="navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.bottom.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li class="navBarCell1Rev">Class</li>
|
||||||
|
<li><a href="package-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="Table.html" title="class in <Unnamed>"><span class="typeNameLink">Prev Class</span></a></li>
|
||||||
|
<li><a href="XML.html" title="class in <Unnamed>"><span class="typeNameLink">Next Class</span></a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?TableRow.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="TableRow.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_bottom">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul class="subNavList">
|
||||||
|
<li>Summary: </li>
|
||||||
|
<li>Nested | </li>
|
||||||
|
<li>Field | </li>
|
||||||
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
||||||
|
<li><a href="#method.summary">Method</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="subNavList">
|
||||||
|
<li>Detail: </li>
|
||||||
|
<li>Field | </li>
|
||||||
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
||||||
|
<li><a href="#method.detail">Method</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1153
01_hintergrund/02_dokumentation_java_klassen/XML.html
Normal file
1153
01_hintergrund/02_dokumentation_java_klassen/XML.html
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title>All Classes</title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 class="bar">All Classes</h1>
|
||||||
|
<div class="indexContainer">
|
||||||
|
<ul>
|
||||||
|
<li><a href="Picture.html" title="class in <Unnamed>" target="classFrame">Picture</a></li>
|
||||||
|
<li><a href="PictureViewer.html" title="class in <Unnamed>" target="classFrame">PictureViewer</a></li>
|
||||||
|
<li><a href="Table.html" title="class in <Unnamed>" target="classFrame">Table</a></li>
|
||||||
|
<li><a href="TableRow.html" title="class in <Unnamed>" target="classFrame">TableRow</a></li>
|
||||||
|
<li><a href="XML.html" title="class in <Unnamed>" target="classFrame">XML</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title>All Classes</title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 class="bar">All Classes</h1>
|
||||||
|
<div class="indexContainer">
|
||||||
|
<ul>
|
||||||
|
<li><a href="Picture.html" title="class in <Unnamed>">Picture</a></li>
|
||||||
|
<li><a href="PictureViewer.html" title="class in <Unnamed>">PictureViewer</a></li>
|
||||||
|
<li><a href="Table.html" title="class in <Unnamed>">Table</a></li>
|
||||||
|
<li><a href="TableRow.html" title="class in <Unnamed>">TableRow</a></li>
|
||||||
|
<li><a href="XML.html" title="class in <Unnamed>">XML</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,197 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title>Constant Field Values</title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="Constant Field Values";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||||
|
<div class="topNav"><a name="navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.top.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="overview-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?constant-values.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="constant-values.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_top">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||||
|
<div class="header">
|
||||||
|
<h1 title="Constant Field Values" class="title">Constant Field Values</h1>
|
||||||
|
<h2 title="Contents">Contents</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#unnamed.package"><Unnamed></a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="constantValuesContainer"><a name="unnamed.package">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h2 title="&lt;Unnamed&gt;"><Unnamed>.*</h2>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<table class="constantsSummary" border="0" cellpadding="3" cellspacing="0" summary="Constant Field Values table, listing constant fields, and values">
|
||||||
|
<caption><span><a href="Picture.html" title="class in <Unnamed>">Picture</a></span><span class="tabEnd"> </span></caption>
|
||||||
|
<tr>
|
||||||
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
||||||
|
<th scope="col">Constant Field</th>
|
||||||
|
<th class="colLast" scope="col">Value</th>
|
||||||
|
</tr>
|
||||||
|
<tbody>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a name="Picture.CENTER">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="Picture.html#CENTER">CENTER</a></code></td>
|
||||||
|
<td class="colLast"><code>2</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><a name="Picture.CORNER">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="Picture.html#CORNER">CORNER</a></code></td>
|
||||||
|
<td class="colLast"><code>3</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a name="Picture.CORNERS">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="Picture.html#CORNERS">CORNERS</a></code></td>
|
||||||
|
<td class="colLast"><code>4</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><a name="Picture.RADIUS">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="Picture.html#RADIUS">RADIUS</a></code></td>
|
||||||
|
<td class="colLast"><code>1</code></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<table class="constantsSummary" border="0" cellpadding="3" cellspacing="0" summary="Constant Field Values table, listing constant fields, and values">
|
||||||
|
<caption><span><a href="PictureViewer.html" title="class in <Unnamed>">PictureViewer</a></span><span class="tabEnd"> </span></caption>
|
||||||
|
<tr>
|
||||||
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
||||||
|
<th scope="col">Constant Field</th>
|
||||||
|
<th class="colLast" scope="col">Value</th>
|
||||||
|
</tr>
|
||||||
|
<tbody>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a name="PictureViewer.FIT">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="PictureViewer.html#FIT">FIT</a></code></td>
|
||||||
|
<td class="colLast"><code>-1</code></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><a name="PictureViewer.NORMAL">
|
||||||
|
<!-- -->
|
||||||
|
</a><code>public static final int</code></td>
|
||||||
|
<td><code><a href="PictureViewer.html#NORMAL">NORMAL</a></code></td>
|
||||||
|
<td class="colLast"><code>1</code></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||||
|
<div class="bottomNav"><a name="navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.bottom.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="overview-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?constant-values.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="constant-values.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_bottom">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title>Deprecated List</title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="Deprecated List";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||||
|
<div class="topNav"><a name="navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.top.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="overview-tree.html">Tree</a></li>
|
||||||
|
<li class="navBarCell1Rev">Deprecated</li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?deprecated-list.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="deprecated-list.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_top">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||||
|
<div class="header">
|
||||||
|
<h1 title="Deprecated API" class="title">Deprecated API</h1>
|
||||||
|
<h2 title="Contents">Contents</h2>
|
||||||
|
</div>
|
||||||
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||||
|
<div class="bottomNav"><a name="navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.bottom.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="overview-tree.html">Tree</a></li>
|
||||||
|
<li class="navBarCell1Rev">Deprecated</li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?deprecated-list.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="deprecated-list.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_bottom">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
218
01_hintergrund/02_dokumentation_java_klassen/help-doc.html
Normal file
218
01_hintergrund/02_dokumentation_java_klassen/help-doc.html
Normal file
|
|
@ -0,0 +1,218 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title>API Help</title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="API Help";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||||
|
<div class="topNav"><a name="navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.top.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="overview-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li class="navBarCell1Rev">Help</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?help-doc.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="help-doc.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_top">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||||
|
<div class="header">
|
||||||
|
<h1 class="title">How This API Document Is Organized</h1>
|
||||||
|
<div class="subTitle">This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.</div>
|
||||||
|
</div>
|
||||||
|
<div class="contentContainer">
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Package</h2>
|
||||||
|
<p>Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Interfaces (italic)</li>
|
||||||
|
<li>Classes</li>
|
||||||
|
<li>Enums</li>
|
||||||
|
<li>Exceptions</li>
|
||||||
|
<li>Errors</li>
|
||||||
|
<li>Annotation Types</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Class/Interface</h2>
|
||||||
|
<p>Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Class inheritance diagram</li>
|
||||||
|
<li>Direct Subclasses</li>
|
||||||
|
<li>All Known Subinterfaces</li>
|
||||||
|
<li>All Known Implementing Classes</li>
|
||||||
|
<li>Class/interface declaration</li>
|
||||||
|
<li>Class/interface description</li>
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li>Nested Class Summary</li>
|
||||||
|
<li>Field Summary</li>
|
||||||
|
<li>Constructor Summary</li>
|
||||||
|
<li>Method Summary</li>
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li>Field Detail</li>
|
||||||
|
<li>Constructor Detail</li>
|
||||||
|
<li>Method Detail</li>
|
||||||
|
</ul>
|
||||||
|
<p>Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</p>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Annotation Type</h2>
|
||||||
|
<p>Each annotation type has its own separate page with the following sections:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Annotation Type declaration</li>
|
||||||
|
<li>Annotation Type description</li>
|
||||||
|
<li>Required Element Summary</li>
|
||||||
|
<li>Optional Element Summary</li>
|
||||||
|
<li>Element Detail</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Enum</h2>
|
||||||
|
<p>Each enum has its own separate page with the following sections:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Enum declaration</li>
|
||||||
|
<li>Enum description</li>
|
||||||
|
<li>Enum Constant Summary</li>
|
||||||
|
<li>Enum Constant Detail</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Tree (Class Hierarchy)</h2>
|
||||||
|
<p>There is a <a href="overview-tree.html">Class Hierarchy</a> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.</p>
|
||||||
|
<ul>
|
||||||
|
<li>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.</li>
|
||||||
|
<li>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Deprecated API</h2>
|
||||||
|
<p>The <a href="deprecated-list.html">Deprecated API</a> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</p>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Index</h2>
|
||||||
|
<p>The <a href="index-all.html">Index</a> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</p>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Prev/Next</h2>
|
||||||
|
<p>These links take you to the next or previous class, interface, package, or related page.</p>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Frames/No Frames</h2>
|
||||||
|
<p>These links show and hide the HTML frames. All pages are available with or without frames.</p>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>All Classes</h2>
|
||||||
|
<p>The <a href="allclasses-noframe.html">All Classes</a> link shows all classes and interfaces except non-static nested types.</p>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Serialized Form</h2>
|
||||||
|
<p>Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.</p>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h2>Constant Field Values</h2>
|
||||||
|
<p>The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<span class="emphasizedPhrase">This help file applies to API documentation generated using the standard doclet.</span></div>
|
||||||
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||||
|
<div class="bottomNav"><a name="navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.bottom.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="overview-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li class="navBarCell1Rev">Help</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?help-doc.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="help-doc.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_bottom">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1036
01_hintergrund/02_dokumentation_java_klassen/index-all.html
Normal file
1036
01_hintergrund/02_dokumentation_java_klassen/index-all.html
Normal file
File diff suppressed because it is too large
Load diff
73
01_hintergrund/02_dokumentation_java_klassen/index.html
Normal file
73
01_hintergrund/02_dokumentation_java_klassen/index.html
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title>Generated Documentation (Untitled)</title>
|
||||||
|
<script type="text/javascript">
|
||||||
|
tmpTargetPage = "" + window.location.search;
|
||||||
|
if (tmpTargetPage != "" && tmpTargetPage != "undefined")
|
||||||
|
tmpTargetPage = tmpTargetPage.substring(1);
|
||||||
|
if (tmpTargetPage.indexOf(":") != -1 || (tmpTargetPage != "" && !validURL(tmpTargetPage)))
|
||||||
|
tmpTargetPage = "undefined";
|
||||||
|
targetPage = tmpTargetPage;
|
||||||
|
function validURL(url) {
|
||||||
|
try {
|
||||||
|
url = decodeURIComponent(url);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var pos = url.indexOf(".html");
|
||||||
|
if (pos == -1 || pos != url.length - 5)
|
||||||
|
return false;
|
||||||
|
var allowNumber = false;
|
||||||
|
var allowSep = false;
|
||||||
|
var seenDot = false;
|
||||||
|
for (var i = 0; i < url.length - 5; i++) {
|
||||||
|
var ch = url.charAt(i);
|
||||||
|
if ('a' <= ch && ch <= 'z' ||
|
||||||
|
'A' <= ch && ch <= 'Z' ||
|
||||||
|
ch == '$' ||
|
||||||
|
ch == '_' ||
|
||||||
|
ch.charCodeAt(0) > 127) {
|
||||||
|
allowNumber = true;
|
||||||
|
allowSep = true;
|
||||||
|
} else if ('0' <= ch && ch <= '9'
|
||||||
|
|| ch == '-') {
|
||||||
|
if (!allowNumber)
|
||||||
|
return false;
|
||||||
|
} else if (ch == '/' || ch == '.') {
|
||||||
|
if (!allowSep)
|
||||||
|
return false;
|
||||||
|
allowNumber = false;
|
||||||
|
allowSep = false;
|
||||||
|
if (ch == '.')
|
||||||
|
seenDot = true;
|
||||||
|
if (ch == '/' && seenDot)
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function loadFrames() {
|
||||||
|
if (targetPage != "" && targetPage != "undefined")
|
||||||
|
top.classFrame.location = top.targetPage;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<frameset cols="20%,80%" title="Documentation frame" onload="top.loadFrames()">
|
||||||
|
<frame src="allclasses-frame.html" name="packageFrame" title="All classes and interfaces (except non-static nested types)">
|
||||||
|
<frame src="Picture.html" name="classFrame" title="Package, class and interface descriptions" scrolling="yes">
|
||||||
|
<noframes>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<h2>Frame Alert</h2>
|
||||||
|
<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="Picture.html">Non-frame version</a>.</p>
|
||||||
|
</noframes>
|
||||||
|
</frameset>
|
||||||
|
</html>
|
||||||
150
01_hintergrund/02_dokumentation_java_klassen/overview-tree.html
Normal file
150
01_hintergrund/02_dokumentation_java_klassen/overview-tree.html
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title>Class Hierarchy</title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="Class Hierarchy";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||||
|
<div class="topNav"><a name="navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.top.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li class="navBarCell1Rev">Tree</li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?overview-tree.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="overview-tree.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_top">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||||
|
<div class="header">
|
||||||
|
<h1 class="title">Hierarchy For All Packages</h1>
|
||||||
|
</div>
|
||||||
|
<div class="contentContainer">
|
||||||
|
<h2 title="Class Hierarchy">Class Hierarchy</h2>
|
||||||
|
<ul>
|
||||||
|
<li type="circle">java.lang.Object
|
||||||
|
<ul>
|
||||||
|
<li type="circle">java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable)
|
||||||
|
<ul>
|
||||||
|
<li type="circle">java.awt.Container
|
||||||
|
<ul>
|
||||||
|
<li type="circle">javax.swing.JComponent (implements java.io.Serializable)
|
||||||
|
<ul>
|
||||||
|
<li type="circle">javax.swing.JScrollPane (implements javax.accessibility.Accessible, javax.swing.ScrollPaneConstants)
|
||||||
|
<ul>
|
||||||
|
<li type="circle"><a href="PictureViewer.html" title="class in <Unnamed>"><span class="typeNameLink">PictureViewer</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li type="circle"><a href="Picture.html" title="class in <Unnamed>"><span class="typeNameLink">Picture</span></a></li>
|
||||||
|
<li type="circle"><a href="Table.html" title="class in <Unnamed>"><span class="typeNameLink">Table</span></a></li>
|
||||||
|
<li type="circle"><a href="TableRow.html" title="class in <Unnamed>"><span class="typeNameLink">TableRow</span></a></li>
|
||||||
|
<li type="circle"><a href="XML.html" title="class in <Unnamed>"><span class="typeNameLink">XML</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||||
|
<div class="bottomNav"><a name="navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.bottom.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li class="navBarCell1Rev">Tree</li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?overview-tree.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="overview-tree.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_bottom">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title><Unnamed></title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1 class="bar"><a href="package-summary.html" target="classFrame"><Unnamed></a></h1>
|
||||||
|
<div class="indexContainer">
|
||||||
|
<h2 title="Classes">Classes</h2>
|
||||||
|
<ul title="Classes">
|
||||||
|
<li><a href="Picture.html" title="class in <Unnamed>" target="classFrame">Picture</a></li>
|
||||||
|
<li><a href="PictureViewer.html" title="class in <Unnamed>" target="classFrame">PictureViewer</a></li>
|
||||||
|
<li><a href="Table.html" title="class in <Unnamed>" target="classFrame">Table</a></li>
|
||||||
|
<li><a href="TableRow.html" title="class in <Unnamed>" target="classFrame">TableRow</a></li>
|
||||||
|
<li><a href="XML.html" title="class in <Unnamed>" target="classFrame">XML</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
|
||||||
|
|
@ -0,0 +1,149 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||||
|
<div class="topNav"><a name="navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.top.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="package-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev Package</li>
|
||||||
|
<li>Next Package</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?package-summary.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="package-summary.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_top">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||||
|
<div class="header">
|
||||||
|
<h1 title="Package" class="title">Package <Unnamed></h1>
|
||||||
|
</div>
|
||||||
|
<div class="contentContainer">
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
|
||||||
|
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
|
||||||
|
<tr>
|
||||||
|
<th class="colFirst" scope="col">Class</th>
|
||||||
|
<th class="colLast" scope="col">Description</th>
|
||||||
|
</tr>
|
||||||
|
<tbody>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a href="Picture.html" title="class in <Unnamed>">Picture</a></td>
|
||||||
|
<td class="colLast">
|
||||||
|
<div class="block">Bildklasse für die Simulation von Processing-Befehlen
|
||||||
|
|
||||||
|
Diese Klasse stellt ein BufferedImage bereit, in das mit Processing-Befehlen gezeichnet
|
||||||
|
werden kann.</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><a href="PictureViewer.html" title="class in <Unnamed>">PictureViewer</a></td>
|
||||||
|
<td class="colLast"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a href="Table.html" title="class in <Unnamed>">Table</a></td>
|
||||||
|
<td class="colLast"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rowColor">
|
||||||
|
<td class="colFirst"><a href="TableRow.html" title="class in <Unnamed>">TableRow</a></td>
|
||||||
|
<td class="colLast"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr class="altColor">
|
||||||
|
<td class="colFirst"><a href="XML.html" title="class in <Unnamed>">XML</a></td>
|
||||||
|
<td class="colLast"> </td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||||
|
<div class="bottomNav"><a name="navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.bottom.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="package-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev Package</li>
|
||||||
|
<li>Next Package</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?package-summary.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="package-summary.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_bottom">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
150
01_hintergrund/02_dokumentation_java_klassen/package-tree.html
Normal file
150
01_hintergrund/02_dokumentation_java_klassen/package-tree.html
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title> Class Hierarchy</title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title=" Class Hierarchy";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||||
|
<div class="topNav"><a name="navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.top.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li class="navBarCell1Rev">Tree</li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?package-tree.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="package-tree.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_top">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||||
|
<div class="header">
|
||||||
|
<h1 class="title">Hierarchy For Package <Unnamed></h1>
|
||||||
|
</div>
|
||||||
|
<div class="contentContainer">
|
||||||
|
<h2 title="Class Hierarchy">Class Hierarchy</h2>
|
||||||
|
<ul>
|
||||||
|
<li type="circle">java.lang.Object
|
||||||
|
<ul>
|
||||||
|
<li type="circle">java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable)
|
||||||
|
<ul>
|
||||||
|
<li type="circle">java.awt.Container
|
||||||
|
<ul>
|
||||||
|
<li type="circle">javax.swing.JComponent (implements java.io.Serializable)
|
||||||
|
<ul>
|
||||||
|
<li type="circle">javax.swing.JScrollPane (implements javax.accessibility.Accessible, javax.swing.ScrollPaneConstants)
|
||||||
|
<ul>
|
||||||
|
<li type="circle"><a href="PictureViewer.html" title="class in <Unnamed>"><span class="typeNameLink">PictureViewer</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li type="circle"><a href="Picture.html" title="class in <Unnamed>"><span class="typeNameLink">Picture</span></a></li>
|
||||||
|
<li type="circle"><a href="Table.html" title="class in <Unnamed>"><span class="typeNameLink">Table</span></a></li>
|
||||||
|
<li type="circle"><a href="TableRow.html" title="class in <Unnamed>"><span class="typeNameLink">TableRow</span></a></li>
|
||||||
|
<li type="circle"><a href="XML.html" title="class in <Unnamed>"><span class="typeNameLink">XML</span></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||||
|
<div class="bottomNav"><a name="navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.bottom.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li class="navBarCell1Rev">Tree</li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?package-tree.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="package-tree.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_bottom">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
30
01_hintergrund/02_dokumentation_java_klassen/script.js
Normal file
30
01_hintergrund/02_dokumentation_java_klassen/script.js
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
function show(type)
|
||||||
|
{
|
||||||
|
count = 0;
|
||||||
|
for (var key in methods) {
|
||||||
|
var row = document.getElementById(key);
|
||||||
|
if ((methods[key] & type) != 0) {
|
||||||
|
row.style.display = '';
|
||||||
|
row.className = (count++ % 2) ? rowColor : altColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
row.style.display = 'none';
|
||||||
|
}
|
||||||
|
updateTabs(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateTabs(type)
|
||||||
|
{
|
||||||
|
for (var value in tabs) {
|
||||||
|
var sNode = document.getElementById(tabs[value][0]);
|
||||||
|
var spanNode = sNode.firstChild;
|
||||||
|
if (value == type) {
|
||||||
|
sNode.className = activeTableTab;
|
||||||
|
spanNode.innerHTML = tabs[value][1];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sNode.className = tableTab;
|
||||||
|
spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<!-- NewPage -->
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<!-- Generated by javadoc (1.8.0_191) on Wed Jun 05 08:24:52 CEST 2019 -->
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
|
||||||
|
<title>Serialized Form</title>
|
||||||
|
<meta name="date" content="2019-06-05">
|
||||||
|
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||||
|
<script type="text/javascript" src="script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
try {
|
||||||
|
if (location.href.indexOf('is-external=true') == -1) {
|
||||||
|
parent.document.title="Serialized Form";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
<div>JavaScript is disabled on your browser.</div>
|
||||||
|
</noscript>
|
||||||
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||||
|
<div class="topNav"><a name="navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.top.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="overview-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?serialized-form.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="serialized-form.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_top">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.top">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||||
|
<div class="header">
|
||||||
|
<h1 title="Serialized Form" class="title">Serialized Form</h1>
|
||||||
|
</div>
|
||||||
|
<div class="serializedFormContainer">
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h2 title="Package">Package <Unnamed></h2>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList"><a name="PictureViewer">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<h3>Class <a href="PictureViewer.html" title="class in <Unnamed>">PictureViewer</a> extends javax.swing.JScrollPane implements Serializable</h3>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h3>Serialized Fields</h3>
|
||||||
|
<ul class="blockList">
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>picture</h4>
|
||||||
|
<pre><a href="Picture.html" title="class in <Unnamed>">Picture</a> picture</pre>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>history</h4>
|
||||||
|
<pre>java.util.Vector<E> history</pre>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>scrollImageIcon</h4>
|
||||||
|
<pre>javax.swing.ImageIcon scrollImageIcon</pre>
|
||||||
|
</li>
|
||||||
|
<li class="blockList">
|
||||||
|
<h4>imageLabel</h4>
|
||||||
|
<pre>javax.swing.JLabel imageLabel</pre>
|
||||||
|
</li>
|
||||||
|
<li class="blockListLast">
|
||||||
|
<h4>zoomFactor</h4>
|
||||||
|
<pre>double zoomFactor</pre>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||||
|
<div class="bottomNav"><a name="navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
||||||
|
<a name="navbar.bottom.firstrow">
|
||||||
|
<!-- -->
|
||||||
|
</a>
|
||||||
|
<ul class="navList" title="Navigation">
|
||||||
|
<li><a href="package-summary.html">Package</a></li>
|
||||||
|
<li>Class</li>
|
||||||
|
<li><a href="overview-tree.html">Tree</a></li>
|
||||||
|
<li><a href="deprecated-list.html">Deprecated</a></li>
|
||||||
|
<li><a href="index-all.html">Index</a></li>
|
||||||
|
<li><a href="help-doc.html">Help</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="subNav">
|
||||||
|
<ul class="navList">
|
||||||
|
<li>Prev</li>
|
||||||
|
<li>Next</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList">
|
||||||
|
<li><a href="index.html?serialized-form.html" target="_top">Frames</a></li>
|
||||||
|
<li><a href="serialized-form.html" target="_top">No Frames</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="navList" id="allclasses_navbar_bottom">
|
||||||
|
<li><a href="allclasses-noframe.html">All Classes</a></li>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<script type="text/javascript"><!--
|
||||||
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
||||||
|
if(window==top) {
|
||||||
|
allClassesLink.style.display = "block";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allClassesLink.style.display = "none";
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<a name="skip.navbar.bottom">
|
||||||
|
<!-- -->
|
||||||
|
</a></div>
|
||||||
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
574
01_hintergrund/02_dokumentation_java_klassen/stylesheet.css
Normal file
574
01_hintergrund/02_dokumentation_java_klassen/stylesheet.css
Normal file
|
|
@ -0,0 +1,574 @@
|
||||||
|
/* Javadoc style sheet */
|
||||||
|
/*
|
||||||
|
Overall document style
|
||||||
|
*/
|
||||||
|
|
||||||
|
@import url('resources/fonts/dejavu.css');
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color:#ffffff;
|
||||||
|
color:#353833;
|
||||||
|
font-family:'DejaVu Sans', Arial, Helvetica, sans-serif;
|
||||||
|
font-size:14px;
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
a:link, a:visited {
|
||||||
|
text-decoration:none;
|
||||||
|
color:#4A6782;
|
||||||
|
}
|
||||||
|
a:hover, a:focus {
|
||||||
|
text-decoration:none;
|
||||||
|
color:#bb7a2a;
|
||||||
|
}
|
||||||
|
a:active {
|
||||||
|
text-decoration:none;
|
||||||
|
color:#4A6782;
|
||||||
|
}
|
||||||
|
a[name] {
|
||||||
|
color:#353833;
|
||||||
|
}
|
||||||
|
a[name]:hover {
|
||||||
|
text-decoration:none;
|
||||||
|
color:#353833;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
font-family:'DejaVu Sans Mono', monospace;
|
||||||
|
font-size:14px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size:20px;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
font-size:18px;
|
||||||
|
}
|
||||||
|
h3 {
|
||||||
|
font-size:16px;
|
||||||
|
font-style:italic;
|
||||||
|
}
|
||||||
|
h4 {
|
||||||
|
font-size:13px;
|
||||||
|
}
|
||||||
|
h5 {
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
h6 {
|
||||||
|
font-size:11px;
|
||||||
|
}
|
||||||
|
ul {
|
||||||
|
list-style-type:disc;
|
||||||
|
}
|
||||||
|
code, tt {
|
||||||
|
font-family:'DejaVu Sans Mono', monospace;
|
||||||
|
font-size:14px;
|
||||||
|
padding-top:4px;
|
||||||
|
margin-top:8px;
|
||||||
|
line-height:1.4em;
|
||||||
|
}
|
||||||
|
dt code {
|
||||||
|
font-family:'DejaVu Sans Mono', monospace;
|
||||||
|
font-size:14px;
|
||||||
|
padding-top:4px;
|
||||||
|
}
|
||||||
|
table tr td dt code {
|
||||||
|
font-family:'DejaVu Sans Mono', monospace;
|
||||||
|
font-size:14px;
|
||||||
|
vertical-align:top;
|
||||||
|
padding-top:4px;
|
||||||
|
}
|
||||||
|
sup {
|
||||||
|
font-size:8px;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Document title and Copyright styles
|
||||||
|
*/
|
||||||
|
.clear {
|
||||||
|
clear:both;
|
||||||
|
height:0px;
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
.aboutLanguage {
|
||||||
|
float:right;
|
||||||
|
padding:0px 21px;
|
||||||
|
font-size:11px;
|
||||||
|
z-index:200;
|
||||||
|
margin-top:-9px;
|
||||||
|
}
|
||||||
|
.legalCopy {
|
||||||
|
margin-left:.5em;
|
||||||
|
}
|
||||||
|
.bar a, .bar a:link, .bar a:visited, .bar a:active {
|
||||||
|
color:#FFFFFF;
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
.bar a:hover, .bar a:focus {
|
||||||
|
color:#bb7a2a;
|
||||||
|
}
|
||||||
|
.tab {
|
||||||
|
background-color:#0066FF;
|
||||||
|
color:#ffffff;
|
||||||
|
padding:8px;
|
||||||
|
width:5em;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Navigation bar styles
|
||||||
|
*/
|
||||||
|
.bar {
|
||||||
|
background-color:#4D7A97;
|
||||||
|
color:#FFFFFF;
|
||||||
|
padding:.8em .5em .4em .8em;
|
||||||
|
height:auto;/*height:1.8em;*/
|
||||||
|
font-size:11px;
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
.topNav {
|
||||||
|
background-color:#4D7A97;
|
||||||
|
color:#FFFFFF;
|
||||||
|
float:left;
|
||||||
|
padding:0;
|
||||||
|
width:100%;
|
||||||
|
clear:right;
|
||||||
|
height:2.8em;
|
||||||
|
padding-top:10px;
|
||||||
|
overflow:hidden;
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
.bottomNav {
|
||||||
|
margin-top:10px;
|
||||||
|
background-color:#4D7A97;
|
||||||
|
color:#FFFFFF;
|
||||||
|
float:left;
|
||||||
|
padding:0;
|
||||||
|
width:100%;
|
||||||
|
clear:right;
|
||||||
|
height:2.8em;
|
||||||
|
padding-top:10px;
|
||||||
|
overflow:hidden;
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
.subNav {
|
||||||
|
background-color:#dee3e9;
|
||||||
|
float:left;
|
||||||
|
width:100%;
|
||||||
|
overflow:hidden;
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
.subNav div {
|
||||||
|
clear:left;
|
||||||
|
float:left;
|
||||||
|
padding:0 0 5px 6px;
|
||||||
|
text-transform:uppercase;
|
||||||
|
}
|
||||||
|
ul.navList, ul.subNavList {
|
||||||
|
float:left;
|
||||||
|
margin:0 25px 0 0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
ul.navList li{
|
||||||
|
list-style:none;
|
||||||
|
float:left;
|
||||||
|
padding: 5px 6px;
|
||||||
|
text-transform:uppercase;
|
||||||
|
}
|
||||||
|
ul.subNavList li{
|
||||||
|
list-style:none;
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited {
|
||||||
|
color:#FFFFFF;
|
||||||
|
text-decoration:none;
|
||||||
|
text-transform:uppercase;
|
||||||
|
}
|
||||||
|
.topNav a:hover, .bottomNav a:hover {
|
||||||
|
text-decoration:none;
|
||||||
|
color:#bb7a2a;
|
||||||
|
text-transform:uppercase;
|
||||||
|
}
|
||||||
|
.navBarCell1Rev {
|
||||||
|
background-color:#F8981D;
|
||||||
|
color:#253441;
|
||||||
|
margin: auto 5px;
|
||||||
|
}
|
||||||
|
.skipNav {
|
||||||
|
position:absolute;
|
||||||
|
top:auto;
|
||||||
|
left:-9999px;
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Page header and footer styles
|
||||||
|
*/
|
||||||
|
.header, .footer {
|
||||||
|
clear:both;
|
||||||
|
margin:0 20px;
|
||||||
|
padding:5px 0 0 0;
|
||||||
|
}
|
||||||
|
.indexHeader {
|
||||||
|
margin:10px;
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
.indexHeader span{
|
||||||
|
margin-right:15px;
|
||||||
|
}
|
||||||
|
.indexHeader h1 {
|
||||||
|
font-size:13px;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
color:#2c4557;
|
||||||
|
margin:10px 0;
|
||||||
|
}
|
||||||
|
.subTitle {
|
||||||
|
margin:5px 0 0 0;
|
||||||
|
}
|
||||||
|
.header ul {
|
||||||
|
margin:0 0 15px 0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
.footer ul {
|
||||||
|
margin:20px 0 5px 0;
|
||||||
|
}
|
||||||
|
.header ul li, .footer ul li {
|
||||||
|
list-style:none;
|
||||||
|
font-size:13px;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Heading styles
|
||||||
|
*/
|
||||||
|
div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
|
||||||
|
background-color:#dee3e9;
|
||||||
|
border:1px solid #d0d9e0;
|
||||||
|
margin:0 0 6px -8px;
|
||||||
|
padding:7px 5px;
|
||||||
|
}
|
||||||
|
ul.blockList ul.blockList ul.blockList li.blockList h3 {
|
||||||
|
background-color:#dee3e9;
|
||||||
|
border:1px solid #d0d9e0;
|
||||||
|
margin:0 0 6px -8px;
|
||||||
|
padding:7px 5px;
|
||||||
|
}
|
||||||
|
ul.blockList ul.blockList li.blockList h3 {
|
||||||
|
padding:0;
|
||||||
|
margin:15px 0;
|
||||||
|
}
|
||||||
|
ul.blockList li.blockList h2 {
|
||||||
|
padding:0px 0 20px 0;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Page layout container styles
|
||||||
|
*/
|
||||||
|
.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer {
|
||||||
|
clear:both;
|
||||||
|
padding:10px 20px;
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
.indexContainer {
|
||||||
|
margin:10px;
|
||||||
|
position:relative;
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
.indexContainer h2 {
|
||||||
|
font-size:13px;
|
||||||
|
padding:0 0 3px 0;
|
||||||
|
}
|
||||||
|
.indexContainer ul {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
.indexContainer ul li {
|
||||||
|
list-style:none;
|
||||||
|
padding-top:2px;
|
||||||
|
}
|
||||||
|
.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt {
|
||||||
|
font-size:12px;
|
||||||
|
font-weight:bold;
|
||||||
|
margin:10px 0 0 0;
|
||||||
|
color:#4E4E4E;
|
||||||
|
}
|
||||||
|
.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd {
|
||||||
|
margin:5px 0 10px 0px;
|
||||||
|
font-size:14px;
|
||||||
|
font-family:'DejaVu Sans Mono',monospace;
|
||||||
|
}
|
||||||
|
.serializedFormContainer dl.nameValue dt {
|
||||||
|
margin-left:1px;
|
||||||
|
font-size:1.1em;
|
||||||
|
display:inline;
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
.serializedFormContainer dl.nameValue dd {
|
||||||
|
margin:0 0 0 1px;
|
||||||
|
font-size:1.1em;
|
||||||
|
display:inline;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
List styles
|
||||||
|
*/
|
||||||
|
ul.horizontal li {
|
||||||
|
display:inline;
|
||||||
|
font-size:0.9em;
|
||||||
|
}
|
||||||
|
ul.inheritance {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
ul.inheritance li {
|
||||||
|
display:inline;
|
||||||
|
list-style:none;
|
||||||
|
}
|
||||||
|
ul.inheritance li ul.inheritance {
|
||||||
|
margin-left:15px;
|
||||||
|
padding-left:15px;
|
||||||
|
padding-top:1px;
|
||||||
|
}
|
||||||
|
ul.blockList, ul.blockListLast {
|
||||||
|
margin:10px 0 10px 0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
ul.blockList li.blockList, ul.blockListLast li.blockList {
|
||||||
|
list-style:none;
|
||||||
|
margin-bottom:15px;
|
||||||
|
line-height:1.4;
|
||||||
|
}
|
||||||
|
ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList {
|
||||||
|
padding:0px 20px 5px 10px;
|
||||||
|
border:1px solid #ededed;
|
||||||
|
background-color:#f8f8f8;
|
||||||
|
}
|
||||||
|
ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList {
|
||||||
|
padding:0 0 5px 8px;
|
||||||
|
background-color:#ffffff;
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
ul.blockList ul.blockList ul.blockList ul.blockList li.blockList {
|
||||||
|
margin-left:0;
|
||||||
|
padding-left:0;
|
||||||
|
padding-bottom:15px;
|
||||||
|
border:none;
|
||||||
|
}
|
||||||
|
ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast {
|
||||||
|
list-style:none;
|
||||||
|
border-bottom:none;
|
||||||
|
padding-bottom:0;
|
||||||
|
}
|
||||||
|
table tr td dl, table tr td dl dt, table tr td dl dd {
|
||||||
|
margin-top:0;
|
||||||
|
margin-bottom:1px;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Table styles
|
||||||
|
*/
|
||||||
|
.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary {
|
||||||
|
width:100%;
|
||||||
|
border-left:1px solid #EEE;
|
||||||
|
border-right:1px solid #EEE;
|
||||||
|
border-bottom:1px solid #EEE;
|
||||||
|
}
|
||||||
|
.overviewSummary, .memberSummary {
|
||||||
|
padding:0px;
|
||||||
|
}
|
||||||
|
.overviewSummary caption, .memberSummary caption, .typeSummary caption,
|
||||||
|
.useSummary caption, .constantsSummary caption, .deprecatedSummary caption {
|
||||||
|
position:relative;
|
||||||
|
text-align:left;
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
color:#253441;
|
||||||
|
font-weight:bold;
|
||||||
|
clear:none;
|
||||||
|
overflow:hidden;
|
||||||
|
padding:0px;
|
||||||
|
padding-top:10px;
|
||||||
|
padding-left:1px;
|
||||||
|
margin:0px;
|
||||||
|
white-space:pre;
|
||||||
|
}
|
||||||
|
.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link,
|
||||||
|
.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link,
|
||||||
|
.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover,
|
||||||
|
.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
|
||||||
|
.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active,
|
||||||
|
.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active,
|
||||||
|
.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited,
|
||||||
|
.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited {
|
||||||
|
color:#FFFFFF;
|
||||||
|
}
|
||||||
|
.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
|
||||||
|
.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {
|
||||||
|
white-space:nowrap;
|
||||||
|
padding-top:5px;
|
||||||
|
padding-left:12px;
|
||||||
|
padding-right:12px;
|
||||||
|
padding-bottom:7px;
|
||||||
|
display:inline-block;
|
||||||
|
float:left;
|
||||||
|
background-color:#F8981D;
|
||||||
|
border: none;
|
||||||
|
height:16px;
|
||||||
|
}
|
||||||
|
.memberSummary caption span.activeTableTab span {
|
||||||
|
white-space:nowrap;
|
||||||
|
padding-top:5px;
|
||||||
|
padding-left:12px;
|
||||||
|
padding-right:12px;
|
||||||
|
margin-right:3px;
|
||||||
|
display:inline-block;
|
||||||
|
float:left;
|
||||||
|
background-color:#F8981D;
|
||||||
|
height:16px;
|
||||||
|
}
|
||||||
|
.memberSummary caption span.tableTab span {
|
||||||
|
white-space:nowrap;
|
||||||
|
padding-top:5px;
|
||||||
|
padding-left:12px;
|
||||||
|
padding-right:12px;
|
||||||
|
margin-right:3px;
|
||||||
|
display:inline-block;
|
||||||
|
float:left;
|
||||||
|
background-color:#4D7A97;
|
||||||
|
height:16px;
|
||||||
|
}
|
||||||
|
.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {
|
||||||
|
padding-top:0px;
|
||||||
|
padding-left:0px;
|
||||||
|
padding-right:0px;
|
||||||
|
background-image:none;
|
||||||
|
float:none;
|
||||||
|
display:inline;
|
||||||
|
}
|
||||||
|
.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd,
|
||||||
|
.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd {
|
||||||
|
display:none;
|
||||||
|
width:5px;
|
||||||
|
position:relative;
|
||||||
|
float:left;
|
||||||
|
background-color:#F8981D;
|
||||||
|
}
|
||||||
|
.memberSummary .activeTableTab .tabEnd {
|
||||||
|
display:none;
|
||||||
|
width:5px;
|
||||||
|
margin-right:3px;
|
||||||
|
position:relative;
|
||||||
|
float:left;
|
||||||
|
background-color:#F8981D;
|
||||||
|
}
|
||||||
|
.memberSummary .tableTab .tabEnd {
|
||||||
|
display:none;
|
||||||
|
width:5px;
|
||||||
|
margin-right:3px;
|
||||||
|
position:relative;
|
||||||
|
background-color:#4D7A97;
|
||||||
|
float:left;
|
||||||
|
|
||||||
|
}
|
||||||
|
.overviewSummary td, .memberSummary td, .typeSummary td,
|
||||||
|
.useSummary td, .constantsSummary td, .deprecatedSummary td {
|
||||||
|
text-align:left;
|
||||||
|
padding:0px 0px 12px 10px;
|
||||||
|
}
|
||||||
|
th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
|
||||||
|
td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
|
||||||
|
vertical-align:top;
|
||||||
|
padding-right:0px;
|
||||||
|
padding-top:8px;
|
||||||
|
padding-bottom:3px;
|
||||||
|
}
|
||||||
|
th.colFirst, th.colLast, th.colOne, .constantsSummary th {
|
||||||
|
background:#dee3e9;
|
||||||
|
text-align:left;
|
||||||
|
padding:8px 3px 3px 7px;
|
||||||
|
}
|
||||||
|
td.colFirst, th.colFirst {
|
||||||
|
white-space:nowrap;
|
||||||
|
font-size:13px;
|
||||||
|
}
|
||||||
|
td.colLast, th.colLast {
|
||||||
|
font-size:13px;
|
||||||
|
}
|
||||||
|
td.colOne, th.colOne {
|
||||||
|
font-size:13px;
|
||||||
|
}
|
||||||
|
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
|
||||||
|
.useSummary td.colFirst, .useSummary th.colFirst,
|
||||||
|
.overviewSummary td.colOne, .overviewSummary th.colOne,
|
||||||
|
.memberSummary td.colFirst, .memberSummary th.colFirst,
|
||||||
|
.memberSummary td.colOne, .memberSummary th.colOne,
|
||||||
|
.typeSummary td.colFirst{
|
||||||
|
width:25%;
|
||||||
|
vertical-align:top;
|
||||||
|
}
|
||||||
|
td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
.tableSubHeadingColor {
|
||||||
|
background-color:#EEEEFF;
|
||||||
|
}
|
||||||
|
.altColor {
|
||||||
|
background-color:#FFFFFF;
|
||||||
|
}
|
||||||
|
.rowColor {
|
||||||
|
background-color:#EEEEEF;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Content styles
|
||||||
|
*/
|
||||||
|
.description pre {
|
||||||
|
margin-top:0;
|
||||||
|
}
|
||||||
|
.deprecatedContent {
|
||||||
|
margin:0;
|
||||||
|
padding:10px 0;
|
||||||
|
}
|
||||||
|
.docSummary {
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.blockList ul.blockList ul.blockList li.blockList h3 {
|
||||||
|
font-style:normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.block {
|
||||||
|
font-size:14px;
|
||||||
|
font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.colLast div {
|
||||||
|
padding-top:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
td.colLast a {
|
||||||
|
padding-bottom:3px;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Formatting effect styles
|
||||||
|
*/
|
||||||
|
.sourceLineNo {
|
||||||
|
color:green;
|
||||||
|
padding:0 30px 0 0;
|
||||||
|
}
|
||||||
|
h1.hidden {
|
||||||
|
visibility:hidden;
|
||||||
|
overflow:hidden;
|
||||||
|
font-size:10px;
|
||||||
|
}
|
||||||
|
.block {
|
||||||
|
display:block;
|
||||||
|
margin:3px 10px 2px 0px;
|
||||||
|
color:#474747;
|
||||||
|
}
|
||||||
|
.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink,
|
||||||
|
.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel,
|
||||||
|
.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink {
|
||||||
|
font-weight:bold;
|
||||||
|
}
|
||||||
|
.deprecationComment, .emphasizedPhrase, .interfaceName {
|
||||||
|
font-style:italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase,
|
||||||
|
div.block div.block span.interfaceName {
|
||||||
|
font-style:normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.contentContainer ul.blockList li.blockList h2{
|
||||||
|
padding-bottom:0px;
|
||||||
|
}
|
||||||
BIN
01_hintergrund/03_alg_vergleich_ai_java.odt
Normal file
BIN
01_hintergrund/03_alg_vergleich_ai_java.odt
Normal file
Binary file not shown.
BIN
01_hintergrund/03_alg_vergleich_ai_java.pdf
Normal file
BIN
01_hintergrund/03_alg_vergleich_ai_java.pdf
Normal file
Binary file not shown.
BIN
01_hintergrund/03_alg_vergleich_scratch_java.odt
Normal file
BIN
01_hintergrund/03_alg_vergleich_scratch_java.odt
Normal file
Binary file not shown.
BIN
01_hintergrund/03_alg_vergleich_scratch_java.pdf
Normal file
BIN
01_hintergrund/03_alg_vergleich_scratch_java.pdf
Normal file
Binary file not shown.
BIN
01_hintergrund/04_alg_processing_android.odt
Normal file
BIN
01_hintergrund/04_alg_processing_android.odt
Normal file
Binary file not shown.
BIN
01_hintergrund/05_alg_processing_debugging.odt
Normal file
BIN
01_hintergrund/05_alg_processing_debugging.odt
Normal file
Binary file not shown.
|
|
@ -0,0 +1,21 @@
|
||||||
|
int a = 10;
|
||||||
|
String name = "Hans";
|
||||||
|
float[] zufaelle;
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
size(600,400);
|
||||||
|
setZufallsArray(10);
|
||||||
|
veraenderung(); //<>//
|
||||||
|
}
|
||||||
|
|
||||||
|
void setZufallsArray(int anzahl){
|
||||||
|
zufaelle = new float[anzahl];
|
||||||
|
for (int i=0; i<anzahl; i++){
|
||||||
|
zufaelle[i]=random(100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void veraenderung(){
|
||||||
|
a = a + 10;
|
||||||
|
name = "Hallo "+name;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
void setup() {
|
||||||
|
size(200, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void mousePressed() {
|
||||||
|
fill(int(random(0, 255)), int(random(0, 255)), int(random(0, 255)));
|
||||||
|
ellipse(mouseX, mouseY, 10, 10); //<>//
|
||||||
|
}
|
||||||
BIN
02_kopiervorlagen/01_alg_wdh_begriffe.odt
Normal file
BIN
02_kopiervorlagen/01_alg_wdh_begriffe.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/02_alg_kontrollstrukturen_wdh.odt
Normal file
BIN
02_kopiervorlagen/02_alg_kontrollstrukturen_wdh.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/03_alg_keine_bloecke_mehr.odt
Normal file
BIN
02_kopiervorlagen/03_alg_keine_bloecke_mehr.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/04_alg_infos_methoden.odt
Normal file
BIN
02_kopiervorlagen/04_alg_infos_methoden.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/04_alg_zaehlschleife.odt
Normal file
BIN
02_kopiervorlagen/04_alg_zaehlschleife.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/04_alg_zaehlschleife_puzzle.odt
Normal file
BIN
02_kopiervorlagen/04_alg_zaehlschleife_puzzle.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/05_alg_optische_taeuschungen_kaffeehaus.odt
Normal file
BIN
02_kopiervorlagen/05_alg_optische_taeuschungen_kaffeehaus.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/06_alg_optische_taeuschungen_uebungen.odt
Normal file
BIN
02_kopiervorlagen/06_alg_optische_taeuschungen_uebungen.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/07_alg_optische_taeuschungen_up_verzw.odt
Normal file
BIN
02_kopiervorlagen/07_alg_optische_taeuschungen_up_verzw.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/08_alg_optische_taeuschungen_uebungen.odt
Normal file
BIN
02_kopiervorlagen/08_alg_optische_taeuschungen_uebungen.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/09_alg_optische_taeuschungen_zusatz.odt
Normal file
BIN
02_kopiervorlagen/09_alg_optische_taeuschungen_zusatz.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/10_alg_balkendiagramm.odt
Normal file
BIN
02_kopiervorlagen/10_alg_balkendiagramm.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/10_alg_balkendiagramm_hilfekarten.odt
Normal file
BIN
02_kopiervorlagen/10_alg_balkendiagramm_hilfekarten.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/11_alg_zufallszahlen.odt
Normal file
BIN
02_kopiervorlagen/11_alg_zufallszahlen.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/11_alg_zufallszahlen_hilfekarten.odt
Normal file
BIN
02_kopiervorlagen/11_alg_zufallszahlen_hilfekarten.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/12_alg_externedaten.odt
Normal file
BIN
02_kopiervorlagen/12_alg_externedaten.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/12_alg_externedaten_hilfekarten.odt
Normal file
BIN
02_kopiervorlagen/12_alg_externedaten_hilfekarten.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/13_alg_maximumsuche.odt
Normal file
BIN
02_kopiervorlagen/13_alg_maximumsuche.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/13_alg_maximumsuche_puzzle.odt
Normal file
BIN
02_kopiervorlagen/13_alg_maximumsuche_puzzle.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/14_alg_weiterearrayalgorithmen.odt
Normal file
BIN
02_kopiervorlagen/14_alg_weiterearrayalgorithmen.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/15_alg_xydiagramm.odt
Normal file
BIN
02_kopiervorlagen/15_alg_xydiagramm.odt
Normal file
Binary file not shown.
BIN
02_kopiervorlagen/15_alg_xydiagramm_uebung.odt
Normal file
BIN
02_kopiervorlagen/15_alg_xydiagramm_uebung.odt
Normal file
Binary file not shown.
|
|
@ -0,0 +1,14 @@
|
||||||
|
//Überlege dir, was die Anweisungen in der Methode "waszeichneich" auslösen könnten
|
||||||
|
// Verändere die Werte, die den Methoden übergeben werden. Was passiert?
|
||||||
|
|
||||||
|
void waszeichneich() {
|
||||||
|
line(100, 50, 200, 100);
|
||||||
|
ellipse(100, 200, 50, 100);
|
||||||
|
rect(300, 100, 250, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(600, 400);
|
||||||
|
waszeichneich(); // Aufruf der Methode
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
void zeichneBildC() {
|
||||||
|
// Zeichne dir zunächst eine Skizze auf ein Blatt Papier und überlege dir, welche
|
||||||
|
// Werte du den Methoden rect(x,y,b,h) und ellipse(x,y,b,h) übergeben musst,
|
||||||
|
// dass Bild C gezeichnet wird
|
||||||
|
|
||||||
|
// ***** hier kommen deine Anweisungen hin ************
|
||||||
|
|
||||||
|
|
||||||
|
// ***** Ende der eigenen Anweisungen **********
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//***** Zusatzaufgabe bzw. Hausaufgabe *************
|
||||||
|
void zeichneBildA() {
|
||||||
|
// ***** hier kommen deine Anweisungen hin ************
|
||||||
|
|
||||||
|
|
||||||
|
// ***** Ende der eigenen Anweisungen **********
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(500, 350); // Festlegen der Fenstergröße
|
||||||
|
zeichneBildC(); // Aufruf deiner Methode
|
||||||
|
// zeichneBildA();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
void zeichneBildC() {
|
||||||
|
|
||||||
|
// ***** hier kommen deine Anweisungen hin ************
|
||||||
|
|
||||||
|
|
||||||
|
// ***** Ende der eigenen Anweisungen **********
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
size(500, 350); // Festlegen der Fenstergröße
|
||||||
|
zeichneBildC(); // Aufruf deiner Methode
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
// Programm zur Darstellung eines Arrays als Balkendiagramm
|
||||||
|
// Autor: Thomas Schaller
|
||||||
|
// Version: 1.0 vom 12.02.2019
|
||||||
|
|
||||||
|
|
||||||
|
// Liste mit allen Werten //<>//
|
||||||
|
int[] zahlen={45, 23, 123, 87, 98, 2, 1, 23, 23, 34};
|
||||||
|
// Schriften
|
||||||
|
PFont kleineSchrift;
|
||||||
|
PFont grosseSchrift;
|
||||||
|
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
size(1000, 700);
|
||||||
|
background(0);
|
||||||
|
kleineSchrift = loadFont("KleineSchrift.vlw");
|
||||||
|
grosseSchrift = loadFont("GrosseSchrift.vlw");
|
||||||
|
zeichneBalken();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void zeichneBalken() {
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Überschrift
|
||||||
|
fill(255,255,255);
|
||||||
|
textFont(grosseSchrift);
|
||||||
|
text("Balkendiagramm", 2, 20);
|
||||||
|
textFont(kleineSchrift);
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// To Do
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Version 1:
|
||||||
|
// Implementiere die ersten vier Balken durch Angabe der Koordinaten aus der Tabelle.
|
||||||
|
// Ergänze dazu die Methode zeicheBalken an der "ToDo"-Stelle.
|
||||||
|
// Version 2:
|
||||||
|
// Ersetze die y-Koordinate und die Breite durch die oben ermittelte Formel.
|
||||||
|
// Deklariere vorher eine Integer-Variable i. Setze i vor der ersten Rechteck
|
||||||
|
// auf 0, vor dem zweite auf 1 usw. Überprüfe, ob deine Rechtecke immer noch
|
||||||
|
// korrekt gezeichnet werden.
|
||||||
|
// Version 3:
|
||||||
|
// Verwende eine for-Schleife, um alle Balken zeichnen zu lassen. Diese muss das i
|
||||||
|
// in jedem Durchgang um 1 erhöhen. Die Anzahl der Elemente im Array bekommst du
|
||||||
|
// durch zahlen.length.
|
||||||
|
// Tipp: Vergleiche mit deiner Implementation von der Kaffeehaus-Täuschung.
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,64 @@
|
||||||
|
/**
|
||||||
|
* Balkendiagramm für int-Array, Zahlen werden zufällig erzeugt.
|
||||||
|
*
|
||||||
|
* @author Schaller
|
||||||
|
* @version 29.11.18
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Liste mit allen Werten //<>//
|
||||||
|
int[] zahlen;
|
||||||
|
// Schriften
|
||||||
|
PFont kleineSchrift;
|
||||||
|
PFont grosseSchrift;
|
||||||
|
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
// Zeichenfläche erzeugen
|
||||||
|
size(1000, 700);
|
||||||
|
background(0);
|
||||||
|
// Schriften laden
|
||||||
|
kleineSchrift = loadFont("KleineSchrift.vlw");
|
||||||
|
grosseSchrift = loadFont("GrosseSchrift.vlw");
|
||||||
|
|
||||||
|
// Zufallszahlen erzeugen und anzeigen
|
||||||
|
erzeugeZufallsarray(20);
|
||||||
|
zeichneBalken();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZufallszahl(int min, int max) {
|
||||||
|
java.util.Random r = new java.util.Random();
|
||||||
|
return r.nextInt(max-min+1)+min;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void erzeugeZufallsarray(int laenge) {
|
||||||
|
// ToDo: Neues Array der richtigen Länge erzeugen
|
||||||
|
|
||||||
|
// ToDo: Jedes Element mit einer Zufallszahl belegen
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void zeichneBalken() {
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Überschrift
|
||||||
|
fill(255,255,255);
|
||||||
|
textFont(grosseSchrift);
|
||||||
|
text("Balkendiagramm", 2, 20);
|
||||||
|
textFont(kleineSchrift);
|
||||||
|
|
||||||
|
// Alle Einträge darstellen
|
||||||
|
for (int i = 0; i< zahlen.length; i++) {
|
||||||
|
|
||||||
|
fill(20,30,170);
|
||||||
|
|
||||||
|
// Balkendiagramm zeichnen
|
||||||
|
rect(120, 25+i*15, zahlen[i]+1, 13);
|
||||||
|
|
||||||
|
// Beschriftung
|
||||||
|
fill(255,255,255);
|
||||||
|
text("i="+i, 2, 35+i*15);
|
||||||
|
text("zahlen["+i+"]="+zahlen[i], 30, 35+i*15);
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,75 @@
|
||||||
|
/**
|
||||||
|
* Balkendiagramm für int-Array, Zahlen werden aus CSV-Datei gelesen.
|
||||||
|
*
|
||||||
|
* @author Schaller
|
||||||
|
* @version 29.11.18
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Liste mit allen Werten
|
||||||
|
// Deklariere ein Array zahlen für die Punkte und ein Array namen für die Spielernamen
|
||||||
|
//------------
|
||||||
|
// TODO
|
||||||
|
//------------
|
||||||
|
|
||||||
|
|
||||||
|
// Schriften
|
||||||
|
PFont kleineSchrift;
|
||||||
|
PFont grosseSchrift;
|
||||||
|
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
// Zeichenfläche erzeugen
|
||||||
|
size(1000, 700);
|
||||||
|
background(0);
|
||||||
|
// Schriften laden
|
||||||
|
kleineSchrift = loadFont("KleineSchrift.vlw");
|
||||||
|
grosseSchrift = loadFont("GrosseSchrift.vlw");
|
||||||
|
|
||||||
|
// CSV-Datei laden und anzeigen
|
||||||
|
ladeTabelle("punkte.csv");
|
||||||
|
zeichneBalken();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ladeTabelle(String name) {
|
||||||
|
// Tabelle aus CSV-Datei laden
|
||||||
|
Table csv = loadTable(name,"header,csv");
|
||||||
|
|
||||||
|
// Initialisiere Arrays, in die alle Zeilen der Tabelle passen
|
||||||
|
// Die Anzahl der gespeicherten Zeilen bekommt man mit csv.getRowCount()
|
||||||
|
//------------
|
||||||
|
// TODO
|
||||||
|
//------------
|
||||||
|
|
||||||
|
// Fülle die Arrays mit Werten aus der Tabelle
|
||||||
|
// Mit csv.getInt(zeilennummer, "Name der Spalte") oder csv.getInt(zeilennummer, spaltennummer)
|
||||||
|
// bekommt man die Werte der Tabelleneinträge als Integer-Wert
|
||||||
|
// Informiere dich unter https://processing.org/reference/Table.html, welche Methode geeignet ist,
|
||||||
|
// um die Namen der Spieler als String zu bekommen. getInt hilft hier nicht weiter.
|
||||||
|
//------------
|
||||||
|
// TODO
|
||||||
|
//------------
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void zeichneBalken() {
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Überschrift
|
||||||
|
fill(255,255,255);
|
||||||
|
textFont(grosseSchrift);
|
||||||
|
text("Punkte", 2, 20);
|
||||||
|
textFont(kleineSchrift);
|
||||||
|
|
||||||
|
// Alle Einträge darstellen
|
||||||
|
// lasse alle Ergebnisse der Spieler in der Form
|
||||||
|
// SpielerXY 234 XXXXXXXXXXXXXXXX
|
||||||
|
// SpielerZY 12 XX
|
||||||
|
// usw.
|
||||||
|
// darstellen. Wandle dazu dein Programm, um die Werte eines Arrays darzustelle ab.
|
||||||
|
//------------
|
||||||
|
// TODO
|
||||||
|
//------------
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,6 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Niko,216
|
||||||
|
Klaus,591
|
||||||
|
Anna,857
|
||||||
|
Lena,180
|
||||||
|
Winfried,168
|
||||||
|
|
|
@ -0,0 +1,156 @@
|
||||||
|
/**
|
||||||
|
* Balkendiagramm für int-Array, Zahlen werden aus CSV-Datei gelesen, Maximum der Werte wird bestimmt.
|
||||||
|
* Hinweis zur Benutzung:
|
||||||
|
* Klicke in das Zeichenfenster
|
||||||
|
* Animierte Suche mit Taste "a"
|
||||||
|
* Automatisches Testen mit Taste "t"*
|
||||||
|
* @author Schaller
|
||||||
|
* @version 29.11.18
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Liste mit allen Werten //<>//
|
||||||
|
int[] zahlen;
|
||||||
|
String[] namen;
|
||||||
|
|
||||||
|
|
||||||
|
// Hilfsvariablen für die Suche
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// ToDo: Hilfsvariablen erzeugen für aktuell größtes und aktuell
|
||||||
|
// untersuchtes Element
|
||||||
|
// -------------------------------------------------------------------
|
||||||
|
// aktuell groesstes Element
|
||||||
|
// aktuell untersuchtes Element
|
||||||
|
int verzoegerung=1000; // Geschwindigkeit der Ausführung
|
||||||
|
|
||||||
|
// Schriften
|
||||||
|
PFont kleineSchrift;
|
||||||
|
PFont grosseSchrift;
|
||||||
|
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
// Zeichenfläche erzeugen
|
||||||
|
size(1000, 700);
|
||||||
|
background(0);
|
||||||
|
// Schriften laden
|
||||||
|
kleineSchrift = loadFont("KleineSchrift.vlw");
|
||||||
|
grosseSchrift = loadFont("GrosseSchrift.vlw");
|
||||||
|
|
||||||
|
// CSV-Datei laden und anzeigen
|
||||||
|
ladeTabelle("punkte.csv");
|
||||||
|
zeichneBalken();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
zeichneBalken();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void keyPressed() {
|
||||||
|
// Animierte Suche mit Taste "a"
|
||||||
|
if (key=='a') {
|
||||||
|
thread("maximumsuche");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Automatisches Testen mit Taste "t"
|
||||||
|
if(key == 't') {
|
||||||
|
// Testfall 1
|
||||||
|
verzoegerung = 0;
|
||||||
|
ladeTabelle("testfall1.csv");
|
||||||
|
int m1 = maximumsuche();
|
||||||
|
if (m1 == 12) {
|
||||||
|
System.out.println("Maximum korrekt gefunden. In Datei testfall1.csv ist der größte Wert "+ zahlen[m1]+" von "+namen[m1]+" an Position "+m1);
|
||||||
|
} else {
|
||||||
|
System.out.println("Maximum in testfall.csv nicht gefunden. Du ermittelst "+m1+" richtig wäre 12");
|
||||||
|
}
|
||||||
|
// Testfall 2: negative Zahlen
|
||||||
|
ladeTabelle("testfall2.csv");
|
||||||
|
int m2 = maximumsuche();
|
||||||
|
if (m2 == 3) {
|
||||||
|
System.out.println("Maximum korrekt gefunden. In Datei testfall2.csv ist der größte Wert "+ zahlen[m2]+" von "+namen[m2]+" an Position "+m2);
|
||||||
|
} else {
|
||||||
|
System.out.println("Maximum in testfall2.csv nicht gefunden. Du ermittelst "+m2+" richtig wäre 3");
|
||||||
|
}
|
||||||
|
// Testfall 3: Nur 1 Element
|
||||||
|
ladeTabelle("testfall3.csv");
|
||||||
|
int m3 = maximumsuche();
|
||||||
|
if (m3 == 0) {
|
||||||
|
System.out.println("Maximum korrekt gefunden. In Datei testfall3.csv ist der größte Wert "+ zahlen[m3]+" von "+namen[m3]+" an Position "+m3);
|
||||||
|
} else {
|
||||||
|
System.out.println("Maximum in testfall3.csv nicht gefunden. Du ermittelst "+m3+" richtig wäre 0");
|
||||||
|
}
|
||||||
|
// Testfall 4: Leere Liste
|
||||||
|
ladeTabelle("testfall4.csv");
|
||||||
|
int m4 = maximumsuche();
|
||||||
|
if (m4 == -1) {
|
||||||
|
System.out.println("Maximum korrekt gefunden. Da die Datei keine Spieler enthält wird -1 zurückgegeben.");
|
||||||
|
} else {
|
||||||
|
System.out.println("Maximum in testfall4.csv nicht gefunden. Du ermittelst "+m4+" richtig wäre -1, da die Datei leer ist.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void ladeTabelle(String name) {
|
||||||
|
// Tabelle aus CSV-Datei laden
|
||||||
|
Table csv = loadTable(name, "header,csv");
|
||||||
|
|
||||||
|
if (csv != null && csv.getColumnCount()==2) {
|
||||||
|
|
||||||
|
// Initialisiere Arrays, in die alle Zeilen der Tabelle passen
|
||||||
|
zahlen = new int[csv.getRowCount()];
|
||||||
|
namen = new String[csv.getRowCount()];
|
||||||
|
|
||||||
|
// Fülle die Arrays mit Werten aus der Tabelle
|
||||||
|
for (int i = 0; i < zahlen.length; i++) {
|
||||||
|
// Lies Wert aus der i. Zeile und der Spalte "Punkte" bzw. "Name"
|
||||||
|
zahlen[i] = csv.getInt(i, "Punkte");
|
||||||
|
namen[i] = csv.getString(i, "Name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void zeichneBalken() {
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Überschrift
|
||||||
|
fill(255,255,255);
|
||||||
|
textFont(grosseSchrift);
|
||||||
|
text("Punkte", 2, 20);
|
||||||
|
textFont(kleineSchrift);
|
||||||
|
|
||||||
|
// Alle Einträge darstellen
|
||||||
|
if (zahlen != null) {
|
||||||
|
for (int i = 0; i< zahlen.length; i++) {
|
||||||
|
|
||||||
|
fill(20,25,165);
|
||||||
|
// aktuelle Elemente farblich hervorheben
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// ToDo: Falls i dem aktuell untersuchtem oder der aktuellen Maximal-
|
||||||
|
// position entspricht, muss eine andere Farbe gewählt werden
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Balkendiagramm zeichnen
|
||||||
|
if (zahlen[i]>=0) rect(120, 25+i*15, zahlen[i]+1, 13);
|
||||||
|
|
||||||
|
// Beschriftung
|
||||||
|
fill(255,255,255);
|
||||||
|
text(namen[i], 2, 35+i*15);
|
||||||
|
text(""+zahlen[i], 70, 35+i*15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int maximumsuche() {
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// ToDO: Implementiere die Maximumsuche, füge nach jeder Veränderung der
|
||||||
|
// Position des aktuellen Elements oder der Position des momentanen Maximums
|
||||||
|
// die Befehle: redraw(); und delay(verzoegerung); ein.
|
||||||
|
// Als Ergebnis soll die Methode die Position des Maximums zurückgeben
|
||||||
|
// Kommentiere die Maximumsuche
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
//<>//
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,6 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Niko,216
|
||||||
|
Klaus,591
|
||||||
|
Anna,857
|
||||||
|
Lena,180
|
||||||
|
Winfried,168
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Spieler1,0
|
||||||
|
Spieler1,6
|
||||||
|
Spieler2,19
|
||||||
|
Spieler6,1
|
||||||
|
Spieler4,45
|
||||||
|
Spieler3,23
|
||||||
|
Spieler3,12
|
||||||
|
Spieler2,44
|
||||||
|
Spieler1,72
|
||||||
|
Spieler5,12
|
||||||
|
Spieler6,4
|
||||||
|
Spieler7,2
|
||||||
|
Spieler4,98
|
||||||
|
Spieler3,21
|
||||||
|
Spieler3,12
|
||||||
|
Spieler2,32
|
||||||
|
Spieler1,12
|
||||||
|
Spieler5,44
|
||||||
|
Spieler3,12
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Spieler1,-5
|
||||||
|
Spieler1,-6
|
||||||
|
Spieler2,-19
|
||||||
|
Spieler6,-1
|
||||||
|
Spieler4,-45
|
||||||
|
Spieler3,-23
|
||||||
|
Spieler3,-12
|
||||||
|
Spieler2,-44
|
||||||
|
Spieler1,-72
|
||||||
|
Spieler5,-12
|
||||||
|
Spieler6,-4
|
||||||
|
Spieler7,-2
|
||||||
|
Spieler4,-98
|
||||||
|
Spieler3,-21
|
||||||
|
Spieler3,-12
|
||||||
|
Spieler2,-32
|
||||||
|
Spieler1,-12
|
||||||
|
Spieler5,-44
|
||||||
|
Spieler3,-12
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Spieler1,45
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
/**
|
||||||
|
* Automatische Zeitungsmeldung mit Maximum und Durchschnitt, Zahlen werden aus CSV-Datei gelesen.
|
||||||
|
*
|
||||||
|
* @author Schaller
|
||||||
|
* @version 29.11.18
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Liste mit allen Werten
|
||||||
|
int[] punkte;
|
||||||
|
String[] namen;
|
||||||
|
|
||||||
|
// Schriften
|
||||||
|
PFont kleineSchrift;
|
||||||
|
PFont grosseSchrift;
|
||||||
|
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
// Zeichenfläche erzeugen
|
||||||
|
size(1000, 700);
|
||||||
|
background(0);
|
||||||
|
// Schriften laden
|
||||||
|
kleineSchrift = loadFont("KleineSchrift.vlw");
|
||||||
|
grosseSchrift = loadFont("GrosseSchrift.vlw");
|
||||||
|
|
||||||
|
// CSV-Datei laden und anzeigen
|
||||||
|
ladeTabelle("punkte.csv");
|
||||||
|
int summe = berechneSumme(punkte);
|
||||||
|
System.out.println("Summe: "+summe);
|
||||||
|
schreibeZeitungsmeldung();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ladeTabelle(String name) { //<>//
|
||||||
|
// Tabelle aus CSV-Datei laden //<>//
|
||||||
|
Table csv = loadTable(name, "header,csv");
|
||||||
|
|
||||||
|
if (csv != null && csv.getColumnCount()==2) {
|
||||||
|
|
||||||
|
// Initialisiere Arrays, in die alle Zeilen der Tabelle passen
|
||||||
|
punkte = new int[csv.getRowCount()];
|
||||||
|
namen = new String[csv.getRowCount()];
|
||||||
|
|
||||||
|
// Fülle die Arrays mit Werten aus der Tabelle
|
||||||
|
for (int i = 0; i < punkte.length; i++) {
|
||||||
|
// Lies Wert aus der i. Zeile und der Spalte "Punkte" bzw. "Name"
|
||||||
|
punkte[i] = csv.getInt(i, "Punkte");
|
||||||
|
namen[i] = csv.getString(i, "Name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void schreibeZeitungsmeldung() {
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Überschrift
|
||||||
|
fill(225,225,255);
|
||||||
|
stroke(155,155,255);
|
||||||
|
textFont(grosseSchrift);
|
||||||
|
text("BREAKING NEWS",5,32);
|
||||||
|
strokeWeight(3);
|
||||||
|
line(2,4,400,4);
|
||||||
|
line(2,45,400,45);
|
||||||
|
strokeWeight(2);
|
||||||
|
line(2,7,400,7);
|
||||||
|
line(2,42,400,42);
|
||||||
|
strokeWeight(1);
|
||||||
|
textFont(kleineSchrift);
|
||||||
|
fill(240);
|
||||||
|
|
||||||
|
int anzahlSpieler = 0;
|
||||||
|
int anzahlSpiele = 0;
|
||||||
|
int summe = berechneSumme(punkte);
|
||||||
|
double durchschnitt = 0;
|
||||||
|
|
||||||
|
text("Großartiges Ergebnis - Klasse XY nimmt an Binärwettbewerb teil.", 2, 60);
|
||||||
|
text("Die Klasse XY hat beim diesjährigen Binärwettbewerb teilgenommen", 2, 82);
|
||||||
|
text("und ein großartiges Ergebnis erzielt. Die XX Schülerinnen und", 2, 94);
|
||||||
|
text("Schüler der Klasse erreichten in "+anzahlSpiele+" Spielen eine Gesamtpunktzahl",2,106);
|
||||||
|
text("von "+summe+". Das ist ein Durchschnitt von XX.X pro Spiel.",2,118);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int berechneSumme(int[] zahlen) {
|
||||||
|
int summe;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// Startwerte setzen //<>//
|
||||||
|
summe = 0;
|
||||||
|
|
||||||
|
// Alle Arrayelemente untersuchen
|
||||||
|
for (i=0; i< zahlen.length; i++) {
|
||||||
|
summe = summe + i;
|
||||||
|
}
|
||||||
|
// Gib die Summe zurück
|
||||||
|
return i;
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,6 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Niko,216
|
||||||
|
Klaus,591
|
||||||
|
Anna,857
|
||||||
|
Lena,180
|
||||||
|
Winfried,168
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Spieler1,0
|
||||||
|
Spieler1,6
|
||||||
|
Spieler2,19
|
||||||
|
Spieler6,1
|
||||||
|
Spieler4,45
|
||||||
|
Spieler3,23
|
||||||
|
Spieler3,12
|
||||||
|
Spieler2,44
|
||||||
|
Spieler1,72
|
||||||
|
Spieler5,12
|
||||||
|
Spieler6,4
|
||||||
|
Spieler7,2
|
||||||
|
Spieler4,98
|
||||||
|
Spieler3,21
|
||||||
|
Spieler3,12
|
||||||
|
Spieler2,32
|
||||||
|
Spieler1,12
|
||||||
|
Spieler5,44
|
||||||
|
Spieler3,12
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Spieler1,-5
|
||||||
|
Spieler1,-6
|
||||||
|
Spieler2,-19
|
||||||
|
Spieler6,-1
|
||||||
|
Spieler4,-45
|
||||||
|
Spieler3,-23
|
||||||
|
Spieler3,-12
|
||||||
|
Spieler2,-44
|
||||||
|
Spieler1,-72
|
||||||
|
Spieler5,-12
|
||||||
|
Spieler6,-4
|
||||||
|
Spieler7,-2
|
||||||
|
Spieler4,-98
|
||||||
|
Spieler3,-21
|
||||||
|
Spieler3,-12
|
||||||
|
Spieler2,-32
|
||||||
|
Spieler1,-12
|
||||||
|
Spieler5,-44
|
||||||
|
Spieler3,-12
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Spieler1,45
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Balkendiagramm für int-Array, Zahlen werden aus CSV-Datei gelesen, Umwandlung in sortierte Tabelle.
|
||||||
|
* Hinweis zur Benutzung:
|
||||||
|
* Klicke in das Zeichenfenster
|
||||||
|
* Start des Algorithmus "wastutes" mit Taste "a"
|
||||||
|
* @author Schaller
|
||||||
|
* @version 29.11.18
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Liste mit allen Werten //<>//
|
||||||
|
int[] zahlen;
|
||||||
|
String[] namen;
|
||||||
|
|
||||||
|
// Hilfsvariablen für die Suche
|
||||||
|
int akt_maximum=-1; // aktuell groesstes Element
|
||||||
|
int akt=-2; // aktuell untersuchtes Element
|
||||||
|
int verzoegerung=1000; // Geschwindigkeit der Ausführung
|
||||||
|
|
||||||
|
// Schriften
|
||||||
|
PFont kleineSchrift;
|
||||||
|
PFont grosseSchrift;
|
||||||
|
|
||||||
|
|
||||||
|
public void setup() {
|
||||||
|
// Zeichenfläche erzeugen
|
||||||
|
size(1000, 700);
|
||||||
|
background(0);
|
||||||
|
// Schriften laden
|
||||||
|
kleineSchrift = loadFont("KleineSchrift.vlw");
|
||||||
|
grosseSchrift = loadFont("GrosseSchrift.vlw");
|
||||||
|
|
||||||
|
// CSV-Datei laden und anzeigen
|
||||||
|
ladeTabelle("punkte.csv");
|
||||||
|
zeichneBalken();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
zeichneBalken();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void keyPressed() {
|
||||||
|
// Animierte Suche mit Taste "a"
|
||||||
|
if (key=='a') {
|
||||||
|
thread("wastutes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void ladeTabelle(String name) {
|
||||||
|
// Tabelle aus CSV-Datei laden
|
||||||
|
Table csv = loadTable(name, "header,csv");
|
||||||
|
|
||||||
|
if (csv != null && csv.getColumnCount()==2) {
|
||||||
|
|
||||||
|
// Initialisiere Arrays, in die alle Zeilen der Tabelle passen
|
||||||
|
zahlen = new int[csv.getRowCount()];
|
||||||
|
namen = new String[csv.getRowCount()];
|
||||||
|
|
||||||
|
// Fülle die Arrays mit Werten aus der Tabelle
|
||||||
|
for (int i = 0; i < zahlen.length; i++) {
|
||||||
|
// Lies Wert aus der i. Zeile und der Spalte "Punkte" bzw. "Name"
|
||||||
|
zahlen[i] = csv.getInt(i, "Punkte");
|
||||||
|
namen[i] = csv.getString(i, "Name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void zeichneBalken() {
|
||||||
|
|
||||||
|
clear();
|
||||||
|
|
||||||
|
// Überschrift
|
||||||
|
fill(255, 255, 255);
|
||||||
|
textFont(grosseSchrift);
|
||||||
|
text("Punkte", 2, 20);
|
||||||
|
textFont(kleineSchrift);
|
||||||
|
|
||||||
|
// Alle Einträge darstellen
|
||||||
|
if (zahlen != null) {
|
||||||
|
for (int i = 0; i< zahlen.length; i++) {
|
||||||
|
|
||||||
|
fill(20, 25, 165);
|
||||||
|
// aktuelle Elemente farblich hervorheben
|
||||||
|
if (i == akt || i == akt+1 ) {
|
||||||
|
fill(140, 230, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Balkendiagramm zeichnen
|
||||||
|
if (zahlen[i]>=0) rect(120, 25+i*15, zahlen[i]+1, 13);
|
||||||
|
|
||||||
|
// Beschriftung
|
||||||
|
fill(255, 255, 255);
|
||||||
|
text(namen[i], 2, 35+i*15);
|
||||||
|
text(zahlen[i], 70, 35+i*15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void wastutes() {
|
||||||
|
// Sind überhaupt Daten da?
|
||||||
|
if (zahlen.length==0 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
for (akt=0; akt+1 < zahlen.length; akt++) {
|
||||||
|
//
|
||||||
|
redraw();
|
||||||
|
delay(verzoegerung);
|
||||||
|
//
|
||||||
|
if (zahlen[akt+1]> zahlen[akt]) {
|
||||||
|
//
|
||||||
|
int dummy = zahlen[akt];
|
||||||
|
zahlen[akt] = zahlen[akt+1];
|
||||||
|
zahlen[akt+1] = dummy;
|
||||||
|
|
||||||
|
//
|
||||||
|
redraw();
|
||||||
|
delay(verzoegerung);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
akt = -2;
|
||||||
|
redraw();
|
||||||
|
delay(verzoegerung);
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,6 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Niko,216
|
||||||
|
Klaus,591
|
||||||
|
Anna,857
|
||||||
|
Lena,180
|
||||||
|
Winfried,168
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Spieler1,0
|
||||||
|
Spieler1,6
|
||||||
|
Spieler2,19
|
||||||
|
Spieler6,1
|
||||||
|
Spieler4,45
|
||||||
|
Spieler3,23
|
||||||
|
Spieler3,12
|
||||||
|
Spieler2,44
|
||||||
|
Spieler1,72
|
||||||
|
Spieler5,12
|
||||||
|
Spieler6,4
|
||||||
|
Spieler7,2
|
||||||
|
Spieler4,98
|
||||||
|
Spieler3,21
|
||||||
|
Spieler3,12
|
||||||
|
Spieler2,32
|
||||||
|
Spieler1,12
|
||||||
|
Spieler5,44
|
||||||
|
Spieler3,12
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Spieler1,-5
|
||||||
|
Spieler1,-6
|
||||||
|
Spieler2,-19
|
||||||
|
Spieler6,-1
|
||||||
|
Spieler4,-45
|
||||||
|
Spieler3,-23
|
||||||
|
Spieler3,-12
|
||||||
|
Spieler2,-44
|
||||||
|
Spieler1,-72
|
||||||
|
Spieler5,-12
|
||||||
|
Spieler6,-4
|
||||||
|
Spieler7,-2
|
||||||
|
Spieler4,-98
|
||||||
|
Spieler3,-21
|
||||||
|
Spieler3,-12
|
||||||
|
Spieler2,-32
|
||||||
|
Spieler1,-12
|
||||||
|
Spieler5,-44
|
||||||
|
Spieler3,-12
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Spieler1,45
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
"Name","Punkte"
|
||||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue