Skip to content

Commit 1d503d8

Browse files
authored
Add files via upload
1 parent 29c3117 commit 1d503d8

17 files changed

Lines changed: 505 additions & 194 deletions

File tree

Campeonato/pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
<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/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44

5-
<groupId>com.mycompany</groupId>
6-
<artifactId>Campeonato</artifactId>
7-
<version>1.0-SNAPSHOT</version>
5+
<groupId>application</groupId>
6+
<artifactId>campeonato2017</artifactId>
7+
<version>1.0</version>
88
<packaging>jar</packaging>
99

10-
<name>Campeonato</name>
10+
<name>campeonato2017</name>
1111

1212
<properties>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14-
<mainClass>com.mycompany.campeonato.MainApp</mainClass>
14+
<mainClass>application.MainApp</mainClass>
1515
</properties>
1616

1717
<organization>
@@ -85,8 +85,8 @@
8585
<artifactId>maven-compiler-plugin</artifactId>
8686
<version>3.1</version>
8787
<configuration>
88-
<source>1.8</source>
89-
<target>1.8</target>
88+
<source>1.7</source>
89+
<target>1.7</target>
9090
<compilerArguments>
9191
<bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
9292
</compilerArguments>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package application;
2+
3+
import javafx.application.Application;
4+
import static javafx.application.Application.launch;
5+
import javafx.fxml.FXMLLoader;
6+
import javafx.scene.Parent;
7+
import javafx.scene.Scene;
8+
import javafx.stage.Stage;
9+
10+
11+
public class MainApp extends Application {
12+
13+
@Override
14+
public void start(Stage stage) throws Exception {
15+
Parent root = FXMLLoader.load(getClass().getResource("/fxml/Principal.fxml"));
16+
17+
Scene scene = new Scene(root);
18+
scene.getStylesheets().add("/styles/Styles.css");
19+
20+
stage.setTitle("Campeonato");
21+
stage.setScene(scene);
22+
stage.show();
23+
}
24+
25+
/**
26+
* The main() method is ignored in correctly deployed JavaFX application.
27+
* main() serves only as fallback in case the application can not be
28+
* launched through deployment artifacts, e.g., in IDEs with limited FX
29+
* support. NetBeans ignores main().
30+
*
31+
* @param args the command line arguments
32+
*/
33+
public static void main(String[] args) {
34+
launch(args);
35+
}
36+
37+
}

Campeonato/src/main/java/model/Jogo.java

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,46 @@
77

88
/**
99
*
10-
* @author deinfo
10+
* @author Usuario
1111
*/
1212
public class Jogo {
13-
String timeA, timeB;
14-
byte golA, golB;
13+
14+
public String timeA;
15+
public String timeB;
16+
public byte golA;
17+
public byte golB;
18+
19+
public Jogo(String timeA, byte golA, String timeB, byte golB) {
20+
this.timeA = timeA;
21+
this.golA = golA;
22+
this.timeB = timeB;
23+
this.golB = golB;
24+
}
25+
26+
public Jogo(String linha) {
27+
String[] partes = linha.split("\\,");
28+
29+
this.timeA = partes[0];
30+
this.golA = Byte.parseByte(partes[1]);
31+
this.timeB = partes[2];
32+
this.golB = Byte.parseByte(partes[3]);
33+
34+
}
1535

1636
public String getTimeA() {
1737
return timeA;
1838
}
1939

2040
public void setTimeA(String timeA) {
21-
this.timeA = timeA;
41+
this.timeA = timeA.toUpperCase();
2242
}
2343

2444
public String getTimeB() {
2545
return timeB;
2646
}
2747

2848
public void setTimeB(String timeB) {
29-
this.timeB = timeB;
49+
this.timeB = timeB.toUpperCase();
3050
}
3151

3252
public byte getGolA() {
@@ -45,36 +65,12 @@ public void setGolB(byte golB) {
4565
this.golB = golB;
4666
}
4767

48-
public Jogo() {
49-
50-
}
51-
52-
public Jogo(String linha) {
53-
String[] partes = linha.split("\\,");
54-
55-
this.timeA = partes[0];
56-
this.golA = Byte.parseByte(partes[1]);
57-
this.timeB = partes[2];
58-
this.golB = Byte.parseByte(partes[3]);
59-
}
60-
61-
public Jogo(String timeA, String timeB, byte golA, byte golB) {
62-
this.timeA = timeA;
63-
this.timeB = timeB;
64-
this.golA = golA;
65-
this.golB = golB;
66-
}
67-
68-
public Jogo(String timeA, String golA, String timeB, String golB) {
69-
this.timeA = timeA.toUpperCase();
70-
this.timeB = timeB.toUpperCase();
71-
this.golA = Byte.parseByte(golA);
72-
this.golB = Byte.parseByte(golB);
73-
}
74-
7568
@Override
7669
public String toString() {
7770
return "Jogo{" + "timeA=" + timeA + ", timeB=" + timeB + ", golA=" + golA + ", golB=" + golB + '}';
7871
}
72+
73+
74+
7975

8076
}

Campeonato/src/main/java/model/Time.java

Lines changed: 101 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,110 +7,147 @@
77

88
/**
99
*
10-
* @author Gusta
10+
* @author Usuario
1111
*/
1212
public class Time {
13-
String nome;
14-
Integer vit = 0, der = 0, emp = 0;
15-
Integer golP = 0, golN = 0;
13+
14+
public String nome;
15+
int vitorias = 0;
16+
int derrotas = 0;
17+
int empates = 0;
18+
int golPro = 0;
19+
int golContra = 0;
20+
byte clas = 0; // de 255 até -255
21+
22+
23+
public Time(String nome, int vitorias, int derrotas, int empates, int golPro, int golContra) {
24+
this.nome = nome;
25+
this.vitorias = vitorias;
26+
this.derrotas = derrotas;
27+
this.empates = empates;
28+
this.golPro = golPro;
29+
this.golContra = golContra;
30+
}
1631

17-
public String getNome() {
18-
return nome;
32+
public Time() {
1933
}
2034

21-
public void setNome(String nome) {
35+
public Time(String nome) {
2236
this.nome = nome;
2337
}
2438

25-
public int getVit() {
26-
return vit;
39+
public int getSaldo() {
40+
return golPro - golContra;
41+
}
42+
43+
public int getPontos() {
44+
return vitorias * 3 + empates;
45+
}
46+
47+
public int getPartidas() {
48+
return vitorias + derrotas + empates;
2749
}
2850

29-
public void setVit(int vit) {
30-
if(vit > 0)
31-
this.vit = vit;
51+
public String getNome() {
52+
return nome;
3253
}
3354

34-
public int getDer() {
35-
return der;
55+
public void setNome(String nome) {
56+
this.nome = nome;
3657
}
3758

38-
public void setDer(int der) {
39-
if(der > 0)
40-
this.der = der;
59+
public int getVitorias() {
60+
return vitorias;
61+
}
62+
63+
public void addGolPro(byte gols){
64+
this.golPro += gols;
4165
}
4266

43-
public int getEmp() {
44-
return emp;
67+
public void addGolContra(byte gols){
68+
this.golContra += gols;
4569
}
4670

47-
public void setEmp(int emp) {
48-
if(emp > 0)
49-
this.emp = emp;
71+
public byte getClas() {
72+
return clas;
5073
}
5174

52-
public int getGolP() {
53-
return golP;
75+
public void setClas(byte clas) {
76+
this.clas = clas;
77+
}
78+
79+
public void setVitorias(int vitorias) {
80+
if (vitorias >= 0) {
81+
this.vitorias = vitorias;
82+
} else {
83+
this.vitorias = 0;
84+
}
5485
}
5586

56-
public void setGolP(int golP) {
57-
if(golP > 0)
58-
this.golP = golP;
87+
public int getDerrotas() {
88+
return derrotas;
5989
}
6090

61-
public int getGolN() {
62-
return golN;
91+
public void setDerrotas(int derrotas) {
92+
if (derrotas >= 0) {
93+
this.derrotas = derrotas;
94+
} else {
95+
this.derrotas = 0;
96+
}
6397
}
6498

65-
public void setGolN(int golN) {
66-
if(golN > 0)
67-
this.golN = golN;
99+
public int getEmpates() {
100+
return empates;
68101
}
69-
70-
int saldoGols() {
71-
return golP - golN;
102+
103+
public void setEmpates(int empates) {
104+
if (derrotas >= 0) {
105+
this.empates = empates;
106+
} else {
107+
this.empates = 0;
108+
}
72109
}
73-
74-
int getPontos() {
75-
return (vit*3) + emp;
110+
111+
public int getGolPro() {
112+
return golPro;
76113
}
77-
78-
int partidas() {
79-
return vit + der + emp;
114+
115+
public void setGolPro(int golPro) {
116+
if (golPro >= 0) {
117+
this.golPro = golPro;
118+
} else {
119+
this.golPro = 0;
120+
}
80121
}
81-
82-
void addVit() {
83-
this.vit++;
122+
123+
public int getGolContra() {
124+
return golContra;
84125
}
85-
86-
void addEmp() {
87-
this.emp++;
126+
127+
public void setGolContra(int golContra) {
128+
if (golContra >= 0) {
129+
this.golContra = golContra;
130+
} else {
131+
this.golContra = 0;
132+
}
88133
}
89134

90-
void addDer() {
91-
this.der++;
135+
public void addVitoria() {
136+
this.vitorias += 1;
92137
}
93138

94-
void addGolP(byte gols) {
95-
this.golP += gols;
139+
public void addDerrota() {
140+
this.derrotas += 1;
96141
}
97142

98-
void addGolN(byte gols) {
99-
this.golN += gols;
100-
}
101-
102-
public Time() {
103-
}
104-
105-
public Time(String nome) {
106-
this.nome = nome;
143+
public void addEmpate() {
144+
this.empates += 1;
107145
}
108146

109147
@Override
110148
public String toString() {
111-
return "Time{" + "nome=" + nome + ", vit=" + vit + ", pto=" + getPontos() + ", der=" + der + ", emp=" + emp + ", golP=" + golP + ", golN=" + golN + '}';
149+
return "Time{" + "nome=" + nome + ", ptos=" + getPontos() + '}';
112150
}
113151

114-
115-
116-
}
152+
153+
}

0 commit comments

Comments
 (0)