-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd68829
commit bf82878
Showing
86 changed files
with
2,186 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/org/woehlke/computer/kurzweil/SimulatedEvolutionApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.woehlke.computer.kurzweil; | ||
|
||
import lombok.extern.log4j.Log4j2; | ||
import org.woehlke.computer.kurzweil.application.ComputerKurzweilProperties; | ||
import org.woehlke.computer.kurzweil.tabs.simulatedevolution.SimulatedEvolutionTab; | ||
|
||
/** | ||
* Class with main Method for Starting the Desktop Application. | ||
* | ||
* @see SimulatedEvolutionTab | ||
* | ||
* © 2006 - 2008 Thomas Woehlke. | ||
* http://thomas-woehlke.de/p/simulated-evolution/ | ||
* @author Thomas Woehlke | ||
*/ | ||
@Log4j2 | ||
public class SimulatedEvolutionApplication { | ||
|
||
private SimulatedEvolutionApplication(String configFileName, String jarFilePath) { | ||
ComputerKurzweilProperties properties = ComputerKurzweilProperties.propertiesFactory(configFileName, jarFilePath); | ||
SimulatedEvolutionTab simulatedEvolutionTab = new SimulatedEvolutionTab(properties); | ||
} | ||
|
||
/** | ||
* Starting the Desktop Application | ||
* @param args CLI Parameter | ||
*/ | ||
public static void main(String[] args) { | ||
String configFileName = "application.yml"; | ||
String jarFilePath = "target/simulatedevolution.jar"; | ||
SimulatedEvolutionApplication application = new SimulatedEvolutionApplication(configFileName,jarFilePath); | ||
} | ||
} |
138 changes: 138 additions & 0 deletions
138
src/main/java/org/woehlke/computer/kurzweil/application/ComputerKurzweilContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
package org.woehlke.computer.kurzweil.application; | ||
|
||
import lombok.Getter; | ||
import lombok.ToString; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.woehlke.computer.kurzweil.commons.Startable; | ||
import org.woehlke.computer.kurzweil.commons.model.LatticePoint; | ||
import org.woehlke.computer.kurzweil.tabs.simulatedevolution.model.CellCore; | ||
import org.woehlke.computer.kurzweil.tabs.simulatedevolution.model.LifeCycle; | ||
|
||
import javax.swing.*; | ||
import javax.swing.border.Border; | ||
import javax.swing.border.CompoundBorder; | ||
import java.util.Date; | ||
import java.util.Random; | ||
|
||
@Log4j2 | ||
@Getter | ||
@ToString(exclude={"random","frame"},callSuper=true) | ||
public class ComputerKurzweilContext implements Startable { | ||
|
||
private final Random random; | ||
private final ComputerKurzweilProperties properties; | ||
|
||
public ComputerKurzweilContext( | ||
ComputerKurzweilProperties computerKurzweilProperties | ||
) { | ||
this.properties = computerKurzweilProperties; | ||
long seed = new Date().getTime(); | ||
this.random = new Random(seed); | ||
} | ||
|
||
public CompoundBorder getTabbedPaneBorder() { | ||
return getBorder(); | ||
} | ||
|
||
public CompoundBorder getFrameBorder(){ | ||
return getBorder(); | ||
} | ||
|
||
public CompoundBorder getBorder(){ | ||
int left = this.getProperties().getAllinone().getView().getBorderPaddingX(); | ||
int right = this.getProperties().getAllinone().getView().getBorderPaddingX(); | ||
int top = this.getProperties().getAllinone().getView().getBorderPaddingY(); | ||
int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY(); | ||
return BorderFactory.createCompoundBorder( | ||
BorderFactory.createEmptyBorder(), | ||
BorderFactory.createEmptyBorder(left,right,top,bottom) | ||
); | ||
} | ||
|
||
public CompoundBorder getBorder(String label){ | ||
int top = this.getProperties().getAllinone().getView().getBorderPaddingY(); | ||
int left = this.getProperties().getAllinone().getView().getBorderPaddingX(); | ||
int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY(); | ||
int right = this.getProperties().getAllinone().getView().getBorderPaddingX(); | ||
return BorderFactory.createCompoundBorder( | ||
BorderFactory.createTitledBorder(label), | ||
BorderFactory.createEmptyBorder(top,left,bottom,right) | ||
); | ||
} | ||
|
||
private CompoundBorder getDoubleBorder(){ | ||
int left = this.getProperties().getAllinone().getView().getBorderPaddingX(); | ||
int right = this.getProperties().getAllinone().getView().getBorderPaddingX(); | ||
int top = this.getProperties().getAllinone().getView().getBorderPaddingY(); | ||
int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY(); | ||
return BorderFactory.createCompoundBorder( | ||
BorderFactory.createEmptyBorder(left,right,top,bottom), | ||
BorderFactory.createEmptyBorder(left,right,top,bottom) | ||
); | ||
} | ||
|
||
private CompoundBorder getDoubleBorder(String label){ | ||
int left = this.getProperties().getAllinone().getView().getBorderPaddingX(); | ||
int right = this.getProperties().getAllinone().getView().getBorderPaddingX(); | ||
int top = this.getProperties().getAllinone().getView().getBorderPaddingY(); | ||
int bottom = this.getProperties().getAllinone().getView().getBorderPaddingY(); | ||
return BorderFactory.createCompoundBorder( | ||
BorderFactory.createEmptyBorder(left,right,top,bottom), | ||
BorderFactory.createEmptyBorder(left,right,top,bottom) | ||
); | ||
} | ||
|
||
public CompoundBorder getBottomButtonsPanelBorder(){ | ||
return getDoubleBorder(); | ||
} | ||
|
||
public CompoundBorder getBottomButtonsPanelBorder(String label){ | ||
return getDoubleBorder(label); | ||
} | ||
|
||
private Border getZeroBorder() { | ||
int top = 0; | ||
int left = 0; | ||
int bottom = 0; | ||
int right = 0; | ||
return BorderFactory.createEmptyBorder(top,left,bottom,right); | ||
} | ||
|
||
public Border getTabBorder() { | ||
return getZeroBorder(); | ||
} | ||
|
||
public Border getCanvasBorder() { | ||
return getZeroBorder(); | ||
} | ||
|
||
public LatticePoint getWorldDimensions(){ | ||
int x = this.properties.getAllinone().getLattice().getWidth(); | ||
int y = this.properties.getAllinone().getLattice().getHeight(); | ||
return new LatticePoint(x,y); | ||
} | ||
|
||
public LatticePoint getNextRandomLatticePoint() { | ||
int x = this.properties.getAllinone().getLattice().getWidth(); | ||
int y = this.properties.getAllinone().getLattice().getHeight(); | ||
int nextX = this.getRandom().nextInt(x); | ||
int nextY = this.getRandom().nextInt(y); | ||
LatticePoint p = new LatticePoint(nextX,nextY); | ||
p.normalize(this.getWorldDimensions()); | ||
p.absoluteValue(); | ||
return p; | ||
} | ||
|
||
public LifeCycle getNewCellLifeCycle() { | ||
return new LifeCycle(this.properties.getSimulatedevolution().getCellConf().getFatAtBirth()); | ||
} | ||
|
||
public CellCore getNewCellCore() { | ||
return new CellCore(this.random); | ||
} | ||
|
||
public void start(){ } | ||
|
||
public void stop() { } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/org/woehlke/computer/kurzweil/commons/Startable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.woehlke.computer.kurzweil.commons; | ||
|
||
public interface Startable { | ||
|
||
void start(); | ||
void stop(); | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/org/woehlke/computer/kurzweil/commons/Updateable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.woehlke.computer.kurzweil.commons; | ||
|
||
public interface Updateable { | ||
|
||
void update(); | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/org/woehlke/computer/kurzweil/commons/gui/GuiComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.woehlke.computer.kurzweil.commons.gui; | ||
|
||
public interface GuiComponent { | ||
//void showMe(); | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/org/woehlke/computer/kurzweil/commons/gui/GuiComponentApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.woehlke.computer.kurzweil.commons.gui; | ||
|
||
public interface GuiComponentApplication { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/org/woehlke/computer/kurzweil/commons/gui/GuiComponentCanvas.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.woehlke.computer.kurzweil.commons.gui; | ||
|
||
public interface GuiComponentCanvas { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/org/woehlke/computer/kurzweil/commons/gui/GuiComponentPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.woehlke.computer.kurzweil.commons.gui; | ||
|
||
public interface GuiComponentPanel { | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/org/woehlke/computer/kurzweil/commons/gui/GuiComponentTab.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package org.woehlke.computer.kurzweil.commons.gui; | ||
|
||
public interface GuiComponentTab { | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/woehlke/computer/kurzweil/commons/has/HasContextApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.woehlke.computer.kurzweil.commons.has; | ||
|
||
import org.woehlke.computer.kurzweil.application.ComputerKurzweilContext; | ||
|
||
public interface HasContextApplication { | ||
|
||
ComputerKurzweilContext getCtx(); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/woehlke/computer/kurzweil/commons/has/HasPanelStartStopButtons.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.woehlke.computer.kurzweil.commons.has; | ||
|
||
import org.woehlke.computer.kurzweil.commons.widgets.PanelStartStopButtons; | ||
|
||
public interface HasPanelStartStopButtons { | ||
|
||
PanelStartStopButtons getPanelStartStopButtonsSubTab(); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/woehlke/computer/kurzweil/commons/has/HasPanelSubtitle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.woehlke.computer.kurzweil.commons.has; | ||
|
||
import org.woehlke.computer.kurzweil.commons.widgets.PanelSubtitle; | ||
|
||
public interface HasPanelSubtitle { | ||
PanelSubtitle getPanelSubtitle(); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/org/woehlke/computer/kurzweil/commons/has/HasTab.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.woehlke.computer.kurzweil.commons.has; | ||
|
||
import org.woehlke.computer.kurzweil.tabs.Tab; | ||
|
||
public interface HasTab { | ||
|
||
Tab getTab(); | ||
//TabType getTabType(); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/woehlke/computer/kurzweil/commons/has/HasTabCanvas.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.woehlke.computer.kurzweil.commons.has; | ||
|
||
import org.woehlke.computer.kurzweil.commons.tabs.TabCanvas; | ||
|
||
public interface HasTabCanvas { | ||
|
||
TabCanvas getCanvas(); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/woehlke/computer/kurzweil/commons/has/HasTabContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.woehlke.computer.kurzweil.commons.has; | ||
|
||
import org.woehlke.computer.kurzweil.commons.tabs.TabContext; | ||
|
||
public interface HasTabContext { | ||
|
||
TabContext getTabCtx(); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/org/woehlke/computer/kurzweil/commons/has/HasTabController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.woehlke.computer.kurzweil.commons.has; | ||
|
||
import org.woehlke.computer.kurzweil.commons.tabs.TabController; | ||
|
||
public interface HasTabController { | ||
|
||
TabController getController(); | ||
void startController(); | ||
void stopController(); | ||
} |
Oops, something went wrong.