Initial commit
This commit is contained in:
7
src/META-INF/MANIFEST.MF
Normal file
7
src/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,7 @@
|
||||
Manifest-Version: 1.0
|
||||
Permissions: sandbox
|
||||
JavaFX-Version: 8.0
|
||||
Class-Path: /cl/cromer/estructuras
|
||||
Created-By: Chris Cromer
|
||||
Main-Class: cl.cromer.estructuras.Main
|
||||
|
213
src/cl/cromer/estructuras/Array.java
Normal file
213
src/cl/cromer/estructuras/Array.java
Normal file
@@ -0,0 +1,213 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
/**
|
||||
* Crear una estructura de dato de tipo array.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class Array {
|
||||
/**
|
||||
* El array.
|
||||
*/
|
||||
private String array[];
|
||||
|
||||
/**
|
||||
* La cantidad de elementos en el array.
|
||||
*/
|
||||
private int size;
|
||||
|
||||
/**
|
||||
* Si es de tipo ordenado o simple.
|
||||
*/
|
||||
private boolean ordered;
|
||||
|
||||
/**
|
||||
* Crear el array con el tamaño pasador por argumento.
|
||||
* @param temano int: El temaño del array a crear.
|
||||
*/
|
||||
public Array(int temano) {
|
||||
this.array = new String[temano];
|
||||
size = 0;
|
||||
ordered = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver la cantidad de elementos en el array.
|
||||
* @return int: Devolver la cantidad de elementos en el array.
|
||||
*/
|
||||
public int size() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dovolver si el tipo es ordenado o no.
|
||||
* @return boolean: Si el tipo de array es ordenado.
|
||||
*/
|
||||
public boolean isOrdered() {
|
||||
return ordered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cambiar el tipo de array entre ordenado o simple.
|
||||
* @param ordered boolean: Si es verdad, es de tipo ordenado, sino el tipo es simple.
|
||||
*/
|
||||
public void setOrdered(boolean ordered) {
|
||||
this.ordered = ordered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insertar un valor al array.
|
||||
* @param valor int: El valor a insertar.
|
||||
* @return boolean: Verdad si fue exitoso, sino falso.
|
||||
*/
|
||||
public boolean insertar(int valor) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] == null) {
|
||||
array[i] = String.valueOf(valor);
|
||||
size++;
|
||||
return true;
|
||||
}
|
||||
else if (array[i].equals(String.valueOf(valor))) {
|
||||
// Ya existe el valor en el array
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Eliminar un valor del array si existe.
|
||||
* @param valor int: El valor a eliminar.
|
||||
* @return boolean: Verdad si fue encontrado y borrado, sino falso.
|
||||
*/
|
||||
public boolean eliminar(int valor) {
|
||||
boolean borrado = false;
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] != null && array[i].equals(String.valueOf(valor))) {
|
||||
// Eliminar el valor
|
||||
array[i] = null;
|
||||
borrado=true;
|
||||
size--;
|
||||
if (ordered) {
|
||||
for (int j = i; j < array.length; j++) {
|
||||
if (j != array.length - 1) {
|
||||
// Correr la array hacia arriba
|
||||
array[j] = array[j + 1];
|
||||
}
|
||||
}
|
||||
array[array.length-1] = null;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return borrado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Buscar si existe un valor dentro el array.
|
||||
* @param valor int: Valor a buscar.
|
||||
* @return int: Devuelve el indice donde fue encontrado, o -1 si no fue encontrado.
|
||||
*/
|
||||
public int buscar(int valor) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] != null && array[i].equals(String.valueOf(valor))) {
|
||||
// Se encontró
|
||||
return i;
|
||||
}
|
||||
}
|
||||
// No se encontró
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver el valor que está guardado en cada indice del array. Se usa para construir la grafica.
|
||||
* @param indice int: El indice que desea ver.
|
||||
* @return String: El valor que está en dicho indice.
|
||||
*/
|
||||
public String getIndice(int indice) {
|
||||
if (indice >= 0 && indice < array.length) {
|
||||
return array[indice];
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenar el array usando burbuja.
|
||||
* @param paso boolean: Si es verdad, solo hago en paso del ordenamiento, sino ordenear todos los elementos.
|
||||
* @return boolean: Verdad si algo cambió, sino falso.
|
||||
*/
|
||||
public boolean burbuja(boolean paso) {
|
||||
boolean cambio = false;
|
||||
|
||||
for (int i = size() - 1; i > 1; i--) {
|
||||
for (int j = 0; j < i; j++) {
|
||||
if (Integer.valueOf(array[j]) > Integer.valueOf(array[j+1])) {
|
||||
String temp = array[j];
|
||||
array[j] = array[j+1];
|
||||
array[j+1] = temp;
|
||||
cambio = true;
|
||||
if (paso) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cambio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenar el array usando inserción.
|
||||
* @param paso boolean: Si es verdad, solo hago en paso del ordenamiento, sino ordenear todos los elementos.
|
||||
* @return boolean: Verdad si algo cambió, sino falso.
|
||||
*/
|
||||
public boolean insercion(boolean paso) {
|
||||
boolean cambio = false;
|
||||
|
||||
for (int i = 1; i < size(); i++) {
|
||||
String temp = array[i];
|
||||
int j = i;
|
||||
while (j > 0 && Integer.valueOf(array[j-1]) >= Integer.valueOf(temp)) {
|
||||
array[j] = array[j-1];
|
||||
--j;
|
||||
cambio = true;
|
||||
}
|
||||
array[j] = temp;
|
||||
if (paso && cambio) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return cambio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenar el array usando selección.
|
||||
* @param paso boolean: Si es verdad, solo hago en paso del ordenamiento, sino ordenear todos los elementos.
|
||||
* @return boolean: Verdad si algo cambió, sino falso.
|
||||
*/
|
||||
public boolean seleccion(boolean paso) {
|
||||
boolean cambio = false;
|
||||
|
||||
for (int i = 0; i < size() - 1; i++) {
|
||||
int minimo = i;
|
||||
for (int j = i + 1; j < size(); j++) {
|
||||
if (Integer.valueOf(array[j]) < Integer.valueOf(array[minimo])) {
|
||||
minimo = j;
|
||||
cambio = true;
|
||||
}
|
||||
}
|
||||
String temp = array[i];
|
||||
array[i] = array[minimo];
|
||||
array[minimo] = temp;
|
||||
if (paso && cambio) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return cambio;
|
||||
}
|
||||
}
|
282
src/cl/cromer/estructuras/ArrayController.java
Normal file
282
src/cl/cromer/estructuras/ArrayController.java
Normal file
@@ -0,0 +1,282 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Scanner;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Esta clase es para controlar todos la interfaz de Array.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class ArrayController implements Initializable {
|
||||
|
||||
/**
|
||||
* La caja para ingresar textos.
|
||||
*/
|
||||
@FXML private TextFieldLimited valorArray;
|
||||
|
||||
/**
|
||||
* Donde poner el contenido de array.
|
||||
*/
|
||||
@FXML private VBox contenidoArray;
|
||||
|
||||
/**
|
||||
* Donde va el codigo a mostrar a la pantalla.
|
||||
*/
|
||||
@FXML private Text codigoArray;
|
||||
|
||||
/**
|
||||
* La escena donde está cosas graficas.
|
||||
*/
|
||||
private Scene scene;
|
||||
|
||||
/**
|
||||
* Donde está guardado los idiomas.
|
||||
*/
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* El array usado en la aplicación.
|
||||
*/
|
||||
private Array array;
|
||||
|
||||
/**
|
||||
* Grafico rectangulos.
|
||||
*/
|
||||
private Grafico grafico;
|
||||
|
||||
/**
|
||||
* Inicializar todos los datos y dibujar las graficas.
|
||||
* @param location URL: El URL de fxml en uso.
|
||||
* @param resourceBundle ResourceBundle: Tiene datos de idioma.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resourceBundle) {
|
||||
this.resourceBundle = resourceBundle;
|
||||
|
||||
scene = null;
|
||||
Colores colores = new Colores();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
contenidoArray.getChildren().addAll(Grafico.crearCaja(colores, String.valueOf(i)));
|
||||
colores.siguinteColor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Llenar el array con numeros al azar.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonLlenar() {
|
||||
if (scene == null) {
|
||||
initializeArray();
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
for (int i = array.size(); i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
while (array.buscar(numero) != -1) {
|
||||
numero = random.nextInt(rango) + minimo;
|
||||
}
|
||||
array.insertar(numero);
|
||||
}
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Vaciar el array de todos los valores.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonVaciar() {
|
||||
if (scene == null) {
|
||||
initializeArray();
|
||||
}
|
||||
|
||||
if (array.isOrdered()) {
|
||||
array = new Array(10);
|
||||
array.setOrdered(true);
|
||||
}
|
||||
else {
|
||||
array = new Array(10);
|
||||
array.setOrdered(false);
|
||||
}
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Insertar un valor al array y mostrar el codigo en la pantalla.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonInsertar() {
|
||||
if (scene == null) {
|
||||
initializeArray();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String tipo = (array.isOrdered())?"Ordenado":"Simple";
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/array" + tipo + "/insertar")).useDelimiter("\\Z").next();
|
||||
codigoArray.setText(codigoTexto);
|
||||
|
||||
if (valorArray.getText() != null && !valorArray.getText().trim().equals("")) {
|
||||
try {
|
||||
boolean exito = array.insertar(Integer.valueOf(valorArray.getText()));
|
||||
if (exito) {
|
||||
generarGrafico();
|
||||
}
|
||||
else {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
if (array.size() == 10) {
|
||||
dialog.setContentText(resourceBundle.getString("arrayLleno"));
|
||||
}
|
||||
else {
|
||||
dialog.setContentText(resourceBundle.getString("arrayValorExiste"));
|
||||
}
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException exception) {
|
||||
// El error no es fatal, sigue
|
||||
Logs.log(Level.WARNING, "No es tipo int.");
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Eliminar un valor del array si existe y mostrar el codigo en la pantalla.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonEliminar() {
|
||||
if (scene == null) {
|
||||
initializeArray();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String tipo = (array.isOrdered())?"Ordenado":"Simple";
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/array" + tipo + "/eliminar")).useDelimiter("\\Z").next();
|
||||
codigoArray.setText(codigoTexto);
|
||||
|
||||
try {
|
||||
if (valorArray.getText() != null && !valorArray.getText().trim().equals("")) {
|
||||
boolean exito = array.eliminar(Integer.valueOf(valorArray.getText()));
|
||||
if (exito) {
|
||||
generarGrafico();
|
||||
}
|
||||
else {
|
||||
errorNoEsta();
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException exception) {
|
||||
// El error no es fatal, sigue
|
||||
Logs.log(Level.WARNING, "No es tipo int.");
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Buscar si existe un elemento en el array y mostrar el codigo en la pantalla
|
||||
* Si existe el valor destacarlo.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonBuscar() {
|
||||
if (scene == null) {
|
||||
initializeArray();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String tipo = (array.isOrdered())?"Ordenado":"Simple";
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/array" + tipo + "/buscar")).useDelimiter("\\Z").next();
|
||||
codigoArray.setText(codigoTexto);
|
||||
|
||||
try {
|
||||
if (valorArray.getText() != null && !valorArray.getText().trim().equals("")) {
|
||||
int encontrado = array.buscar(Integer.valueOf(valorArray.getText()));
|
||||
if (encontrado != -1) {
|
||||
generarGrafico();
|
||||
grafico = new Grafico(scene);
|
||||
grafico.destacer(encontrado, "rectangulo");
|
||||
}
|
||||
else {
|
||||
errorNoEsta();
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException exception) {
|
||||
// El error no es fatal, sigue
|
||||
Logs.log(Level.WARNING, "No es tipo int.");
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Se muestra un error si la persona no ingresa un valor en el TextField.
|
||||
*/
|
||||
private void errorNoValor() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("arrayNoValor"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Error cuando el valor no está en el array.
|
||||
*/
|
||||
private void errorNoEsta() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("arrayNoEsta"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear el array de temaño 10. La scene está usado para saber si es de tipo ordenado o simple segun el ménu.
|
||||
*/
|
||||
private void initializeArray() {
|
||||
scene = contenidoArray.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
this.array = new Array(10);
|
||||
Array array = (Array) scene.getUserData();
|
||||
this.array.setOrdered(array.isOrdered());
|
||||
}
|
||||
|
||||
/**
|
||||
* Poner los valores en el grafico.
|
||||
*/
|
||||
private void generarGrafico() {
|
||||
grafico.removerDestacar();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Text text = (Text) scene.lookup("#caja_" + String.valueOf(i));
|
||||
text.setText(array.getIndice(i));
|
||||
}
|
||||
}
|
||||
}
|
174
src/cl/cromer/estructuras/BurbujaController.java
Normal file
174
src/cl/cromer/estructuras/BurbujaController.java
Normal file
@@ -0,0 +1,174 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ButtonBar;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Dialog;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Esta clase es para controlar todos la interfaz de Burbuja.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class BurbujaController implements Initializable {
|
||||
/**
|
||||
* Donde poner el contenido de array.
|
||||
*/
|
||||
@FXML private HBox contenidoBurbuja;
|
||||
|
||||
/**
|
||||
* Donde va el codigo a mostrar a la pantalla.
|
||||
*/
|
||||
@FXML private Text codigoBurbuja;
|
||||
|
||||
/**
|
||||
* La escena donde está cosas graficas.
|
||||
*/
|
||||
private Scene scene;
|
||||
|
||||
/**
|
||||
* Donde está guardado los idiomas.
|
||||
*/
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* El array usado en la aplicación.
|
||||
*/
|
||||
private Array array;
|
||||
|
||||
/**
|
||||
* Inicializar todos los datos y dibujar las graficas.
|
||||
* @param location URL: El URL de fxml en uso.
|
||||
* @param resourceBundle ResourceBundle: Tiene datos de idioma.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resourceBundle) {
|
||||
this.resourceBundle = resourceBundle;
|
||||
|
||||
scene = null;
|
||||
|
||||
Colores colores = new Colores();
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
array = new Array(10);
|
||||
array.setOrdered(true);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
while (array.buscar(numero) != -1) {
|
||||
numero = random.nextInt(rango) + minimo;
|
||||
}
|
||||
array.insertar(numero);
|
||||
contenidoBurbuja.getChildren().addAll(Grafico.crearCaja(colores, String.valueOf(i), String.valueOf(numero)));
|
||||
colores.siguinteColor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear un array nuevo.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonNuevo() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
array = new Array(10);
|
||||
array.setOrdered(true);
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
for (int i = array.size(); i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
while (array.buscar(numero) != -1) {
|
||||
numero = random.nextInt(rango) + minimo;
|
||||
}
|
||||
array.insertar(numero);
|
||||
}
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenarlo paso por paso.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPaso() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/burbuja/ordenar")).useDelimiter("\\Z").next();
|
||||
codigoBurbuja.setText(codigoTexto);
|
||||
|
||||
if (!array.burbuja(true)) {
|
||||
errorYaOrdenado();
|
||||
}
|
||||
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenarlo completamente.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonCorrer() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/burbuja/ordenar")).useDelimiter("\\Z").next();
|
||||
codigoBurbuja.setText(codigoTexto);
|
||||
|
||||
if (!array.burbuja(false)) {
|
||||
errorYaOrdenado();
|
||||
}
|
||||
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Se muestra un error si el array ya está ordenado.
|
||||
*/
|
||||
private void errorYaOrdenado() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("burbujaYaOrdenado"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear el array de temaño 10.
|
||||
*/
|
||||
private void initializeScene() {
|
||||
scene = contenidoBurbuja.getScene();
|
||||
}
|
||||
|
||||
/**
|
||||
* Poner los valores en el grafico.
|
||||
*/
|
||||
private void generarGrafico() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Text text = (Text) scene.lookup("#caja_" + String.valueOf(i));
|
||||
text.setText(array.getIndice(i));
|
||||
}
|
||||
}
|
||||
}
|
101
src/cl/cromer/estructuras/Cola.java
Normal file
101
src/cl/cromer/estructuras/Cola.java
Normal file
@@ -0,0 +1,101 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
/**
|
||||
* Crear una estructura de dato de tipo cola.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class Cola {
|
||||
/**
|
||||
* La cola.
|
||||
*/
|
||||
private String cola[];
|
||||
|
||||
/**
|
||||
* La cantidad de elementos que están en la cola.
|
||||
*/
|
||||
private int size;
|
||||
|
||||
/**
|
||||
* Inicializar.
|
||||
*/
|
||||
public Cola() {
|
||||
this.cola = null;
|
||||
size = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver la cantidad de elementos que están en la cola.
|
||||
* @return int: La cantidad de elementos.
|
||||
*/
|
||||
public int size() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push un valor en la cola encima.
|
||||
* @param valor int: El valor a push.
|
||||
*/
|
||||
public void push(int valor) {
|
||||
if (this.cola != null) {
|
||||
String cola[] = new String[this.cola.length + 1];
|
||||
int i;
|
||||
for (i = 0; i < this.cola.length; i++) {
|
||||
cola[i] = this.cola[i];
|
||||
}
|
||||
cola[i] = String.valueOf(valor);
|
||||
this.cola = cola;
|
||||
size++;
|
||||
}
|
||||
else {
|
||||
String pila[] = new String[1];
|
||||
pila[0] = String.valueOf(valor);
|
||||
this.cola = pila;
|
||||
size++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop un valor del principio de la cola.
|
||||
* @return boolean: Verdad si fue exitoso.
|
||||
*/
|
||||
public boolean pop() {
|
||||
if (this.cola != null) {
|
||||
String cola[] = new String[this.cola.length -1];
|
||||
// Nueva array sin el valor del primer
|
||||
System.arraycopy(this.cola, 1, cola, 0, cola.length);
|
||||
this.cola = cola;
|
||||
size--;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek al valor que está al principio de la cola.
|
||||
* @return int: El valor que está al principio de la cola.
|
||||
*/
|
||||
public int peek() {
|
||||
if (this.cola != null && size() > 0) {
|
||||
return Integer.valueOf(cola[0]);
|
||||
}
|
||||
else {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver el valor que está en un indice de la cola.
|
||||
* @param indice int: El indice que desea devolver.
|
||||
* @return String: El valor que está guardado en el indice.
|
||||
*/
|
||||
public String getIndice(int indice) {
|
||||
if (indice >= 0 && indice < cola.length) {
|
||||
return cola[indice];
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
236
src/cl/cromer/estructuras/ColaController.java
Normal file
236
src/cl/cromer/estructuras/ColaController.java
Normal file
@@ -0,0 +1,236 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ButtonBar;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Dialog;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Scanner;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Esta clase es para controlar todos la interfaz de Cola.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class ColaController implements Initializable {
|
||||
/**
|
||||
* La caja para ingresar textos.
|
||||
*/
|
||||
@FXML private TextFieldLimited valorCola;
|
||||
|
||||
/**
|
||||
* Donde poner el contenido de array.
|
||||
*/
|
||||
@FXML private VBox contenidoCola;
|
||||
|
||||
/**
|
||||
* Donde va el codigo a mostrar a la pantalla.
|
||||
*/
|
||||
@FXML private Text codigoCola;
|
||||
|
||||
/**
|
||||
* La escena donde está cosas graficas.
|
||||
*/
|
||||
private Scene scene;
|
||||
|
||||
/**
|
||||
* Donde está guardado los idiomas.
|
||||
*/
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* La cola usado en la aplicación.
|
||||
*/
|
||||
private Cola cola;
|
||||
|
||||
/**
|
||||
* Grafico rectangulos.
|
||||
*/
|
||||
private Grafico grafico;
|
||||
|
||||
/**
|
||||
* Inicializar todos los datos y dibujar las graficas.
|
||||
* @param location URL: El URL de fxml en uso.
|
||||
* @param resourceBundle ResourceBundle: Tiene datos de idioma.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resourceBundle) {
|
||||
this.resourceBundle = resourceBundle;
|
||||
|
||||
cola = new Cola();
|
||||
|
||||
scene = null;
|
||||
Colores colores = new Colores();
|
||||
|
||||
for (int i = 9; i >= 0; i--) {
|
||||
contenidoCola.getChildren().addAll(Grafico.crearCaja(colores, String.valueOf(i)));
|
||||
colores.siguinteColor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Llenar la cola con numeros al azar.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonLlenar() {
|
||||
if (scene == null) {
|
||||
scene = contenidoCola.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
for (int i = cola.size(); i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
cola.push(numero);
|
||||
}
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Vaciar la cola de todos los valores.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonVaciar() {
|
||||
if (scene == null) {
|
||||
scene = contenidoCola.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
cola = new Cola();
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Push un valor a la cola y mostrar el codigo en la pantalla.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPush() {
|
||||
if (scene == null) {
|
||||
scene = contenidoCola.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/cola/push")).useDelimiter("\\Z").next();
|
||||
codigoCola.setText(codigoTexto);
|
||||
|
||||
if (valorCola.getText() != null && !valorCola.getText().trim().equals("")) {
|
||||
try {
|
||||
if (cola.size() < 10) {
|
||||
cola.push(Integer.valueOf(valorCola.getText()));
|
||||
generarGrafico();
|
||||
}
|
||||
else {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("colaLlena"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException exception) {
|
||||
// El error no es fatal, sigue
|
||||
Logs.log(Level.WARNING, "No es tipo int.");
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop un valor de la pila si existe y mostrar el codigo en la pantalla.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPop() {
|
||||
if (scene == null) {
|
||||
scene = contenidoCola.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/cola/pop")).useDelimiter("\\Z").next();
|
||||
codigoCola.setText(codigoTexto);
|
||||
|
||||
if (cola.size() > 0) {
|
||||
cola.pop();
|
||||
generarGrafico();
|
||||
}
|
||||
else {
|
||||
errorVacia();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek a ver si existe un elemento en la pila y mostrar el codigo en la pantalla
|
||||
* Si existe un valor destacarlo.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPeek() {
|
||||
if (scene == null) {
|
||||
scene = contenidoCola.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/cola/peek")).useDelimiter("\\Z").next();
|
||||
codigoCola.setText(codigoTexto);
|
||||
|
||||
int encontrado = cola.peek();
|
||||
if (encontrado != Integer.MIN_VALUE) {
|
||||
generarGrafico();
|
||||
grafico.destacer(0, "rectangulo");
|
||||
}
|
||||
else {
|
||||
errorVacia();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Se muestra un error si la persona no ingresa un valor en el TextField.
|
||||
*/
|
||||
private void errorNoValor() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("colaNoValor"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Error cuando la pila está vacía.
|
||||
*/
|
||||
private void errorVacia() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("colaVacia"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Poner los valores en el grafico.
|
||||
*/
|
||||
private void generarGrafico() {
|
||||
grafico.removerDestacar();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Text text = (Text) scene.lookup("#caja_" + String.valueOf(i));
|
||||
text.setText(cola.getIndice(i));
|
||||
}
|
||||
}
|
||||
}
|
94
src/cl/cromer/estructuras/Colores.java
Normal file
94
src/cl/cromer/estructuras/Colores.java
Normal file
@@ -0,0 +1,94 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
/**
|
||||
* Rotación de colores.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class Colores {
|
||||
/**
|
||||
* Cuantos colores estan definidos en esta clase.
|
||||
*/
|
||||
static public int MAX_COLORS = 7;
|
||||
|
||||
/**
|
||||
* El color actual en forma numerica.
|
||||
*/
|
||||
private int color;
|
||||
|
||||
/**
|
||||
* El color de texto actual.
|
||||
*/
|
||||
private Color texto;
|
||||
|
||||
/**
|
||||
* El color de fondo actual.
|
||||
*/
|
||||
private Color fondo;
|
||||
|
||||
/**
|
||||
* Inicializar el primer color.
|
||||
*/
|
||||
public Colores() {
|
||||
siguinteColor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cambiar el color al siguinte. Si no hay, voler al primer.
|
||||
*/
|
||||
public void siguinteColor() {
|
||||
switch (color) {
|
||||
case 1:
|
||||
color = 2;
|
||||
texto = Color.WHITE;
|
||||
fondo = Color.RED;
|
||||
break;
|
||||
case 2:
|
||||
color = 3;
|
||||
texto = Color.BLACK;
|
||||
fondo = Color.WHITE;
|
||||
break;
|
||||
case 3:
|
||||
color = 4;
|
||||
texto = Color.BLACK;
|
||||
fondo = Color.PINK;
|
||||
break;
|
||||
case 4:
|
||||
color = 5;
|
||||
texto = Color.BLACK;
|
||||
fondo = Color.YELLOW;
|
||||
break;
|
||||
case 5:
|
||||
color = 6;
|
||||
texto = Color.BLACK;
|
||||
fondo = Color.GREEN;
|
||||
break;
|
||||
case 6 :
|
||||
color = 7;
|
||||
texto = Color.BLACK;
|
||||
fondo = Color.ORANGE;
|
||||
break;
|
||||
default:
|
||||
color = 1;
|
||||
texto = Color.WHITE;
|
||||
fondo = Color.BLUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver el color del texto actual.
|
||||
* @return Color: Color del texto.
|
||||
*/
|
||||
public Color getTexto() {
|
||||
return texto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver el color del fondo actual.
|
||||
* @return Color: Color del fondo.
|
||||
*/
|
||||
public Color getFondo() {
|
||||
return fondo;
|
||||
}
|
||||
}
|
196
src/cl/cromer/estructuras/Grafico.java
Normal file
196
src/cl/cromer/estructuras/Grafico.java
Normal file
@@ -0,0 +1,196 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.animation.Animation;
|
||||
import javafx.animation.PauseTransition;
|
||||
import javafx.animation.SequentialTransition;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.shape.Circle;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* Esta clase es para trabajar con graficos.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class Grafico {
|
||||
/**
|
||||
* Contiene la animación de destacar.
|
||||
*/
|
||||
private SequentialTransition blinkTransition;
|
||||
|
||||
/**
|
||||
* El valor de cual caja está destacado actualmente
|
||||
*/
|
||||
private int destacado;
|
||||
|
||||
/**
|
||||
* El tipo de objeto que está destacado.
|
||||
*/
|
||||
private String tipo;
|
||||
|
||||
/**
|
||||
* El color original de fondo para volver cuando no es destacado.
|
||||
*/
|
||||
private Color destacadoBG;
|
||||
|
||||
/**
|
||||
* El color original de text para volver cuando no es destacado.
|
||||
*/
|
||||
private Color destacadoFG;
|
||||
|
||||
/**
|
||||
* La escena donde está cosas graficas.
|
||||
*/
|
||||
private Scene scene;
|
||||
|
||||
/**
|
||||
* Graficar una escena.
|
||||
* @param scene La scene a destacar.
|
||||
*/
|
||||
public Grafico(Scene scene) {
|
||||
this.scene = scene;
|
||||
destacado = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear un rectangulo con texto adentro.
|
||||
* @param colores Colores: Los colores para dar color al rectangulo.
|
||||
* @param label String: El texto por el ID de fxml.
|
||||
* @return StackPane: Devolver el stackpane que contiene el rectangulo y texto.
|
||||
*/
|
||||
public static StackPane crearCaja(Colores colores, String label) {
|
||||
Rectangle rectangle = new Rectangle();
|
||||
rectangle.setHeight(40);
|
||||
rectangle.setWidth(40);
|
||||
rectangle.setFill(colores.getFondo());
|
||||
rectangle.setStroke(Color.BLACK);
|
||||
rectangle.setId("border_" + label);
|
||||
Text text = new Text();
|
||||
text.setId("caja_" + label);
|
||||
text.setStroke(colores.getTexto());
|
||||
|
||||
StackPane stackPane = new StackPane();
|
||||
stackPane.getChildren().addAll(rectangle, text);
|
||||
return stackPane;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear un rectangulo con texto adentro.
|
||||
* @param colores Colores: Los colores para dar color al rectangulo.
|
||||
* @param label String: El texto por el ID de fxml.
|
||||
* @param texto String: El texto a colocar dentro el rectangulo.
|
||||
* @return StackPane: Devolver el stackpane que contiene el rectangulo y texto.
|
||||
*/
|
||||
public static StackPane crearCaja(Colores colores, String label, String texto) {
|
||||
Rectangle rectangle = new Rectangle();
|
||||
rectangle.setHeight(40);
|
||||
rectangle.setWidth(40);
|
||||
rectangle.setFill(colores.getFondo());
|
||||
rectangle.setStroke(Color.BLACK);
|
||||
rectangle.setId("border_" + label);
|
||||
Text text = new Text();
|
||||
text.setId("caja_" + label);
|
||||
text.setStroke(colores.getTexto());
|
||||
text.setText(texto);
|
||||
|
||||
StackPane stackPane = new StackPane();
|
||||
stackPane.getChildren().addAll(rectangle, text);
|
||||
return stackPane;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destacar un elemento
|
||||
* @param valor int: El indice a destacar.
|
||||
* @param tipo String: El tipo de objeto a destacer(rectangulo o cicurlo)
|
||||
*/
|
||||
public void destacer(int valor, String tipo) {
|
||||
if (!tipo.equals("rectangulo") && !tipo.equals("circulo")) {
|
||||
return;
|
||||
}
|
||||
this.tipo = tipo;
|
||||
destacado = valor;
|
||||
Colores colores = new Colores();
|
||||
Rectangle rectangle = null;
|
||||
Circle circle = null;
|
||||
if (tipo.equals("rectangulo")) {
|
||||
rectangle = (Rectangle) scene.lookup("#border_" + String.valueOf(valor));
|
||||
destacadoBG = (Color) rectangle.getFill();
|
||||
}
|
||||
else if (tipo.equals("circulo")) {
|
||||
circle = (Circle) scene.lookup("#border_" + String.valueOf(valor));
|
||||
destacadoBG = (Color) circle.getFill();
|
||||
}
|
||||
Text text = (Text) scene.lookup("#caja_" + String.valueOf(valor));
|
||||
destacadoFG = (Color) text.getStroke();
|
||||
PauseTransition changeColor[] = new PauseTransition[Colores.MAX_COLORS];
|
||||
for (int i = 0; i < Colores.MAX_COLORS; i++) {
|
||||
if (tipo.equals("rectangulo")) {
|
||||
changeColor[i] = createPauseTransition(rectangle, text, colores.getFondo(), colores.getTexto());
|
||||
}
|
||||
else if (tipo.equals("circulo")) {
|
||||
changeColor[i] = createPauseTransition(circle, text, colores.getFondo(), colores.getTexto());
|
||||
}
|
||||
colores.siguinteColor();
|
||||
}
|
||||
blinkTransition = new SequentialTransition(changeColor);
|
||||
blinkTransition.setCycleCount(Animation.INDEFINITE);
|
||||
blinkTransition.play();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remover el efecto de destacar.
|
||||
*/
|
||||
public void removerDestacar() {
|
||||
if (destacado != -1) {
|
||||
blinkTransition.stop();
|
||||
if (tipo.equals("rectangulo")) {
|
||||
Rectangle rectangle = (Rectangle) scene.lookup("#border_" + String.valueOf(destacado));
|
||||
rectangle.setFill(destacadoBG);
|
||||
}
|
||||
else if (tipo.equals("circulo")) {
|
||||
Circle circle = (Circle) scene.lookup("#border_" + String.valueOf(destacado));
|
||||
circle.setFill(destacadoBG);
|
||||
}
|
||||
Text text = (Text) scene.lookup("#caja_" + String.valueOf(destacado));
|
||||
text.setStroke(destacadoFG);
|
||||
destacado = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear un animacion de transicion usando colores que cambian.
|
||||
* @param rectangle Rectangle: El objeto que desea animar.
|
||||
* @param text Text: El texto que desea animar.
|
||||
* @param colorBackground Color: Color del fondo de destacer.
|
||||
* @param colorText Color: Color del texto.
|
||||
* @return PauseTransition: La transition creado con los elementos y colores.
|
||||
*/
|
||||
private static PauseTransition createPauseTransition(Rectangle rectangle , Text text, Color colorBackground, Color colorText) {
|
||||
PauseTransition changeColor = new PauseTransition(new Duration(100));
|
||||
changeColor.setOnFinished(actionEvent -> {
|
||||
rectangle.setFill(colorBackground);
|
||||
text.setStroke(colorText);
|
||||
});
|
||||
return changeColor ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear un animacion de transicion usando colores que cambian.
|
||||
* @param circle Circle: El objeto que desea animar.
|
||||
* @param text Text: El texto que desea animar.
|
||||
* @param colorBackground Color: Color del fondo de destacer.
|
||||
* @param colorText Color: Color del texto.
|
||||
* @return PauseTransition: La transition creado con los elementos y colores.
|
||||
*/
|
||||
private static PauseTransition createPauseTransition(Circle circle , Text text, Color colorBackground, Color colorText) {
|
||||
PauseTransition changeColor = new PauseTransition(new Duration(100));
|
||||
changeColor.setOnFinished(actionEvent -> {
|
||||
circle.setFill(colorBackground);
|
||||
text.setStroke(colorText);
|
||||
});
|
||||
return changeColor ;
|
||||
}
|
||||
}
|
174
src/cl/cromer/estructuras/InsercionController.java
Normal file
174
src/cl/cromer/estructuras/InsercionController.java
Normal file
@@ -0,0 +1,174 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ButtonBar;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Dialog;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Esta clase es para controlar todos la interfaz de Inserción.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class InsercionController implements Initializable {
|
||||
/**
|
||||
* Donde poner el contenido de array.
|
||||
*/
|
||||
@FXML private HBox contenidoInsercion;
|
||||
|
||||
/**
|
||||
* Donde va el codigo a mostrar a la pantalla.
|
||||
*/
|
||||
@FXML private Text codigoInsercion;
|
||||
|
||||
/**
|
||||
* La escena donde está cosas graficas.
|
||||
*/
|
||||
private Scene scene;
|
||||
|
||||
/**
|
||||
* Donde está guardado los idiomas.
|
||||
*/
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* El array usado en la aplicación.
|
||||
*/
|
||||
private Array array;
|
||||
|
||||
/**
|
||||
* Inicializar todos los datos y dibujar las graficas.
|
||||
* @param location URL: El URL de fxml en uso.
|
||||
* @param resourceBundle ResourceBundle: Tiene datos de idioma.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resourceBundle) {
|
||||
this.resourceBundle = resourceBundle;
|
||||
|
||||
scene = null;
|
||||
|
||||
Colores colores = new Colores();
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
array = new Array(10);
|
||||
array.setOrdered(true);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
while (array.buscar(numero) != -1) {
|
||||
numero = random.nextInt(rango) + minimo;
|
||||
}
|
||||
array.insertar(numero);
|
||||
contenidoInsercion.getChildren().addAll(Grafico.crearCaja(colores, String.valueOf(i), String.valueOf(numero)));
|
||||
colores.siguinteColor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear un array nuevo.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonNuevo() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
array = new Array(10);
|
||||
array.setOrdered(true);
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
for (int i = array.size(); i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
while (array.buscar(numero) != -1) {
|
||||
numero = random.nextInt(rango) + minimo;
|
||||
}
|
||||
array.insertar(numero);
|
||||
}
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenarlo paso por paso.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPaso() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/insercion/ordenar")).useDelimiter("\\Z").next();
|
||||
codigoInsercion.setText(codigoTexto);
|
||||
|
||||
if (!array.insercion(true)) {
|
||||
errorYaOrdenado();
|
||||
}
|
||||
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenarlo completamente.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonCorrer() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/insercion/ordenar")).useDelimiter("\\Z").next();
|
||||
codigoInsercion.setText(codigoTexto);
|
||||
|
||||
if (!array.insercion(false)) {
|
||||
errorYaOrdenado();
|
||||
}
|
||||
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Se muestra un error si el array ya está ordenado.
|
||||
*/
|
||||
private void errorYaOrdenado() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("insercionYaOrdenado"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear el array de temaño 10.
|
||||
*/
|
||||
private void initializeScene() {
|
||||
scene = contenidoInsercion.getScene();
|
||||
}
|
||||
|
||||
/**
|
||||
* Poner los valores en el grafico.
|
||||
*/
|
||||
private void generarGrafico() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Text text = (Text) scene.lookup("#caja_" + String.valueOf(i));
|
||||
text.setText(array.getIndice(i));
|
||||
}
|
||||
}
|
||||
}
|
119
src/cl/cromer/estructuras/ListaEnlazada.java
Normal file
119
src/cl/cromer/estructuras/ListaEnlazada.java
Normal file
@@ -0,0 +1,119 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
public class ListaEnlazada {
|
||||
private Enlace lista;
|
||||
|
||||
public ListaEnlazada() {
|
||||
lista = null;
|
||||
}
|
||||
|
||||
public Enlace buscar(int llave) {
|
||||
if (this.lista != null) {
|
||||
// La lista no es vacia
|
||||
Enlace lista = this.lista;
|
||||
while (lista.getLlave() != llave) {
|
||||
// Buscar hasta la llave es encontraddo
|
||||
if (lista.getSiguente() != null) {
|
||||
// Buscar en la sigenute enlace
|
||||
lista = lista.getSiguente();
|
||||
}
|
||||
else {
|
||||
// No se encuentra
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// Se encontró
|
||||
return lista;
|
||||
}
|
||||
else {
|
||||
// La lista es vacia, nada para buscar
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean insertar(int llave, int valor) {
|
||||
if (buscar(llave) == null) {
|
||||
// Crear una enlace y agregarla a la lista
|
||||
Enlace nueva = new Enlace();
|
||||
nueva.setLlave(llave);
|
||||
nueva.setValor(valor);
|
||||
nueva.setSiguente(lista);
|
||||
lista = nueva;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// Se falló porque la llave ya existe
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean eliminar(int llave) {
|
||||
if (lista != null) {
|
||||
// La lista no es vacia
|
||||
Enlace lista = this.lista;
|
||||
Enlace previo = lista;
|
||||
while (lista.getLlave() != llave) {
|
||||
// Buscar hasta la llave es encontraddo
|
||||
if (lista.getSiguente() != null) {
|
||||
// Buscar en la sigenute enlace
|
||||
previo = lista;
|
||||
lista = lista.getSiguente();
|
||||
}
|
||||
else {
|
||||
// No se encuentra
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Se encontró
|
||||
if (lista == this.lista) {
|
||||
// Si es la primera enlace, cambiarla al siguente enlace
|
||||
this.lista = this.lista.getSiguente();
|
||||
}
|
||||
else {
|
||||
// Sino cortar esta enlace de la lista
|
||||
previo.setSiguente(lista.getSiguente());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// La lista es vacia, no hay nada para eliminar
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Estructura de enlaces
|
||||
public class Enlace {
|
||||
private int llave;
|
||||
private int valor;
|
||||
private Enlace siguente;
|
||||
|
||||
protected Enlace() {
|
||||
siguente = null;
|
||||
}
|
||||
|
||||
protected int getLlave() {
|
||||
return llave;
|
||||
}
|
||||
|
||||
protected void setLlave(int llave) {
|
||||
this.llave = llave;
|
||||
}
|
||||
|
||||
protected int getValor() {
|
||||
return valor;
|
||||
}
|
||||
|
||||
protected void setValor(int valor) {
|
||||
this.valor = valor;
|
||||
}
|
||||
|
||||
protected Enlace getSiguente() {
|
||||
return siguente;
|
||||
}
|
||||
|
||||
protected void setSiguente(Enlace siguente) {
|
||||
this.siguente = siguente;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
52
src/cl/cromer/estructuras/Logs.java
Normal file
52
src/cl/cromer/estructuras/Logs.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.FileHandler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.SimpleFormatter;
|
||||
|
||||
/**
|
||||
* Esta clase es para configurar el logeo de la aplicación.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class Logs {
|
||||
/**
|
||||
* Nombre de archivo para guardar los logs.
|
||||
*/
|
||||
static final public String LOGFILE = "./EDD.log";
|
||||
|
||||
/**
|
||||
* Nombre del log.
|
||||
*/
|
||||
static final public String LOGNAME = "EDD";
|
||||
|
||||
/**
|
||||
* Crear un logger usando {@value #LOGNAME}. Guardar los logs en el archivo de {@value #LOGFILE}. Pero solo logear si Main.DEBUG es vardad.
|
||||
*/
|
||||
public Logs() {
|
||||
if (Main.DEBUG) {
|
||||
Logger logger = Logger.getLogger(LOGNAME);
|
||||
try {
|
||||
FileHandler fileHandler = new FileHandler(LOGFILE, true);
|
||||
logger.addHandler(fileHandler);
|
||||
SimpleFormatter formatter = new SimpleFormatter();
|
||||
fileHandler.setFormatter(formatter);
|
||||
}
|
||||
catch (SecurityException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Agregar un log al logger.
|
||||
* @param level Level: El tipo de error o mensaje que ha sido generado.
|
||||
* @param mensaje String: El mensaje de lo que pasó.
|
||||
*/
|
||||
static public void log(Level level, String mensaje) {
|
||||
if (Main.DEBUG) {
|
||||
Logger.getLogger(LOGNAME).log(level, mensaje);
|
||||
}
|
||||
}
|
||||
}
|
66
src/cl/cromer/estructuras/Main.java
Normal file
66
src/cl/cromer/estructuras/Main.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Estructuras de Datos
|
||||
* Creado como proyecto semestral para la asignatura de estructuras de datos por la profesora Karina Rojas y el profesor Jorge Elgueta.
|
||||
* Creado en 2016-1
|
||||
* @author Chris Cromer
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Main extends Application {
|
||||
/**
|
||||
* Estado de depuración.
|
||||
*/
|
||||
static final public boolean DEBUG = false;
|
||||
|
||||
/**
|
||||
* Crear el stage y la scene para la aplicación grafica.
|
||||
* @param stage El primer stage donde va todas las cosas visuales.
|
||||
*/
|
||||
@Override
|
||||
public void start(Stage stage) {
|
||||
Locale locale = new Locale("es", "ES");
|
||||
ResourceBundle resourceBundle = ResourceBundle.getBundle("cl.cromer.estructuras.bundles.Idioma", locale);
|
||||
|
||||
try {
|
||||
Parent parent = FXMLLoader.load(getClass().getResource("/cl/cromer/estructuras/fxml/main.fxml"), ResourceBundle.getBundle("cl.cromer.estructuras.bundles.Idioma", locale));
|
||||
stage.setTitle(resourceBundle.getString("titulo"));
|
||||
Scene scene = new Scene(parent, 1024, 768);
|
||||
scene.getStylesheets().add("/cl/cromer/estructuras/css/style.css");
|
||||
stage.setScene(scene);
|
||||
}
|
||||
catch (IOException exception) {
|
||||
// Este error es fatal, hay que cerrar la aplicación.
|
||||
Logs.log(Level.SEVERE, "No se pudo abrir el archivo de fxml.");
|
||||
stage.close();
|
||||
}
|
||||
|
||||
//stage.setMaximized(true);
|
||||
stage.setMinHeight(640);
|
||||
stage.setMinWidth(768);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicilizar el logeo y lanzar la interfaz grafica.
|
||||
* @param args String[]: Argumentos desde la consola.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
if (DEBUG) {
|
||||
new Logs();
|
||||
}
|
||||
|
||||
launch(args);
|
||||
}
|
||||
}
|
288
src/cl/cromer/estructuras/MenuController.java
Normal file
288
src/cl/cromer/estructuras/MenuController.java
Normal file
@@ -0,0 +1,288 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Controlar las acciones cuando una opción es elegido en el menu.
|
||||
*/
|
||||
public class MenuController extends VBox implements Initializable {
|
||||
/**
|
||||
* La barra del menu.
|
||||
*/
|
||||
@FXML private MenuBar menuBar;
|
||||
|
||||
/**
|
||||
* Los idiomas.
|
||||
*/
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* Inicialicar el menu con el idioma.
|
||||
* @param location URL: Tiene URL de FXML en uso.
|
||||
* @param resourceBundle: Tiene los idiomas.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resourceBundle) {
|
||||
this.resourceBundle = resourceBundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Array Simple.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuArraySimple() {
|
||||
Array array = new Array(1);
|
||||
array.setOrdered(false);
|
||||
loadStage(
|
||||
resourceBundle.getString("tituloArraySimple"),
|
||||
"/cl/cromer/estructuras/fxml/array.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css",
|
||||
array
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Array Ordenado.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuArrayOrdenado() {
|
||||
Array array = new Array(1);
|
||||
array.setOrdered(true);
|
||||
loadStage(
|
||||
resourceBundle.getString("tituloArrayOrdenado"),
|
||||
"/cl/cromer/estructuras/fxml/array.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css",
|
||||
array
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Burbuja.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuBurbuja() {
|
||||
loadStage(
|
||||
resourceBundle.getString("tituloBurbuja"),
|
||||
"/cl/cromer/estructuras/fxml/burbuja.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Inserción.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuInsercion() {
|
||||
loadStage(
|
||||
resourceBundle.getString("tituloInsercion"),
|
||||
"/cl/cromer/estructuras/fxml/insercion.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Selecion.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuSeleccion() {
|
||||
loadStage(
|
||||
resourceBundle.getString("tituloSeleccion"),
|
||||
"/cl/cromer/estructuras/fxml/seleccion.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Selecion.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuShell() {
|
||||
loadStage(
|
||||
resourceBundle.getString("tituloShell"),
|
||||
"/cl/cromer/estructuras/fxml/shell.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Pila.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuPila() {
|
||||
loadStage(
|
||||
resourceBundle.getString("tituloPila"),
|
||||
"/cl/cromer/estructuras/fxml/pila.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Cola.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuCola() {
|
||||
loadStage(
|
||||
resourceBundle.getString("tituloCola"),
|
||||
"/cl/cromer/estructuras/fxml/cola.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Ingles.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuIngles() {
|
||||
ButtonType botonCambiar = new ButtonType(resourceBundle.getString("cambiar"), ButtonBar.ButtonData.OK_DONE);
|
||||
ButtonType botonCancelar = new ButtonType(resourceBundle.getString("cancelar"), ButtonBar.ButtonData.CANCEL_CLOSE);
|
||||
Dialog<ButtonType> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("cambiarIdioma"));
|
||||
dialog.setContentText(resourceBundle.getString("cambiarIdiomaMensaje"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCancelar);
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCambiar);
|
||||
dialog.getDialogPane().setPrefSize(400, 120);
|
||||
|
||||
Optional<ButtonType> result = dialog.showAndWait();
|
||||
if (result.isPresent() && result.get() == botonCambiar) {
|
||||
// Si hace click en cambiar, cambiar el idioma y reiniciar.
|
||||
Locale locale = new Locale("en", "EN");
|
||||
ResourceBundle resourceBundle = ResourceBundle.getBundle("cl.cromer.estructuras.bundles.Idioma", locale);
|
||||
|
||||
loadStage(
|
||||
"/cl/cromer/estructuras/fxml/main.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css",
|
||||
resourceBundle
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Español.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuEspanol() {
|
||||
ButtonType botonCambiar = new ButtonType(resourceBundle.getString("cambiar"), ButtonBar.ButtonData.OK_DONE);
|
||||
ButtonType botonCancelar = new ButtonType(resourceBundle.getString("cancelar"), ButtonBar.ButtonData.CANCEL_CLOSE);
|
||||
Dialog<ButtonType> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("cambiarIdioma"));
|
||||
dialog.setContentText(resourceBundle.getString("cambiarIdiomaMensaje"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCancelar);
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCambiar);
|
||||
dialog.getDialogPane().setPrefSize(400, 120);
|
||||
|
||||
Optional<ButtonType> result = dialog.showAndWait();
|
||||
if (result.isPresent() && result.get() == botonCambiar) {
|
||||
// Si hace click en cambiar, cambiar el idioma y reiniciar.
|
||||
Locale locale = new Locale("es", "ES");
|
||||
ResourceBundle resourceBundle = ResourceBundle.getBundle("cl.cromer.estructuras.bundles.Idioma", locale);
|
||||
|
||||
loadStage(
|
||||
"/cl/cromer/estructuras/fxml/main.fxml",
|
||||
"/cl/cromer/estructuras/css/style.css",
|
||||
resourceBundle
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Click en Acerca.
|
||||
*/
|
||||
@FXML
|
||||
protected void menuAcerca() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("acerca"));
|
||||
dialog.setContentText(resourceBundle.getString("credito"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cargar el fxml, css y titulo.
|
||||
* @param title String: El titulo de la escena.
|
||||
* @param fxml String: El archivo de fxml.
|
||||
* @param css String: El archivo de css.
|
||||
*/
|
||||
private void loadStage(String title, String fxml, String css) {
|
||||
Scene scene = menuBar.getScene();
|
||||
Stage stage = (Stage) scene.getWindow();
|
||||
|
||||
try {
|
||||
Parent parent = FXMLLoader.load(getClass().getResource(fxml), resourceBundle);
|
||||
scene.setRoot(parent);
|
||||
}
|
||||
catch (IOException exception) {
|
||||
// Este error es fatal, hay que cerrar la aplicación.
|
||||
Logs.log(Level.SEVERE, "No se pudo abrir el archivo de fxml.");
|
||||
stage.close();
|
||||
}
|
||||
|
||||
scene.getStylesheets().add(css);
|
||||
stage.setScene(scene);
|
||||
stage.setTitle(resourceBundle.getString("titulo") + " - " + title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cargar el fxml y css.
|
||||
* @param fxml String: El archivo de fxml.
|
||||
* @param css String: El archivo de css.
|
||||
*/
|
||||
private void loadStage(String fxml, String css, ResourceBundle resourceBundle) {
|
||||
Scene scene = menuBar.getScene();
|
||||
Stage stage = (Stage) scene.getWindow();
|
||||
|
||||
try {
|
||||
Parent parent = FXMLLoader.load(getClass().getResource(fxml), resourceBundle);
|
||||
scene.setRoot(parent);
|
||||
}
|
||||
catch (IOException exception) {
|
||||
// Este error es fatal, hay que cerrar la aplicación.
|
||||
Logs.log(Level.SEVERE, "No se pudo abrir el archivo de fxml.");
|
||||
stage.close();
|
||||
}
|
||||
|
||||
scene.getStylesheets().add(css);
|
||||
stage.setScene(scene);
|
||||
stage.setTitle(resourceBundle.getString("titulo"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Cargar el fxml, css y titulo.
|
||||
* @param title String: El titulo de la escena.
|
||||
* @param fxml String: El archivo de fxml.
|
||||
* @param css String: El archivo de css.
|
||||
*/
|
||||
private void loadStage(String title, String fxml, String css, Object object) {
|
||||
Scene scene = menuBar.getScene();
|
||||
Stage stage = (Stage) scene.getWindow();
|
||||
|
||||
try {
|
||||
Parent parent = FXMLLoader.load(getClass().getResource(fxml), resourceBundle);
|
||||
scene.setRoot(parent);
|
||||
}
|
||||
catch (IOException exception) {
|
||||
// Este error es fatal, hay que cerrar la aplicación.
|
||||
Logs.log(Level.SEVERE, "No se pudo abrir el archivo de fxml.");
|
||||
stage.close();
|
||||
}
|
||||
|
||||
scene.getStylesheets().add(css);
|
||||
scene.setUserData(object);
|
||||
stage.setScene(scene);
|
||||
stage.setTitle(resourceBundle.getString("titulo") + " - " + title);
|
||||
}
|
||||
}
|
100
src/cl/cromer/estructuras/Pila.java
Normal file
100
src/cl/cromer/estructuras/Pila.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
/**
|
||||
* Crear una estructura de dato de tipo pila.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class Pila {
|
||||
/**
|
||||
* La pila.
|
||||
*/
|
||||
private String pila[];
|
||||
|
||||
/**
|
||||
* La cantidad de elementos en la pila.
|
||||
*/
|
||||
private int size;
|
||||
|
||||
/**
|
||||
* Inicializar.
|
||||
*/
|
||||
public Pila() {
|
||||
pila = null;
|
||||
size = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver la cantidad de elementos en la pila.
|
||||
* @return int: La cantidad de elementos.
|
||||
*/
|
||||
public int size() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push un valor en la pila encima.
|
||||
* @param valor int: El valor a push.
|
||||
*/
|
||||
public void push(int valor) {
|
||||
if (this.pila != null) {
|
||||
String pila[] = new String[this.pila.length + 1];
|
||||
int i;
|
||||
for (i = 0; i < this.pila.length; i++) {
|
||||
pila[i] = this.pila[i];
|
||||
}
|
||||
pila[i] = String.valueOf(valor);
|
||||
this.pila = pila;
|
||||
size++;
|
||||
}
|
||||
else {
|
||||
String pila[] = new String[1];
|
||||
pila[0] = String.valueOf(valor);
|
||||
this.pila = pila;
|
||||
size++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop un valor de encima de la pila.
|
||||
* @return boolean: Verdad si fue exitoso.
|
||||
*/
|
||||
public boolean pop() {
|
||||
if (this.pila != null && size() > 0) {
|
||||
String pila[] = new String[this.pila.length -1];
|
||||
System.arraycopy(this.pila, 0, pila, 0, pila.length);
|
||||
this.pila = pila;
|
||||
size--;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek al valor que está encima de la pila.
|
||||
* @return int: El valor que está encima de la pila.
|
||||
*/
|
||||
public int peek() {
|
||||
if (pila != null && size() > 0) {
|
||||
return Integer.valueOf(pila[pila.length -1]);
|
||||
}
|
||||
else {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver el valor que está en un indice de la pila.
|
||||
* @param indice int: El indice que desea devolver.
|
||||
* @return String: El valor que está guardado en el indice.
|
||||
*/
|
||||
public String getIndice(int indice) {
|
||||
if (indice >= 0 && indice < pila.length) {
|
||||
return pila[indice];
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
236
src/cl/cromer/estructuras/PilaController.java
Normal file
236
src/cl/cromer/estructuras/PilaController.java
Normal file
@@ -0,0 +1,236 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ButtonBar;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Dialog;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Scanner;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Esta clase es para controlar todos la interfaz de Pila.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class PilaController implements Initializable {
|
||||
/**
|
||||
* La caja para ingresar textos.
|
||||
*/
|
||||
@FXML private TextFieldLimited valorPila;
|
||||
|
||||
/**
|
||||
* Donde poner el contenido de array.
|
||||
*/
|
||||
@FXML private VBox contenidoPila;
|
||||
|
||||
/**
|
||||
* Donde va el codigo a mostrar a la pantalla.
|
||||
*/
|
||||
@FXML private Text codigoPila;
|
||||
|
||||
/**
|
||||
* La escena donde está cosas graficas.
|
||||
*/
|
||||
private Scene scene;
|
||||
|
||||
/**
|
||||
* Donde está guardado los idiomas.
|
||||
*/
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* La pila usado en la aplicación.
|
||||
*/
|
||||
private Pila pila;
|
||||
|
||||
/**
|
||||
* Grafico rectangulos.
|
||||
*/
|
||||
private Grafico grafico;
|
||||
|
||||
/**
|
||||
* Inicializar todos los datos y dibujar las graficas.
|
||||
* @param location URL: El URL de fxml en uso.
|
||||
* @param resourceBundle ResourceBundle: Tiene datos de idioma.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resourceBundle) {
|
||||
this.resourceBundle = resourceBundle;
|
||||
|
||||
pila = new Pila();
|
||||
|
||||
scene = null;
|
||||
Colores colores = new Colores();
|
||||
|
||||
for (int i = 9; i >= 0; i--) {
|
||||
contenidoPila.getChildren().addAll(Grafico.crearCaja(colores, String.valueOf(i)));
|
||||
colores.siguinteColor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Llenar la pila con numeros al azar.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonLlenar() {
|
||||
if (scene == null) {
|
||||
scene = contenidoPila.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
for (int i = pila.size(); i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
pila.push(numero);
|
||||
}
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Vaciar la pila de todos los valores.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonVaciar() {
|
||||
if (scene == null) {
|
||||
scene = contenidoPila.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
pila = new Pila();
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Push un valor a la pila y mostrar el codigo en la pantalla.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPush() {
|
||||
if (scene == null) {
|
||||
scene = contenidoPila.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/pila/push")).useDelimiter("\\Z").next();
|
||||
codigoPila.setText(codigoTexto);
|
||||
|
||||
if (valorPila.getText() != null && !valorPila.getText().trim().equals("")) {
|
||||
try {
|
||||
if (pila.size() < 10) {
|
||||
pila.push(Integer.valueOf(valorPila.getText()));
|
||||
generarGrafico();
|
||||
}
|
||||
else {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("pilaLlena"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException exception) {
|
||||
// El error no es fatal, sigue
|
||||
Logs.log(Level.WARNING, "No es tipo int.");
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
else {
|
||||
errorNoValor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop un valor de la pila si existe y mostrar el codigo en la pantalla.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPop() {
|
||||
if (scene == null) {
|
||||
scene = contenidoPila.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/pila/pop")).useDelimiter("\\Z").next();
|
||||
codigoPila.setText(codigoTexto);
|
||||
|
||||
if (pila.size() > 0) {
|
||||
pila.pop();
|
||||
generarGrafico();
|
||||
}
|
||||
else {
|
||||
errorVacia();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Peek a ver si existe un elemento en la pila y mostrar el codigo en la pantalla
|
||||
* Si existe un valor destacarlo.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPeek() {
|
||||
if (scene == null) {
|
||||
scene = contenidoPila.getScene();
|
||||
grafico = new Grafico(scene);
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/pila/peek")).useDelimiter("\\Z").next();
|
||||
codigoPila.setText(codigoTexto);
|
||||
|
||||
int encontrado = pila.peek();
|
||||
if (encontrado != Integer.MIN_VALUE) {
|
||||
generarGrafico();
|
||||
grafico.destacer(pila.size() - 1, "rectangulo");
|
||||
}
|
||||
else {
|
||||
errorVacia();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Se muestra un error si la persona no ingresa un valor en el TextField.
|
||||
*/
|
||||
private void errorNoValor() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("pilaNoValor"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Error cuando la pila está vacía.
|
||||
*/
|
||||
private void errorVacia() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("pilaVacia"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Poner los valores en el grafico.
|
||||
*/
|
||||
private void generarGrafico() {
|
||||
grafico.removerDestacar();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Text text = (Text) scene.lookup("#caja_" + String.valueOf(i));
|
||||
text.setText(pila.getIndice(i));
|
||||
}
|
||||
}
|
||||
}
|
174
src/cl/cromer/estructuras/SeleccionController.java
Normal file
174
src/cl/cromer/estructuras/SeleccionController.java
Normal file
@@ -0,0 +1,174 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ButtonBar;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Dialog;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Esta clase es para controlar todos la interfaz de Selección.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class SeleccionController implements Initializable {
|
||||
/**
|
||||
* Donde poner el contenido de array.
|
||||
*/
|
||||
@FXML private HBox contenidoSeleccion;
|
||||
|
||||
/**
|
||||
* Donde va el codigo a mostrar a la pantalla.
|
||||
*/
|
||||
@FXML private Text codigoSeleccion;
|
||||
|
||||
/**
|
||||
* La escena donde está cosas graficas.
|
||||
*/
|
||||
private Scene scene;
|
||||
|
||||
/**
|
||||
* Donde está guardado los idiomas.
|
||||
*/
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* El array usado en la aplicación.
|
||||
*/
|
||||
private Array array;
|
||||
|
||||
/**
|
||||
* Inicializar todos los datos y dibujar las graficas.
|
||||
* @param location URL: El URL de fxml en uso.
|
||||
* @param resourceBundle ResourceBundle: Tiene datos de idioma.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resourceBundle) {
|
||||
this.resourceBundle = resourceBundle;
|
||||
|
||||
scene = null;
|
||||
|
||||
Colores colores = new Colores();
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
array = new Array(10);
|
||||
array.setOrdered(true);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
while (array.buscar(numero) != -1) {
|
||||
numero = random.nextInt(rango) + minimo;
|
||||
}
|
||||
array.insertar(numero);
|
||||
contenidoSeleccion.getChildren().addAll(Grafico.crearCaja(colores, String.valueOf(i), String.valueOf(numero)));
|
||||
colores.siguinteColor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear un array nuevo.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonNuevo() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
array = new Array(10);
|
||||
array.setOrdered(true);
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
for (int i = array.size(); i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
while (array.buscar(numero) != -1) {
|
||||
numero = random.nextInt(rango) + minimo;
|
||||
}
|
||||
array.insertar(numero);
|
||||
}
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenarlo paso por paso.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPaso() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/seleccion/ordenar")).useDelimiter("\\Z").next();
|
||||
codigoSeleccion.setText(codigoTexto);
|
||||
|
||||
if (!array.seleccion(true)) {
|
||||
errorYaOrdenado();
|
||||
}
|
||||
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenarlo completamente.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonCorrer() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/seleccion/ordenar")).useDelimiter("\\Z").next();
|
||||
codigoSeleccion.setText(codigoTexto);
|
||||
|
||||
if (!array.seleccion(false)) {
|
||||
errorYaOrdenado();
|
||||
}
|
||||
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Se muestra un error si el array ya está ordenado.
|
||||
*/
|
||||
private void errorYaOrdenado() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("seleccionYaOrdenado"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear el array de temaño 10.
|
||||
*/
|
||||
private void initializeScene() {
|
||||
scene = contenidoSeleccion.getScene();
|
||||
}
|
||||
|
||||
/**
|
||||
* Poner los valores en el grafico.
|
||||
*/
|
||||
private void generarGrafico() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Text text = (Text) scene.lookup("#caja_" + String.valueOf(i));
|
||||
text.setText(array.getIndice(i));
|
||||
}
|
||||
}
|
||||
}
|
174
src/cl/cromer/estructuras/ShellController.java
Normal file
174
src/cl/cromer/estructuras/ShellController.java
Normal file
@@ -0,0 +1,174 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ButtonBar;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Dialog;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* Esta clase es para controlar todos la interfaz de Shell.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class ShellController implements Initializable {
|
||||
/**
|
||||
* Donde poner el contenido de array.
|
||||
*/
|
||||
@FXML private HBox contenidoSeleccion;
|
||||
|
||||
/**
|
||||
* Donde va el codigo a mostrar a la pantalla.
|
||||
*/
|
||||
@FXML private Text codigoSeleccion;
|
||||
|
||||
/**
|
||||
* La escena donde está cosas graficas.
|
||||
*/
|
||||
private Scene scene;
|
||||
|
||||
/**
|
||||
* Donde está guardado los idiomas.
|
||||
*/
|
||||
private ResourceBundle resourceBundle;
|
||||
|
||||
/**
|
||||
* El array usado en la aplicación.
|
||||
*/
|
||||
private Array array;
|
||||
|
||||
/**
|
||||
* Inicializar todos los datos y dibujar las graficas.
|
||||
* @param location URL: El URL de fxml en uso.
|
||||
* @param resourceBundle ResourceBundle: Tiene datos de idioma.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resourceBundle) {
|
||||
this.resourceBundle = resourceBundle;
|
||||
|
||||
scene = null;
|
||||
|
||||
Colores colores = new Colores();
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
array = new Array(10);
|
||||
array.setOrdered(true);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
while (array.buscar(numero) != -1) {
|
||||
numero = random.nextInt(rango) + minimo;
|
||||
}
|
||||
array.insertar(numero);
|
||||
contenidoSeleccion.getChildren().addAll(Grafico.crearCaja(colores, String.valueOf(i), String.valueOf(numero)));
|
||||
colores.siguinteColor();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear un array nuevo.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonNuevo() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
array = new Array(10);
|
||||
array.setOrdered(true);
|
||||
|
||||
Random random = new Random();
|
||||
int maximo = 99;
|
||||
int minimo = 0;
|
||||
int rango = maximo - minimo + 1;
|
||||
|
||||
for (int i = array.size(); i < 10; i++) {
|
||||
int numero = random.nextInt(rango) + minimo;
|
||||
while (array.buscar(numero) != -1) {
|
||||
numero = random.nextInt(rango) + minimo;
|
||||
}
|
||||
array.insertar(numero);
|
||||
}
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenarlo paso por paso.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonPaso() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/seleccion/ordenar")).useDelimiter("\\Z").next();
|
||||
codigoSeleccion.setText(codigoTexto);
|
||||
|
||||
if (!array.seleccion(true)) {
|
||||
errorYaOrdenado();
|
||||
}
|
||||
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ordenarlo completamente.
|
||||
*/
|
||||
@FXML
|
||||
protected void botonCorrer() {
|
||||
if (scene == null) {
|
||||
initializeScene();
|
||||
}
|
||||
|
||||
// Mostrar el codigo
|
||||
String codigoTexto = new Scanner(getClass().getResourceAsStream("/cl/cromer/estructuras/code/seleccion/ordenar")).useDelimiter("\\Z").next();
|
||||
codigoSeleccion.setText(codigoTexto);
|
||||
|
||||
if (!array.seleccion(false)) {
|
||||
errorYaOrdenado();
|
||||
}
|
||||
|
||||
generarGrafico();
|
||||
}
|
||||
|
||||
/**
|
||||
* Se muestra un error si el array ya está ordenado.
|
||||
*/
|
||||
private void errorYaOrdenado() {
|
||||
ButtonType botonCerrar = new ButtonType(resourceBundle.getString("cerrar"), ButtonBar.ButtonData.OK_DONE);
|
||||
Dialog<String> dialog = new Dialog<>();
|
||||
dialog.setTitle(resourceBundle.getString("error"));
|
||||
dialog.setContentText(resourceBundle.getString("seleccionYaOrdenado"));
|
||||
dialog.getDialogPane().getButtonTypes().add(botonCerrar);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crear el array de temaño 10.
|
||||
*/
|
||||
private void initializeScene() {
|
||||
scene = contenidoSeleccion.getScene();
|
||||
}
|
||||
|
||||
/**
|
||||
* Poner los valores en el grafico.
|
||||
*/
|
||||
private void generarGrafico() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Text text = (Text) scene.lookup("#caja_" + String.valueOf(i));
|
||||
text.setText(array.getIndice(i));
|
||||
}
|
||||
}
|
||||
}
|
155
src/cl/cromer/estructuras/TextFieldLimited.java
Normal file
155
src/cl/cromer/estructuras/TextFieldLimited.java
Normal file
@@ -0,0 +1,155 @@
|
||||
package cl.cromer.estructuras;
|
||||
|
||||
import com.sun.javafx.css.converters.SizeConverter;
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.css.CssMetaData;
|
||||
import javafx.css.Styleable;
|
||||
import javafx.css.StyleableIntegerProperty;
|
||||
import javafx.css.StyleableProperty;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.shape.Shape;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Crear un TextField especial que tiene un maximo de digitos que puede ingresar. Se extiene a TextField.
|
||||
* @author Chris Cromer
|
||||
*/
|
||||
public class TextFieldLimited extends TextField {
|
||||
/**
|
||||
* La cantidad maxima de caracters permitidas en el TextFieldLimited
|
||||
*/
|
||||
private IntegerProperty maxLength;
|
||||
|
||||
/**
|
||||
* Llamar a TextField.
|
||||
*/
|
||||
public TextFieldLimited() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reemplazar el texto basado en cambios de teclado, no deja ingresar mas text si length es mayor al maximo.
|
||||
* @param start int: Donde empece el cambio.
|
||||
* @param end int: Donde termina.
|
||||
* @param text String: Texto a cambiar.
|
||||
*/
|
||||
@Override
|
||||
public void replaceText(int start, int end, String text) {
|
||||
if (getMaxLength() != 0) {
|
||||
if (text.equals("")) {
|
||||
super.replaceText(start, end, text);
|
||||
}
|
||||
else if (getText().length() < getMaxLength()) {
|
||||
super.replaceText(start, end, text);
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.replaceText(start, end, text);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reemplazar un selección de texto.
|
||||
* @param text String: El texto a reemplazar.
|
||||
*/
|
||||
@Override
|
||||
public void replaceSelection(String text) {
|
||||
if (getMaxLength() != 0) {
|
||||
if (text.equals("")) {
|
||||
super.replaceSelection(text);
|
||||
}
|
||||
else if (getText().length() < getMaxLength()) {
|
||||
if (text.length() > getMaxLength() - getText().length()) {
|
||||
text = text.substring(0, getMaxLength() - getText().length());
|
||||
}
|
||||
super.replaceSelection(text);
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.replaceSelection(text);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asignar un valor maximo de caracters permitidio en el TextFieldLimited.
|
||||
* @param value int: La cantidad maxima.
|
||||
*/
|
||||
public final void setMaxLength(int value) {
|
||||
if (maxLength != null || value > 0) {
|
||||
maxLengthProperty().set(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver la cantidad maxima si está asignado.
|
||||
* @return int: Cantidad de caracters.
|
||||
*/
|
||||
public final int getMaxLength() {
|
||||
return maxLength == null ? 0 : maxLength.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* JavaFX FXML field property por tamaño maximo
|
||||
* @return IntegerProperty: Property.
|
||||
*/
|
||||
public final IntegerProperty maxLengthProperty() {
|
||||
if (maxLength == null) {
|
||||
maxLength = new StyleableIntegerProperty() {
|
||||
|
||||
@Override
|
||||
public CssMetaData<TextFieldLimited, Number> getCssMetaData() {
|
||||
return TextFieldLimited.StyleableProperties.MAX_LENGTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean() {
|
||||
return TextFieldLimited.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "maxLength";
|
||||
}
|
||||
};
|
||||
}
|
||||
return maxLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* CSS por FXML con un maximo tamaño
|
||||
*/
|
||||
private static class StyleableProperties {
|
||||
private static final CssMetaData<TextFieldLimited,Number> MAX_LENGTH =
|
||||
new CssMetaData<TextFieldLimited,Number>("-fx-max-length", SizeConverter.getInstance(), 0) {
|
||||
@Override
|
||||
public boolean isSettable(TextFieldLimited node) {
|
||||
return node.maxLength == null || !node.maxLength.isBound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StyleableProperty<Number> getStyleableProperty(TextFieldLimited node) {
|
||||
return (StyleableProperty<Number>) node.maxLengthProperty();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES;
|
||||
|
||||
static {
|
||||
final List<CssMetaData<? extends Styleable, ?>> styleables = new ArrayList<>(Shape.getClassCssMetaData());
|
||||
styleables.add(MAX_LENGTH);
|
||||
STYLEABLES = Collections.unmodifiableList(styleables);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lista de estilos aplicable.
|
||||
* @return List: La lista de estilos.
|
||||
*/
|
||||
public static List<CssMetaData<? extends Styleable, ?>> getClassCssMetaData() {
|
||||
return TextFieldLimited.StyleableProperties.STYLEABLES;
|
||||
}
|
||||
}
|
86
src/cl/cromer/estructuras/bundles/Idioma_en.properties
Normal file
86
src/cl/cromer/estructuras/bundles/Idioma_en.properties
Normal file
@@ -0,0 +1,86 @@
|
||||
titulo=Data Structures
|
||||
tituloArraySimple=Simple Array
|
||||
tituloArrayOrdenado=Ordered Array
|
||||
tituloPila=Stack
|
||||
tituloCola=Queue
|
||||
tituloBurbuja=Bubble
|
||||
tituloInsercion=Insertion
|
||||
tituloSeleccion=Selection
|
||||
tituloShell=Shell
|
||||
|
||||
estructuras=Structures
|
||||
array=Array
|
||||
arraySimple=Simple
|
||||
arrayOrdenado=Ordered
|
||||
ordenamiento=Sort
|
||||
burbuja=Bubble
|
||||
insercion=Insertion
|
||||
seleccion=Selection
|
||||
shell=Shell
|
||||
listaEnlazada=Linked List
|
||||
listaSimple=Simple
|
||||
listaCircular=Circular
|
||||
doblementeEnlazada=Double Linked
|
||||
pila=Stack
|
||||
cola=Queue
|
||||
arboles=Tree
|
||||
general=General
|
||||
binario=Binary
|
||||
busquedaBinario=Binary Search
|
||||
AVL=AVL
|
||||
rojoNegro=Red-Black
|
||||
bTree=B-Tree
|
||||
grafos=Graphs
|
||||
dirigidos=Directed
|
||||
noDirigidos=Undirected
|
||||
tablaHash=Hash Table
|
||||
|
||||
idioma=Language
|
||||
ingles=English
|
||||
espanol=Spanish
|
||||
|
||||
cambiarIdioma=Change Language
|
||||
cambiarIdiomaMensaje=To change the language the program must be restarted.\n\nAre you sure you wish the restart?
|
||||
|
||||
ayuda=Help
|
||||
acerca=About
|
||||
|
||||
credito=Made by Christopher Cromer(chris@cromer.cl)\nCivil Engineering in Computer Science\nUniversity of the B\u00EDo B\u00EDo
|
||||
|
||||
cambiar=Change
|
||||
cancelar=Cancel
|
||||
cerrar=Close
|
||||
error=Error
|
||||
|
||||
llenar=Fill
|
||||
vaciar=Empty
|
||||
insertar=Insert
|
||||
eliminar=Delete
|
||||
buscar=Search
|
||||
push=Push
|
||||
pop=Pop
|
||||
peek=Peek
|
||||
nuevo=New
|
||||
paso=Step
|
||||
correr=Run
|
||||
|
||||
arrayLleno=Value not inserted because array is full.
|
||||
arrayValorExiste=Value already exists.
|
||||
arrayNoEsta=Value does not exist.
|
||||
arrayNoValor=Please input a numeric value.
|
||||
|
||||
burbujaYaOrdenado=The array is already sorted.
|
||||
|
||||
insercionYaOrdenado=The array is already sorted.
|
||||
|
||||
seleccionYaOrdenado=The array is already sorted.
|
||||
|
||||
shellYaOrdenado=The array is already sorted.
|
||||
|
||||
pilaLlena=Value not inserted because the stack is full.
|
||||
pilaVacia=The stack is empty.
|
||||
pilaNoValor=Please input a numeric value.
|
||||
|
||||
colaLlena=Value not inserted because the queue is full.
|
||||
colaVacia=The queue is empty.
|
||||
colaNoValor=Please input a numeric value.
|
86
src/cl/cromer/estructuras/bundles/Idioma_es.properties
Normal file
86
src/cl/cromer/estructuras/bundles/Idioma_es.properties
Normal file
@@ -0,0 +1,86 @@
|
||||
titulo=Estructuras de Datos
|
||||
tituloArraySimple=Array Simple
|
||||
tituloArrayOrdenado=Array Ordenado
|
||||
tituloPila=Pila
|
||||
tituloCola=Cola
|
||||
tituloBurbuja=Burbuja
|
||||
tituloInsercion=Inserci\u00F3n
|
||||
tituloSeleccion=Selecci\u00F3n
|
||||
tutuloShell=Shell
|
||||
|
||||
estructuras=Estructuras
|
||||
array=Array
|
||||
arraySimple=Simple
|
||||
arrayOrdenado=Ordenado
|
||||
ordenamiento=Ordenamiento
|
||||
burbuja=Burbuja
|
||||
insercion=Inserci\u00F3n
|
||||
seleccion=Seleci\u00F3n
|
||||
shell=Shell
|
||||
listaEnlazada=Lista Enlazada
|
||||
listaSimple=Simple
|
||||
listaCircular=Circular
|
||||
doblementeEnlazada=Doblemente Enlazada
|
||||
pila=Pila
|
||||
cola=Cola
|
||||
arboles=Arbol
|
||||
general=General
|
||||
binario=Binario
|
||||
busquedaBinario=Busqueda Binaria
|
||||
AVL=AVL
|
||||
rojoNegro=Rojo-Negro
|
||||
bTree=B-Tree
|
||||
grafos=Grafo
|
||||
dirigidos=Dirigido
|
||||
noDirigidos=No Dirigido
|
||||
tablaHash=Tabla Hash
|
||||
|
||||
idioma=Idioma
|
||||
ingles=Ingl\u00E9s
|
||||
espanol=Espa\u00F1ol
|
||||
|
||||
cambiarIdioma=Cambiar Idioma
|
||||
cambiarIdiomaMensaje=Para cambiar el idioma el programa debe reiniciarse.\n\nUsted est\u00E1 seguro que desea reiniciar?
|
||||
|
||||
ayuda=Ayuda
|
||||
acerca=Acerca
|
||||
|
||||
credito=Construido por Christopher Cromer\nIngenier\u00EDa Civil en Inform\u00E1tica\nUniversidad del B\u00EDo B\u00EDo
|
||||
|
||||
cambiar=Cambiar
|
||||
cancelar=Cancelar
|
||||
cerrar=Cerrar
|
||||
error=Error
|
||||
|
||||
vaciar=Vaciar
|
||||
llenar=Llenar
|
||||
insertar=Insertar
|
||||
eliminar=Eliminar
|
||||
buscar=Buscar
|
||||
push=Push
|
||||
pop=Pop
|
||||
peek=Peek
|
||||
nuevo=Nuevo
|
||||
paso=Paso
|
||||
correr=Correr
|
||||
|
||||
arrayLleno=Valor no fue insertado porque el array est\u00E1 lleno.
|
||||
arrayValorExiste=El valor ya existe.
|
||||
arrayNoEsta=El valor no existe.
|
||||
arrayNoValor=Ingresar un valor num\u00E9rico por favor.
|
||||
|
||||
burbujaYaOrdenado=El array ya est\u00E1 ordenado.
|
||||
|
||||
insercionYaOrdenado=El array ya est\u00E1 ordenado.
|
||||
|
||||
seleccionYaOrdenado=El array ya est\u00E1 ordenado.
|
||||
|
||||
shellYaOrdenado=El array ya est\u00E1 ordenado.
|
||||
|
||||
pilaLlena=Valor no fue insertado porque la pila est\u00E1 llena.
|
||||
pilaVacia=La pila est\u00E1 vac\u00EDa.
|
||||
pilaNoValor=Ingresar un valor num\u00E9rico por favor.
|
||||
|
||||
colaLlena=Valor no fue insertado porque la cola est\u00E1 llena.
|
||||
colaVacia=La cola est\u00E1 vac\u00EDa.
|
||||
colaNoValor=Ingresar un valor num\u00E9rico por favor.
|
10
src/cl/cromer/estructuras/code/arrayOrdenado/buscar
Normal file
10
src/cl/cromer/estructuras/code/arrayOrdenado/buscar
Normal file
@@ -0,0 +1,10 @@
|
||||
public int buscar(int valor) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] != 0 && array[i] == valor) {
|
||||
// Se encontró
|
||||
return i;
|
||||
}
|
||||
}
|
||||
// No se encontró
|
||||
return -1;
|
||||
}
|
18
src/cl/cromer/estructuras/code/arrayOrdenado/eliminar
Normal file
18
src/cl/cromer/estructuras/code/arrayOrdenado/eliminar
Normal file
@@ -0,0 +1,18 @@
|
||||
public boolean eliminar(int valor) {
|
||||
boolean borrado = false;
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] != 0 && array[i] == valor) {
|
||||
// Eliminar el valor
|
||||
array[i] = 0;
|
||||
borrado=true;
|
||||
for (int j = i; j < array.length; j++) {
|
||||
if (j != array.length - 1) {
|
||||
// Correr la array hacia arriba
|
||||
array[j] = array[j + 1];
|
||||
}
|
||||
}
|
||||
array[array.length-1] = 0;
|
||||
}
|
||||
}
|
||||
return borrado;
|
||||
}
|
13
src/cl/cromer/estructuras/code/arrayOrdenado/insertar
Normal file
13
src/cl/cromer/estructuras/code/arrayOrdenado/insertar
Normal file
@@ -0,0 +1,13 @@
|
||||
public boolean insertar(int valor) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] == 0) {
|
||||
array[i] = valor;
|
||||
return true;
|
||||
}
|
||||
else if (array[i] == valor) {
|
||||
// Ya existe el valor en el array
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
10
src/cl/cromer/estructuras/code/arraySimple/buscar
Normal file
10
src/cl/cromer/estructuras/code/arraySimple/buscar
Normal file
@@ -0,0 +1,10 @@
|
||||
public int buscar(int valor) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] != 0 && array[i] == valor) {
|
||||
// Se encontró
|
||||
return i;
|
||||
}
|
||||
}
|
||||
// No se encontró
|
||||
return -1;
|
||||
}
|
12
src/cl/cromer/estructuras/code/arraySimple/eliminar
Normal file
12
src/cl/cromer/estructuras/code/arraySimple/eliminar
Normal file
@@ -0,0 +1,12 @@
|
||||
public boolean eliminar(int valor) {
|
||||
boolean borrado = false;
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] != 0 && array[i] == valor) {
|
||||
// Eliminar el valor
|
||||
array[i] = 0;
|
||||
borrado=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return borrado;
|
||||
}
|
13
src/cl/cromer/estructuras/code/arraySimple/insertar
Normal file
13
src/cl/cromer/estructuras/code/arraySimple/insertar
Normal file
@@ -0,0 +1,13 @@
|
||||
public boolean insertar(int valor) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i] == 0) {
|
||||
array[i] = valor;
|
||||
return true;
|
||||
}
|
||||
else if (array[i] == valor) {
|
||||
// Ya existe el valor en el array
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
13
src/cl/cromer/estructuras/code/burbuja/ordenar
Normal file
13
src/cl/cromer/estructuras/code/burbuja/ordenar
Normal file
@@ -0,0 +1,13 @@
|
||||
public void burbuja() {
|
||||
for (int i = elementos - 1; i > 1; i--) {
|
||||
for(j = 0; in < i; j++) {
|
||||
// Si están fuera del orden
|
||||
if (array[j] > array[j+1]) {
|
||||
// Intercambiar valores
|
||||
int temp = array[j];
|
||||
array[j] = array[j+1];
|
||||
array[j+1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
4
src/cl/cromer/estructuras/code/cola/peek
Normal file
4
src/cl/cromer/estructuras/code/cola/peek
Normal file
@@ -0,0 +1,4 @@
|
||||
public int peek() {
|
||||
// Devolver el valor en el primer indice
|
||||
return this.pila[primer];
|
||||
}
|
6
src/cl/cromer/estructuras/code/cola/pop
Normal file
6
src/cl/cromer/estructuras/code/cola/pop
Normal file
@@ -0,0 +1,6 @@
|
||||
public void pop() {
|
||||
// Borrar el valor que está al prinicipio.
|
||||
this.pila[primer] = 0;
|
||||
// Cambiar el primer nivel de la cola.
|
||||
primer++;
|
||||
}
|
6
src/cl/cromer/estructuras/code/cola/push
Normal file
6
src/cl/cromer/estructuras/code/cola/push
Normal file
@@ -0,0 +1,6 @@
|
||||
public void push(int valor) {
|
||||
// Sumar el final.
|
||||
final++;
|
||||
// Insertar el valor
|
||||
this.pila[final] = valor;
|
||||
}
|
14
src/cl/cromer/estructuras/code/insercion/ordenar
Normal file
14
src/cl/cromer/estructuras/code/insercion/ordenar
Normal file
@@ -0,0 +1,14 @@
|
||||
public void insercion() {
|
||||
for (int i = 1; i < elementos; i++) {
|
||||
// Guardar el elemento en un variable temporario.
|
||||
int temp = array[i];
|
||||
int j = i;
|
||||
// Mover los valores hasta que hay una mas pequeño.
|
||||
while (j > 0 && array[j-1] >= temp) {
|
||||
array[j] = array[j-1];
|
||||
--j;
|
||||
}
|
||||
// Poner el valor temporario despues de los valores mas pequeños.
|
||||
array[j] = temp;
|
||||
}
|
||||
}
|
4
src/cl/cromer/estructuras/code/pila/peek
Normal file
4
src/cl/cromer/estructuras/code/pila/peek
Normal file
@@ -0,0 +1,4 @@
|
||||
public int peek() {
|
||||
// Devolver el valor encima
|
||||
return this.pila[encima];
|
||||
}
|
6
src/cl/cromer/estructuras/code/pila/pop
Normal file
6
src/cl/cromer/estructuras/code/pila/pop
Normal file
@@ -0,0 +1,6 @@
|
||||
public void pop() {
|
||||
// Borrar el valor que está encima.
|
||||
this.pila[encima] = 0;
|
||||
// Restar el nivel de la pila.
|
||||
encima--;
|
||||
}
|
6
src/cl/cromer/estructuras/code/pila/push
Normal file
6
src/cl/cromer/estructuras/code/pila/push
Normal file
@@ -0,0 +1,6 @@
|
||||
public void push(int valor) {
|
||||
// Sumar el nivel de la pila
|
||||
encima++;
|
||||
// Insertar el valor
|
||||
this.pila[encima] = valor;
|
||||
}
|
13
src/cl/cromer/estructuras/code/seleccion/ordenar
Normal file
13
src/cl/cromer/estructuras/code/seleccion/ordenar
Normal file
@@ -0,0 +1,13 @@
|
||||
public void seleccion() {
|
||||
for (int i = 0; i < elementos - 1; i++) {
|
||||
int minimo = i;
|
||||
for (int j = i + 1; j < elementos; j++) {
|
||||
if (array[j] < array[minimo]) {
|
||||
minimo = j;
|
||||
}
|
||||
}
|
||||
int temp = array[i];
|
||||
array[i] = array[minimo];
|
||||
array[minimo] = temp;
|
||||
}
|
||||
}
|
21
src/cl/cromer/estructuras/css/style.css
Normal file
21
src/cl/cromer/estructuras/css/style.css
Normal file
@@ -0,0 +1,21 @@
|
||||
.text {
|
||||
-fx-font-family: "Arial";
|
||||
-fx-font-size: 14;
|
||||
}
|
||||
|
||||
.menu-bar {
|
||||
-fx-background-color: #aeb5ba, linear-gradient(to bottom, #ecf4fa 0%, #ced4d9 100%);
|
||||
-fx-background-insets: 0, 0 0 1 0;
|
||||
}
|
||||
|
||||
.menu-bar .menu .label {
|
||||
-fx-text-fill: #2d3e4c;
|
||||
}
|
||||
|
||||
.text-field-limited {
|
||||
-fx-max-length: 3;
|
||||
}
|
||||
|
||||
.scroll-pane {
|
||||
-fx-background-color:transparent;
|
||||
}
|
30
src/cl/cromer/estructuras/fxml/array.fxml
Normal file
30
src/cl/cromer/estructuras/fxml/array.fxml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import cl.cromer.estructuras.TextFieldLimited?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<VBox prefHeight="768.0" prefWidth="1024.0" spacing="10" xmlns="http://javafx.com/javafx/8.0.92" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cl.cromer.estructuras.ArrayController">
|
||||
<fx:include source="menu.fxml" />
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="TOP_CENTER" VBox.vgrow="ALWAYS" spacing="50">
|
||||
<VBox spacing="10">
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button text="%llenar" onAction="#botonLlenar" />
|
||||
<Button text="%vaciar" onAction="#botonVaciar" />
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button text="%insertar" onAction="#botonInsertar" />
|
||||
<Button text="%eliminar" onAction="#botonEliminar" />
|
||||
<Button text="%buscar" onAction="#botonBuscar" />
|
||||
<TextFieldLimited fx:id="valorArray" maxLength="3" prefWidth="50" />
|
||||
</HBox>
|
||||
<VBox fx:id="contenidoArray" alignment="CENTER" />
|
||||
</VBox>
|
||||
<StackPane alignment="TOP_LEFT" minWidth="450">
|
||||
<Text fx:id="codigoArray" />
|
||||
</StackPane>
|
||||
</HBox>
|
||||
</ScrollPane>
|
||||
</VBox>
|
24
src/cl/cromer/estructuras/fxml/burbuja.fxml
Normal file
24
src/cl/cromer/estructuras/fxml/burbuja.fxml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<VBox prefHeight="768.0" prefWidth="1024.0" spacing="10" xmlns="http://javafx.com/javafx/8.0.92" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cl.cromer.estructuras.BurbujaController">
|
||||
<fx:include source="menu.fxml" />
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="TOP_CENTER" VBox.vgrow="ALWAYS" spacing="50">
|
||||
<VBox spacing="10">
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button text="%nuevo" onAction="#botonNuevo" />
|
||||
<Button text="%paso" onAction="#botonPaso" />
|
||||
<Button text="%correr" onAction="#botonCorrer" />
|
||||
</HBox>
|
||||
<HBox fx:id="contenidoBurbuja" alignment="CENTER" />
|
||||
</VBox>
|
||||
<StackPane alignment="TOP_LEFT" minWidth="450">
|
||||
<Text fx:id="codigoBurbuja" />
|
||||
</StackPane>
|
||||
</HBox>
|
||||
</ScrollPane>
|
||||
</VBox>
|
31
src/cl/cromer/estructuras/fxml/cola.fxml
Normal file
31
src/cl/cromer/estructuras/fxml/cola.fxml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import cl.cromer.estructuras.TextFieldLimited?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
|
||||
<VBox prefHeight="768.0" prefWidth="1024.0" spacing="10" xmlns="http://javafx.com/javafx/8.0.92" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cl.cromer.estructuras.ColaController">
|
||||
<fx:include source="menu.fxml" />
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="TOP_CENTER" VBox.vgrow="ALWAYS" spacing="50">
|
||||
<VBox spacing="10">
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button text="%llenar" onAction="#botonLlenar" />
|
||||
<Button text="%vaciar" onAction="#botonVaciar" />
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button text="%push" onAction="#botonPush" />
|
||||
<Button text="%pop" onAction="#botonPop" />
|
||||
<Button text="%peek" onAction="#botonPeek" />
|
||||
<TextFieldLimited fx:id="valorCola" maxLength="3" prefWidth="50" />
|
||||
</HBox>
|
||||
<VBox fx:id="contenidoCola" alignment="CENTER" />
|
||||
</VBox>
|
||||
<StackPane alignment="TOP_LEFT" minWidth="450">
|
||||
<Text fx:id="codigoCola" />
|
||||
</StackPane>
|
||||
</HBox>
|
||||
</ScrollPane>
|
||||
</VBox>
|
24
src/cl/cromer/estructuras/fxml/insercion.fxml
Normal file
24
src/cl/cromer/estructuras/fxml/insercion.fxml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<VBox prefHeight="768.0" prefWidth="1024.0" spacing="10" xmlns="http://javafx.com/javafx/8.0.92" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cl.cromer.estructuras.InsercionController">
|
||||
<fx:include source="menu.fxml" />
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="TOP_CENTER" VBox.vgrow="ALWAYS" spacing="50">
|
||||
<VBox spacing="10">
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button text="%nuevo" onAction="#botonNuevo" />
|
||||
<Button text="%paso" onAction="#botonPaso" />
|
||||
<Button text="%correr" onAction="#botonCorrer" />
|
||||
</HBox>
|
||||
<HBox fx:id="contenidoInsercion" alignment="CENTER" />
|
||||
</VBox>
|
||||
<StackPane alignment="TOP_LEFT" minWidth="450">
|
||||
<Text fx:id="codigoInsercion" />
|
||||
</StackPane>
|
||||
</HBox>
|
||||
</ScrollPane>
|
||||
</VBox>
|
17
src/cl/cromer/estructuras/fxml/main.fxml
Normal file
17
src/cl/cromer/estructuras/fxml/main.fxml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.control.ScrollPane?>
|
||||
|
||||
<VBox prefHeight="768.0" prefWidth="1024.0" spacing="10" xmlns="http://javafx.com/javafx/8.0.92" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<fx:include source="menu.fxml"/>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="CENTER" VBox.vgrow="ALWAYS">
|
||||
<ImageView>
|
||||
<Image url="@/cl/cromer/estructuras/images/UBBLogo.png" />
|
||||
</ImageView>
|
||||
</HBox>
|
||||
</ScrollPane>
|
||||
</VBox>
|
45
src/cl/cromer/estructuras/fxml/menu.fxml
Normal file
45
src/cl/cromer/estructuras/fxml/menu.fxml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
|
||||
<MenuBar fx:id="menuBar" fx:controller="cl.cromer.estructuras.MenuController" xmlns="http://javafx.com/javafx/8.0.92" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<Menu text="%estructuras">
|
||||
<Menu text="%array">
|
||||
<MenuItem text="%arraySimple" onAction="#menuArraySimple"/>
|
||||
<MenuItem text="%arrayOrdenado" onAction="#menuArrayOrdenado"/>
|
||||
</Menu>
|
||||
<Menu text="%ordenamiento">
|
||||
<MenuItem text="%burbuja" onAction="#menuBurbuja"/>
|
||||
<MenuItem text="%insercion" onAction="#menuInsercion"/>
|
||||
<MenuItem text="%seleccion" onAction="#menuSeleccion"/>
|
||||
<MenuItem text="%shell" onAction="#menuShell"/>
|
||||
</Menu>
|
||||
<Menu text="%listaEnlazada">
|
||||
<MenuItem text="%listaSimple"/>
|
||||
<MenuItem text="%listaCircular"/>
|
||||
<MenuItem text="%doblementeEnlazada"/>
|
||||
</Menu>
|
||||
<MenuItem text="%pila" onAction="#menuPila"/>
|
||||
<MenuItem text="%cola" onAction="#menuCola"/>
|
||||
<Menu text="%arboles">
|
||||
<MenuItem text="%general"/>
|
||||
<MenuItem text="%binario"/>
|
||||
<MenuItem text="%busquedaBinario"/>
|
||||
<MenuItem text="%AVL"/>
|
||||
<MenuItem text="%rojoNegro"/>
|
||||
<MenuItem text="%bTree"/>
|
||||
</Menu>
|
||||
<Menu text="%grafos">
|
||||
<MenuItem text="%dirigidos"/>
|
||||
<MenuItem text="%noDirigidos"/>
|
||||
</Menu>
|
||||
<MenuItem text="%tablaHash"/>
|
||||
</Menu>
|
||||
<Menu text="%idioma">
|
||||
<MenuItem onAction="#menuIngles" text="%ingles"/>
|
||||
<MenuItem onAction="#menuEspanol" text="%espanol"/>
|
||||
</Menu>
|
||||
<Menu text="%ayuda">
|
||||
<MenuItem onAction="#menuAcerca" text="%acerca"/>
|
||||
</Menu>
|
||||
</MenuBar>
|
30
src/cl/cromer/estructuras/fxml/pila.fxml
Normal file
30
src/cl/cromer/estructuras/fxml/pila.fxml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import cl.cromer.estructuras.TextFieldLimited?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<VBox prefHeight="768.0" prefWidth="1024.0" spacing="10" xmlns="http://javafx.com/javafx/8.0.92" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cl.cromer.estructuras.PilaController">
|
||||
<fx:include source="menu.fxml" />
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="TOP_CENTER" VBox.vgrow="ALWAYS" spacing="50">
|
||||
<VBox spacing="10">
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button fx:id="botonLlenar" text="%llenar" onAction="#botonLlenar" />
|
||||
<Button fx:id="botonVaciar" text="%vaciar" onAction="#botonVaciar" />
|
||||
</HBox>
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button fx:id="botonPush" text="%push" onAction="#botonPush" />
|
||||
<Button fx:id="botonPop" text="%pop" onAction="#botonPop" />
|
||||
<Button fx:id="botonPeek" text="%peek" onAction="#botonPeek" />
|
||||
<TextFieldLimited fx:id="valorPila" maxLength="3" prefWidth="50" />
|
||||
</HBox>
|
||||
<VBox fx:id="contenidoPila" alignment="CENTER" />
|
||||
</VBox>
|
||||
<StackPane alignment="TOP_LEFT" minWidth="450">
|
||||
<Text fx:id="codigoPila" />
|
||||
</StackPane>
|
||||
</HBox>
|
||||
</ScrollPane>
|
||||
</VBox>
|
24
src/cl/cromer/estructuras/fxml/seleccion.fxml
Normal file
24
src/cl/cromer/estructuras/fxml/seleccion.fxml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<VBox prefHeight="768.0" prefWidth="1024.0" spacing="10" xmlns="http://javafx.com/javafx/8.0.92" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cl.cromer.estructuras.SeleccionController">
|
||||
<fx:include source="menu.fxml" />
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="TOP_CENTER" VBox.vgrow="ALWAYS" spacing="50">
|
||||
<VBox spacing="10">
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button text="%nuevo" onAction="#botonNuevo" />
|
||||
<Button text="%paso" onAction="#botonPaso" />
|
||||
<Button text="%correr" onAction="#botonCorrer" />
|
||||
</HBox>
|
||||
<HBox fx:id="contenidoSeleccion" alignment="CENTER" />
|
||||
</VBox>
|
||||
<StackPane alignment="TOP_LEFT" minWidth="450">
|
||||
<Text fx:id="codigoSeleccion" />
|
||||
</StackPane>
|
||||
</HBox>
|
||||
</ScrollPane>
|
||||
</VBox>
|
24
src/cl/cromer/estructuras/fxml/shell.fxml
Normal file
24
src/cl/cromer/estructuras/fxml/shell.fxml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.Text?>
|
||||
|
||||
<VBox prefHeight="768.0" prefWidth="1024.0" spacing="10" xmlns="http://javafx.com/javafx/8.0.92" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cl.cromer.estructuras.ShellController">
|
||||
<fx:include source="menu.fxml" />
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" VBox.vgrow="ALWAYS">
|
||||
<HBox alignment="TOP_CENTER" VBox.vgrow="ALWAYS" spacing="50">
|
||||
<VBox spacing="10">
|
||||
<HBox alignment="CENTER" spacing="10">
|
||||
<Button text="%nuevo" onAction="#botonNuevo" />
|
||||
<Button text="%paso" onAction="#botonPaso" />
|
||||
<Button text="%correr" onAction="#botonCorrer" />
|
||||
</HBox>
|
||||
<HBox fx:id="contenidoShell" alignment="CENTER" />
|
||||
</VBox>
|
||||
<StackPane alignment="TOP_LEFT" minWidth="450">
|
||||
<Text fx:id="codigoShell" />
|
||||
</StackPane>
|
||||
</HBox>
|
||||
</ScrollPane>
|
||||
</VBox>
|
BIN
src/cl/cromer/estructuras/images/UBBLogo.png
Normal file
BIN
src/cl/cromer/estructuras/images/UBBLogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
BIN
src/cl/cromer/estructuras/images/diagram.png
Normal file
BIN
src/cl/cromer/estructuras/images/diagram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 158 KiB |
170
src/cl/cromer/estructuras/images/diagrama.uml
Normal file
170
src/cl/cromer/estructuras/images/diagrama.uml
Normal file
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Diagram>
|
||||
<ID>JAVA</ID>
|
||||
<OriginalElement />
|
||||
<nodes>
|
||||
<node x="3677.083333333333" y="684.5">cl.cromer.estructuras.InsercionController</node>
|
||||
<node x="2336.083333333333" y="684.5">cl.cromer.estructuras.BurbujaController</node>
|
||||
<node x="3225.083333333333" y="684.5">cl.cromer.estructuras.SeleccionController</node>
|
||||
<node x="44.87500000000023" y="642.5">cl.cromer.estructuras.PilaController</node>
|
||||
<node x="0.0" y="1064.0">cl.cromer.estructuras.Logs</node>
|
||||
<node x="2812.083333333333" y="228.0">cl.cromer.estructuras.Array</node>
|
||||
<node x="1221.6666666666667" y="642.5">cl.cromer.estructuras.ColaController</node>
|
||||
<node x="0.0" y="270.5">cl.cromer.estructuras.Pila</node>
|
||||
<node x="1965.0" y="0.0">cl.cromer.estructuras.Colores</node>
|
||||
<node x="1368.8750000000002" y="218.0">cl.cromer.estructuras.Grafico</node>
|
||||
<node x="713.8750000000002" y="280.5">cl.cromer.estructuras.TextFieldLimited</node>
|
||||
<node x="1777.0833333333335" y="632.0">cl.cromer.estructuras.ArrayController</node>
|
||||
<node x="573.8750000000002" y="790.0">cl.cromer.estructuras.TextFieldLimited.StyleableProperties</node>
|
||||
<node x="5.5" y="1229.0">cl.cromer.estructuras.Main</node>
|
||||
<node x="1077.8750000000002" y="270.5">cl.cromer.estructuras.Cola</node>
|
||||
<node x="2776.083333333333" y="663.5">cl.cromer.estructuras.MenuController</node>
|
||||
</nodes>
|
||||
<notes />
|
||||
<edges>
|
||||
<edge source="cl.cromer.estructuras.ColaController" target="cl.cromer.estructuras.TextFieldLimited">
|
||||
<point x="-214.16666666666674" y="-183.0" />
|
||||
<point x="1264.5" y="592.0" />
|
||||
<point x="954.6750000000002" y="592.0" />
|
||||
<point x="68.79999999999995" y="89.5" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.PilaController" target="cl.cromer.estructuras.TextFieldLimited">
|
||||
<point x="42.41666666666674" y="-183.0" />
|
||||
<point x="341.79166666666697" y="582.0" />
|
||||
<point x="748.2750000000003" y="582.0" />
|
||||
<point x="-137.5999999999999" y="89.5" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.ColaController" target="cl.cromer.estructuras.Cola">
|
||||
<point x="-128.5" y="-183.0" />
|
||||
<point x="1350.1666666666667" y="582.0" />
|
||||
<point x="1145.6250000000002" y="582.0" />
|
||||
<point x="-67.75" y="99.5" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.ArrayController" target="cl.cromer.estructuras.TextFieldLimited">
|
||||
<point x="-224.58333333333326" y="-193.5" />
|
||||
<point x="1822.0" y="562.0" />
|
||||
<point x="1023.4750000000001" y="562.0" />
|
||||
<point x="137.5999999999999" y="89.5" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.PilaController" target="cl.cromer.estructuras.Colores">
|
||||
<point x="-42.41666666666674" y="-183.0" />
|
||||
<point x="256.9583333333335" y="612.0" />
|
||||
<point x="277.5" y="612.0" />
|
||||
<point x="277.5" y="178.0" />
|
||||
<point x="1983.0714285714284" y="178.0" />
|
||||
<point x="-108.42857142857156" y="79.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.ArrayController" target="cl.cromer.estructuras.Colores">
|
||||
<point x="44.916666666666686" y="-193.5" />
|
||||
<point x="0.0" y="79.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.InsercionController" target="cl.cromer.estructuras.Colores">
|
||||
<point x="143.0" y="-141.0" />
|
||||
<point x="4034.583333333333" y="572.0" />
|
||||
<point x="3853.652380952381" y="572.0" />
|
||||
<point x="3853.652380952381" y="178.0" />
|
||||
<point x="2199.9285714285716" y="178.0" />
|
||||
<point x="108.42857142857133" y="79.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.ColaController" target="cl.cromer.estructuras.Colores">
|
||||
<point x="214.16666666666674" y="-183.0" />
|
||||
<point x="1692.8333333333335" y="612.0" />
|
||||
<point x="1950.4023809523812" y="612.0" />
|
||||
<point x="1950.4023809523812" y="198.0" />
|
||||
<point x="2055.357142857143" y="198.0" />
|
||||
<point x="-36.14285714285711" y="79.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.MenuController" target="cl.cromer.estructuras.Array">
|
||||
<point x="0.0" y="-162.0" />
|
||||
<point x="-2.8421709430404007E-14" y="142.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.Main" target="cl.cromer.estructuras.Logs">
|
||||
<point x="0.0" y="-46.5" />
|
||||
<point x="0.0" y="57.5" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.SeleccionController" target="cl.cromer.estructuras.Array">
|
||||
<point x="0.0" y="-141.0" />
|
||||
<point x="3441.083333333333" y="602.0" />
|
||||
<point x="3069.9166666666665" y="602.0" />
|
||||
<point x="79.33333333333326" y="142.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.BurbujaController" target="cl.cromer.estructuras.Array">
|
||||
<point x="140.0" y="-141.0" />
|
||||
<point x="2686.083333333333" y="612.0" />
|
||||
<point x="2950.9166666666665" y="612.0" />
|
||||
<point x="-39.666666666666686" y="142.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.SeleccionController" target="cl.cromer.estructuras.Colores">
|
||||
<point x="144.0" y="-141.0" />
|
||||
<point x="3585.083333333333" y="188.0" />
|
||||
<point x="2163.785714285714" y="188.0" />
|
||||
<point x="72.28571428571422" y="79.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.PilaController" target="cl.cromer.estructuras.Pila">
|
||||
<point x="-212.08333333333326" y="-183.0" />
|
||||
<point x="87.29166666666697" y="612.0" />
|
||||
<point x="66.75" y="612.0" />
|
||||
<point x="-66.75" y="99.5" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.BurbujaController" target="cl.cromer.estructuras.Colores">
|
||||
<point x="-140.0" y="-141.0" />
|
||||
<point x="2406.083333333333" y="198.0" />
|
||||
<point x="2127.6428571428573" y="198.0" />
|
||||
<point x="36.14285714285711" y="79.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.InsercionController" target="cl.cromer.estructuras.Array">
|
||||
<point x="-143.0" y="-141.0" />
|
||||
<point x="3748.583333333333" y="592.0" />
|
||||
<point x="3109.583333333333" y="592.0" />
|
||||
<point x="118.99999999999989" y="142.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.ColaController" target="cl.cromer.estructuras.Grafico">
|
||||
<point x="42.83333333333326" y="-183.0" />
|
||||
<point x="1521.5" y="612.0" />
|
||||
<point x="1584.7083333333335" y="612.0" />
|
||||
<point x="-43.16666666666674" y="152.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.ArrayController" target="cl.cromer.estructuras.Array">
|
||||
<point x="224.58333333333331" y="-193.5" />
|
||||
<point x="2271.1666666666665" y="592.0" />
|
||||
<point x="2871.583333333333" y="592.0" />
|
||||
<point x="-119.0" y="142.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.TextFieldLimited.StyleableProperties" target="cl.cromer.estructuras.TextFieldLimited">
|
||||
<point x="104.0" y="-35.5" />
|
||||
<point x="0.0" y="89.5" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.Grafico" target="cl.cromer.estructuras.Colores">
|
||||
<point x="0.0" y="-152.0" />
|
||||
<point x="1627.8750000000002" y="188.0" />
|
||||
<point x="2019.2142857142858" y="188.0" />
|
||||
<point x="-72.28571428571422" y="79.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.PilaController" target="cl.cromer.estructuras.Grafico">
|
||||
<point x="127.25" y="-183.0" />
|
||||
<point x="426.6250000000002" y="602.0" />
|
||||
<point x="1412.041666666667" y="602.0" />
|
||||
<point x="-215.83333333333326" y="152.0" />
|
||||
</edge>
|
||||
<edge source="cl.cromer.estructuras.ArrayController" target="cl.cromer.estructuras.Grafico">
|
||||
<point x="-134.74999999999994" y="-193.5" />
|
||||
<point x="1911.8333333333335" y="552.0" />
|
||||
<point x="1757.3750000000002" y="552.0" />
|
||||
<point x="129.5" y="152.0" />
|
||||
</edge>
|
||||
</edges>
|
||||
<settings layout="Hierarchic Group" zoom="0.7670220499151925" x="708.3626599273417" y="461.0925604169958" />
|
||||
<SelectedNodes>
|
||||
<node>cl.cromer.estructuras.SeleccionController</node>
|
||||
</SelectedNodes>
|
||||
<Categories>
|
||||
<Category>Fields</Category>
|
||||
<Category>Constructors</Category>
|
||||
<Category>Methods</Category>
|
||||
<Category>Properties</Category>
|
||||
<Category>Inner Classes</Category>
|
||||
</Categories>
|
||||
<SCOPE>All</SCOPE>
|
||||
<VISIBILITY>private</VISIBILITY>
|
||||
</Diagram>
|
||||
|
Reference in New Issue
Block a user