diff --git a/AutomataLatest.jar b/AutomataLatest.jar
new file mode 100644
index 0000000..128ba2d
Binary files /dev/null and b/AutomataLatest.jar differ
diff --git a/ClockLatestLatest.jar b/ClockLatestLatest.jar
new file mode 100644
index 0000000..8d24d27
Binary files /dev/null and b/ClockLatestLatest.jar differ
diff --git a/pomAutomata.xml b/pomAutomata.xml
new file mode 100644
index 0000000..8c34cb9
--- /dev/null
+++ b/pomAutomata.xml
@@ -0,0 +1,28 @@
+
+
+ 4.0.0
+
+ org.example
+ MavenDirectory
+ 1.0-SNAPSHOT
+
+
+ com.googlecode.json-simple
+ json-simple
+ 1.1.1
+
+
+ org.openjfx
+ javafx-graphics
+ 11.0.2
+
+
+ org.openjfx
+ javafx-fxml
+ 15-ea+6
+
+
+
+
\ No newline at end of file
diff --git a/srcAutomata/main/java/Automata/Automata.java b/srcAutomata/main/java/Automata/Automata.java
new file mode 100644
index 0000000..0e85e5f
--- /dev/null
+++ b/srcAutomata/main/java/Automata/Automata.java
@@ -0,0 +1,206 @@
+package Automata;
+import java.io.File;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.io.FileReader;
+import java.io.BufferedReader;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+
+public class Automata {
+ enum STATES{Off,Wait,Accept,Check,Cook};
+ private int cash=0;
+ private int drinkIndex;
+ private ArrayList menu;
+ private ArrayList prices;
+ private STATES state=STATES.Off;
+ private Boolean checkResult=false;
+ private String nameOfMenuFile;
+ private File fileMenu=null;
+ private Exception exception=null;
+ public Automata(String nameOfMenuFile)
+ {
+ this.nameOfMenuFile=nameOfMenuFile;
+ }
+ private void loadMenuFromTXT()
+ {
+ try
+ {
+ FileReader fileReader = new FileReader(fileMenu);
+ BufferedReader bufferedReader = new BufferedReader(fileReader);
+ String line;
+ menu=new ArrayList();
+ prices=new ArrayList();
+ while ((line = bufferedReader.readLine()) != null)
+ {
+ String[] splitedLine = line.split(" ");
+ String name = splitedLine[0];
+ menu.add(name);
+ int price = Integer.parseInt(splitedLine[1]);
+ prices.add(price);
+ }
+ if(menu.size()==0)
+ throw new Exception("File is empty");
+ if(prices.size()!=menu.size())
+ throw new Exception("File is incomplete");
+
+ }
+ catch (Exception ex)
+ {
+ exception=ex;
+ }
+ }
+ private void loadMenuFromJson()
+ {
+ menu=new ArrayList<>();
+ prices=new ArrayList<>();
+ try {
+ JSONParser parser = new JSONParser();
+ JSONObject jsonObject=(JSONObject) parser.parse(new FileReader(fileMenu));
+ JSONArray jsonArray =(JSONArray) jsonObject.get("Drinks");
+ for(int i=0;i getMenu()
+ {
+ if(state!=STATES.Off)
+ {
+ ArrayList menuList = new ArrayList<>();
+ for (int i = 0; i < menu.size(); i++) {
+ menuList.add(menu.get(i)+" : "+prices.get(i).toString());
+ }
+
+ return menuList;
+ }
+ return null;
+ }
+ public STATES getState()
+ {
+ return state;
+ }
+ public void choice(String name)
+ {
+ checkResult=false;
+ for(int i=0;i-1)
+ {
+ state = STATES.Cook;
+ cash -= prices.get(drinkIndex);
+ return new Drink(menu.get(drinkIndex));
+ }
+ else
+ return null;
+ }
+ public void finish()
+ {
+ state=STATES.Wait;
+ }
+ public int returnMoney()
+ {
+ int money=cash;
+ cash=0;
+ return money;
+ }
+ public int getCash() {
+ return cash;
+ }
+ public void choice(int index)
+ {
+ if(check(index))
+ drinkIndex=index;
+ else
+ drinkIndex=-1;
+ }
+}
diff --git a/srcAutomata/main/java/Automata/Drink.java b/srcAutomata/main/java/Automata/Drink.java
new file mode 100644
index 0000000..1c9713a
--- /dev/null
+++ b/srcAutomata/main/java/Automata/Drink.java
@@ -0,0 +1,15 @@
+package Automata;
+
+public class Drink
+{
+ String name;
+ public Drink(String name)
+ {
+ this.name=name;
+ }
+ public String getName()
+ {
+ return name;
+ }
+}
+
diff --git a/srcAutomata/main/java/META-INF/MANIFEST.MF b/srcAutomata/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/srcAutomata/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/srcAutomata/main/java/sample/Controller.java b/srcAutomata/main/java/sample/Controller.java
new file mode 100644
index 0000000..632edf7
--- /dev/null
+++ b/srcAutomata/main/java/sample/Controller.java
@@ -0,0 +1,151 @@
+package sample;
+
+import Automata.Automata;
+import Automata.Drink;
+
+import javafx.application.Platform;
+import javafx.beans.InvalidationListener;
+import javafx.beans.property.SimpleStringProperty;
+import javafx.beans.property.StringProperty;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.concurrent.Task;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.*;
+
+import java.net.URL;
+import java.util.ResourceBundle;
+
+public class Controller implements Initializable {
+ private Automata automata;
+ @FXML
+ private Button buttonOn;
+ @FXML
+ private Button buttonOff;
+ @FXML
+ private Label labelState;
+ @FXML
+ private Label labelCash;
+ @FXML
+ private TextField textFieldMoney;
+ @FXML
+ private Button buttonPutMoney;
+ @FXML
+ private Button buttonBuy;
+ @FXML
+ private Button buttonCancel;
+ @FXML
+ private Button buttonReturnMoney;
+ @FXML
+ private ComboBox comboBoxMenu;
+ @FXML
+ private ProgressBar progressBar;
+ SimpleStringProperty stringPropertyState;
+ private boolean isBusy=false;
+ @Override
+ public void initialize(URL location, ResourceBundle resources)
+ {
+ stringPropertyState=new SimpleStringProperty();
+ stringPropertyState.setValue("State : Off");
+ labelState.textProperty().bind(stringPropertyState);
+ }
+ @FXML
+ public void clickOn()
+ {
+ if(automata==null)
+ {
+ automata = new Automata("Menu.json");
+ automata.on();
+ comboBoxMenu.getItems().addAll(automata.getMenu());
+ }
+ else
+ automata.on();
+ printState();
+ }
+ @FXML
+ public void clickOff()
+ {
+ if(automata!=null) {
+ automata.off();
+ printState();
+ }
+ }
+ @FXML
+ public void clickPutMoney()
+ {
+ try
+ {
+ automata.coin(Integer.parseInt(textFieldMoney.getText()));
+ printState();
+ }
+ catch (Exception ex)
+ {
+ textFieldMoney.setText("");
+ }
+ }
+ @FXML
+ public void clickBuy() throws Exception
+ {
+ if(automata!=null) {
+ automata.choice(comboBoxMenu.getSelectionModel().getSelectedIndex());
+ printState();
+ Task task = new Task() {
+ @Override
+ protected Void call() {
+ try {
+ Platform.runLater(()->isBusy=true);
+ waitSeconds(2000);
+ Platform.runLater(() -> automata.cook());
+ waitSeconds(6000);
+ Platform.runLater(() -> automata.finish());
+ printStats(1);
+ Platform.runLater(()->isBusy=false);
+ } catch (Exception ex) {
+
+ }
+ return null;
+ }
+
+ private void printStats(float progress) {
+ Platform.runLater(() -> printState());
+ Platform.runLater(() -> progressBar.setProgress(progress));
+ }
+
+ private void waitSeconds(int seconds) throws Exception {
+ for (int i = 1; i <= seconds; i++) {
+ Thread.sleep(1);
+ printStats((float) i / seconds);
+ }
+ }
+ };
+
+ Thread th = new Thread(task);
+ th.setDaemon(true);
+ th.start();
+ }
+ }
+ @FXML
+ public void clickCancel()
+ {
+ if(automata!=null && !isBusy)
+ automata.cancel();
+ printState();
+ }
+ @FXML
+ public void clickReturnMoney()
+ {
+ if(automata!=null) {
+ automata.returnMoney();
+ printState();
+ }
+ }
+ private void printState()
+ {
+ if(automata!=null)
+ {
+ stringPropertyState.setValue("State : "+automata.getState());
+ labelCash.setText("Cash : "+automata.getCash());
+ }
+ }
+}
diff --git a/srcAutomata/main/java/sample/Main.java b/srcAutomata/main/java/sample/Main.java
new file mode 100644
index 0000000..21c4362
--- /dev/null
+++ b/srcAutomata/main/java/sample/Main.java
@@ -0,0 +1,24 @@
+package sample;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+
+public class Main extends Application {
+
+ @Override
+ public void start(Stage primaryStage) throws Exception{
+ Parent root =FXMLLoader.load(getClass().getResource("/sample.fxml"));
+ primaryStage.setTitle("Hello World");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/srcAutomata/main/resources/META-INF/MANIFEST.MF b/srcAutomata/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/srcAutomata/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/srcAutomata/main/resources/Menu.json b/srcAutomata/main/resources/Menu.json
new file mode 100644
index 0000000..ef0301c
--- /dev/null
+++ b/srcAutomata/main/resources/Menu.json
@@ -0,0 +1,9 @@
+{
+ "Drinks" :
+ [
+ {"Name" : "Tea","Price" : 10},
+ {"Name" : "Coffee","Price" : 15},
+ {"Name" : "Cappucino","Price" : 20},
+ {"Name" : "Water","Price" : 10}
+ ]
+}
\ No newline at end of file
diff --git a/srcAutomata/main/resources/Menu.txt b/srcAutomata/main/resources/Menu.txt
new file mode 100644
index 0000000..598cc17
--- /dev/null
+++ b/srcAutomata/main/resources/Menu.txt
@@ -0,0 +1 @@
+Tea 5
\ No newline at end of file
diff --git a/srcAutomata/main/resources/sample.fxml b/srcAutomata/main/resources/sample.fxml
new file mode 100644
index 0000000..819f410
--- /dev/null
+++ b/srcAutomata/main/resources/sample.fxml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/srcClock/META-INF/MANIFEST.MF b/srcClock/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a3f3e7e
--- /dev/null
+++ b/srcClock/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: main.java.sample.Main
+
diff --git a/srcClock/main/java/META-INF/MANIFEST.MF b/srcClock/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a3f3e7e
--- /dev/null
+++ b/srcClock/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: main.java.sample.Main
+
diff --git a/srcClock/main/java/sample/Controller.java b/srcClock/main/java/sample/Controller.java
new file mode 100644
index 0000000..97069a2
--- /dev/null
+++ b/srcClock/main/java/sample/Controller.java
@@ -0,0 +1,113 @@
+package sample;
+
+import javafx.application.Platform;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.geometry.Insets;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.Background;
+import javafx.scene.layout.BackgroundFill;
+import javafx.scene.layout.CornerRadii;
+import javafx.scene.layout.Pane;
+import javafx.scene.paint.Color;
+import javafx.scene.paint.Paint;
+import javafx.scene.shape.Circle;
+import javafx.scene.shape.Line;
+import javafx.scene.text.Font;
+import javafx.scene.text.Text;
+
+import java.net.URL;
+import java.util.*;
+
+public class Controller implements Initializable {
+ Timer timer;
+ @FXML
+ Pane pane;
+ @Override
+ public void initialize(URL url, ResourceBundle resourceBundle) {
+ pane.setBackground(new Background(new BackgroundFill(Color.web("#2F4355"), CornerRadii.EMPTY, Insets.EMPTY)));
+ timer = new Timer();
+ timer.scheduleAtFixedRate(new TimerTask() {
+ @Override
+ public void run() {
+ Calendar calendar=Calendar.getInstance();
+ Platform.runLater(()->pane.getChildren().clear());
+ int radius=(int)(Math.min(getCentralX(),getCentralY())/1.2);
+ Color linesColor=Color.web("#FA0054");
+ drawLine( (calendar.get(Calendar.SECOND)+45)*6,radius,1,getCentralX(),getCentralY(),
+ -1,-1,linesColor);
+ drawLine((calendar.get(Calendar.MINUTE)+45)*6,(int)(radius/1.1),4,getCentralX(),getCentralY(),
+ -1,-1,linesColor);
+ drawLine((calendar.get(Calendar.HOUR)+45)*30,(int)(radius/1.2),7,getCentralX(),getCentralY(),
+ -1,-1,linesColor);
+ drawClockFace(radius);
+ }
+ private void drawLine(double degree,int length,int width,double startPosX,double startPosY,
+ double endPosX,double endPosY,Color color)
+ {
+ if(color==null)
+ color=Color.BLACK;
+ if(endPosX==-1)
+ endPosX=getXOnCircle(degree,length);
+ if(endPosY==-1)
+ endPosY=getYOnCircle(degree,length);
+ Line line=new Line(startPosX,startPosY,endPosX,endPosY);
+ line.setStrokeWidth(width);
+ line.setStroke(color);
+ Platform.runLater(()->pane.getChildren().addAll(line));
+ }
+ private double getXOnCircle(double degree,double radius)
+ {
+ return radius*Math.cos(degree*Math.PI/180)+getCentralX();
+ }
+ private double getYOnCircle(double degree,double radius)
+ {
+ return radius*Math.sin(degree*Math.PI/180)+getCentralY();
+ }
+ private double getCentralX()
+ {
+ return pane.getWidth()/2;
+ }
+ private double getCentralY()
+ {
+ return pane.getHeight()/2;
+ }
+ private void drawClockFace(double radius)
+ {
+ for(int i=0;i<360;i+=6)
+ {
+ Circle circle=new Circle(getXOnCircle(i,radius),getYOnCircle(i,radius),radius/50);
+ circle.setStroke(Color.web("#D1FA00"));
+ circle.setFill(Color.web("#D1FA00"));
+ Platform.runLater(()->pane.getChildren().addAll(circle));
+ }
+ for(int i=0;i<12;i++) {
+ Text textNumber;
+ if(i!=0)
+ textNumber=new Text(String.valueOf(i));
+ else
+ textNumber=new Text(String.valueOf(12));
+
+ double fontSize=getCentralX()/6;
+ textNumber.setStyle("-fx-font: "+fontSize+" arial;");
+ textNumber.setX(getXOnCircle(i*30-90,radius-fontSize)-fontSize/3.5);
+ textNumber.setY(getYOnCircle(i*30-90,radius-fontSize));
+ textNumber.setFill(Color.web("#00FAA6"));
+ Platform.runLater(()->pane.getChildren().addAll(textNumber));
+ }
+ for(int i=0;i<60;i++)
+ {
+ Text textMinutesNumber;
+ textMinutesNumber=new Text(String.valueOf(i));
+ double fontSize=getCentralX()/16;
+ textMinutesNumber.setStyle("-fx-font: "+fontSize+" arial;");
+ textMinutesNumber.setX(getXOnCircle(i*6-90,radius+fontSize)-fontSize/2.5);
+ textMinutesNumber.setY(getYOnCircle(i*6-90,radius+fontSize)+fontSize/2.5);
+ textMinutesNumber.setFill(Color.web("#00FAA6"));
+ Platform.runLater(()->pane.getChildren().addAll(textMinutesNumber));
+ }
+ }
+ }, 0, 1000);
+ }
+}
diff --git a/srcClock/main/java/sample/Main.java b/srcClock/main/java/sample/Main.java
new file mode 100644
index 0000000..07a6123
--- /dev/null
+++ b/srcClock/main/java/sample/Main.java
@@ -0,0 +1,24 @@
+package main.java.sample;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+public class Main extends Application {
+
+ @Override
+ public void start(Stage primaryStage) throws Exception{
+ Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
+ primaryStage.setTitle("Hello World");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/srcClock/main/java/sample/sample.fxml b/srcClock/main/java/sample/sample.fxml
new file mode 100644
index 0000000..c7a16be
--- /dev/null
+++ b/srcClock/main/java/sample/sample.fxml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/srcClock/main/resources/MANIFEST.MF b/srcClock/main/resources/MANIFEST.MF
new file mode 100644
index 0000000..1040997
--- /dev/null
+++ b/srcClock/main/resources/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Main-Class: main.java.sample.Main
+Class-Path: src.zip javafx-swt.jar javafx.web.jar javafx.base.jar javafx
+ .fxml.jar javafx.media.jar javafx.swing.jar javafx.controls.jar javafx.
+ graphics.jar
+