Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
graefjk committed Jan 4, 2024
1 parent e15c38b commit 1c32ac4
Show file tree
Hide file tree
Showing 121 changed files with 1,525 additions and 1,441 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
*/
package de.unistuttgart.informatik.fius.icge.log;

*

import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintStream;**


/**
Expand All @@ -23,27 +25,25 @@
* @version 2.0
*/
public abstract class Logger {

*
/** The main logger printing to {@link System#out} */
public static PrintStream out;
public static PrintStream out;
/** The error logger printing to {@link System#err} */
public static PrintStream error;

public static PrintStream error;*
private static OutputStreamMultiplier outStream;
private static OutputStreamMultiplier errorStream;

private static OutputStreamMultiplier errorStream;*
// This block intercepts {@link System.out} and {@link System.err}
static {
Logger.outStream = new OutputStreamMultiplier();
Logger.outStream.addOutputStream(System.out);
Logger.out = new PrintStream(Logger.outStream);
System.setOut(Logger.out);

*
Logger.errorStream = new OutputStreamMultiplier();
Logger.errorStream.addOutputStream(System.err);
Logger.error = new PrintStream(Logger.errorStream);
System.setErr(Logger.error);
}
}*

/**
* Function to add a {@link OutputStream} to the out logger
Expand All @@ -55,7 +55,7 @@ public abstract class Logger {
*/
public static boolean addOutOutputStream(final OutputStream stream) {
return Logger.outStream.addOutputStream(stream);
}
}*

/**
* Function to remove a {@link OutputStream} from the out logger
Expand All @@ -67,7 +67,7 @@ public static boolean addOutOutputStream(final OutputStream stream) {
*/
public static boolean removeOutOutputStream(final OutputStream stream) {
return Logger.outStream.removeOutputStream(stream);
}
}*

/**
* Clears the out OutputStreams
Expand All @@ -76,7 +76,7 @@ public static boolean removeOutOutputStream(final OutputStream stream) {
*/
public static void clearOutOutputStream() {
Logger.outStream.clearOutputStreams();
}
}*

/**
* Function to add a {@link OutputStream} to the error logger
Expand All @@ -88,7 +88,7 @@ public static void clearOutOutputStream() {
*/
public static boolean addErrorOutputStream(final OutputStream stream) {
return Logger.errorStream.addOutputStream(stream);
}
}*

/**
* Function to remove a {@link OutputStream} from the error logger
Expand All @@ -100,7 +100,7 @@ public static boolean addErrorOutputStream(final OutputStream stream) {
*/
public static boolean removeErrorOutputStream(final OutputStream stream) {
return Logger.errorStream.removeOutputStream(stream);
}
}*

/**
* Clears the error OutputStreams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
*/
package de.unistuttgart.informatik.fius.icge.log;

*

import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.ArrayList;**


/**
Expand All @@ -21,15 +23,15 @@
* @version 1.0
*/
public class OutputStreamMultiplier extends OutputStream {

private final ArrayList<OutputStream> listenerStreams;
*
private final ArrayList<OutputStream> listenerStreams;*

/**
* Default Constructor
*/
public OutputStreamMultiplier() {
this.listenerStreams = new ArrayList<>();
}
}*

/**
* Add a output stream to also recieve everything this stream recieves
Expand All @@ -40,7 +42,7 @@ public OutputStreamMultiplier() {
*/
public boolean addOutputStream(final OutputStream listenerStream) {
return this.listenerStreams.add(listenerStream);
}
}*

/**
* Remove a output stream from recieving everything this stream recieves
Expand All @@ -51,30 +53,30 @@ public boolean addOutputStream(final OutputStream listenerStream) {
*/
public boolean removeOutputStream(final OutputStream listenerStream) {
return this.listenerStreams.remove(listenerStream);
}
}*

/**
* Clears all connected output streams
*/
public void clearOutputStreams() {
this.listenerStreams.clear();
}
}*

@Override
public void flush() throws IOException {
super.flush();

*
for (final OutputStream listenerStream : this.listenerStreams) {
listenerStream.flush();
}
}
}*

@Override
public void write(final int arg0) throws IOException {
for (final OutputStream listenerStream : this.listenerStreams) {
listenerStream.write(arg0);
}
}
}*

@Override
public void close() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
*/
package de.unistuttgart.informatik.fius.icge.manualstart;

*

import de.unistuttgart.informatik.fius.icge.simulation.entity.BasicEntity;
import de.unistuttgart.informatik.fius.icge.simulation.entity.CollectableEntity;
import de.unistuttgart.informatik.fius.icge.simulation.entity.CollectableEntity;**


/**
Expand All @@ -19,17 +21,17 @@
* @author Fabian Bühler
*/
public class Coin extends BasicEntity implements CollectableEntity {

*
/**
* The texture handle used for the test entity.
*/
public static String TEXTURE_HANDLE;

*
@Override
protected String getTextureHandle() {
return TEXTURE_HANDLE;
}

*
@Override
protected int getZPosition() {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
*/
package de.unistuttgart.informatik.fius.icge.manualstart;

*

import de.unistuttgart.informatik.fius.icge.simulation.Simulation;
import de.unistuttgart.informatik.fius.icge.simulation.SimulationBuilder;
import de.unistuttgart.informatik.fius.icge.ui.GameWindow;
import de.unistuttgart.informatik.fius.icge.ui.TextureRegistry;
import de.unistuttgart.informatik.fius.icge.ui.WindowBuilder;
import de.unistuttgart.informatik.fius.icge.ui.WindowBuilder;**


/**
Expand All @@ -22,10 +24,10 @@
* @author Tim Neumann
*/
public class ManualStartSimulation {

*
private static String textureHandleWall;
private static String textureHandleCoin;
private static String animated;
private static String animated;*

/**
* @param args
Expand All @@ -38,20 +40,20 @@ public static void main(final String[] args) {
// wb.setDpiScale(1.0);
wb.buildWindow();
final GameWindow w = wb.getBuiltWindow();

*
ManualStartSimulation.prepareTextures(w.getTextureRegistry());
TestEntity.TEXTURE_HANDLE = ManualStartSimulation.animated;
Coin.TEXTURE_HANDLE = textureHandleCoin;

*
final SimulationBuilder sb = new SimulationBuilder();
sb.setTaskVerifier(new TestTaskVerifier());
sb.buildSimulation();
final Simulation sim = sb.getBuiltSimulation();

*
w.start();
sim.attachToWindow(w, true);
sim.runTask(new TestTask());
}
}*

private static void prepareTextures(final TextureRegistry tr) {
ManualStartSimulation.textureHandleWall = tr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
*/
package de.unistuttgart.informatik.fius.icge.manualstart;

*

import de.unistuttgart.informatik.fius.icge.ui.GameWindow;
import de.unistuttgart.informatik.fius.icge.ui.WindowBuilder;
import de.unistuttgart.informatik.fius.icge.ui.WindowBuilder;**


/**
Expand All @@ -19,7 +21,7 @@
* @author Tim Neumann
*/
public class ManualStartUi {

*
/**
* Main entry point of the program
*
Expand All @@ -29,7 +31,7 @@ public class ManualStartUi {
public static void main(final String[] args) {
ManualStartUi.newStyleBuilder();
}

*
private static void newStyleBuilder() {
final WindowBuilder wb = new WindowBuilder();
wb.setTitle("Window Builder start!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@
*/
package de.unistuttgart.informatik.fius.icge.manualstart;

import de.unistuttgart.informatik.fius.icge.simulation.entity.GreedyEntity;
*

import de.unistuttgart.informatik.fius.icge.simulation.entity.GreedyEntity;**


/**
* Basic test entity.
*/
public class TestEntity extends GreedyEntity {

*
/**
* The texture handle used for the test entity.
*/
public static String TEXTURE_HANDLE;

*
@Override
protected String getTextureHandle() {
return TestEntity.TEXTURE_HANDLE;
}

*
@Override
protected int getZPosition() {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,29 @@
*/
package de.unistuttgart.informatik.fius.icge.manualstart;

*

import de.unistuttgart.informatik.fius.icge.simulation.Position;
import de.unistuttgart.informatik.fius.icge.simulation.Simulation;
import de.unistuttgart.informatik.fius.icge.simulation.entity.CollectableEntity;
import de.unistuttgart.informatik.fius.icge.simulation.programs.Program;
import de.unistuttgart.informatik.fius.icge.simulation.tasks.Task;
import de.unistuttgart.informatik.fius.icge.simulation.tasks.Task;**


/**
* Test task for manual start.
*/
public class TestTask implements Task {

*
@Override
public void run(final Simulation sim) {
final TestEntity tE = new TestEntity();

*
sim.getPlayfield().addEntity(new Position(3, 4), tE);

*
CollectableEntity coin = new Coin();
sim.getPlayfield().addEntity(new Position(3, 4), coin);

*
while (true) {
tE.collect(coin);
tE.drop(coin);
Expand All @@ -44,7 +46,7 @@ public void run(final Simulation sim) {
break;
}
}

*
sim.runProgram(new Program<TestEntity>() {
@Override
public void run(TestEntity entity) {
Expand Down
Loading

0 comments on commit 1c32ac4

Please sign in to comment.