Skip to content

Commit

Permalink
Merge pull request #25 from solid-titans/beta
Browse files Browse the repository at this point in the history
Atualização semanal do CRUD
  • Loading branch information
LucasSnatiago authored Oct 21, 2020
2 parents ae35339 + 8ab3999 commit 7066b53
Show file tree
Hide file tree
Showing 63 changed files with 4,530 additions and 2,326 deletions.
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
runner = button.sh
cleaner = limparAmbiente.sh
safeCleaner = limparJava.sh
compiler = compile.sh
makeJar = makeJar.sh

run:
sh $(runner)

clean:
sh $(cleaner)

safeClean:
sh $(safeCleaner)

compile:
sh $(compiler)

jar: compile
sh $(makeJar)
2 changes: 2 additions & 0 deletions compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd 'src'
javac -d . Main.java
2 changes: 1 addition & 1 deletion limparAmbiente.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Programa para limpar a área de trabalho do Crud de forma segura
# Programa para limpar a área de trabalho do Crud de forma segura e seu banco de dados

find . -name *.class -type f -delete
rm -rf src/Dados
5 changes: 5 additions & 0 deletions limparJava.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

# Programa para limpar a área de trabalho do Crud de forma segura

find . -name *.class -type f -delete
5 changes: 5 additions & 0 deletions makeJar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

cd src/

jar cvfm Crud.jar MANIFEST.txt *
3 changes: 3 additions & 0 deletions src/MANIFEST.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Created-By: Solid Titans
Main-Class: Main
73 changes: 68 additions & 5 deletions src/Main.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,78 @@
import java.io.File;

import menu.Menu;
import menu.*;
import menu.api.*;
import menu.backend.cruds.*;
import menu.backend.input.*;
import menu.frontend.*;
import menu.frontend.graficos.*;

public class Main {

/**
* Função maestro para orquestrar todos os objetos usados no programa
* @param args
*/
public static void main(String[] args) {

// Verificar se o directorio de dados existe, caso nao exista crie-o
File directorioDados = new File("Dados");
if(!directorioDados.exists()) directorioDados.mkdir();
if (!directorioDados.exists())
directorioDados.mkdir();

// Comum a todos
Input input = new Input();

//Destaques
ANSILibrary destaqueTam = new ANSILibrary(15, 124, ANSILibrary.TEXTO_SUBLINHADO);
ANSILibrary destaqueTitulo = new ANSILibrary(15, 9, ANSILibrary.TEXTO_SUBLINHADO);
ANSILibrary destaqueObs = new ANSILibrary(15, 234, ANSILibrary.TEXTO_SUBLINHADO);
ANSILibrary destaqueData = new ANSILibrary(15, 232, ANSILibrary.TEXTO_SUBLINHADO);

//Interfaces ASCII
ASCIInterface usuariosGraficos = new ASCIInterface(92, 226, 93, 232);
ASCIInterface perguntasGraficos = new ASCIInterface(21, 111, 232, 15);
ASCIInterface respostasGraficos = new ASCIInterface(40, 121, 232, 15);

//CustomPrints
CustomPrint usuariosPrint = new CustomPrint(usuariosGraficos,destaqueTitulo,destaqueObs);
CustomPrint perguntasPrint = new CustomPrint(perguntasGraficos,destaqueTitulo,destaqueObs);
CustomPrint respostasPrint = new CustomPrint(respostasGraficos,destaqueTitulo,destaqueObs);

CustomPrint usuariosInputPrint = new CustomPrint(usuariosGraficos,destaqueTitulo,destaqueTam);
CustomPrint perguntasInputPrint = new CustomPrint(perguntasGraficos,destaqueTitulo,destaqueTam);
CustomPrint respostasInputPrint = new CustomPrint(respostasGraficos,destaqueTitulo,destaqueTam);

// Definicoes
CustomInput usuariosCustomInput = new CustomInput(usuariosInputPrint);
CustomInput perguntasCustomInput = new CustomInput(perguntasInputPrint);
CustomInput respostasCustomInput = new CustomInput(respostasInputPrint);

// Interface
UsuariosFrontEnd usuariosFrontEnd = new UsuariosFrontEnd(usuariosPrint, usuariosCustomInput);
PerguntasFrontEnd perguntasFrontEnd = new PerguntasFrontEnd(perguntasPrint, input);
RespostasFrontEnd respostasFrontEnd = new RespostasFrontEnd(respostasPrint, input);

// APIS
UsuariosAPI usuariosAPI = new UsuariosAPI(usuariosFrontEnd, usuariosCustomInput);
PerguntasAPI perguntasAPI = new PerguntasAPI(perguntasFrontEnd, perguntasCustomInput);
RespostasAPI respostasAPI = new RespostasAPI(respostasFrontEnd, respostasCustomInput);

// Cruds
UsuariosCRUD usuariosCRUD = new UsuariosCRUD();
PerguntasCRUD perguntasCRUD = new PerguntasCRUD("Dados");
RespostasCRUD respostasCRUD = new RespostasCRUD("Dados");

// Menu
ASCIInterface graficos = new ASCIInterface(27,255 , 232, 232);
CustomPrint myPrint = new CustomPrint(graficos,destaqueData,destaqueObs);

Selecao selecao = new Selecao(myPrint, input);
APIControle minhaAPI = new APIControle(usuariosAPI, perguntasAPI, respostasAPI, usuariosCRUD, perguntasCRUD,
respostasCRUD);

Menu m = new Menu();
m.Inicio();
//Iniciar ao menu
Menu m = new Menu(myPrint, minhaAPI, selecao);
m.Inicio(); //Começar efetivamente o programa
}

}
2 changes: 1 addition & 1 deletion src/crud/Crud.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package crud;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.lang.reflect.Constructor;
Expand Down Expand Up @@ -67,6 +66,7 @@ public int create(T objeto) {

// Retornando a id usada na criacao do objeto
if(id != -1) this.create(objeto, id);

return id;
}

Expand Down
9 changes: 9 additions & 0 deletions src/crud/indices/ArvoreBMais_String_Int.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@
// CHAVE: String (usado para algum atributo textual da entidade como Nome, Título, ...)
// VALOR: Int (usado para o identificador dessa entidade)

/******************************************************************************
* A {@code ArvoreBMais_String_Int}
*
*
*
* @version 0.0.0
* @category Indice Indireto
******************************************************************************/

public class ArvoreBMais_String_Int {

private int ordem; // Número máximo de filhos que uma página pode conter
Expand Down
Loading

0 comments on commit 7066b53

Please sign in to comment.