Buscar

Arvore B - Exclusão da Arvore B, Isserção na arvore B.

Esta é uma pré-visualização de arquivo. Entre para ver o arquivo original

TrabalhoPOII/ArvoreB mod and/build.xml
 
 Builds, tests, and runs the project ArvoreB.
 
 
TrabalhoPOII/ArvoreB mod and/build/built-jar.properties
#Sat, 03 Jun 2017 10:35:42 -0300
/home/joao/Documentos/Pasta\ sem\ t\u00edtulo/ArvoreB\ mod\ and=
TrabalhoPOII/ArvoreB mod and/build/classes/.netbeans_automatic_build
TrabalhoPOII/ArvoreB mod and/build/classes/.netbeans_update_resources
TrabalhoPOII/ArvoreB mod and/build/classes/arvoreb/BTree.class
TrabalhoPOII/ArvoreB mod and/build/classes/arvoreb/BenditoN.class
TrabalhoPOII/ArvoreB mod and/build/classes/arvoreb/No.class
TrabalhoPOII/ArvoreB mod and/build/classes/arvoreb/Principal.class
TrabalhoPOII/ArvoreB mod and/dist/ArvoreB.jar
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.7
Created-By: 1.8.0_131-b11 (Oracle Corporation)
Class-Path: 
X-COMMENT: Main-Class will be added automatically by build
Main-Class: arvoreb.Principal
arvoreb/BTree.class
arvoreb/BenditoN.class
arvoreb/No.class
arvoreb/Principal.class
TrabalhoPOII/ArvoreB mod and/dist/README.TXT
========================
BUILD OUTPUT DESCRIPTION
========================
When you build an Java application project that has a main class, the IDE
automatically copies all of the JAR
files on the projects classpath to your projects dist/lib folder. The IDE
also adds each of the JAR files to the Class-Path element in the application
JAR files manifest file (MANIFEST.MF).
To run the project from the command line, go to the dist folder and
type the following:
java -jar "ArvoreB.jar" 
To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.
Notes:
* If two JAR files on the project classpath have the same name, only the first
JAR file is copied to the lib folder.
* Only JAR files are copied to the lib folder.
If the classpath contains other types of files or folders, these files (folders)
are not copied.
* If a library on the projects classpath also has a Class-Path element
specified in the manifest,the content of the Class-Path element has to be on
the projects runtime path.
* To set a main class in a standard Java project, right-click the project node
in the Projects window and choose Properties. Then click Run and enter the
class name in the Main Class field. Alternatively, you can manually type the
class name in the manifest Main-Class element.
TrabalhoPOII/ArvoreB mod and/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
TrabalhoPOII/ArvoreB mod and/nbproject/build-impl.xml
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must set src.dir
 Must set test.src.dir
 Must set build.dir
 Must set dist.dir
 Must set build.classes.dir
 Must set dist.javadoc.dir
 Must set build.test.classes.dir
 Must set build.test.results.dir
 Must set build.classes.excludes
 Must set dist.jar
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must set javac.includes
No tests executed.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must set JVM to use for profiling in profiler.info.jvm
 Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select some files in the IDE or set javac.includes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 To run this application from the command line without
Ant, try:
 
 java -jar "${dist.jar.resolved}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set run.class
 
 
 
 Must select one file in the IDE or set run.class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set debug.class
 
 
 
 
 Must select one file in the IDE or set debug.class
 
 
 
 
 Must set fix.includes
 
 
 
 
 
 
 
 
 
 This target only works when run from inside the NetBeans IDE.
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set profile.class
 This target only works when run from inside the NetBeans IDE.
 
 
 
 
 
 
 
 
 This target only works when run from inside the NetBeans IDE.
 
 
 
 
 
 
 
 
 
 
 
 
 This target only works when run from inside the NetBeans IDE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set run.class
 
 
 
 
 
 Must select some files in the IDE or set test.includes
 
 
 
 
 Must select one file in the IDE or set run.class
 
 
 
 
 Must select one file in the IDE or set applet.url
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select some files in the IDE or set javac.includes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Some tests failed; see details above.
 
 
 
 
 
 
 
 
 Must select some files in the IDE or set test.includes
 
 
 
 Some tests failed; see details above.
 
 
 
 Must select some files in the IDE or set test.class
 Must select some method in the IDE or set test.method
 
 
 
 Some tests failed; see details above.
 
 
 
 
 Must select one file in the IDE or set test.class
 
 
 
 Must select one file in the IDE or set test.class
 Must select some method in the IDE or set test.method
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set applet.url
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set applet.url
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
TrabalhoPOII/ArvoreB mod and/nbproject/genfiles.properties
build.xml.data.CRC32=1828ba03
build.xml.script.CRC32=41190f37
build.xml.stylesheet.CRC32=8064a381@1.79.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=1828ba03
nbproject/build-impl.xml.script.CRC32=e25045b1
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
TrabalhoPOII/ArvoreB mod and/nbproject/private/private.properties
compile.on.save=true
user.properties.file=/home/joao/.netbeans/8.2/build.properties
TrabalhoPOII/ArvoreB mod and/nbproject/private/private.xml
 
 
 
 
 
TrabalhoPOII/ArvoreB mod and/nbproject/project.properties
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
 ${run.classpath}
debug.test.classpath=\
 ${run.test.classpath}
# Os arquivos em build.classes.dir que devem ser exclu\u00eddos do jar de distribui\u00e7\u00e3o
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/ArvoreB.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.processorpath=\
 ${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
 ${javac.classpath}:\
 ${build.classes.dir}
javac.test.processorpath=\
 ${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=arvoreb.Principal
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
 ${javac.classpath}:\
 ${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
 ${javac.test.classpath}:\
 ${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
TrabalhoPOII/ArvoreB mod and/nbproject/project.xml
 
 org.netbeans.modules.java.j2seproject
 
 
 ArvoreB
 
 
 
 
 
 
 
 
TrabalhoPOII/ArvoreB mod and/src/arvoreb/BTree.java
package arvoreb;
import static arvoreb.BenditoN.n;
public class BTree {
 //Atributos
 private No raiz;
 //Construtor
 public BTree() {
 }
 //Getters
 public No getRaiz() {
 return raiz;
 }
 //Métodos
 public void insereArvore(int info, int posArq) {
 No folha, pai;
 int i, pos;
 if (raiz == null) {
 raiz = new No(info, posArq);
 } else {
 folha = navegaAteFolha(info);
 pos = folha.procuraPos(info);
 folha.remaneja(pos);
 folha.setTL(folha.getTL() + 1);
 folha.setvInfo(pos, info);
 folha.setvPos(pos, posArq);
 if (folha.getTL() > 2 * n) {
 pai = localizaPai(folha, info);
 split(folha, pai);
 }
 }
 }
 No navegaAteFolha(int info) {
 int i;
 No p = raiz;
 while (p.getvLig(0) != null) {
 i = 0;
 while (i < p.getTL() && info > p.getvInfo(i)) {
 i = i + 1;
 }
 p = p.getvLig(i);
 }
 return p;
 }
 No localizaPai(No folha, int info) {
 No p, pai;
 int i;
 p = raiz;
 pai = p;
 while (p != folha) {
 i = 0;
 while (i < p.getTL() && info > p.getvInfo(i)) {
 i = i + 1;
 }
 pai = p;
 p = p.getvLig(i);
 }
 return pai;
 }
 public void split(No folha, No pai) {
 No caixa1, caixa2;
 int i = 0, pos = 0;
 int info;
 caixa1 = new No();
 caixa2 = new No();
 for (i = 0; i < n; i++) {
 caixa1.setvInfo(i, folha.getvInfo(i));
 caixa1.setvPos(i, folha.getvPos(i));
 caixa1.setvLig(i, folha.getvLig(i));
 }
 caixa1.setvLig(n, folha.getvLig(n));
 caixa1.setTL(n);
 for (i = n + 1; i < 2 * n + 1; i++) {
 caixa2.setvInfo(i - (n + 1), folha.getvInfo(i));
 caixa2.setvPos(i - (n + 1), folha.getvPos(i));
 caixa2.setvLig(i - (n + 1), folha.getvLig(i));
 }
 caixa2.setvLig(n, folha.getvLig(2 * n + 1));
 caixa2.setTL(n);
 if (pai == folha) {
 folha.setvInfo(0, folha.getvInfo(n));
 folha.setvPos(0, folha.getvPos(n));
 folha.setvLig(0, caixa1);
 folha.setvLig(1, caixa2);
 folha.setTL(1);
 } else {
 info = folha.getvInfo(n);
 pos = pai.procuraPos(info);
 pai.remaneja(pos);
 pai.setTL(pai.getTL() + 1);
 pai.setvInfo(pos, folha.getvInfo(n));
 pai.setvPos(pos, folha.getvPos(n));
 pai.setvLig(pos, caixa1);
 pai.setvLig(pos + 1, caixa2);
 if (pai.getTL() > 2 * n) {
 folha = pai;
 info = folha.getvInfo(n);
 pai = localizaPai(pai, info);
 split(folha, pai);
 }
 }
 }
 public void inOrdem(No raiz) {
 int i = 0;
 if (raiz != null) {
 for (i = 0; i < raiz.getTL(); i++) {
 inOrdem(raiz.getvLig(i));
 System.out.printf("%d, ", raiz.getvInfo(i));
 }
 inOrdem(raiz.getvLig(raiz.getTL()));
 }
 }
 public void exibeInOrdem() {
 No p = null;
 if (raiz == null) {
 System.out.println("A árvore está vazia!");
 } else {
 p = raiz;
 System.out.println("Elementos:");
 inOrdem(p);
 }
 }
 // Começa Remover
 /* Verifica se um elemento existe na Arvore
 * public boolean isIn(int)
 * @param info
 * retorna true se elemento está presente na arvore
 */
 public boolean isIn(int info) {
 No p = raiz;
 int i = 0;
 boolean flag = false;
 for (int pos = 0; pos < p.getTL(); pos++) {
 if (info == p.getvInfo(pos)) {
 flag = true;
 }
 }
 if (!flag) {
 p = navegaAteFolha(info);
 while (i < p.getTL()) {
 if (info == p.getvInfo(i)) {
 flag = true;
 }
 i++;
 }
 }
 return flag;
 }
 /* Exclui elemento de uma folha e remaneja informações e ligações
 * void excluiElementoFolha(No , int)
 * @param folha 
 * @param info
 * return void
 */
 public void excluiElementoFolha(No folha, int info) {
 int i = 0;
 while (info != folha.getvInfo(i)) {
 i++;
 }
 //Remaneja posição do elemento e sua ligação
 while (i < folha.getTL() - 1) {
 folha.setvInfo(i, folha.getvInfo(i + 1));
 folha.setvPos(i, folha.getvPos(i + 1));
 i++;
 }
 folha.setTL(folha.getTL() - 1);
 }
 /* empresta do pai e o pai da folha a direita
 * boolean getDir(int, int, No, No){
 * @param folha 
 * @param info
 * @param pos
 * @param pai 
 * return true se emprestimo for realizado
 */
 public boolean getDir(int info, int pos, No folha, No pai) {
 No aux = pai.getvLig(pos + 1);
 int infoPai, posPai, auxinfo, auxpos;
 // Se a ligação não for nula e TL dir > N
 if (pai.getvLig(pos + 1) != null && pai.getvLig(pos + 1).getTL() > n) {
 auxinfo = aux.getvInfo(0);
 auxpos = aux.getvPos(0);
 infoPai = pai.getvInfo(pos);
 posPai = pai.getvPos(pos);
 remover(aux.getvInfo(0)); 
 pai.setvInfo(pos, auxinfo);
 pai.setvPos(pos, auxpos);
 insereArvore(infoPai, posPai);
 return true;
 }
 return false;
 }
 /* empresta do pai e o pai da folha a direita
 * boolean getEsq(int, int, No, No){
 * @param folha 
 * @param info
 * @param pos
 * @param pai 
 * return true se emprestimo for realizado
 */
 public boolean getEsq(int info, int pos, No folha, No pai) {
 No aux = pai.getvLig(pos);
 int infoPai, posPai, auxinfo, auxpos;
 if (pai.getvLig(pos) != null && pai.getvLig(pos).getTL() > n) {
 auxinfo = aux.getvInfo(aux.getTL() - 1);
 auxpos = aux.getvPos(aux.getTL() - 1);
 infoPai = pai.getvInfo(pos);
 posPai = pai.getvPos(pos);
 remover(aux.getvInfo(aux.getTL() - 1));
 pai.setvInfo(pos, auxinfo);
 pai.setvPos(pos, auxpos);
 insereArvore(infoPai, posPai);
 return true;
 } else {
 return false;
 }
 }
 public void fusao(int pos, No folha, No pai) {
 No aux = pai.getvLig(pos + 1);
 int infoPai, posPai;
 infoPai = pai.getvInfo(pos);
 posPai = pai.getvPos(pos);
 excluiElementoFolha(pai, infoPai);
 for (int p = pos + 1; p <= pai.getTL(); p++) {
pai.setvLig(p, pai.getvLig(p + 1));
 }
 insereArvore(infoPai, posPai);
 for (int p = 0; p < aux.getTL(); p++) {
 insereArvore(aux.getvInfo(p), aux.getvPos(p));
 }
 if (pai.getTL() < n && pai != raiz){ // isIn se o TL < N e !=raiz
 fusaoNoPaiSolo(pai);
 }
 }
 //ordem quebrada
 public void fusaoNoPaiSolo(No folha){
 int i = 0, j = 0, pos = 0;
 No aux , p, avo ;
 p = localizaPai(folha, folha.getvInfo(0));
 i = pos(folha.getvInfo(0), p);
 if (p == raiz) {
 if (p.getTL() > 1) {
 if (i == 0) {
 fusao(i, folha, p);
 } else {
 fusao(i - 1, folha, p);
 }
 } else {
 aux = mergePai(p);
 raiz = aux;
 }
 }
 }
 public No mergePai(No pai){
 No esq = pai.getvLig(0);
 No dir = pai.getvLig(1);
 int pos = 0;
 esq.setvInfo(esq.getTL(), pai.getvInfo(0));
 esq.setvPos(esq.getTL(), pai.getvPos(0)); // foi mudado
 esq.setTL(esq.getTL() + 1);
 for (pos = 0; pos < dir.getTL(); pos++) {
 esq.setvLig(esq.getTL(), dir.getvLig(pos));
 esq.setvInfo(esq.getTL(), dir.getvInfo(pos));
 esq.setvPos(esq.getTL(), dir.getvPos(pos));
 esq.setTL(esq.getTL() + 1);
 }
 esq.setvLig(esq.getTL(), dir.getvLig(pos));
 return esq;
 }
 public No killPai(No folha){
 No esq = folha.getvLig(0); 
 No dir = killFilho(folha.getvLig(1), esq);
 int pos = 0;
 for (pos = 0; pos < dir.getTL(); pos++) {
 esq.setvLig(esq.getTL(), dir.getvLig(pos));
 esq.setvInfo(esq.getTL(), dir.getvInfo(pos));
 esq.setvPos(esq.getTL(), dir.getvPos(pos));
 esq.setTL(esq.getTL() + 1);
 }
 esq.setvLig(esq.getTL(), dir.getvLig(pos));
 return esq;
 }
 public No mergeFilhos(No folha){ //Somente se raiz possuir um único elemento
 No esq = folha.getvLig(0); 
 No dir = folha.getvLig(1);
 int pos = 0;
 for (pos = 0; pos < dir.getTL(); pos++) {
 esq.setvLig(esq.getTL(), dir.getvLig(pos));
 esq.setvInfo(esq.getTL(), dir.getvInfo(pos));
 esq.setvPos(esq.getTL(), dir.getvPos(pos));
 esq.setTL(esq.getTL() + 1);
 }
 esq.setvLig(esq.getTL(), dir.getvLig(pos));
 return esq;
 }
 public No killFilho(No folha, No viz) {
 No esq = folha.getvLig(0); 
 No dir = folha.getvLig(1); 
 int pos = 0, auxinfo = esq.getvInfo(0), auxpos = esq.getvPos(0); 
 for (pos = 0; pos < esq.getTL() - 1; pos++) {
 esq.setvInfo(pos, esq.getvInfo(pos + 1)); 
 esq.setvPos(pos, esq.getvPos(pos + 1)); 
 }
 esq.setvInfo(pos, folha.getvInfo(0));
 esq.setvPos(pos, folha.getvPos(0));
 for (pos = 0; pos < dir.getTL(); pos++) {
 esq.setvInfo(esq.getTL(), dir.getvInfo(pos));
 esq.setvPos(esq.getTL(), dir.getvPos(pos));
 esq.setTL(esq.getTL() + 1);
 }
 folha.setvLig(1, esq);
 folha.setvLig(0, viz.getvLig(viz.getTL()));
 folha.setvInfo(0, auxinfo);
 folha.setvPos(0, auxpos);
 return folha;
 }
 public int pos(int info, No pai) {
 int i = 0;
 while (info > pai.getvInfo(i) && i < pai.getTL()) {
 i++;
 }
 return i;
 }
 public boolean apagarNo(No folha, int info) {
 No esq, dir;
 int pos = 0, k = 0;
 //Localiza elemento
 pos = pos(info, folha);
 //filho direita
 esq = folha.getvLig(pos);
 //filho esq
 dir = folha.getvLig(pos + 1);
 //Merge dos filhos no No
 for (k = 0; k < dir.getTL(); k++) {
 esq.setvLig(esq.getTL(), dir.getvLig(k));
 esq.setvInfo(esq.getTL(), dir.getvInfo(k));
 esq.setvPos(esq.getTL(), dir.getvPos(k));
 esq.setTL(esq.getTL() + 1);
 }
 esq.setvLig(esq.getTL(), dir.getvLig(k)); 
 folha.setvLig(pos, esq);
 //remanejando informações e ligações
 for (k = pos; k < folha.getTL(); k++){
 folha.setvInfo(k, folha.getvInfo(k + 1)); 
 folha.setvPos(k, folha.getvPos(k + 1)); 
 if (k != pos) {
 folha.setvLig(k, folha.getvLig(k + 1)); 
 }
 }
 folha.setTL(folha.getTL() - 1);
 return true;
 }
 public No busca(int info) {
 No p = raiz;
 int i = 0;
 boolean flag = false;
 while (!flag) {
 for (i = 0; i < p.getTL(); i++) {
 if (info == p.getvInfo(i)) {
 flag = true;
 }
 }
 if (!flag) {
 int pos = pos(info, p);
 p = p.getvLig(pos);
 }
 }
 return p;
 }
 public void remover(int info) {
 No folha, pai,nAux;
 int lado = 0, pos = 0, aux = 0;
 boolean flag = false;
 if (raiz == null){
 System.out.println("Arvore Vazia!");
 } else {
 if (isIn(info)){
 folha = busca(info);
 if (folha.getvLig(0) == null){//É uma folha?
 if (folha == raiz){ //Esse caralho de folha é raiz?
 excluiElementoFolha(folha, info); //Exclui elemento da folha
 flag = true; 
 } else {//Folha não é a raiz
 pai = localizaPai(folha, info); 
 excluiElementoFolha(folha, info); 
 if (folha.getTL() < n){// N>tl/ empresta Tem elementos a emprestar?
 lado = pos(info, pai);
 //Lado ==0 dir senão esquerda
 if (lado == 0){//Verifica posição atual
 flag = getDir(info, lado, folha, pai);
 } else{
 if (lado > 0 && lado < pai.getTL()){//ta no meio
 flag = getEsq(info, lado - 1, folha, pai);
 if (!flag){
 flag = getDir(info, lado, folha, pai);
 }
 } else{//so pode pegar da esquereda
 flag = getEsq(info, lado - 1, folha, pai);
 }
 }
 if (!flag){//nao pegou de ninguem, verifica lado novamente.
 if (lado == 0) {
 fusao(lado, folha, pai); // Fode todo mundo
 flag = true;
 } else {//
 fusao(lado - 1, folha, pai);
 flag = true;
 }
 }
 }
 }
 if (flag) {
 System.out.println("Excluido.");
 } else {
 System.out.println("Falha na exclusão.");
 }
 } else{// não é um caralho de folha 
 //Se a chave não estiver numa folha, troque-a com seu sucessor imediato.
 flag = emprestaFolha(folha, info);//Tenta pegar de uma folha
 if (!flag){
 if (folha != raiz){// se não estiver na raiz
 pai = localizaPai(folha, info);
 excluiElementoFolha(folha, info);
lado = pos(info, pai);// Verifica lado
 fusaoNoPaiSolo(pai);
 flag = true;
 } else{// se info estiver na raiz
 // A folha tem uma chave a menos que o mínimo. Verifique as páginas irmãs da esquerda e direita
 if (folha.getTL() == n - 1) {
 excluiElementoFolha(folha, info); // 2. Elimine a chave da folha.
 nAux = mergeFilhos(folha);
 raiz = nAux;
 flag = true;
 } else {
 flag = apagarNo(folha, info);
 }
 }
 }
 if (flag) {
 System.out.println("Removido.");
 } else {
 System.out.println("Falha.");
 }
 }
 } else{
 System.out.println("O elemento não existe.");
 }
 }
 }
 
 public boolean emprestaFolha(No folha, int info) {
 No aux = folha;
 int auxinfo = 0, auxpos = 0;
 int pos = pos(info, folha);
 aux = aux.getvLig(pos);
 while (aux.getvLig(aux.getTL()) != null) // Anda até a folha
 {
 aux = aux.getvLig(aux.getTL());
 }
 if (aux.getTL() > n) // Valida para saber se pode emprestar ! caso sim 
 { // Apaga da folha e joga para a raiz 
 auxinfo = aux.getvInfo(aux.getTL() - 1);
 auxpos = aux.getvPos(aux.getTL() - 1);
 excluiElementoFolha(aux, aux.getvInfo(aux.getTL() - 1));
 folha.setvInfo(pos, auxinfo);
 folha.setvPos(pos, auxpos);
 return true;
 }
 aux = folha;
 aux = aux.getvLig(pos + 1);
 while (aux.getvLig(0) != null) // Anda até a folha novamente
 {
 aux = aux.getvLig(0);
 }
 if (aux.getTL() > n) // Valida para saber se pode emprestar ! caso sim Apaga a folha e joga para a raiz
 {
 auxinfo = aux.getvInfo(0);
 auxpos = aux.getvPos(0);
 excluiElementoFolha(aux, aux.getvInfo(0));
 folha.setvInfo(pos, auxinfo);
 folha.setvPos(pos, auxpos);
 return true;
 }
 return false;
 }
}
TrabalhoPOII/ArvoreB mod and/src/arvoreb/BenditoN.java
package arvoreb;
public interface BenditoN 
{
 final int n = 5;
}
TrabalhoPOII/ArvoreB mod and/src/arvoreb/No.java
package arvoreb;
public class No implements BenditoN
{
 int vInfo[];
 int vPos[];
 No vLig[];
 int TL;
 public No() 
 {
 vInfo = new int[2*n+1];
 vPos = new int [2*n+1];
 vLig = new No [2*n+2];
 for (int i = 0 ; i < 2*n+2 ; i++)
 vLig[i] = null; 
 TL = 0; 
 }
 
 public No(int info, int posArq)
 { 
 this();
 vInfo[0] = info;
 vPos [0] = posArq;
 TL = 1;
 }
 public int getvInfo(int p) 
 {
 return vInfo[p];
 }
 public void setvInfo(int p, int info) 
 {
 vInfo[p] = info;
 }
 public int getvPos(int p) 
 {
 return vPos[p];
 }
 public void setvPos(int p, int pos) 
 {
 vPos[p] = pos;
 }
 public No getvLig (int p) 
 {
 return vLig[p];
 }
 public void setvLig(int p, No lig) 
 {
 vLig[p] = lig;
 }
 public int getTL() 
 {
 return TL;
 }
 public void setTL(int TL) 
 {
 this.TL = TL;
 }
 
 int procuraPos (int info)
 {
 int i=0;
 while (i<TL && info > vInfo[i] )
 {
 i++;
 }
 return i; 
 }
 
 public void remaneja (int pos)
 {
 int i;
 
 vLig[TL+1] = vLig [TL];
 for(i = TL ; i > pos ; i-- )
 {
 vInfo[i] = vInfo[i-1];
 vPos[i] = vPos[i-1];
 vLig[i] = vLig[i-1]; 
 }
 }
 
 
}
TrabalhoPOII/ArvoreB mod and/src/arvoreb/Principal.java
package arvoreb;
import java.util.Scanner;
public class Principal 
{
 public static void main(String[] args) 
 {
 Scanner sc = new Scanner (System.in);
 int num;
 BTree b = new BTree();
 
 System.out.println("## Menu ##\n");
 System.out.println("\n[1]Inserir Elementos");
 System.out.println("\n[2]Excluir Elementos");
 System.out.println("\n[3]Exibir In Ordem");
 System.out.println("\n[0]Sair");
 
 num = sc.nextInt();
 
 while(num!=0)
 {
 switch(num)
 {
 case 1:
 while(num!=0)
 {
 System.out.println("Inserir Elemento: ");
 num = sc.nextInt();
 if(num!=0)
 b.insereArvore(num, num);
 }
 
 
 break;
 case 2:
 while(num!=0)
 {
 System.out.println("\nExcluir Elemento: ");
 num = sc.nextInt();
 if(num!=0)
 b.remover(num);
 }
 break;
 case 3:
 No p = b.getRaiz();
 b.exibeInOrdem();
 break;
 case 0:
 num=0;
 break;
 }
 System.out.println("\n## Menu ##");
 System.out.println("\n[1]Inserir Elementos");
 System.out.println("\n[2]Excluir Elementos");
 System.out.println("\n[3]Exibir In Ordem");
 System.out.println("\n[0]Sair\n");
 num = sc.nextInt();
 }
 
 
 
 
 /*
 System.out.println("Inserir Elemento: ");
 num = sc.nextInt();
 while(num!=0)
 {
 b.insereArvore(num, num);
 System.out.println("Inserir Elemento: (0-Sair)");
 num = sc.nextInt();
 }
 
 b.exibeInOrdem();
 
 System.out.println("\nExcluir Elemento: ");
 num = sc.nextInt();
 while(num!=0)
 {
 b.remover(num);
 No p = b.getRaiz();
 b.exibeInOrdem();
 System.out.println("\nExcluir Elemento: (0 - Sair) ");
 num = sc.nextInt();
 }
 
 */
 }
 
}
TrabalhoPOII/Arvores/.git/FETCH_HEAD
edfcf1b92b6d764755f7806c84b73007cfd297c8	not-for-merge	branch 'master' of https://jamdes%40hotmail.com@github.com/SoRRiSoJa/Arvores.git
TrabalhoPOII/Arvores/.git/HEAD
ref: refs/heads/master
TrabalhoPOII/Arvores/.git/config
[pack]
	buildbitmaps = false
[core]
	symlinks = false
	repositoryformatversion = 0
	filemode = false
	logallrefupdates = true
	bare = false
[remote "origin"]
	url = https://jamdes%40hotmail.com@github.com/SoRRiSoJa/Arvores.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
TrabalhoPOII/Arvores/.git/index
TrabalhoPOII/Arvores/.git/logs/HEAD
edfcf1b92b6d764755f7806c84b73007cfd297c8 eb62f94a5b2fa03b3c6bc26712f9339292990012 Aluno <Aluno@LS004m09-72455> 1496184043 -0300	commit: In orden B+ alterado
eb62f94a5b2fa03b3c6bc26712f9339292990012 f3561bd16adc3ee7e9401ecdb71f1e41ad612c06 Aluno <Aluno@LS004m09-72455> 1496188090 -0300	commit: Narea dinâmica adicionada
TrabalhoPOII/Arvores/.git/logs/refs/heads/master
0000000000000000000000000000000000000000 edfcf1b92b6d764755f7806c84b73007cfd297c8 Aluno <Aluno@LS004m09-72455> 1496181858 -0300	branch: Created from branch refs/remotes/origin/master
edfcf1b92b6d764755f7806c84b73007cfd297c8 eb62f94a5b2fa03b3c6bc26712f9339292990012 Aluno <Aluno@LS004m09-72455> 1496184043 -0300	commit: In orden B+ alterado
eb62f94a5b2fa03b3c6bc26712f9339292990012 f3561bd16adc3ee7e9401ecdb71f1e41ad612c06 Aluno <Aluno@LS004m09-72455> 1496188090 -0300	commit: Narea dinâmica adicionada
TrabalhoPOII/Arvores/.git/logs/refs/remotes/origin/master
0000000000000000000000000000000000000000 edfcf1b92b6d764755f7806c84b73007cfd297c8 Aluno <Aluno@LS004m09-72455> 1496181858 -0300	fetch: created
edfcf1b92b6d764755f7806c84b73007cfd297c8 eb62f94a5b2fa03b3c6bc26712f9339292990012 Aluno <Aluno@LS004m09-72455> 1496184063 -0300	push: forced-update
eb62f94a5b2fa03b3c6bc26712f9339292990012 f3561bd16adc3ee7e9401ecdb71f1e41ad612c06 Aluno <Aluno@LS004m09-72455> 1496188127 -0300	push: forced-update
TrabalhoPOII/Arvores/.git/objects/02/064cfe008024907f93b574fc565ba3a5140c99
TrabalhoPOII/Arvores/.git/objects/04/ef18c07f91e349ac7ac43df99566135d1e9d4f
TrabalhoPOII/Arvores/.git/objects/10/f41800f3b711171adf30e3d79256484d51cf1b
TrabalhoPOII/Arvores/.git/objects/11/e22a20b0071287fa041e47b64b480f8b873c43
TrabalhoPOII/Arvores/.git/objects/16/1d92c5a259b600a77046e5326254098c8fe8cb
TrabalhoPOII/Arvores/.git/objects/24/34ba3405bc5e1d6e0153c3232f28e9532dad1c
TrabalhoPOII/Arvores/.git/objects/25/47f172a661be19bffe1fa812a9c1994ce1a9c1
TrabalhoPOII/Arvores/.git/objects/28/1d048a856810e1d5d6e7554f8d40d93cac2f94
TrabalhoPOII/Arvores/.git/objects/2a/59d8b50f3a2e2162caaba1b0a2766487567b3a
TrabalhoPOII/Arvores/.git/objects/2c/5c5c14db8c05a95c1d0e2332e65014bb9366b2
TrabalhoPOII/Arvores/.git/objects/2c/c50adaefc97ad1159f4c89b4fa1dc1fe864982
TrabalhoPOII/Arvores/.git/objects/39/2eb1e09a4f3b970b71fddeef7152387bb09899
TrabalhoPOII/Arvores/.git/objects/3a/30bc1b5ee615dce5f0c23c0e3b0c567cc0f74b
TrabalhoPOII/Arvores/.git/objects/44/87bdc2f0c15edbeceb50b4122a0e91ab407b24
TrabalhoPOII/Arvores/.git/objects/54/4ba40d0bd39814d9afc6f569befd76e0b4e3d4
TrabalhoPOII/Arvores/.git/objects/60/e0cda6138d39c7548ae5a6c93c419086548258
TrabalhoPOII/Arvores/.git/objects/64/1245f3d942a2dc75174207cc38eeaa85cd8be3
TrabalhoPOII/Arvores/.git/objects/79/9ba1d6c7208b95bd9191f3e8d8859362a4286c
TrabalhoPOII/Arvores/.git/objects/7c/c2b56b9fdff43a86b47211cae8080a42ef650f
TrabalhoPOII/Arvores/.git/objects/7d/85eeaed5e60c4d56123aa451e3aa23b140265d
TrabalhoPOII/Arvores/.git/objects/81/5f766fd4771bf084159cda5c0c8647ec02d057
TrabalhoPOII/Arvores/.git/objects/a0/c30ab8533e2905366120c6d1e052515c3ad885
TrabalhoPOII/Arvores/.git/objects/a5/6b8cce559fb5a9b82d4398ad0e7cda201a07fb
TrabalhoPOII/Arvores/.git/objects/b8/88b26e69821c077d03b759ef19b2dcfa679546
TrabalhoPOII/Arvores/.git/objects/ba/6dc3732c65cc9e31fe3063e48490f2d9970dd4
TrabalhoPOII/Arvores/.git/objects/c8/eab1fca0d90862497fe3e280d2378cf1099321
TrabalhoPOII/Arvores/.git/objects/c9/121d9f2d88a9a62bd2da8c492309e288dd6d39
TrabalhoPOII/Arvores/.git/objects/d6/59a3a7555f052122415b32b373efcab5c80dce
TrabalhoPOII/Arvores/.git/objects/d7/5cfb13bda7e7eafb88d88d5689e698f1fdae19
TrabalhoPOII/Arvores/.git/objects/da/82ba243b4614a8871be15c4c7d95ed6b833980
TrabalhoPOII/Arvores/.git/objects/df/0425ccea18e375469efba2f45c0e63c0e6b833
TrabalhoPOII/Arvores/.git/objects/e5/53884419c59d0db208bbfaf102c2aa24d4c081
TrabalhoPOII/Arvores/.git/objects/eb/62f94a5b2fa03b3c6bc26712f9339292990012
TrabalhoPOII/Arvores/.git/objects/f1/16a307d047a67a7f57459d74042e005ba0ede0
TrabalhoPOII/Arvores/.git/objects/f2/61df11b0d3653d508e655ac076008938543c32
TrabalhoPOII/Arvores/.git/objects/f3/561bd16adc3ee7e9401ecdb71f1e41ad612c06
TrabalhoPOII/Arvores/.git/objects/f9/515cc764705865fb399dc4557a0349940c6c0e
TrabalhoPOII/Arvores/.git/objects/fc/d343a5851a4eb291e932a1751066907214d802
TrabalhoPOII/Arvores/.git/objects/pack/pack-0f090c03c553ec4293d3cbe06a2e668e959e2ee9.idx
TrabalhoPOII/Arvores/.git/objects/pack/pack-0f090c03c553ec4293d3cbe06a2e668e959e2ee9.pack
TrabalhoPOII/Arvores/.git/refs/heads/master
f3561bd16adc3ee7e9401ecdb71f1e41ad612c06
TrabalhoPOII/Arvores/.git/refs/remotes/origin/master
f3561bd16adc3ee7e9401ecdb71f1e41ad612c06
TrabalhoPOII/Arvores/build.xml
 
 Builds, tests, and runs the project POArvores.
 
 
TrabalhoPOII/Arvores/build/built-jar.properties
#Tue, 30 May 2017 19:39:21 -0300
C\:\\Users\\Aluno\\Documents\\NetBeansProjects\\Arvores=
TrabalhoPOII/Arvores/build/classes/.netbeans_automatic_build
TrabalhoPOII/Arvores/build/classes/.netbeans_update_resources
TrabalhoPOII/Arvores/build/classes/BPtree/BPNode.class
TrabalhoPOII/Arvores/build/classes/BPtree/BTPlus.class
TrabalhoPOII/Arvores/build/classes/BPtree/Param.class
TrabalhoPOII/Arvores/build/classes/Btree/BTNode.class
TrabalhoPOII/Arvores/build/classes/Btree/BTree.class
TrabalhoPOII/Arvores/build/classes/NArea/DNarea.class
TrabalhoPOII/Arvores/build/classes/NArea/ListInfo.class
TrabalhoPOII/Arvores/build/classes/NArea/ListInfoNo.class
TrabalhoPOII/Arvores/build/classes/NArea/ListLig.class
TrabalhoPOII/Arvores/build/classes/NArea/ListLigNo.class
TrabalhoPOII/Arvores/build/classes/NArea/NArea.class
TrabalhoPOII/Arvores/build/classes/NArea/NNDarea.class
TrabalhoPOII/Arvores/build/classes/NArea/Node.class
TrabalhoPOII/Arvores/build/classes/poarvores/POArvores.class
TrabalhoPOII/Arvores/dist/POArvores.jar
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.4
Created-By: 1.8.0_91-b15 (Oracle Corporation)
Class-Path: 
X-COMMENT: Main-Class will be added automatically by build
Main-Class: poarvores.POArvores
BPtree/BPNode.class
BPtree/BTPlus.class
BPtree/Param.class
Btree/BTNode.class
Btree/BTree.class
NArea/NArea.class
NArea/Node.class
poarvores/POArvores.class
TrabalhoPOII/Arvores/dist/README.TXT
========================
BUILD OUTPUT DESCRIPTION
========================
When you build an Java application project that has a main class, the IDE
automatically copies all of the JAR
files on the projects classpath to your projects dist/lib folder. The IDE
also adds each of the JAR files to the Class-Path element in the application
JAR files manifest file (MANIFEST.MF).
To run the project from the command line, go to the dist folder and
type the following:
java -jar "POArvores.jar" 
To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.
Notes:
* If two JAR files on the project classpath have the same name, only the first
JAR file is copied to the lib folder.
* Only JAR files are copied to the lib folder.
If the classpath contains other types of files or folders, these files (folders)
are not copied.
* If a library on the projects classpath also has a Class-Path element
specified in the manifest,the content of the Class-Path element has to be on
the projects runtime path.
* To set a main class in a standard Java project, right-click the project node
in the Projects window and choose Properties. Then click Run and enter the
class name in the Main Class field. Alternatively, you can manually type the
class name in the manifest Main-Class element.
TrabalhoPOII/Arvores/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
TrabalhoPOII/Arvores/nbproject/build-impl.xml
Must set src.dir
 Must set test.src.dir
 Must set build.dir
 Must set dist.dir
 Must set build.classes.dir
 Must set dist.javadoc.dir
 Must set build.test.classes.dir
 Must set build.test.results.dir
 Must set build.classes.excludes
 Must set dist.jar
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must set javac.includes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 No tests executed.
Must set JVM to use for profiling in profiler.info.jvm
 Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select some files in the IDE or set javac.includes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 To run this application from the command line without Ant, try:
 
 java -jar "${dist.jar.resolved}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set run.class
 
 
 
 Must select one file in the IDE or set run.class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set debug.class
 
 
 
 
 Must select one file in the IDE or set debug.class
 
 
 
 
 Must set fix.includes
 
 
 
 
 
 
 
 
 
 This target only works when run from inside the NetBeans IDE.
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set profile.class
 This target only works when run from inside the NetBeans IDE.
 
 
 
 
 
 
 
 
 This target only works when run from inside the NetBeans IDE.
 
 
 
 
 
 
 
 
 
 
 
 
 This target only works when run from inside the NetBeans IDE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set run.class
 
 
 
 
 
 Must select some files in the IDE or set test.includes
 
 
 
 
 Must select one file in the IDE or set run.class
 
 
 
 
 Must select one file in the IDE or set applet.url
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select some files in the IDE or set javac.includes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Some tests failed; see details above.
 
 
 
 
 
 
 
 
 Must select some files in the IDE or set test.includes
 
 
 
 Some tests failed; see details above.
 
 
 
 Must select some files in the IDE or set test.class
 Must select some method in the IDE or set test.method
 
 
 
 Some tests failed; see details above.
 
 
 
 
 Must select one file in the IDE or set test.class
 
 
 
 Must select one
file in the IDE or set test.class
 Must select some method in the IDE or set test.method
 
 
 
 
 
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set applet.url
 
 
 
 
 
 
 
 
 Must select one file in the IDE or set applet.url
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
TrabalhoPOII/Arvores/nbproject/genfiles.properties
build.xml.data.CRC32=9f46c0e1
build.xml.script.CRC32=41bdee6f
build.xml.stylesheet.CRC32=8064a381@1.80.1.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=9f46c0e1
nbproject/build-impl.xml.script.CRC32=be0f2ab9
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
TrabalhoPOII/Arvores/nbproject/private/private.properties
compile.on.save=true
user.properties.file=C:\\Users\\Aluno\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
TrabalhoPOII/Arvores/nbproject/private/private.xml
 
 
 
 
 file:/D:/Arvores/src/poarvores/POArvores.java
 file:/D:/Arvores/src/BPtree/BTPlus.java
 file:/D:/Arvores/src/BPtree/BPNode.java
 
 
TrabalhoPOII/Arvores/nbproject/project.properties
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
 ${run.classpath}
debug.test.classpath=\
 ${run.test.classpath}
# Os arquivos em build.classes.dir que devem ser exclu\u00eddos do jar de distribui\u00e7\u00e3o
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/POArvores.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
includes=**
jar.compress=false
javac.classpath=
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.processorpath=\
 ${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
 ${javac.classpath}:\
 ${build.classes.dir}
javac.test.processorpath=\
 ${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=poarvores.POArvores
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
 ${javac.classpath}:\
 ${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
 ${javac.test.classpath}:\
 ${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
TrabalhoPOII/Arvores/nbproject/project.xml
 
 org.netbeans.modules.java.j2seproject
 
 
 POArvores
 
 
 
 
 
 
 
 
TrabalhoPOII/Arvores/src/BPtree/BPNode.java
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package BPtree;
/**
 *
 * @author joao
 */
public class BPNode implements Param {
 private int[] vInfo;
 private BPNode[] vLig;
 private BPNode ant;
 private BPNode prox;
 private int tl;
 public BPNode() {
 this.vInfo = new int[N * 2 + 1];
 this.vLig = new BPNode[N * 2 + 2];
 this.ant = this.prox = null;
 for (int i = 0; i < N * 2 + 2; i++) {
 this.vLig[i] = null;
 }
 this.tl = 0;
 }
 public BPNode(int info) {
 this.vInfo = new int[N * 2 + 1];
 this.vLig = new BPNode[N * 2 + 2];
 this.ant = this.prox = null;
 for (int i = 0; i < N * 2 + 2; i++) {
 this.vLig[i] = null;
 }
 this.vInfo[0] = info;
 this.tl = 1;
 }
 public void exibeNo(){
 for(int i=0;i<tl;i++){
 System.out.println("["+vInfo[i]+"]");
 }
 }
 public void setInfo(int pos, int info) {
 this.vInfo[pos] = info;
 }
 public int getInfo(int pos) {
 return this.vInfo[pos];
 }
 public void setLig(int pos, BPNode no) {
 this.vLig[pos] = no;
 }
 public BPNode getLig(int pos) {
 return this.vLig[pos];
 }
 public void setTl(int tl) {
 this.tl = tl;
 }
 public int getTl() {
 return tl;
 }
 /*Retorna a posição no vetor vInfo para uma info
 * int procuraPosicao(int)
 * @param info
 * Retorna inteiro com a posição do vetor de informações para a informação do nó
 */
 public int procuraPosicao(int info) {
 int i = 0;
 while (i < getTl() && info > getInfo(i)) {
 i++;
 }
 return i;
 }
 /*Remaneja de o vetor de informações para etapa de operação de inserção
 * void remanejaInvertido(int)
 * @param pos
 */
 public void remaneja(int pos) {
 vLig[tl + 1] = vLig[tl];
 for (int i = tl; i > pos; i--) {
 vInfo[i] = vInfo[i - 1];
 vLig[i] = vLig[i - 1];
 }
 }
 public void remanejaSplit(int info) {
 int pos = info;
 while (pos < tl - 1) {
 vInfo[pos] = vInfo[pos + 1];
 vLig[pos] = vLig[pos + 1];
 pos++;
 }
 }
 /*Remaneja de forma inversa o vetor de informações para etapa de operação de exclusao
 * void remanejaInvertido(int)
 * @param pos
 */
 public void remanejaInvertido(int info) {
 int pos = procuraPosicao(info);
 while (pos < tl) {
 vInfo[pos] = vInfo[pos + 1];
 vLig[pos] = vLig[pos + 1];
 pos++;
 }
 tl--;
 }
 /*Retorna se um nó é uma folha
 boolean isFolha()
 * Retorna true para nó com 0 ligações
 */
 public boolean isFolha() {
 return (vLig[0] == null);
 }
 public BPNode getAnt() {
 return ant;
 }
 public void setAnt(BPNode ant) {
 this.ant = ant;
 }

Teste o Premium para desbloquear

Aproveite todos os benefícios por 3 dias sem pagar! 😉
Já tem cadastro?

Continue navegando