Buscar

Arvore Narea, BTree ,BTree+ em Java

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

POArvores/.git/COMMIT_EDITMSG
Primeiro commit!
POArvores/.git/HEAD
ref: refs/heads/master
POArvores/.git/config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = https://github.com/SoRRiSoJa/Arvores.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
POArvores/.git/description
Unnamed repository; edit this file 'description' to name the repository.
POArvores/.git/hooks/applypatch-msg.sample
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".
. git-sh-setup
test -x "$GIT_DIR/hooks/commit-msg" &&
	exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
:
POArvores/.git/hooks/commit-msg.sample
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
test "" = "$(grep '^Signed-off-by: ' "$1" |
	 sort | uniq -c | sed -e '/^[ 	]*1[ 	]/d')" || {
	echo >&2 Duplicate Signed-off-by lines.
	exit 1
}
POArvores/.git/hooks/post-update.sample
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
exec git update-server-info
POArvores/.git/hooks/pre-applypatch.sample
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".
. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
	exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
:
POArvores/.git/hooks/pre-commit.sample
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
then
	against=HEAD
else
	# Initial commit: diff against an empty tree object
	against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
	# Note that the use of brackets around a tr range is ok here, (it's
	# even required, for portability to Solaris 10's /usr/bin/tr), since
	# the square bracket bytes happen to fall in the designated range.
	test $(git diff --cached --name-only --diff-filter=A -z $against |
	 LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
	cat <<\EOF
Error: Attempt to add a non-ASCII file name.
This can cause problems if you want to work with people on other platforms.
To be portable it is advisable to rename the file.
If you know what you are doing you can disable this check using:
 git config hooks.allownonascii true
EOF
	exit 1
fi
# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
POArvores/.git/hooks/pre-push.sample
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local sha1> <remote ref> <remote sha1>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).
remote="$1"
url="$2"
z40=0000000000000000000000000000000000000000
IFS=' '
while read local_ref local_sha remote_ref remote_sha
do
	if [ "$local_sha" = $z40 ]
	then
		# Handle delete
		:
	else
		if [ "$remote_sha" = $z40 ]
		then
			# New branch, examine all commits
			range="$local_sha"
		else
			# Update to existing branch, examine new commits
			range="$remote_sha..$local_sha"
		fi
		# Check for WIP commit
		commit=`git rev-list -n 1 --grep '^WIP' "$range"`
		if [ -n "$commit" ]
		then
			echo "Found WIP commit in $local_ref, not pushing"
			exit 1
		fi
	fi
done
exit 0
POArvores/.git/hooks/pre-rebase.sample
#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.
publish=next
basebranch="$1"
if test "$#" = 2
then
	topic="refs/heads/$2"
else
	topic=`git symbolic-ref HEAD` ||
	exit 0 ;# we do not interrupt rebasing detached HEAD
fi
case "$topic" in
refs/heads/??/*)
	;;
*)
	exit 0 ;# we do not interrupt others.
	;;
esac
# Now we are dealing with a topic branch being rebased
# on top of master. Is it OK to rebase it?
# Does the topic really exist?
git show-ref -q "$topic" || {
	echo >&2 "No such branch $topic"
	exit 1
}
# Is topic fully merged to master?
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
if test -z "$not_in_master"
then
	echo >&2 "$topic is fully merged to master; better remove it."
	exit 1 ;# we could allow it, but there is no point.
fi
# Is topic ever merged to next? If so you should not be rebasing it.
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
only_next_2=`git rev-list ^master ${publish} | sort`
if test "$only_next_1" = "$only_next_2"
then
	not_in_topic=`git rev-list "^$topic" master`
	if test -z "$not_in_topic"
	then
		echo >&2 "$topic is already up-to-date with master"
		exit 1 ;# we could allow it, but there is no point.
	else
		exit 0
	fi
else
	not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
	/usr/bin/perl -e '
		my $topic = $ARGV[0];
		my $msg = "* $topic has commits already merged to public branch:\n";
		my (%not_in_next) = map {
			/^([0-9a-f]+) /;
			($1 => 1);
		} split(/\n/, $ARGV[1]);
for my $elem (map {
				/^([0-9a-f]+) (.*)$/;
				[$1 => $2];
			} split(/\n/, $ARGV[2])) {
			if (!exists $not_in_next{$elem->[0]}) {
				if ($msg) {
					print STDERR $msg;
					undef $msg;
				}
				print STDERR " $elem->[1]\n";
			}
		}
	' "$topic" "$not_in_next" "$not_in_master"
	exit 1
fi
<<\DOC_END
This sample hook safeguards topic branches that have been
published from being rewound.
The workflow assumed here is:
 * Once a topic branch forks from "master", "master" is never
 merged into it again (either directly or indirectly).
 * Once a topic branch is fully cooked and merged into "master",
 it is deleted. If you need to build on top of it to correct
 earlier mistakes, a new topic branch is created by forking at
 the tip of the "master". This is not strictly necessary, but
 it makes it easier to keep your history simple.
 * Whenever you need to test or publish your changes to topic
 branches, merge them into "next" branch.
The script, being an example, hardcodes the publish branch name
to be "next", but it is trivial to make it configurable via
$GIT_DIR/config mechanism.
With this workflow, you would want to know:
(1) ... if a topic branch has ever been merged to "next". Young
 topic branches can have stupid mistakes you would rather
 clean up before publishing, and things that have not been
 merged into other branches can be easily rebased without
 affecting other people. But once it is published, you would
 not want to rewind it.
(2) ... if a topic branch has been fully merged to "master".
 Then you can delete it. More importantly, you should not
 build on top of it -- other people may already want to
 change things related to the topic as patches against your
 "master", so if you need further changes, it is better to
 fork the topic (perhaps with the same name) afresh from the
 tip of "master".
Let's look at this example:
		 o---o---o---o---o---o---o---o---o---o "next"
		 / / / /
		 / a---a---b A / /
		/ / / /
	 / / c---c---c---c B /
	 / / / \ /
	 / / / b---b C \ /
	 / / / / \ /
 ---o---o---o---o---o---o---o---o---o---o---o "master"
A, B and C are topic branches.
 * A has one fix since it was merged up to "next".
 * B has finished. It has been fully merged up to "master" and "next",
 and is ready to be deleted.
 * C has not merged to "next" at all.
We would want to allow C to be rebased, refuse A, and encourage
B to be deleted.
To compute (1):
	git rev-list ^master ^topic next
	git rev-list ^master next
	if these match, topic has not merged in next at all.
To compute (2):
	git rev-list master..topic
	if this is empty, it is fully merged to "master".
DOC_END
POArvores/.git/hooks/prepare-commit-msg.sample
#!/bin/sh
#
# An example hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg".
# This hook includes three examples. The first comments out the
# "Conflicts:" part of a merge commit.
#
# The second includes the output of "git diff --name-status -r"
# into the message, just before the "git status" output. It is
# commented because it doesn't cope with --amend or with squashed
# commits.
#
# The third example adds a Signed-off-by line to the message, that can
# still be edited. This is rarely a good idea.
case "$2,$3" in
 merge,)
 /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
# ,|template,)
# /usr/bin/perl -i.bak -pe '
# print "\n" . `git diff --cached --name-status -r`
#	 if /^#/ && $first++ == 0' "$1" ;;
 *) ;;
esac
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
POArvores/.git/hooks/update.sample
#!/bin/sh
#
# An example hook script to blocks unannotated tags from entering.
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
#
# To enable this hook, rename this file to "update".
#
# Config
# ------
# hooks.allowunannotated
# This boolean sets whether unannotated tags will be allowed into the
# repository. By default they won't be.
# hooks.allowdeletetag
# This boolean sets whether deleting tags will be allowed in the
# repository. By default they won't be.
# hooks.allowmodifytag
# This boolean sets whether a tag may be modified after creation. By default
# it won't be.
# hooks.allowdeletebranch
# This boolean sets whether deleting branches will be allowed in the
# repository. By default they won't be.
# hooks.denycreatebranch
# This boolean sets whether remotely creating branches will be denied
# in the repository. By default this is allowed.
#
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
# --- Safety check
if [ -z "$GIT_DIR" ]; then
	echo "Don't run this script from the command line." >&2
	echo " (if you want, you could supply GIT_DIR then run" >&2
	echo " $0 <ref> <oldrev> <newrev>)" >&2
	exit 1
fi
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
	echo "usage: $0 <ref> <oldrev> <newrev>" >&2
	exit 1
fi
# --- Config
allowunannotated=$(git config --bool hooks.allowunannotated)
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
denycreatebranch=$(git config --bool hooks.denycreatebranch)
allowdeletetag=$(git config --bool hooks.allowdeletetag)
allowmodifytag=$(git config --bool hooks.allowmodifytag)
# check for no description
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
case "$projectdesc" in
"Unnamed repository"* | "")
	echo "*** Project description file hasn't been set" >&2
	exit 1
	;;
esac
# --- Check types
# if $newrev is 0000...0000, it's a commit to delete a ref.
zero="0000000000000000000000000000000000000000"
if [ "$newrev" = "$zero" ]; then
	newrev_type=delete
else
	newrev_type=$(git cat-file -t $newrev)
fi
case "$refname","$newrev_type" in
	refs/tags/*,commit)
		# un-annotated tag
		short_refname=${refname##refs/tags/}
		if [ "$allowunannotated" != "true" ]; then
			echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
			echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
			exit 1
		fi
		;;
	refs/tags/*,delete)
		# delete tag
		if [ "$allowdeletetag" != "true" ]; then
			echo "*** Deleting a tag is not allowed in this repository" >&2
			exit 1
		fi
		;;
	refs/tags/*,tag)
		# annotated tag
		if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
		then
			echo "*** Tag '$refname' already exists." >&2
			echo "*** Modifying a tag is not allowed in this repository." >&2
			exit 1
		fi
		;;
	refs/heads/*,commit)
		# branch
		if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
			echo "*** Creating a branch is not allowed in this repository" >&2
			exit 1
		fi
		;;
	refs/heads/*,delete)
		# delete branch
		if [ "$allowdeletebranch" != "true" ]; then
			echo "*** Deleting a branch is not allowed in this repository" >&2
			exit 1
		fi
		;;
	refs/remotes/*,commit)
		# tracking branch
		;;
	refs/remotes/*,delete)
		# delete tracking branch
		if [ "$allowdeletebranch" != "true" ]; then
			echo "*** Deleting a tracking branch is not allowed in this repository" >&2
			exit 1
		fi
		;;
	*)
		# Anything else (is there anything else?)
		echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
		exit 1
		;;
esac
# --- Finished
exit 0
POArvores/.git/index
POArvores/.git/info/exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
POArvores/.git/logs/HEAD
0000000000000000000000000000000000000000 edfcf1b92b6d764755f7806c84b73007cfd297c8 Joao andre Martins <joao@joaoDesk> 1496101382 -0300	commit (initial): Primeiro commit!
POArvores/.git/logs/refs/heads/master
0000000000000000000000000000000000000000 edfcf1b92b6d764755f7806c84b73007cfd297c8 Joao andre Martins <joao@joaoDesk> 1496101382 -0300	commit (initial): Primeiro commit!
POArvores/.git/logs/refs/remotes/origin/master
0000000000000000000000000000000000000000 edfcf1b92b6d764755f7806c84b73007cfd297c8 Joao andre Martins <joao@joaoDesk> 1496101617 -0300	update by push
POArvores/.git/objects/03/e80c8f54ba6c1541bbb08b6115f475a42d9e6d
POArvores/.git/objects/10/7c2b6deeb81ea785bccc6ecbf584aaecefa570
POArvores/.git/objects/13/867da52f4e279e9e9284bfea20c6670cecfc5d
POArvores/.git/objects/15/bf15d650bf6d4762dc490ab746317a58b43f72
POArvores/.git/objects/19/92f9c0c802a45dcec4da4876a03c735ec3725d
POArvores/.git/objects/1a/0a5b0448530fbec1d5de80e994110d679e3975
POArvores/.git/objects/20/4cc7ccc4af42f928980f335654deafa4aeee70
POArvores/.git/objects/24/58cc670553c9439bfb69f3e56e9ec34fbb7510
POArvores/.git/objects/2c/fbbf58e2e5677f47eab8675587024996c39a28
POArvores/.git/objects/32/8e8e5bc3b7f1f7bad2bc0751a933e00c801983
POArvores/.git/objects/36/7a7edd658e5f79cbff2a9f130b36796c28be0d
POArvores/.git/objects/39/ddaed3a8ffb3d4c3527d69eef39e6bacd6d42f
POArvores/.git/objects/44/c864e833d1d521c3aa9ec298fb97f1c500906f
POArvores/.git/objects/47/182face5bb9a9f1f780837b952f39f37f772b0
POArvores/.git/objects/47/1d1fa1ba32181380fc83e740c0002dfa695215
POArvores/.git/objects/48/9a583ed1243923e3bbaffcc8fdc26bd51cacc5
POArvores/.git/objects/4a/de473235502219198e8ce14d94c8b7b8531b2e
POArvores/.git/objects/50/bbdff21d1d389186d13ad585e07fa0bd306275
POArvores/.git/objects/51/c95a3c5cdea784f59a3889af580431ab862aa5
POArvores/.git/objects/57/f2b1060a650a3e497417a271b6696a5fba3de0
POArvores/.git/objects/5d/efdc98f152f62d55a6d1ca51bdd69d1c6cb84c
POArvores/.git/objects/68/07a2ba1902a255b464065dd83188d73fbe6d01
POArvores/.git/objects/74/d59e87d52d8be27976057644488a827fb06af1
POArvores/.git/objects/78/739be0d0c15204559c14ffca4752636369f5d3
POArvores/.git/objects/7a/4e8c89c1645adf9299f0ed25b9fc550d156183
POArvores/.git/objects/80/dce99235c8b5f269200cf8a629162e455dafe8
POArvores/.git/objects/93/72cbbb109ff79113f392806debca283dc8bd9e
POArvores/.git/objects/97/81d3c9ef3ee3be5150dd4a4620827b3c2d2c32
POArvores/.git/objects/9e/c333b92228b75fd9609957d5bfc63466d7aeaf
POArvores/.git/objects/b0/b47e0723b37b35d100c63fcac093edf687a965
POArvores/.git/objects/b0/ea131a5bec2555aa5758123edd1735895f5141
POArvores/.git/objects/b2/f879cec11d0dd135321f263346c66a5fce49ea
POArvores/.git/objects/b7/61b891c5ddbf0047061873c5945808270c2c8d
POArvores/.git/objects/b7/64ecabba5a874865831e3eeccd9197ecd60107
POArvores/.git/objects/ba/adf72181a743ae64968f3434dac82349f4c42b
POArvores/.git/objects/bd/1f38829c5d9029f235212dd77b18bd94c498ca
POArvores/.git/objects/c3/220903a38e170650fd914526b22d897af4a58c
POArvores/.git/objects/d1/1295641ef4c0993b070474f2503342bd9ac249
POArvores/.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
POArvores/.git/objects/ed/fcf1b92b6d764755f7806c84b73007cfd297c8
POArvores/.git/objects/f0/055a7d303fe21e83c27d9c5f9903330828d260
POArvores/.git/objects/f4/6b5c2ef8555377706576ea72ffa7e1ce713cc5
POArvores/.git/objects/f5/7af0c8374424d9d91331a2143e3549544fb006
POArvores/.git/objects/f9/281e2474833439e5bb41d5fb59a116e0c608d6
POArvores/.git/refs/heads/master
edfcf1b92b6d764755f7806c84b73007cfd297c8
POArvores/.git/refs/remotes/origin/master
edfcf1b92b6d764755f7806c84b73007cfd297c8
POArvores/build.xml
 
 Builds, tests, and runs the project POArvores.
 
 
POArvores/build/built-jar.properties
#Mon, 29 May 2017 20:28:14 -0300
/home/joao/NetBeansProjects/POArvores=
POArvores/build/classes/.netbeans_automatic_build
POArvores/build/classes/.netbeans_update_resources
POArvores/build/classes/BPtree/BPNode.class
POArvores/build/classes/BPtree/BTPlus.class
POArvores/build/classes/BPtree/Param.class
POArvores/build/classes/Btree/BTNode.class
POArvores/build/classes/Btree/BTree.class
POArvores/build/classes/NArea/NArea.class
POArvores/build/classes/NArea/Node.class
POArvores/build/classes/poarvores/POArvores.class
POArvores/dist/POArvores.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: 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
POArvores/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.
POArvores/manifest.mf
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
POArvores/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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
POArvores/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
POArvores/nbproject/private/private.properties
compile.on.save=true
user.properties.file=/home/joao/.netbeans/8.2/build.properties
POArvores/nbproject/private/private.xml
 
 
 
 
 
POArvores/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
POArvores/nbproject/project.xml
 
 org.netbeans.modules.java.j2seproject
 
 
 POArvores
 
 
 
 
 
 
 
 
POArvores/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 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;
 }
 public BPNode getProx() {
 return prox;
 }
 public void setProx(BPNode prox) {
 this.prox = prox;
 }
}
POArvores/src/BPtree/BTPlus.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 BTPlus implements Param {
 private BPNode raiz;
 public BTPlus() {
 this.raiz = null;
 }
 /* Retorna o nodo folha com a informação em info
 * BPNode navega_ate_folha(int)
 * @param info
 * Retorna o nodo folha em que se encontra a informação
 */
 public BPNode navega_ate_folha(int info) {
 BPNode p = raiz;
 int i = 0;
 while (p.getLig(0) != null && p.getInfo(i) != info) {
 i = 0;
 while (i < p.getTl() && info > p.getInfo(i)) {
 i++;
 }
 if (p.getInfo(i) != info) {
 p = p.getLig(i);
 }
 }
 return p;
 }
 /* Retorna o nodo pai para folha com a informação info
 * BPNode localizaPai(BPNode, int)
 * @param folha
 * @param info
 * Retorna o nodo pai para o nodo folha com a info
 */
 public BPNode localizaPai(BPNode folha, int info) {
 BPNode p = raiz, pai = p;
 int i;
 while (p != folha) {
 i = 0;
 while (i < p.getTl() && info > p.getInfo(i)) {
 i++;
 }
 pai = p;
 p = p.getLig(i);
 }
 return pai;
 }
 private void split(BPNode folha, BPNode pai, int info) {
 BPNode caixa1, caixa2, cxProx, cxAnt;
 int i, pos, n = N;
 int TL1;
 caixa1 = new BPNode();
 caixa2 = new BPNode();
 if (folha.isFolha()) {
 TL1 = (int) Math.round((n - 1) / 2.0);//parte inteira
 } else {
 TL1 = (int) Math.round((n / 2.0) - 1);//arredondamento para cima
 }
 for (i = 0; i < TL1; i++)//cria /menores pra caixa 1
 {
 caixa1.setInfo(i, folha.getInfo(i));
 caixa1.setLig(i, folha.getLig(i));
 }
 caixa1.setTl(i);
 caixa1.setLig(caixa1.getTl() - 1, folha.getLig(caixa1.getTl() - 1));
 int j = 0;
 for (; i < n; i++)//restante caixa 2
 {
 caixa2.setInfo(j, folha.getInfo(i));
 caixa2.setLig(j, folha.getLig(i));
 j++;
 }
 caixa2.setLig(j, folha.getLig(n - 1));
 caixa2.setTl(j);
 if (pai == folha) // primeiro split
 {
 if (folha.isFolha()) {
 folha.setInfo(0, caixa2.getInfo(0)); // insere na folha o menor eelmenento da 2 caixa 
 folha.setLig(0, caixa1);// liga na posicao 0 a caixa 1
 folha.setLig(1, caixa2);// posicao 1 caixa 2
 caixa1.setProx(caixa2);
 folha.setTl(1);
 } else {
 folha.setInfo(0, caixa2.getInfo(0));
 folha.setLig(0, caixa1); //liga as caixa 1 e 2 
 folha.setLig(1, caixa2);
 caixa1.setProx(caixa2);
 folha.setTl(2);
 caixa2.remanejaSplit(0);
 caixa2.setTl(caixa2.getTl() - 1);
 }
 } else {
 info = caixa2.getInfo(0);// pega o menor valor
 pos = pai.procuraPosicao(info);// procura posicao
 cxProx = pai.getLig(pos + 1);// para pegar o N da PROXIMA posicao
 pai.remaneja(pos);
 pai.setTl(pai.getTl() + 1);
 pai.setInfo(pos, info);
 pai.setLig(pos, caixa1);
 pai.setLig(pos + 1, caixa2);
 caixa1.setProx(caixa2);
 if (pos == 0)// INICIO
 {
 caixa2.setProx(cxProx);
 } else {
 cxAnt = pai.getLig(pos - 1);// pega o no anterior
 cxAnt.setProx(caixa1);
 caixa2.setProx(cxProx);
 }
 if (pai.getTl() > n)//overflow
 {
 folha = pai;
 pai = localizaPai(pai, info);
 split(folha, pai, info);
 }
 }
 }
 public void insere(int info) {
 BPNode no, pai;
 int pos;
 if (raiz == null) {
 raiz = new BPNode(info);
 } else {
 no = navega_ate_folha(info);
 pos = no.procuraPosicao(info);
 no.remaneja(pos);
 no.setTl(no.getTl() + 1);
 no.setInfo(pos, info);
 if (no.getTl() > N - 1)// N é sempre para LIGAÇÃO !
 {
 pai = localizaPai(no, info);
 split(no, pai, info);
 }
 }
 }
 public void inOrden(BPNode raiz) {
 if (raiz != null) {
 for (int i = 0; i < raiz.getTl(); i++) {
 inOrden(raiz.getLig(i));
 System.out.println("Aqui:" + raiz.getInfo(i));
 }
 inOrden(raiz.getLig(raiz.getTl()));
 }
 }
 public BPNode getRaiz(){
 return this.raiz;
 }
}
POArvores/src/BPtree/Param.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 interface Param {
 public static final int N=5;
}
POArvores/src/Btree/BTNode.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 Btree;
import BPtree.Param;
/**
 *
 * @author joao
 */
public class BTNode implements Param {
 private int[] vInfo;
 private int[] vPos;
 private BTNode[] vLig;
 private int tl;
 public BTNode() {
 this.vInfo = new int[N * 2 + 1];
 this.vPos = new int[N * 2 + 1];
 this.vLig = new BTNode[N * 2 + 2];
 for (int i = 0; i < N * 2 + 2; i++) {
 this.vLig[i] = null;
 }
 this.tl = 0;
 }
 public BTNode(int info, int pos) {
 this.vInfo = new int[N * 2 + 1];
 this.vPos = new int[N * 2 + 1];
 this.vLig = new BTNode[N * 2 + 2];
 for (int i = 0; i < N * 2 + 2; i++) {
 this.vLig[i] = null;
 }
 this.vInfo[0] = info;
 this.vPos[0] = pos;
 this.tl = 0;
 }
 public void setInfo(int pos, int info) {
 this.vInfo[pos] = info;
 }
 public void setPos(int pos, int info) {
 this.vPos[pos] = info;
 }
 public int getInfo(int pos) {
 return this.vInfo[pos];
 }
 public int getPos(int pos) {
 return this.vPos[pos];
 }
 public void setLig(int pos, BTNode no) {
 this.vLig[pos] = no;
 }
 public BTNode 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];
 vPos[i] = vPos[i - 1];
 vLig[i] = vLig[i - 1];
 }
 }
 /*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];
 vPos[pos] = vPos[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 e N+1 elementos
 */
 public boolean isFolha() {
 return (vLig[0] == null && tl > N);
 }
}
POArvores/src/Btree/BTree.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 Btree;
import BPtree.Param;
/**
 *
 * @author joao
 */
public class BTree implements Param{
 private BTNode raiz;
 public BTree() {
 this.raiz = null;
 }
//--------------------------------------------------------------------------
 /* Navega até uma folha com a informação info
 * BTnode navegaAteFolha(int)
 * @param info
 * Retorna o nó da Arvore contendo a informação info
 */
 public BTNode navegaAteFolha(int info) {
 BTNode p = raiz;
 int i = 0;
 while (p.getLig(0) != null) {
 i = 0;
 while (i < p.getTl() && info > p.getInfo(i)) {
 i++;
 }
 if (p.getInfo(i) != info) {
 p = p.getLig(i);
 }
 }
 return p;
 }
//--------------------------------------------------------------------------
 /* Localiza o No Pai de Uma folha com a informação info
 * BTnode localizaPai(int,BTnode)
 * @param info
 * @param folha
 * Retorna o nó da Arvore contendo o nó pais para o nó folha
 */
 public BTNode localizaPai(int info, BTNode folha) {
 BTNode pai, p = raiz;
 int i;
 pai = p;
 while (p != folha) {
 i = 0;
 while (i < p.getTl() && info > p.getInfo(i)) {
 i++;
 }
 pai = p;
 p = p.getLig(i);
 }
 return pai;
 }
//--------------------------------------------------------------------------
 public void split(BTNode folha, BTNode pai, int info) {
 BTNode cx1 = new BTNode(), cx2 = new BTNode();
 int pos, infoAux, i;
 for (i = 0; i < N; i++) {
 cx1.setInfo(i, folha.getInfo(i));
 cx1.setPos(i, folha.getPos(i));
 cx1.setLig(i, folha.getLig(i));
 }
 cx1.setLig(N, folha.getLig(N));
 cx1.setTl(N);
 for (i = (N + 1); i < (2 * N + 1); i++) {
 cx2.setInfo((i - N + 1), folha.getInfo(i));
 cx2.setPos((i - N + 1), folha.getPos(i));
 cx2.setLig((i - N + 1), folha.getLig(i));
 }
 cx2.setLig(N, folha.getLig(i));
 cx2.setTl(N);
 if (pai == folha) {
 folha.setInfo(0, folha.getInfo(N));
 folha.setPos(0, folha.getPos(N));
 folha.setLig(0, cx1);
 folha.setLig(1, cx2);
 folha.setTl(1);
 } else {
 pos = pai.procuraPosicao(info);
 pai.remaneja(pos);
 pai.setTl(pai.getTl() + 1);
 pai.setInfo(pos, folha.getInfo(N));
 pai.setPos(pos, folha.getPos(N));
 pai.setLig(pos, cx1);
 pai.setLig(pos + 1, cx2);
 if (pai.getTl() > 2 * N) {
 folha = pai;
 infoAux = folha.getInfo(N);
 pai = localizaPai(info, pai);
 split(folha, pai, info);
 }
 }
 }
 //--------------------------------------------------------------------------
 /* Insere uma informação e sua respectiva posição no arquivo em uma BTree
 * void insere(int,int)
 * @param info
 * @param posArq
 */
 public void insere(int info, int posArq) {
 BTNode folha, pai;
 int pos;
 if (raiz == null) {
 raiz = new BTNode(info, posArq);
 } else {
 folha = navegaAteFolha(info);
 pos = folha.procuraPosicao(info);
 folha.remaneja(pos);
 folha.setTl(folha.getTl() + 1);
 folha.setInfo(pos, info);
 folha.setPos(pos, posArq);
 if (folha.getTl() > 2 * N) {
 pai = localizaPai(info, folha);
 split(folha, pai, info);
 }
 }
 }
 //--------------------------------------------------------------------------
 public void inOrden(BTNode raiz) {
 if (raiz != null) {
 for (int i = 0; i < raiz.getTl(); i++) {
 inOrden(raiz.getLig(i));
 System.out.print("[" + raiz.getInfo(i) + "]");
 }
 inOrden(raiz.getLig(raiz.getTl()));
 }
 }
//--------------------------------------------------------------------------
 private BTNode pegaVizinho(int info, BTNode pai) {
 int pos = pai.procuraPosicao(info);
 return (pos >= pai.getTl()) ? pai.getLig(pos - 1) : pai.getLig(pos + 1);
 }
//--------------------------------------------------------------------------
 public boolean verPagIrmaDir(BTNode pai) {
 BTNode pDir = pai.getLig(pai.getTl());
 int cont = 0, i = 0;
 while (i < (2 * N + 2)) {
 if (pDir.getLig(i) != null) {
 cont++;
 }
 i++;
 }
 return (cont > N);
 }
//--------------------------------------------------------------------------
 public boolean verPagIrmaEsq(BTNode pai) {
 BTNode pDir = pai.getLig(pai.getTl()-1);
 int cont = 0, i = 0;
 while (i < (2 * N + 2)) {
 if (pDir.getLig(i) != null) {
 cont++;
 }
 i++;
 }
 return (cont > N);
 }
//--------------------------------------------------------------------------
 public BTNode getRaiz() {
 return raiz;
 }
//--------------------------------------------------------------------------
}
POArvores/src/NArea/NArea.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 NArea;
/**
 *
 * @author joao
 */
public class NArea {
 private Node root;
 public NArea() {
 this.root = null;
 }
 public void insere(int info) {
 Node p, ant = null;
 int pos = 0;
 boolean flag = false;
 if (root == null) {
 root = new Node(info);
 } else {
 p = root;
 while (p != null && !flag) {
 if (p.getTl() < (Node.N - 1)) {
 pos = p.busca(info);
 p.remaneja(pos);
 p.setvInfo(pos, info);
 p.setTl(p.getTl() + 1);
 flag = true;
 } else {
 ant = p;
 pos = p.busca(info);
 p = p.getvLig(pos);
 }
 }
 if (!flag) {
 ant.setvLig(pos, new Node(info));
 }
 }
 }
 public Node getRaiz() {
 return root;
 }
 public void inOrden(Node raiz) {
 if (raiz != null) {
 for (int i = 0; i < raiz.getTl(); i++) {
 inOrden(raiz.getvLig(i));
System.out.print("[" + raiz.getInfo(i) + "]");
 }
 inOrden(raiz.getvLig(raiz.getTl()));
 }
 }
}
POArvores/src/NArea/Node.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 NArea;
import BPtree.Param;
/**
 *
 * @author joao
 */
public class Node implements Param{
 private final int[] vInfo;
 private final Node[] vLig;
 private int tl;
 public Node() {
 this.tl = 0;
 this.vInfo = new int[N - 1];
 this.vLig = new Node[N];
 for (int i = 0; i < N; i++) {
 vLig[i] = null;
 }
 }
 public Node(int info) {
 this.vInfo = new int[N - 1];
 this.vLig = new Node[N];
 this.vInfo[0] = info;
 for (int i = 0; i < N; i++) {
 vLig[i] = null;
 }
 tl = 1;
 }
 public int getInfo(int pos) {
 return vInfo[pos];
 }
 public void setvInfo(int pos, int info) {
 if (tl < N - 1 && pos < N - 1) {
 this.vInfo[pos] = info;
 }
 }
 public Node getvLig(int pos) {
 return vLig[pos];
 }
 public void setvLig(int pos, Node lig) {
 this.vLig[pos] = lig;
 }
 public int getTl() {
 return tl;
 }
 public void setTl(int val) {
 this.tl = val;
 }
 public int busca(int info) {
 int pos = 0;
 while (pos < tl && info > vInfo[pos]) {
 pos++;
 }
 return pos;
 }
 public void remaneja(int pos) {
 for (int i = tl; i > pos; i--) {
 vInfo[i] = vInfo[i - 1];
 }
 }
}
POArvores/src/poarvores/POArvores.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 poarvores;
import NArea.NArea;
/**
 *
 * @author joao
 */
public class POArvores {
 /**
 * @param args the command line arguments
 */
 public static void main(String[] args) {
 NArea arvore = new NArea();
 
 arvore.insere(10);
 arvore.insere(30);
 arvore.insere(77);
 arvore.insere(83);
 arvore.insere(44);
 arvore.insere(32);
 arvore.insere(21);
 arvore.insere(15);
 arvore.insere(17);
 arvore.insere(74);
 
 System.out.print("Inseridno valores:");
 
 System.out.println("");
 System.out.println("inOrden:");
 arvore.inOrden(arvore.getRaiz());
 }
 
}

Teste o Premium para desbloquear

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

Outros materiais