From a8b2b34be438d5917f61448bcebb6b71a25336fd Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Sun, 3 Jul 2016 15:57:56 -0400 Subject: [PATCH] Created the tree types that can be chosen. --- src/cl/cromer/estructuras/ArbolTipos.java | 82 +++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/cl/cromer/estructuras/ArbolTipos.java diff --git a/src/cl/cromer/estructuras/ArbolTipos.java b/src/cl/cromer/estructuras/ArbolTipos.java new file mode 100644 index 0000000..2e2fb8a --- /dev/null +++ b/src/cl/cromer/estructuras/ArbolTipos.java @@ -0,0 +1,82 @@ +package cl.cromer.estructuras; + +/** + * Esta clase contiene los tipos de arboles. + * + * @author Chris Cromer + */ +final public class ArbolTipos { + /** + * Tipo general. + */ + static final public int GENERAL = 0; + + /** + * Tipo binario. + */ + static final public int BINARIO = 1; + + /** + * Tipo busqueda binaria. + */ + static final public int BUSQUEDA_BINARIA = 2; + + /** + * Tipo AVL. + */ + static final public int AVL = 3; + + /** + * Tipo rojo-negro. + */ + static final public int ROJO_NEGRO = 4; + + /** + * Tipo B-Tree. + */ + static final public int B_TREE = 5; + + /** + * El tipo elegido. + */ + final private int tipo; + + /** + * Inicilizar el tipo de arbol. + * + * @param tipo int: El tipo de lista enlazada, {@value #GENERAL}, {@value #BINARIO}, {@value #BUSQUEDA_BINARIA}, {@value #AVL}, {@value #ROJO_NEGRO} o {@value #B_TREE} + */ + public ArbolTipos(int tipo) { + switch (tipo) { + case GENERAL: + this.tipo = GENERAL; + break; + case BINARIO: + this.tipo = BINARIO; + break; + case BUSQUEDA_BINARIA: + this.tipo = BUSQUEDA_BINARIA; + break; + case AVL: + this.tipo = AVL; + break; + case ROJO_NEGRO: + this.tipo = ROJO_NEGRO; + break; + case B_TREE: + this.tipo = B_TREE; + break; + default: + this.tipo = GENERAL; + } + } + + /** + * Devolver el tipo de arbol. + * + * @return int: El tipo. + */ + public int getTipo() { + return tipo; + } +}