Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>tanel</groupId>
<artifactId>boot3</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>
8 changes: 8 additions & 0 deletions src/main/java/rihard/JooneVorrand2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package rihard;
//liidesfn kaust
public interface JooneVorrand2{


public double f(double a, double b);

}
21 changes: 21 additions & 0 deletions src/main/java/rihard/Joonefunktsioon2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package rihard;

public class Joonefunktsioon2 implements JooneVorrand2{

double a;
double b;

public Joonefunktsioon2(double a, double b){

this.a=a;
this.b=b;

}

public double f(double x, double b){

return (a*b);

}

}
42 changes: 42 additions & 0 deletions src/main/java/rihard/Rakendus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package rihard;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpSession;

@RestController
@SpringBootApplication
public class Rakendus{


public static double arvuta(JooneVorrand2 fn, double arv1, double arv2){

return fn.f(arv1, arv2);

}


@RequestMapping("/joon2")
public String vabaliige(double a, double b){

JooneVorrand2 vabaliige=new Joonefunktsioon2(a, b);

return "S = "+(arvuta(vabaliige, a, b));

}




public static void main(String[] args) {
System.getProperties().put("server.port", 4213);
SpringApplication.run(Rakendus.class, args);
}
}

//scl enable rh-maven33 bash
//mvn package
//java -jar target/boot3-1.0-SNAPSHOT.jar
7 changes: 7 additions & 0 deletions src/main/java/tanel/JooneVorrand2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package tanel;
public interface JooneVorrand2{


public double f(double a, double b);

}
21 changes: 21 additions & 0 deletions src/main/java/tanel/Joonefunktsioon2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tanel;

public class Joonefunktsioon2 implements JooneVorrand2{

double a;
double b;

public Joonefunktsioon2(double a, double b){

this.a=a;
this.b=b;

}

public double f(double x, double b){

return ((a*b)/2);

}

}
42 changes: 42 additions & 0 deletions src/main/java/tanel/Rakendus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package tanel;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpSession;

@RestController
@SpringBootApplication
public class Rakendus{


public static double arvuta(JooneVorrand2 fn, double arv1, double arv2){

return fn.f(arv1, arv2);

}


@RequestMapping("/joon2")
public String vabaliige(double a, double b){

JooneVorrand2 vabaliige=new Joonefunktsioon2(a, b);

return "S = "+(arvuta(vabaliige, a, b));

}




public static void main(String[] args) {
System.getProperties().put("server.port", 8768);
SpringApplication.run(Rakendus.class, args);
}
}

//scl enable rh-maven33 bash
//mvn package
//java -jar target/boot3-1.0-SNAPSHOT.jar
31 changes: 31 additions & 0 deletions src/main/resources/public/arvutus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html>
<head>
<script>
var yhendus=new XMLHttpRequest();
yhendus.onreadystatechange=andmedSaabusid;
function vajutus(){
var a1=document.getElementById("kast1").value;
var a2=document.getElementById("kast2").value;
yhendus.open("GET","/joon2?a="+a1+"&b="+a2, true);
yhendus.send();
}


function andmedSaabusid(){
document.getElementById("vastus").innerHTML=yhendus.responseText;
}



</script>
</head>
<body>
<h1>Arvutamine</h1>
<input type="text" id="kast1" placeholder="a"/>
<input type="text" id="kast2" placeholder="b"/>
<input type="button" value="Arvuta" onclick="vajutus()"/>
<br><br>
<div id="vastus">Vastuse koht</div>
</body>
</html>
35 changes: 35 additions & 0 deletions src/main/resources/public/tervitus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<head>
<script>
var yhendus=new XMLHttpRequest();
yhendus.onreadystatechange=andmedSaabusid;
function vajutus(){
var a1=document.getElementById("kast1").value;
var a2=document.getElementById("kast2").value;
yhendus.open("GET","/joon2?a="+a1+"&b="+a2, true);
yhendus.send();
}


function andmedSaabusid(){
document.getElementById("vastus").innerHTML=yhendus.responseText;
}



</script>
</head>
<body>
<h1>Kolmnurga pindala arvutamine</h1>
<br><br>
Sisesta alus<br>
<input type="text" id="kast1" placeholder="alus"/><br>
Sisesta korgus<br>
<input type="text" id="kast2" placeholder="korgus"/>
<br>
<input type="button" value="Arvuta" onclick="vajutus()"/>
<br><br>
<div id="vastus">Vastus: </div>
</body>
</html>
1 change: 1 addition & 0 deletions src/main/resources/public/tervitus.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tere
1 change: 1 addition & 0 deletions src/main/resources/public/ülesanne.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TEE TERVITUS.TXT'ST HTML FILE, MIS K�IB K�SIMAS GEOM KESKMISEST ARVE JA KUVAB VASTUSE. 2X GET
20 changes: 20 additions & 0 deletions src/test/java/rihard/EsimeneTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package rihard;

import org.junit.*;
import static org.junit.Assert.*;


public class EsimeneTest{




@Test
public void test1(){

Rakendus r=new Rakendus();
assertEquals("S = 6.0", r.vabaliige(3, 2));

}

}
20 changes: 20 additions & 0 deletions src/test/java/tanel/EsimeneTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package tanel;

import org.junit.*;
import static org.junit.Assert.*;


public class EsimeneTest{




@Test
public void test1(){

Rakendus r=new Rakendus();
assertEquals("S = 6.0", r.vabaliige(3, 4));

}

}
Binary file added target/boot3-1.0-SNAPSHOT.jar
Binary file not shown.
Binary file added target/boot3-1.0-SNAPSHOT.jar.original
Binary file not shown.
31 changes: 31 additions & 0 deletions target/classes/public/arvutus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html>
<head>
<script>
var yhendus=new XMLHttpRequest();
yhendus.onreadystatechange=andmedSaabusid;
function vajutus(){
var a1=document.getElementById("kast1").value;
var a2=document.getElementById("kast2").value;
yhendus.open("GET","/joon2?a="+a1+"&b="+a2, true);
yhendus.send();
}


function andmedSaabusid(){
document.getElementById("vastus").innerHTML=yhendus.responseText;
}



</script>
</head>
<body>
<h1>Arvutamine</h1>
<input type="text" id="kast1" placeholder="a"/>
<input type="text" id="kast2" placeholder="b"/>
<input type="button" value="Arvuta" onclick="vajutus()"/>
<br><br>
<div id="vastus">Vastuse koht</div>
</body>
</html>
35 changes: 35 additions & 0 deletions target/classes/public/tervitus.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<head>
<script>
var yhendus=new XMLHttpRequest();
yhendus.onreadystatechange=andmedSaabusid;
function vajutus(){
var a1=document.getElementById("kast1").value;
var a2=document.getElementById("kast2").value;
yhendus.open("GET","/joon2?a="+a1+"&b="+a2, true);
yhendus.send();
}


function andmedSaabusid(){
document.getElementById("vastus").innerHTML=yhendus.responseText;
}



</script>
</head>
<body>
<h1>Kolmnurga pindala arvutamine</h1>
<br><br>
Sisesta alus<br>
<input type="text" id="kast1" placeholder="alus"/><br>
Sisesta korgus<br>
<input type="text" id="kast2" placeholder="korgus"/>
<br>
<input type="button" value="Arvuta" onclick="vajutus()"/>
<br><br>
<div id="vastus">Vastus: </div>
</body>
</html>
1 change: 1 addition & 0 deletions target/classes/public/tervitus.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tere
1 change: 1 addition & 0 deletions target/classes/public/ülesanne.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TEE TERVITUS.TXT'ST HTML FILE, MIS K�IB K�SIMAS GEOM KESKMISEST ARVE JA KUVAB VASTUSE. 2X GET
Binary file added target/classes/rihard/JooneVorrand2.class
Binary file not shown.
Binary file added target/classes/rihard/Joonefunktsioon2.class
Binary file not shown.
Binary file added target/classes/rihard/Rakendus.class
Binary file not shown.
Binary file added target/classes/tanel/JooneVorrand2.class
Binary file not shown.
Binary file added target/classes/tanel/Joonefunktsioon2.class
Binary file not shown.
Binary file added target/classes/tanel/Rakendus.class
Binary file not shown.
5 changes: 5 additions & 0 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Generated by Maven
#Mon Mar 13 13:38:31 EET 2017
version=1.0-SNAPSHOT
groupId=tanel
artifactId=boot3
Loading