From 2bf7b97d9fe268424ed687e6fae1398a0e148c9f Mon Sep 17 00:00:00 2001 From: Humam Abusitta Date: Mon, 30 Mar 2015 23:06:09 -0400 Subject: [PATCH 01/10] all done --- .gitignore | 12 - LICENSE | 675 --------------------------- Middleware/HashClient.java | 65 +++ Middleware/HashFinder.java | 65 +++ Middleware/LinkedListMiddleware.java | 163 +++++++ Middleware/MidArrayList.java | 197 ++++++++ Middleware/Middleware_1_B.java | 426 +++++++++++++++++ 7 files changed, 916 insertions(+), 687 deletions(-) delete mode 100644 .gitignore delete mode 100644 LICENSE create mode 100644 Middleware/HashClient.java create mode 100644 Middleware/HashFinder.java create mode 100644 Middleware/LinkedListMiddleware.java create mode 100644 Middleware/MidArrayList.java create mode 100644 Middleware/Middleware_1_B.java diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 32858aa..0000000 --- a/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -*.class - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 6b156fe..0000000 --- a/LICENSE +++ /dev/null @@ -1,675 +0,0 @@ -GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - diff --git a/Middleware/HashClient.java b/Middleware/HashClient.java new file mode 100644 index 0000000..a2a53c3 --- /dev/null +++ b/Middleware/HashClient.java @@ -0,0 +1,65 @@ +package edu.oakland.production.GroupProject.Middleware; + +import java.util.*; +import edu.oakland.production.GroupProject.Middleware.*; + +/** + * @author Dean DeHart, Middleware + * @version 1.0 150330 + * @since 1.0 150328 + */ +public class HashClient { + /** + * Creates an instance of the Database HashTable class. + * Error is currently caused by missing import statement for this class. -Dean + */ + //private HashTable hashTable; + /** + * Creates an instance of the Middleware HashArrayCreator class, located in the + * edu.oakland.production.GroupProject.Middleware package. -Dean + */ + private HashArrayCreator hashArrayCreator; + /** + * Creates an instance of the Middleware HashDataFinder class, located in the + * edu.oakland.production.GroupProject.Middleware package. -Dean + */ + private HashFinder hashFinder; + /** + * Creates an instance of the Middleware HashClient class, located in the + * edu.oakland.production.GroupProject.Middleware package. -Dean + */ + private HashClient hashClient = new HashClient(); + /** + *See findHashTableValue(); -Dean + */ + private int[] hashTableArray; + /** + *See findHashTableValue(); -Dean + */ + private int hashTableArraySize; + /** + *See findHashTableValue(); -Dean + */ + private int hashValue; + /** + *Returns the Big O notation for the HashTable. + *@return String + */ + private String bigONotation() { + String bigO = "The Big O notation for HashTable is O(1)"; + return bigO; + } + private void createHashTable(int n) { + hashTable = new HashTable(n); + } + /** + * Method for searching the hashTable. -Dean + */ + private void findHashTableValue() { + hashFinder = new HashFinder(); + + hashValue = hashArray[10]; + System.out.println("The hash value to be retrieved is: " + hashValue); + hashFinder.findHashValue(hashValue, hashTableArraySize, hashTableArray); + } +} diff --git a/Middleware/HashFinder.java b/Middleware/HashFinder.java new file mode 100644 index 0000000..876978a --- /dev/null +++ b/Middleware/HashFinder.java @@ -0,0 +1,65 @@ +package edu.oakland.production.GroupProject.Middleware; +/** +*@author Jared Okoniewski, Jesse Rominske, Dean DeHart +*@version version 2.0 150330 +*@since version 1.0 152403 +*/ +public class HashFinder { + /** + *The input variable that will be located within the Hash Table. + */ + private int hashInput; + /** + *The size of the Hash Table being searched. + */ + private int hashSize; + /** + *The reference to the Hash Table itself. + */ + private int[] table; + /** + *The index of wherever the search found the element. + *Used in Display package for index return. + */ + private int hashOutput; + /** + *Finds a value within the Hash Table. + *Accepts an input value, an array size, and an array as arguments. + *@param input The input value, assigned to hashInput. Order needs to be changed? -Dean + *@param size The size value, assigned to hashSize. Order needs to be changed? -Dean + *@param array The array, assigned to table. Order needs to be changed? -Dean + */ + public int findHashValue(int input, int size, int[] array) { + + System.out.println("The method findValue was called."); //announce method + //assigning arguments to variables + hashInput = input; + hashSize = size; + table = array; + int items = 0; + + int arrayIndex = input % (size - 1); //find the original hash key + + while(table[arrayIndex] != -1) { //as long as the slot has something in it + if(table[arrayIndex] == input) { //if we found it + System.out.println(input + "was found at index " + arrayIndex); //tell user + hashOutput = input; //set the output to the value of the input + break; //end the loop + } + ++arrayIndex; //increment the index at each attempt + ++items; //Increment the number of items searched + arrayIndex %= size; //return to table[0] if we can't find it + break; //end the loop + } + if(hashOutput != input) { //if there is a mismatch between input and output + System.out.println("Value not found in hash table."); //tell user + } + + System.out.println(items + " items were searched"); //spit out the number of items searched + + return hashOutput;//spit out the value found + } +} +/** +*This class is that which finds a value in a Hash Table. +*/ diff --git a/Middleware/LinkedListMiddleware.java b/Middleware/LinkedListMiddleware.java new file mode 100644 index 0000000..a072523 --- /dev/null +++ b/Middleware/LinkedListMiddleware.java @@ -0,0 +1,163 @@ +package edu.oakland.production; + +import java.util.*; +import edu.oakland.helper.*; + +/** +*@author Zack Waldrup +*@version version 2.1 150325 +*@since version 1.0 150323 +*/ +public class LinkedListMiddleware { + + /** + *Instance variables needed for the constructors and methods + */ + int listSize; + int iMin; + int taskTime; + int value; + static long startTime, endTime; + LinkedListDB db; + + /** + *Overloaded constructor for the LinkedListMiddleware class. + *Passes the requested list size to the database. + *@param listSize of type "int" + */ + public LinkedListMiddleware(int listSize) { + this.listSize = listSize; + db = new /*Databaseclassname*/(); + this.createLinkedList(listSize); + } + + /** + *This method performs a Selection Sort on a LinkedList + */ + public void selectSort() { + startTime = System.currentTimeMillis(); + + for (int j = 0; j < listSize; j++) { + iMin = j; + for (int i = j + 1; i < listSize; i++) { + if (db.get(i) < db.get(iMin)) { + iMin = i; + } + } + if(iMin != j) { + swapValues(j, iMin); + } + } + endTime = System.currentTimeMillis(); + taskTime = endTime - startTime; + System.out.println("Selection Sort time taken: " + tasktime); + } + + /** + *This method performs a Bubble Sort on a LinkedList + */ + public void bubbleSort() { + startTime = System.currentTimeMillis(); + + for (int i = listSize - 1; i > 1; i--) { + for (int j = 0; j < i; j++) { + if(db.get(j) > db.get(j + 1)){ + swapValues(j, j+1); + } + } + } + endTime = System.currentTimeMillis(); + taskTime = endTime - startTime; + System.out.println("Bubble Sort time taken: " + tasktime); + } + + /** + *This method linearly searches a LinkedList + *@param value of type "int" + */ + public void linearSearch(int value) { + this.value = value; + boolean valuePresent = false; + String indexWithValue = ""; + startTime = System.currentTimeMillis(); + + for (int i = 0; i < listSize; i++) { + if(db.get(i) == value) { + valuePresent = true; + indexWithValue += i + " "; + } + } + System.out.println("Value found: " + valuePresent); + endTime = System.currentTimeMillis(); + taskTime = endTime - startTime; + System.out.println("Linear Search time taken: " + tasktime); + } + + /** + *This method conducts a binary searche on a LinkedList + *@param value of type "int" + */ + public void binarySearch(int value) { + this.value = value; + int lowIndex = 0; + int highIndex = listSize - 1; + int timesThrough = 0; + startTime = System.currentTimeMillis(); + + while (lowIndex <= highIndex) { + int middleIndex = (highIndex + lowIndex) / 2; + if(db.get(middleIndex) < value) { + lowIndex = middleIndex + 1; + } else if(db.get(middleIndex) > value) { + highIndex = middleIndex - 1; + } else { + System.out.println("Found " + value + "at " + middleIndex); + lowIndex = highIndex + 1; + } + timesThrough++; + } + + endTime = System.currentTimeMillis(); + taskTime = endTime - startTime; + System.out.println("Binary Search time taken: " + tasktime); + System.out.println("Binary Search times through: " + timesThrough); + } + + /** + *This method swaps the values of 2 elements in a LinkedList + *@param indexOne of type "int" + *@param indexTwo of type "int" + */ + public void swapValues(int indexOne, int indexTwo) { + int temp = db.get(indexOne); + db.set(indexOne,db.get(indexTwo)); + db.set(indexTwo, temp); + } + + /** + *Method for creating a LinkedList + *@param listSize of type "int" + *@return list1 of type "LinkedList" + */ + public void createLinkedList(int listSize) { + this.listSize = listSize; + + for(int i = 0; i < listSize; i++) { + db.add(i, randomInt(100, 1000)); + } + } + + /** + *This method gives a random number based on a maximum and + *minimum range of selection + *@param min of type "int" + *@param max of type "int" + *@return randomNumber of type "int" + */ + public static int randomInt(int min, int max) { + Random rand = new Random(); + int randomNumber = rand.nextInt((max - min) + 1) + min; + return randomNumber; + } + +} \ No newline at end of file diff --git a/Middleware/MidArrayList.java b/Middleware/MidArrayList.java new file mode 100644 index 0000000..6839275 --- /dev/null +++ b/Middleware/MidArrayList.java @@ -0,0 +1,197 @@ +package edu.oakland.production.ClassProject; + +import java.util.ArrayList; +import edu.oakland.production.ClassProject.*; + +/** +*@author Toufiq Hussain +*@version version 1.3 150330 +*@since version 1.0 150323 +**/ +public class MidArrayList { + + /** + *Declared instance variables here. + */ + private ArrayListDatabase theArray; + private int arraySize; + static long startTime; + static long endTime; + + /** + *Overloaded constructor to create database. Takes in + *a variable of type "int" to specify size. + */ + MidArrayList(int size){ + arraySize =size; + theArray = new ArrayListDatabase(size); + } + + /** + *Generates a random array to fill database. + */ + public void generateRandomArray() { + System.out.println("Generating random array..."); + for (int i = 0; i < arraySize; i++) { + int j = 0; + j = (int) ((Math.random() * 1000) + 100); + theArray.addStudent(j); + } + } + + /** + *Returns the size of the array as a String sentence + */ + public int returnArraySize(){ + return theArray.returnSize(); + } + + /** + *Returns the array in its entirety. USE ONLY WHEN DEBUGGING + */ + public void returnArray(){ + + for(int i = 0; i 1; i--) { + for (int j = 0; j < i; j++) { + if (theArray.getStudent(j) > theArray.getStudent(j + 1)) { + swapValues(j, j + 1); + } + } + } + + endTime = System.currentTimeMillis(); + System.out.println("Bubble sort took " + (endTime - startTime) + " ms"); + } + + /** + *Selection sorts the entire array and prints the time taken. + */ + public void selectionSort(){ + System.out.println("Selection sort initialized"); + startTime = System.currentTimeMillis(); + + int min = 0; + for(int j=0;j < arraySize-1; j++){ + min = j; + + for(int i = j+1; i < arraySize;i++){ + if(theArray.getStudent(i) < theArray.getStudent(min)){ + min = i; + } + } + + if(min != j){ + swapValues(j,min); + } + } + + endTime = System.currentTimeMillis(); + System.out.println("Selection sort took " + (endTime - startTime) + " ms"); + } + + /** + *Binary searches for a value in a sorted array. + *This takes an int (the value to search for). + */ + public void binarySearch(int value) { + + System.out.println("Binary search initialized."); + + startTime = System.currentTimeMillis(); + + int lowIndex = 0; + int highIndex = arraySize - 1; + + int timesThrough = 0; + + while (lowIndex <= highIndex) { + + int middleIndex = (highIndex + lowIndex) / 2; + + if (theArray.getStudent(middleIndex) < value) + lowIndex = middleIndex + 1; + + else if (theArray.getStudent(middleIndex) > value) + highIndex = middleIndex - 1; + + else { + + System.out.println("Found a match for " + value + " at index " + middleIndex); + + lowIndex = highIndex + 1; + + } + + timesThrough++; + + } + + endTime = System.currentTimeMillis(); + + System.out.println("Binary search took " + (endTime - startTime) + " ms"); + + System.out.println("Times through: " + timesThrough); + + } + + /** + *Linear searches for a value in a sorted array. + *This takes an int (the value to search for). + */ + public void linearSearch(int value) { + + boolean valueInArray = false; + String indexsWithValue = ""; + + System.out.println("Linear search initialized"); + startTime = System.currentTimeMillis(); + + for (int i = 0; i < arraySize; i++) { + + if (theArray.getStudent(i) == value) { + valueInArray = true; + indexsWithValue += i + " "; + } + + } + + //System.out.println(indexsWithValue); + System.out.println("Value found: " + valueInArray); + + endTime = System.currentTimeMillis(); + + System.out.println("Linear search took " + (endTime - startTime) + " ms"); + + } +} \ No newline at end of file diff --git a/Middleware/Middleware_1_B.java b/Middleware/Middleware_1_B.java new file mode 100644 index 0000000..e48ceef --- /dev/null +++ b/Middleware/Middleware_1_B.java @@ -0,0 +1,426 @@ +package edu.oakland.production.ClassProject.Middleware; + +//Import java util framework +import java.util.*; + +//Import Middleware stuff. +import edu.oakland.production.ClassProject.Middleware.*; + +//Import BinaryTree.java +import edu.oakland.production.ClassProject.Database.*; + + +/* + * Middleware Part 1B. Purpose is to experiment with BinaryTrees'. + * + * @author Joshua Herkness, Trevor Luebbert Middleware + * @version version 1.1 + * @since version 1.0 + */ +public class Middleware { + + /// Minimum possible key value, used with generating a random key. + private int minimumKeyValue = 400000; + /// Maximum possible key value, used with generating a random key. + private int maximumKeyValue = 800000; + + /// Minimum possible name value, used with generating a random name. + private int minimumNameValue = 200000; + /// Maximum possible key value, used with generating a random name. + private int maximumNameValue = 600000; + + Database database; + + /* + * Default constructor for the Middleware Class. + * + * @param database Database object. + * + * @returns Middleware + */ + public Middleware(Database database){ + + //Link the database + this.database = database + } + + /* + * Creates a binary tree inside the database given a size, then populates it with non-duplicate random integer and string values. + * + * @param size Integer value corresponding to the size of the binary tree. + */ + public void createBinaryTree(int size){ + + database.createBinaryTree(size); + + BinaryTree binaryTree = database.getBinaryTree(); + + populateBinaryTree(binaryTree, size); + } + + /* + * Populates a BinaryTree object with a given size, with a key and + * name for each node with a non-duplicate random number. + * + * @param binaryTree BinaryTree object, located within the database. + * @param size Integer value corresponding to the size of the binary tree. + * + */ + private void populateBinaryTree(BinaryTree binaryTree, int size){ + + binaryTree = new BinaryTree(); + + // Create a non-duplicate random number list for keys. + List nonDuplicateRandomNumberKeys = new List(); + // Create a non-duplicate random number list for names. + List nonDuplicateRandomNumberNames = new List(); + + // Populate both key and name lists. + nonDuplicateRandomNumberKeys = nonDuplicateRandomNumbers(minimumKeyValue, maximumKeyValue, size); + nonDuplicateRandomNumberNames = nonDuplicateRandomNumbers(minimumNameValue, maximumNameValue, size); + + for (int i = 0; i < size; i++){ + + // Reference key integer from a given index. + int key = nonDuplicateRandomNumberKeys.get(i); + // Reference name integer from a given index, then convert to a string. + String name = Integer.toString(nonDuplicateRandomNumberNames.get(i)); + + // Add a node to the BinaryTree, given the key and name. + binaryTree.addNode(key, name); + + } + } + + /* + * Searches for three integer key values, and provide a record of the amount of nodes searched through, durring a preorder search, for each key searched. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns nodesSearched String value corresponding to the number of nodes searched respectively. + */ + public String calculatePreorderNodesSearched(int key1, int key2, int key3){ + + String nodesSearched = ""; + + BinaryTree binaryTree = this.database.getBinaryTree(); + Node focusNode = binaryTree.getRootNode(); + + nodesSearched += Integer.toString(calculatePreorderNodesSearched(binaryTree, focusNode, key1)); + nodesSearched += " "; + + nodesSearched += Integer.toString(calculatePreorderNodesSearched(binaryTree, focusNode, key2)); + nodesSearched += " "; + + nodesSearched += Integer.toString(calculatePreorderNodesSearched(binaryTree, focusNode, key3)); + + return nodesSearched; + } + + /* + * Searches for three integer key values, and provide a record of the amount of nodes searched through, durring a in order search, for each key searched. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns nodesSearched String value corresponding to the number of nodes searched respectively. + */ + public String calculateInOrderNodesSearched(int key1, int key2, int key3){ + + String nodesSearched = ""; + + BinaryTree binaryTree = this.database.getBinaryTree(); + Node focusNode = binaryTree.getRootNode(); + + nodesSearched += Integer.toString(calculateInOrderNodesSearched(binaryTree, focusNode, key1)); + nodesSearched += " "; + + nodesSearched += Integer.toString(calculateInOrderNodesSearched(binaryTree, focusNode, key2)); + nodesSearched += " "; + + nodesSearched += Integer.toString(calculateInOrderNodesSearched(binaryTree, focusNode, key3)); + + return nodesSearched; + } + + /* + * Calculates the amount of nodes searched in a preorder search, for locating a given key. + * + * @param binaryTree BinaryTree object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculatePreorderNodesSearched(BinaryTree binaryTree, Node focusNode, int key){ + + int nodesSearched = calculatePreorderNodesSearched(binaryTree, focusNode, key, true); + + return nodesSearched; + + } + + /* + * Helper recursive method used to calculates the amount of nodes searched in a preorder search, for locating a given key. + * + * @param binaryTree BinaryTree object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * @param continueSearch Boolean value corresponding to whether the node has been located. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculatePreorderNodesSearched(BinaryTree binaryTree, Node focusNode, int key, boolean continueSearching){ + + // Begin each recursion with zero nodes searched. + int nodesSearched = 0; + + // Ignore the recursion loop if the node is already found, or if the node is non existant. + if (!continueSearching){ + return 0; + } else if (focusNode == null){ + return 0; + } else { + // Count the node. + nodesSearched++; + } + + // If the focus node has the desired key, increament the amount of nodesSearched, and + if (focusNode.getKey() == key){ + + continueSearching = false; + return nodesSearched; + + } + + if (focusNode.leftNode != null){ + nodesSearched += calculatePreorderNodesSearched(binaryTree, focusNode.leftNode, key, continueSearching); + } + + if (focusNode.rightNode != null){ + nodesSearched += calculatePreorderNodesSearched(binaryTree, focusNode.righNode, key, continueSearching); + } + + return nodesSearched; + + } + + /* + * Calculates the amount of nodes searched in an in order search, for locating a given key. + * + * @param binaryTree BinaryTree object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculateInOrderNodesSearched(BinaryTree binaryTree, Node focusNode, String name){ + + int nodesSearched = calculateInOrderNodesSearched(binaryTree, focusNode, key, true); + + return nodesSearched; + } + + /* + * Helper recursive method used to calculates the amount of nodes searched in an in order search, for locating a given key. + * + * @param binaryTree BinaryTree object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * @param continueSearch Boolean value corresponding to whether the node has been located. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculateInOrderNodesSearched(BinaryTree binaryTree, Node focusNode, String name, boolean continueSearching){ + + // Begin each recursion with zero nodes searched. + int nodesSearched = 0; + + // Ignore the recursion loop if the node is already found, or if the node is non existant. + if (!continueSearching){ + return 0; + } else if (focusNode == null){ + return 0; + } else { + // Count the node. + nodesSearched++; + } + + if (focusNode.leftNode != null){ + nodesSearched += calculateInOrderNodesSearched(binaryTree, focusNode.leftNode, key, continueSearching); + } + + // If the focus node has the desired key, increament the amount of nodesSearched, and + if (focusNode.getKey() == key){ + + continueSearching = false; + return nodesSearched; + + } + + if (focusNode.rightNode != null){ + nodesSearched += calculateInOrderNodesSearched(binaryTree, focusNode.righNode, key, continueSearching); + } + + return nodesSearched; + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct a preorder search on three given keys. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns duration String value corresponding to the time elapsed durring the searches. + */ + public String calculatePreorderSearchDuration(int key1, int key2, int key3){ + + String duration = ""; + + BinaryTree binaryTree = this.database.getBinaryTree(); + Node focusNode = binaryTree.getRootNode(); + + duration += Double.toString(calculatePreorderSearchDuration(binaryTree, focusNode, key1)); + duration += " "; + + duration += Double.toString(calculatePreorderSearchDuration(binaryTree, focusNode, key2)); + duration += " "; + + duration += Double.toString(calculatePreorderSearchDuration(binaryTree, focusNode, key3)); + + return duration; + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct a preorder search on three given keys. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns duration String value corresponding to the time elapsed durring the searches. + */ + public String calculateInOrderSearchDuration(int key1, int key2, int key3){ + + String duration = ""; + + BinaryTree binaryTree = this.database.getBinaryTree(); + Node focusNode = binaryTree.getRootNode(); + + duration += Double.toString(calculateInOrderSearchDuration(binaryTree, focusNode, key1)); + duration += " "; + + duration += Double.toString(calculateInOrderSearchDuration(binaryTree, focusNode, key2)); + duration += " "; + + duration += Double.toString(calculateInOrderSearchDuration(binaryTree, focusNode, key3)); + + return duration; + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct a preorder search on a given key. + * + * @param binaryTree BinaryTree object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns double Double type corresponding to time taken to search the binaryTree. + */ + private double calculatePreorderSearchDuration(BinaryTree binaryTree, Node focusNode, int key){ + + double startTime = System.currentTimeMillis(); + int temporary = calculatePreorderNodesSearched(binaryTree, focusNode, key); + double endTime = System.currentTimeMillis(); + + return (endTime - startTime); + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct an in order search on a given key. + * + * @param binaryTree BinaryTree object. + * @param focusNode Start or begining node of the binary tree. + * @param name String value corresponding with desired search value. + * + * @returns double Double type corresponding to time taken to search the binaryTree. + */ + private double calculateInOrderSearchDuration(BinaryTree binaryTree, Node focusNode, String name){ + + double startTime = System.currentTimeMillis(); + int temporary = calculateInOrderNodesSearched(binaryTree, focusNode, key); + double endTime = System.currentTimeMillis(); + + return (endTime - startTime); + } + + /* + * Description. Not working just yet. + * + * @param binaryTree BinaryTree object. + * + * @returns String String corresponding to the big O relationship for the binary tree. + */ + public String calculateBigORelationship(BinaryTree binaryTree){ + + } + + /* + * Generates a non-duplicate random number list, given a minimumValue, maximumValue, and size. + * + * @param minimumValue Integer value corresponding to the minimum possible random value generated. + * @param maximumValue Integer value corresponding to the maximum possible random value generated. + * + * @returns List List type, shuffled to mimic non-duplicate random numbers. + */ + private List createNonDuplicateRandomNumbers(int minimumValue, int maximumValue, int size){ + + // Create an instance of ArrayList, with type int. + ArrayList nonDuplicateRandomNumbers = new ArrayList(); + + //Test for errors with provided data. If there arent enough possible numbers, return null. + if ((maximumValue - minimumValue) < size){ + + //There has been an error. + return null; + + } + + // For the range of numbers provided. + // Creates an ArrayList of integers from minimumValue to maximumValue. + for (int i = minimumValue; i <= maximumValue; i++){ + + // Add that number to the ArrayList. + nonDuplicateRandomNumbers.add(i); + } + + // Shuffle the ArrayList, randomizing the numbers. + Collections.shuffle(nonDuplicateRandomNumbers); + + // Return a immutable List object, created from the ArrayList, trimming off unnecessary values. + return nonDuplicateRandomNumbers.subList(0, size - 1); + + } + + /* + * Retrieves the database object. + * + * @returns database Database object. + */ + public Database getDatabase(){ + return this.database; + } + + /* + * Modifies the database object stored in Middleware. + * + * @param database Database object corresponding to the new database. + */ + public void setDatabase(Database database){ + this.database = database; + } +} \ No newline at end of file From d13b836cba9f65796a885b1420138b96bfb50c7a Mon Sep 17 00:00:00 2001 From: Humam Abusitta Date: Mon, 30 Mar 2015 23:11:41 -0400 Subject: [PATCH 02/10] all done with methods in a word document --- Middleware methods.docx | Bin 0 -> 16312 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Middleware methods.docx diff --git a/Middleware methods.docx b/Middleware methods.docx new file mode 100644 index 0000000000000000000000000000000000000000..478448d94f265b9fd94dddc78f4a9fb5dc894d27 GIT binary patch literal 16312 zcmeHugL@^*xAu;0+qP}n$;6pxV%wQGnb_vUwrx!8WG1%ld^x{+&ONy2`Tl`>yPv&! zcU8TsYwxbNYE{)*iZURer~q&PBme*)0x-wgYM2560N=p?02BZuu(pV;jgyIulfJ6E zor$9^y_>ZaVIC+jWex!Nqx}CJ|BL^D`h+oyK1M{b`=Gag>Bc4LR?6@FBYDv#IA%{k z;jHqax5D}DZ=KtmOy5bFSVsm4C)YeDA(;ZESJJGYkQ!XcjxqR>{Nwe^IcSy_cj$bL zvB)yQ71;LlX4GYAqe|KU|l@x zo%_q2BR3}$tpvb9FeruvNi83z`EZaT!PcI%n3vZ{lM6Fyg^N0OIvpuUcgj#oww(5~ zz`IGneIt-9rWpcpX+>yFD@HRmLYi%>o*U5Mr><<*`J{|qWDRfkR62vK<$a2tm+U9$ zY9lwTUOr_r>6_3;cY;bx#eguQuniVJ6$Dqjw_0vup;pxy5`<9Uwxm|&M)QWP-Bri?soZF zs3Q)w7-ZS2%{WBhqh-Cng8&r&Mo;`$?56XN9QhCS!Fo0*ND z@^H)$ciu?Qy}(XVgA4C~T6om!(|&Gu10)8ue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~k~yri7mlpP z+#+ZM02NP?mLjnb3m8i&cH~5U65c|mZME&$;!$;TuRDZEoN?1qg&vK3iH0_b!qlbm z=s||D45}3~h^kH`a}sK>(IxbGSV2VsHNE!U5j50b){tegFo&jA&MU4VMP!*oT>I|j zk*=D~o$I{!*l{c>S*OaSX~Qy8fDsS6JFc@jEYZu}ulS7~_lRW8L&>}R&g}gu_pMF3 z>h#pB@VK6P#gUw$;#HkIJCQ0xfr30_^}a^8MT6JJ{His-NZ?-`Xs~a*CYRzEgE z5dUgYe73XuKa1jn%fBBPDq}XQjEL)drXgjUCjnb~-rhBtNc6jqR}Vl$S!1B%>`F`_`m6VN4?%9I=?<2rrS^@gVtSkRJCDBwYgc7^+6^b0 zJSO$Qe6`H&fQ~1`L0gn~(Vt#8K4IWvFB0@nW}Sj4L)=+>DMIri7Ts1_9=steL+DqC zT`J`xb*FoP?2nJ88`zb;KnkA_68j$8N|9_!J(_{EWdylk7Bu(iap2$}{=B-GU=3YU z@WMSj2ihekJHIEM7A!kttImFh@EHfmJ;H)Ojgz!x6ue0Cq`tN~cgv*63b@A?WeZ*v z|3p32>LT=*#O$US47V zugk+t>c`%j@kKR^^sH>sIX#Dg3#m)Lunb9NFf-CtlyoS&zTkT+U;Tc@hd-M`e%UApSr+52B7~DZuC$1KfUVyge#)|4*#c* z-9J_Q(}m(s6@|FJtN5!!#XsTy+?)Lq{*CZ=_&;`P|Eb}hdpCb-s3iTP0{^{}^H1>K zCt80(0RVm`0N{U2yZ#CPr{(*nf)keCpZzyG_@DTHS_^;TAJ~7#|IK#zC;so9`k!b3 fAeQSd)&ISVSCj$!XkGvS?8gc8(L!^1f4lpC-j}-U literal 0 HcmV?d00001 From 4a00a3a82343ec0efb87f87f26fb42c46fe3f705 Mon Sep 17 00:00:00 2001 From: Humam Abusitta Date: Thu, 2 Apr 2015 01:30:55 -0400 Subject: [PATCH 03/10] This is the final code from middleware --- Middleware/HashClient.java | 12 ++++++----- Middleware/HashFinder.java | 4 ++-- Middleware/LinkedListMiddleware.java | 30 ++++++++++++++++++---------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/Middleware/HashClient.java b/Middleware/HashClient.java index a2a53c3..fb02029 100644 --- a/Middleware/HashClient.java +++ b/Middleware/HashClient.java @@ -5,7 +5,7 @@ /** * @author Dean DeHart, Middleware - * @version 1.0 150330 + * @version 2.0 150401 * @since 1.0 150328 */ public class HashClient { @@ -13,7 +13,7 @@ public class HashClient { * Creates an instance of the Database HashTable class. * Error is currently caused by missing import statement for this class. -Dean */ - //private HashTable hashTable; + private HashTable hashTable; /** * Creates an instance of the Middleware HashArrayCreator class, located in the * edu.oakland.production.GroupProject.Middleware package. -Dean @@ -51,15 +51,17 @@ private String bigONotation() { } private void createHashTable(int n) { hashTable = new HashTable(n); + hashTableArray = hashTable.containerArray; } /** * Method for searching the hashTable. -Dean */ - private void findHashTableValue() { + private int findHashTableValue() { hashFinder = new HashFinder(); - hashValue = hashArray[10]; + hashValue = hashTableArray[10]; System.out.println("The hash value to be retrieved is: " + hashValue); - hashFinder.findHashValue(hashValue, hashTableArraySize, hashTableArray); + int valueIndex = hashFinder.findHashValue(hashValue, hashTableArraySize, hashTableArray); + return valueindex; } } diff --git a/Middleware/HashFinder.java b/Middleware/HashFinder.java index 876978a..5c2c3e2 100644 --- a/Middleware/HashFinder.java +++ b/Middleware/HashFinder.java @@ -1,7 +1,7 @@ package edu.oakland.production.GroupProject.Middleware; /** *@author Jared Okoniewski, Jesse Rominske, Dean DeHart -*@version version 2.0 150330 +*@version version 3.0 150401 *@since version 1.0 152403 */ public class HashFinder { @@ -57,7 +57,7 @@ public int findHashValue(int input, int size, int[] array) { System.out.println(items + " items were searched"); //spit out the number of items searched - return hashOutput;//spit out the value found + return arrayIndex;//spit out the index of the value found } } /** diff --git a/Middleware/LinkedListMiddleware.java b/Middleware/LinkedListMiddleware.java index a072523..f355261 100644 --- a/Middleware/LinkedListMiddleware.java +++ b/Middleware/LinkedListMiddleware.java @@ -1,11 +1,11 @@ -package edu.oakland.production; +package edu.oakland.production.ClassProject; import java.util.*; -import edu.oakland.helper.*; +import edu.oakland.production.ClassProject.*; /** *@author Zack Waldrup -*@version version 2.1 150325 +*@version version 2.3 150401 *@since version 1.0 150323 */ public class LinkedListMiddleware { @@ -15,9 +15,10 @@ public class LinkedListMiddleware { */ int listSize; int iMin; - int taskTime; + long taskTime; int value; static long startTime, endTime; + public boolean valuePresent = false; LinkedListDB db; /** @@ -27,12 +28,13 @@ public class LinkedListMiddleware { */ public LinkedListMiddleware(int listSize) { this.listSize = listSize; - db = new /*Databaseclassname*/(); + db = new LinkedListDB(); this.createLinkedList(listSize); } /** *This method performs a Selection Sort on a LinkedList + *Big O: O(n^2) */ public void selectSort() { startTime = System.currentTimeMillis(); @@ -50,11 +52,12 @@ public void selectSort() { } endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Selection Sort time taken: " + tasktime); + System.out.println("Selection Sort time taken: " + taskTime); } /** *This method performs a Bubble Sort on a LinkedList + *Big O: O(n^2) */ public void bubbleSort() { startTime = System.currentTimeMillis(); @@ -68,16 +71,17 @@ public void bubbleSort() { } endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Bubble Sort time taken: " + tasktime); + System.out.println("Bubble Sort time taken: " + taskTime); } /** *This method linearly searches a LinkedList + *Big O: O(n) *@param value of type "int" */ public void linearSearch(int value) { this.value = value; - boolean valuePresent = false; + valuePresent = false; String indexWithValue = ""; startTime = System.currentTimeMillis(); @@ -90,11 +94,12 @@ public void linearSearch(int value) { System.out.println("Value found: " + valuePresent); endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Linear Search time taken: " + tasktime); + System.out.println("Linear Search time taken: " + taskTime); } /** *This method conducts a binary searche on a LinkedList + *Big O: O(log(n)) *@param value of type "int" */ public void binarySearch(int value) { @@ -110,16 +115,19 @@ public void binarySearch(int value) { lowIndex = middleIndex + 1; } else if(db.get(middleIndex) > value) { highIndex = middleIndex - 1; - } else { + } else if(db.get(middleIndex) == value){ + valuePresent = true; System.out.println("Found " + value + "at " + middleIndex); lowIndex = highIndex + 1; + } else { + System.out.println("Value is not in this list"); } timesThrough++; } endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Binary Search time taken: " + tasktime); + System.out.println("Binary Search time taken: " + taskTime); System.out.println("Binary Search times through: " + timesThrough); } From f102b45ee572f73537a02442c4db89345df7013e Mon Sep 17 00:00:00 2001 From: Humam Abusitta Date: Thu, 2 Apr 2015 01:39:12 -0400 Subject: [PATCH 04/10] This is the final code from middleware --- Middleware/ArrayListDatabase (1).java | 29 +++++++ Middleware/ArrayListDatabase.java | 55 +++++++++++++ Middleware/ArrayListMockDisplay.java | 33 ++++++++ Middleware/BinaryTree.java | 62 ++++++++++++++ Middleware/LLMiddlewareTest.java | 76 ++++++++++++++++++ Middleware/LinkListDB.java | 24 ++++++ Middleware/LinkedListDB.java | 27 +++++++ Middleware/Middleware.java | 111 ++++++++++++++++++++++++++ Middleware/MockDisplay (1).java | 28 +++++++ Middleware/MockDisplay.java | 35 ++++++++ Middleware/MockDisplay1.java | 28 +++++++ Middleware/Node.java | 19 +++++ ~$ddleware methods.docx | Bin 0 -> 162 bytes 13 files changed, 527 insertions(+) create mode 100644 Middleware/ArrayListDatabase (1).java create mode 100644 Middleware/ArrayListDatabase.java create mode 100644 Middleware/ArrayListMockDisplay.java create mode 100644 Middleware/BinaryTree.java create mode 100644 Middleware/LLMiddlewareTest.java create mode 100644 Middleware/LinkListDB.java create mode 100644 Middleware/LinkedListDB.java create mode 100644 Middleware/Middleware.java create mode 100644 Middleware/MockDisplay (1).java create mode 100644 Middleware/MockDisplay.java create mode 100644 Middleware/MockDisplay1.java create mode 100644 Middleware/Node.java create mode 100644 ~$ddleware methods.docx diff --git a/Middleware/ArrayListDatabase (1).java b/Middleware/ArrayListDatabase (1).java new file mode 100644 index 0000000..e1099f7 --- /dev/null +++ b/Middleware/ArrayListDatabase (1).java @@ -0,0 +1,29 @@ + +/** +*@author Eldari Gogiashvili +*@version version 1.0.0 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class ArrayListDatabase{ + + public setStudent(){ + +} + public getStudent(){ + } + public addStudent(){ + } + public removeStudent(){ + } + public clearAllStudents(){ + } + public returnSize(){ + } +/** +*This class was created for Middleware. +*/ \ No newline at end of file diff --git a/Middleware/ArrayListDatabase.java b/Middleware/ArrayListDatabase.java new file mode 100644 index 0000000..f21b186 --- /dev/null +++ b/Middleware/ArrayListDatabase.java @@ -0,0 +1,55 @@ +package edu.oakland.production.ClassProject; + +import java.util.*; + + +/** +*@author Eldari Gogiashvili +*@version version 1.0.1 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class ArrayListDatabase{ + + ArrayList students; + + ArrayListDatabase(int size){ + students = new ArrayList(size); + } + + + public Integer getStudent(int i){ + return students.get(i); + } + + + public void setStudent(int i, int j){ + students.add(i,j); + } + + + public void addStudent(int i){ + students.add(i); + } + + + public void removeStudent(int i){ + students.remove(i); + } + + + public int returnSize(){ + return students.size(); + } + + public void clearAllStudents(){ + students.clear(); + } +} +/** +*This class was created for Middleware. +*/ \ No newline at end of file diff --git a/Middleware/ArrayListMockDisplay.java b/Middleware/ArrayListMockDisplay.java new file mode 100644 index 0000000..8e8ae60 --- /dev/null +++ b/Middleware/ArrayListMockDisplay.java @@ -0,0 +1,33 @@ +package edu.oakland.production.ClassProject; + +import edu.oakland.production.ClassProject.*; +/** +*@author Eldari Gogiashvili +*@version version 1.0.1 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class ArrayListMockDisplay { + public void main(String[] args){ + + int ListSize = 100; + int searchKey = 100; + + /** + *Constructor for Middleware. + */ + MidArrayList mw = new MidArrayList(ListSize); + mw.selectionSort(); + mw.linearSearch(searchKey); + mw.binarySearch(searchKey); + + MidArrayList mw1 = new MidArrayList(ListSize); + mw1.bubbleSort(); + mw1.linearSearch(searchKey); + mw1.binarySearch(searchKey); + } +} \ No newline at end of file diff --git a/Middleware/BinaryTree.java b/Middleware/BinaryTree.java new file mode 100644 index 0000000..d75c46e --- /dev/null +++ b/Middleware/BinaryTree.java @@ -0,0 +1,62 @@ +package edu.oakland.production.ClassProject.middleware; + +public class BinaryTree{ + + private Node root; + + private void addNode(String name, double gpa, int tg){ + Node newNode = new Node(name, gpa, tg); + if(root == null){ + root = newNode; + } + else{ + Node focusNode = root; + Node parent; + while(true){ + parent = focusNode; + if(tg < focusNode.tg){ + focusNode = focusNode.leftChild; + + if(focusNode == null){ + parent.leftChild = newNode; + return; + } + } + else { + focusNode = focusNode.rightChild; + if(focusNode == null){ + parent.rightChild = newNode; + return; + } + } + } + } + } + + private void preorderTraverseTree(Node focusNode){ + if(focusNode != null){ + System.out.println(focusNode); + preorderTraverseTree(focusNode.leftChild); + preorderTraverseTree(focusNode.rightChild); + } + } + + private Node findNode(int tg){ + Node focusNode = root; + while(focusNode.tg != tg){ + if(tg < focusNode.tg){ + focusNode = focusNode.leftChild; + } + else{ + focusNode = focusNode.rightChild; + } + if(focusNode == null){ + return null; + } + } + return focusNode; + + } + + } + diff --git a/Middleware/LLMiddlewareTest.java b/Middleware/LLMiddlewareTest.java new file mode 100644 index 0000000..3aa4f4a --- /dev/null +++ b/Middleware/LLMiddlewareTest.java @@ -0,0 +1,76 @@ +package edu.oakland.test.ClassProject; + +import java.util.*; +import junit.framework.*; +import edu.oakland.production.ClassProject.*; + +/** +*@author Zack Waldrup +*@version version 1.0 150401 +*@since version 1.0 150401 +*/ +public class LLMiddlewareTest extends TestCase { + + /** + *Instance variables needed for test classes + */ + int listSize = 10; + int searchInt = 200; + LinkedListMiddleware mw1; + + /** + *setUp method to ensure a new LinkedListMiddleware class on each test + */ + public void setUp() { + mw1 = new LinkedListMiddleware(listSize); + } + + /** + *This method tests whether the elements in the list are in order + */ + public void testSelectSort() { + boolean goodSort = true; + mw1.selectSort(); + for(int i = 1; i < listSize; i++){ + if(mw1.db.get(i) > mw1.db.get(i+1)) { + goodsort = false; + } + } + assertTrue(goodsort); + } + + /** + *This method tests whether the elements in the list are in order + */ + public void testBubbleSort() { + boolean goodSort = true; + mw1.bubbleSort(); + for(int i = 1; i < listSize; i++){ + if(mw1.db.get(i) > mw1.db.get(i+1)) { + goodsort = false; + } + } + assertTrue(goodsort); + } + + /** + *This method tests whether the linear search finds the given integer + */ + public void testLinearSearch() { + mw1.db.add(1, searchInt); + mw1.selectSort(); + mw1.linearSearch(searchInt); + assertTrue(valuePresent); + } + + /** + *This method tests whether the binary search finds the given integer + */ + public void testBinarySearch() { + mw1.db.add(1, searchInt); + mw1.selectSort(); + mw1.binarySearch(searchInt); + assertTrue(valuePresent); + } + +} \ No newline at end of file diff --git a/Middleware/LinkListDB.java b/Middleware/LinkListDB.java new file mode 100644 index 0000000..0bbf3d3 --- /dev/null +++ b/Middleware/LinkListDB.java @@ -0,0 +1,24 @@ + +/** +*@author Eldari Gogiashvili +*@version version 1.0.0 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class LinkListDB{ + + public static add(){ + +} + public static get(){ +} + + public static set(){ +} +/** +*This class was created for Middleware. +*/ \ No newline at end of file diff --git a/Middleware/LinkedListDB.java b/Middleware/LinkedListDB.java new file mode 100644 index 0000000..d72f126 --- /dev/null +++ b/Middleware/LinkedListDB.java @@ -0,0 +1,27 @@ +package edu.oakland.production.ClassProject; + +/** +*@author Eldari Gogiashvili, Zack Waldrup +*@version version 1.0.1 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class LinkedListDB{ + + public void add(int index, int value){ + } + + public int get(int value){ + return 1; + } + + public void set(int index, int value){ + } +} +/** +*This class was created for Middleware. +*/ \ No newline at end of file diff --git a/Middleware/Middleware.java b/Middleware/Middleware.java new file mode 100644 index 0000000..17c0e27 --- /dev/null +++ b/Middleware/Middleware.java @@ -0,0 +1,111 @@ + +/** +*@author Eldari Gogiashvili +*@version version 1.0.0 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class Middleware { + + /** + *Instance variables. + */ + int ListSize; + + int Size; + + int size; + int key1; + int key2; + int key3; + + int n; + + int input; + int size; + int array; + + int param + + /** + *Constructor for LinkedListMiddleware. + *@param ListSize Takes an integer and passes it to the LinkedListMiddleware instance. + */ + LinkedListMiddleware mw = new LinkedListMiddleware(); + mw.LinkedListMiddleware(int ListSize); + mw.selectSort(); + mw.bubbleSort(); + mw.linearSearch(); + mw.binarySearch(); + + + /** + *Constructor for MidArrayList. + *@param ListSize Takes an integer and passes it to the MidArrayList instance. + */ + MidArrayList mw1 = new MidArrayList(); + mw1.MidArrayList(int Size); + mw1.bubbleSort(); + mw1.selectionSort(); + mw1.linearSearch(); + mw1.binarySearch(); + + /** + *Constructor for Middleware1. + *@param ListSize Takes an integer and passes it to the Middleware1 instance. + */ + Middleware1 mw2 = new Middleware1(); + mw2.createBinaryTree(int size); + mw2.calculatePreorderNodesSearched(int key1, int key2, int key3); + mw2.calculateInOrderNodesSearched(int key1, int key2, int key3); + mw2.calculatePreorderSearchDuration(int key1, int key2, int key3); + mw2.calculateInOrderSearchDuration(int key1, int key2, int key3); + mw2.calculateBigORelationship(); + mw2.getDatabase(); + mw2.setDatabase(Database database); + + /** + *Constructor for HashClient. + *@param ListSize Takes an integer and passes it to the HashClient instance. + */ + HashClient mw3 = new HashClient(); + mw3.createHashTable(int n); + mw3.findHashTableValue(); + mw3.bigONotation(); + + /** + *Constructor for HashFinder. + *@param ListSize Takes an integer and passes it to the HashClient instance. + */ + HashFinder mw4 = new HashFinder(); + mw4.findHashValue(int input, int size, int array); + + /** + *Constructor for StackCut. + *@param ListSize Takes an integer and passes it to the HashClient instance. + */ + StackCut mw5 = new StackCut(); + mw5.StackCut(int param); + mw5.push(Object param); + mw5.pop(Object param); + mw5.displayStacks(); + mw5.peek(); + + /** + *Constructor for Student. + *@param ListSize Takes an integer and passes it to the HashClient instance. + */ + Student mw6 = new Student(); + mw6.getID(); + mw6.getName(); + mw6.getMajor(); + mw6.getGPA(); + mw6.getTG(); + +/** +*This class was created for Middleware. +*/ \ No newline at end of file diff --git a/Middleware/MockDisplay (1).java b/Middleware/MockDisplay (1).java new file mode 100644 index 0000000..981f2d4 --- /dev/null +++ b/Middleware/MockDisplay (1).java @@ -0,0 +1,28 @@ + +/** +*@author Eldari Gogiashvili +*@version version 1.0.0 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class MockDisplay { + + int ListSize + + /** + *Constructor for Middleware. + */ + LinkedListMiddleware mw = new LinkedListMiddleware(ListSize); + mw.selectSort(); + mw.linearSearch(); + mw.binarySearch(); + + LinkedListMiddleware mw1 = new LinkedListMiddleware(ListSize); + mw1.bubbleSort(); + mw1.linearSearch(); + mw1.binarySearch(); +} \ No newline at end of file diff --git a/Middleware/MockDisplay.java b/Middleware/MockDisplay.java new file mode 100644 index 0000000..c167935 --- /dev/null +++ b/Middleware/MockDisplay.java @@ -0,0 +1,35 @@ +package edu.oakland.production.ClassProject; + +/** +*@author Eldari Gogiashvili, Zack Waldrup +*@version version 1.0.1 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class MockDisplay { + + int ListSize = 10; + + /** + *Method for testing the LinkedListMiddleware class + */ + public void testLL(){ + /** + *Constructor for Middleware. + */ + LinkedListMiddleware mw = new LinkedListMiddleware(ListSize); + mw.selectSort(); + mw.linearSearch(100); + mw.binarySearch(100); + + LinkedListMiddleware mw1 = new LinkedListMiddleware(ListSize); + mw1.bubbleSort(); + mw1.linearSearch(100); + mw1.binarySearch(100); + + } +} \ No newline at end of file diff --git a/Middleware/MockDisplay1.java b/Middleware/MockDisplay1.java new file mode 100644 index 0000000..1f06419 --- /dev/null +++ b/Middleware/MockDisplay1.java @@ -0,0 +1,28 @@ + +/** +*@author Eldari Gogiashvili +*@version version 1.0.0 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class MockDisplay { + + int ListSize + + /** + *Constructor for Middleware. + */ + LinkedListMiddleware mw = new MidArrayList(ListSize); + mw.selectSort(); + mw.linearSearch(); + mw.binarySearch(); + + LinkedListMiddleware mw1 = new MidArrayList(ListSize); + mw1.bubbleSort(); + mw1.linearSearch(); + mw1.binarySearch(); +} \ No newline at end of file diff --git a/Middleware/Node.java b/Middleware/Node.java new file mode 100644 index 0000000..af2eee7 --- /dev/null +++ b/Middleware/Node.java @@ -0,0 +1,19 @@ +package edu.oakland.production.ClassProject.middleware; + +public class Node{ + + public int tg; + public String name; + public double gpa; + public Node leftChild; + public Node rightChild; + + Node(int intTg, String stringName, double doubleGpa){ + this.tg = intTg; + this.name = stringName; + this.gpa = doubleGpa; + } + public String toString(){ + return name + " has a thesis grade of " + tg; + } +} \ No newline at end of file diff --git a/~$ddleware methods.docx b/~$ddleware methods.docx new file mode 100644 index 0000000000000000000000000000000000000000..23095ada55a72eed6d7d045e76c8c891629fd2cf GIT binary patch literal 162 zcmd<{D9ugGRd7ryEzT?{Nn{`n@G*EWlrrQpBm%JlgCj!{kXOu*$xs4>$Yw12zqR}( l149oZ149D{I|B(Adm0mhy&A{{fyEH@9S|M^!;fc+m;h0Y8a)62 literal 0 HcmV?d00001 From c935a0d64d1bbaa6d538c0a736ed40d903466338 Mon Sep 17 00:00:00 2001 From: Humam Abusitta Date: Mon, 6 Apr 2015 15:45:44 -0400 Subject: [PATCH 05/10] Update 3:45 PM 20150604 --- Middleware/ArrayListDatabase (1).java | 29 ----- Middleware/BinaryTree.java | 16 +-- Middleware/LLMiddlewareTest.java | 6 +- Middleware/LinkedListMiddleware.java | 4 +- Middleware/Middleware.java | 154 ++++++++++++++++++-------- Middleware/MockDisplay (1).java | 28 ----- Middleware/MockDisplay1.java | 28 ----- Middleware/Node.java | 4 +- 8 files changed, 125 insertions(+), 144 deletions(-) delete mode 100644 Middleware/ArrayListDatabase (1).java delete mode 100644 Middleware/MockDisplay (1).java delete mode 100644 Middleware/MockDisplay1.java diff --git a/Middleware/ArrayListDatabase (1).java b/Middleware/ArrayListDatabase (1).java deleted file mode 100644 index e1099f7..0000000 --- a/Middleware/ArrayListDatabase (1).java +++ /dev/null @@ -1,29 +0,0 @@ - -/** -*@author Eldari Gogiashvili -*@version version 1.0.0 date 150331 -*since version 1.0.0 -*/ - -/** -*This class represents the middleware -*/ - -public class ArrayListDatabase{ - - public setStudent(){ - -} - public getStudent(){ - } - public addStudent(){ - } - public removeStudent(){ - } - public clearAllStudents(){ - } - public returnSize(){ - } -/** -*This class was created for Middleware. -*/ \ No newline at end of file diff --git a/Middleware/BinaryTree.java b/Middleware/BinaryTree.java index d75c46e..62ecdf8 100644 --- a/Middleware/BinaryTree.java +++ b/Middleware/BinaryTree.java @@ -2,9 +2,9 @@ public class BinaryTree{ - private Node root; + public Node root; - private void addNode(String name, double gpa, int tg){ + public void addNode(String name, double gpa, int tg){ Node newNode = new Node(name, gpa, tg); if(root == null){ root = newNode; @@ -33,7 +33,7 @@ private void addNode(String name, double gpa, int tg){ } } - private void preorderTraverseTree(Node focusNode){ + public void preorderTraverseTree(Node focusNode){ if(focusNode != null){ System.out.println(focusNode); preorderTraverseTree(focusNode.leftChild); @@ -41,18 +41,18 @@ private void preorderTraverseTree(Node focusNode){ } } - private Node findNode(int tg){ + public Node findNode(int tg){ Node focusNode = root; while(focusNode.tg != tg){ + if(tg > focusNode.tg){ + return focusNode; + } if(tg < focusNode.tg){ focusNode = focusNode.leftChild; } else{ focusNode = focusNode.rightChild; - } - if(focusNode == null){ - return null; - } + } } return focusNode; diff --git a/Middleware/LLMiddlewareTest.java b/Middleware/LLMiddlewareTest.java index 3aa4f4a..5803d38 100644 --- a/Middleware/LLMiddlewareTest.java +++ b/Middleware/LLMiddlewareTest.java @@ -6,7 +6,7 @@ /** *@author Zack Waldrup -*@version version 1.0 150401 +*@version version 1.1 150403 *@since version 1.0 150401 */ public class LLMiddlewareTest extends TestCase { @@ -57,7 +57,7 @@ public void testBubbleSort() { *This method tests whether the linear search finds the given integer */ public void testLinearSearch() { - mw1.db.add(1, searchInt); + mw1.db.add(searchInt); mw1.selectSort(); mw1.linearSearch(searchInt); assertTrue(valuePresent); @@ -67,7 +67,7 @@ public void testLinearSearch() { *This method tests whether the binary search finds the given integer */ public void testBinarySearch() { - mw1.db.add(1, searchInt); + mw1.db.add(searchInt); mw1.selectSort(); mw1.binarySearch(searchInt); assertTrue(valuePresent); diff --git a/Middleware/LinkedListMiddleware.java b/Middleware/LinkedListMiddleware.java index f355261..7ea4c91 100644 --- a/Middleware/LinkedListMiddleware.java +++ b/Middleware/LinkedListMiddleware.java @@ -5,7 +5,7 @@ /** *@author Zack Waldrup -*@version version 2.3 150401 +*@version version 2.4 150403 *@since version 1.0 150323 */ public class LinkedListMiddleware { @@ -151,7 +151,7 @@ public void createLinkedList(int listSize) { this.listSize = listSize; for(int i = 0; i < listSize; i++) { - db.add(i, randomInt(100, 1000)); + db.add(randomInt(100, 1000)); } } diff --git a/Middleware/Middleware.java b/Middleware/Middleware.java index 17c0e27..54252d1 100644 --- a/Middleware/Middleware.java +++ b/Middleware/Middleware.java @@ -1,111 +1,177 @@ - +package edu.oakland.production.ClassProject.middleware; +import edu.oakland.production.ClassProject.middleware.*; /** *@author Eldari Gogiashvili -*@version version 1.0.0 date 150331 -*since version 1.0.0 +*@version version 2.0.0 date 150405 +*since version 1.0.0 date 150331 */ /** -*This class represents the middleware +*This class represents the middleware. */ public class Middleware { - + /** - *Instance variables. + *Instance variables used in subsequent methods. */ int ListSize; - int Size; - int size; int key1; int key2; int key3; - int n; - int input; int size; int array; - - int param - + int param; + int ID; + string Name; + string Major; + double GPA; + double TG; + + LinkedListMiddleware mw = new LinkedListMiddleware(); + MidArrayList mw1 = new MidArrayList(); + BinaryTreeMW mw2 = new BinaryTreeMW(); + HashClient mw3 = new HashClient(); + HashFinder mw4 = new HashFinder(); + StackCut mw5 = new StackCut(); + StudentStack studentStack = new StudentStack(10); /** *Constructor for LinkedListMiddleware. *@param ListSize Takes an integer and passes it to the LinkedListMiddleware instance. + *Calls the LinkedListMiddleware, selectSort, bubbleSort,linearSearch, and binarySearch methods. */ - LinkedListMiddleware mw = new LinkedListMiddleware(); + public void llMW(){ mw.LinkedListMiddleware(int ListSize); + } + public void selectSortLL(){ mw.selectSort(); + return int TaskTime + } + public void bubbleSortLL(){ mw.bubbleSort(); + return int TaskTime + } + public void linearSearchLL(){ mw.linearSearch(); + return + } + public void binarySearchLL(){ mw.binarySearch(); - + return + } /** *Constructor for MidArrayList. - *@param ListSize Takes an integer and passes it to the MidArrayList instance. - */ - MidArrayList mw1 = new MidArrayList(); + *@param Size Takes an integer and passes it to the MidArrayList instance. + *Calls the MidArrayList, bubbleSort, selectionSort, linearSearch, and binarySearch methods. + */ + public void alMW(){ mw1.MidArrayList(int Size); + } + public void bubbleSortAL(){ mw1.bubbleSort(); + } + public void selectionSortAL(){ mw1.selectionSort(); + } + public void linearSearchAL(){ mw1.linearSearch(); + } + public void binarySearchAL(){ mw1.binarySearch(); - + } + /** - *Constructor for Middleware1. - *@param ListSize Takes an integer and passes it to the Middleware1 instance. + *Constructor for BinaryTree. + *@param size Takes an integer and passes it to the BinaryTree instance. + *@param key1 Passes random string value to the BinaryTree instance. + *@param key2 Passes random string value to the BniaryTree instance. + *@param key3 Passes random string value to the BinaryTree instance. + *Calls the createBinaryTree, calculatePreorderNodesSearched, calculateInOrderNodesSearched, calculatePreorderSearchDuration, calculateInOrderSearchDuration, calculateBigORelationship, getDatabase, and setDatabase methods. */ - Middleware1 mw2 = new Middleware1(); - mw2.createBinaryTree(int size); + public void BinaryTreeMW(){ + mw2.BinaryTreeMW(int size); + } + public void calculatePreorderNodesSearched(){ mw2.calculatePreorderNodesSearched(int key1, int key2, int key3); + } + public void calculateInOrderNodesSearched(){ mw2.calculateInOrderNodesSearched(int key1, int key2, int key3); + } + public void calculatePreorderSearchDuration(){ mw2.calculatePreorderSearchDuration(int key1, int key2, int key3); + } + public void calculateInOrderSearchDuration(){ mw2.calculateInOrderSearchDuration(int key1, int key2, int key3); + } + public void calculateBigORelationship(){ mw2.calculateBigORelationship(); - mw2.getDatabase(); - mw2.setDatabase(Database database); - + } + /** *Constructor for HashClient. - *@param ListSize Takes an integer and passes it to the HashClient instance. + *@param n Takes an integer and passes it to the HashClient instance. + *Calls the createHashTable, findHashTableValue, and BigONotation methods. */ - HashClient mw3 = new HashClient(); + public void createHashTable(){ mw3.createHashTable(int n); - mw3.findHashTableValue(); + } + public void findHashTableValue(int value){ + mw3.findHashTableValue(int value); + return int index + } + public void bigONotation(){ mw3.bigONotation(); - + return string Time + } /** *Constructor for HashFinder. - *@param ListSize Takes an integer and passes it to the HashClient instance. + *@param input Passes integer to the HashFinder instance. + *@param size Passes integer to the HashFinder instance. + *@param array Passes array to the HashFinder instance. */ - HashFinder mw4 = new HashFinder(); + public void findHashValue(){ mw4.findHashValue(int input, int size, int array); + } /** *Constructor for StackCut. - *@param ListSize Takes an integer and passes it to the HashClient instance. + *@param param Passes a parameter to the StackCut instance. */ - StackCut mw5 = new StackCut(); + public void StackCut(){ mw5.StackCut(int param); + } + public void push(){ mw5.push(Object param); + } + public void pop(){ mw5.pop(Object param); + } + public void displayStacks(){ mw5.displayStacks(); + } + public void peek(){ mw5.peek(); + } /** - *Constructor for Student. - *@param ListSize Takes an integer and passes it to the HashClient instance. + *Method for creating a Student. + *@param ID + *@param Name + *@param Major + *@param GPA + *@param TG + *Creates a Student Object and pushes it to the stack. */ - Student mw6 = new Student(); - mw6.getID(); - mw6.getName(); - mw6.getMajor(); - mw6.getGPA(); - mw6.getTG(); - + public static void createStudent(int ID, string Name, string Major, double GPA, double TG){ + Student newStudent = new Student(ID, Name, Major, GPA, TG); + studentStack.push(newStudent); +} +} /** *This class was created for Middleware. -*/ \ No newline at end of file +*/ diff --git a/Middleware/MockDisplay (1).java b/Middleware/MockDisplay (1).java deleted file mode 100644 index 981f2d4..0000000 --- a/Middleware/MockDisplay (1).java +++ /dev/null @@ -1,28 +0,0 @@ - -/** -*@author Eldari Gogiashvili -*@version version 1.0.0 date 150331 -*since version 1.0.0 -*/ - -/** -*This class represents the middleware -*/ - -public class MockDisplay { - - int ListSize - - /** - *Constructor for Middleware. - */ - LinkedListMiddleware mw = new LinkedListMiddleware(ListSize); - mw.selectSort(); - mw.linearSearch(); - mw.binarySearch(); - - LinkedListMiddleware mw1 = new LinkedListMiddleware(ListSize); - mw1.bubbleSort(); - mw1.linearSearch(); - mw1.binarySearch(); -} \ No newline at end of file diff --git a/Middleware/MockDisplay1.java b/Middleware/MockDisplay1.java deleted file mode 100644 index 1f06419..0000000 --- a/Middleware/MockDisplay1.java +++ /dev/null @@ -1,28 +0,0 @@ - -/** -*@author Eldari Gogiashvili -*@version version 1.0.0 date 150331 -*since version 1.0.0 -*/ - -/** -*This class represents the middleware -*/ - -public class MockDisplay { - - int ListSize - - /** - *Constructor for Middleware. - */ - LinkedListMiddleware mw = new MidArrayList(ListSize); - mw.selectSort(); - mw.linearSearch(); - mw.binarySearch(); - - LinkedListMiddleware mw1 = new MidArrayList(ListSize); - mw1.bubbleSort(); - mw1.linearSearch(); - mw1.binarySearch(); -} \ No newline at end of file diff --git a/Middleware/Node.java b/Middleware/Node.java index af2eee7..d47c86f 100644 --- a/Middleware/Node.java +++ b/Middleware/Node.java @@ -8,10 +8,10 @@ public class Node{ public Node leftChild; public Node rightChild; - Node(int intTg, String stringName, double doubleGpa){ - this.tg = intTg; + Node(String stringName, double doubleGpa, int intTg){ this.name = stringName; this.gpa = doubleGpa; + this.tg = intTg; } public String toString(){ return name + " has a thesis grade of " + tg; From 18a28d9ace6ce8f3e90b8546b5b132ecf2d248f1 Mon Sep 17 00:00:00 2001 From: Humam Abusitta Date: Mon, 6 Apr 2015 16:02:35 -0400 Subject: [PATCH 06/10] Update 3:45 PM 20150604 --- Middleware/BinaryTreeMW.java | 467 +++++++++++++++++++++++++++++++++ Middleware/CSE231-ClassProject | 1 + Middleware/StackCut.java | 57 ++++ Middleware/Student.java | 35 +++ Middleware/StudentTest.java | 204 ++++++++++++++ 5 files changed, 764 insertions(+) create mode 100644 Middleware/BinaryTreeMW.java create mode 160000 Middleware/CSE231-ClassProject create mode 100644 Middleware/StackCut.java create mode 100644 Middleware/Student.java create mode 100644 Middleware/StudentTest.java diff --git a/Middleware/BinaryTreeMW.java b/Middleware/BinaryTreeMW.java new file mode 100644 index 0000000..f2a68a4 --- /dev/null +++ b/Middleware/BinaryTreeMW.java @@ -0,0 +1,467 @@ +package edu.oakland.production.ClassProject.Middleware; + +//Import java util framework +import java.util.*; + +//Import BinaryTreeDB.java & Node.java +import edu.oakland.production.ClassProject.Database.*; + + +/* + * BinaryTreeMW. + * + * @author Joshua Herkness, Trevor Luebbert Middleware + * @version version 2.0 + * @since version 1.0 + */ +public class BinaryTreeMW { + + /// Minimum possible key value, used with generating a random key. + private int minimumKeyValue = 400000; + /// Maximum possible key value, used with generating a random key. + private int maximumKeyValue = 800000; + + /// Minimum possible name value, used with generating a random name. + private int minimumNameValue = 200000; + /// Maximum possible key value, used with generating a random name. + private int maximumNameValue = 600000; + + private BinaryTreeDB binaryTreeDatabase; + + /* + * Default constructor for the BinaryTreeMW Class. + * + * @returns BinaryTreeMW + */ + public BinaryTreeMW(){ + + this.binaryTreeDatabase = new BinaryTreeDB(); + } + + /* + * Overloaded constructor for the BinaryTreeMW Class. Popluates the binaryTreeDatabase given a size. + * + * @param size Integer value corresponding to the desired size of the BinaryTreeDB object. + * + * @returns BinaryTreeMW + */ + public BinaryTreeMW(int size){ + + this.binaryTreeDatabase = new BinaryTreeDB(); + + // Populates the BinaryTreeDB object + populateBinaryTreeDB(size); + } + + /* + * Populates a private global BinaryTreeDB object with a given amount of nodes. Creates a non-duplicate random key and name for each node. + * + * @param size Integer value corresponding to the size of the binary tree. + * + */ + public void populateBinaryTreeDB(int size){ + + // Refresh the BinaryTreeDB object. + this.binaryTreeDatabase = new BinaryTreeDB(); + + // Create a non-duplicate random number list for keys. + List nonDuplicateRandomNumberKeys = new ArrayList(); + // Create a non-duplicate random number list for names. + List nonDuplicateRandomNumberNames = new ArrayList(); + + // Populate both key and name lists. + nonDuplicateRandomNumberKeys = createNonDuplicateRandomNumbers(minimumKeyValue, maximumKeyValue, size); + nonDuplicateRandomNumberNames = createNonDuplicateRandomNumbers(minimumNameValue, maximumNameValue, size); + + for (int i = 0; i < size; i++){ + + // Reference key integer from a given index. + int key = nonDuplicateRandomNumberKeys.get(i); + // Reference name integer from a given index, then convert to a string. + String name = String.valueOf(nonDuplicateRandomNumberNames.get(i)); + + // Add a node to the BinaryTreeDB, given the key and name. + this.binaryTreeDatabase.addNode(key, name); + + } + } + + /* + * Searches for three integer key values, providing a record of the amount of nodes searched durring a preorder search. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns nodesSearched String value corresponding to the number of nodes searched respectively. + */ + public String calculatePreorderNodesSearched(int key1, int key2, int key3){ + + String nodesSearched = ""; + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + nodesSearched += String.valueOf(calculatePreorderNodesSearched(this.binaryTreeDatabase, focusNode, key1)); + nodesSearched += " "; + + nodesSearched += String.valueOf(calculatePreorderNodesSearched(this.binaryTreeDatabase, focusNode, key2)); + nodesSearched += " "; + + nodesSearched += String.valueOf(calculatePreorderNodesSearched(this.binaryTreeDatabase, focusNode, key3)); + + return nodesSearched; + } + + /* + * Searches for three integer key values, providing a record of the amount of nodes searched durring an in order search. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns nodesSearched String value corresponding to the number of nodes searched respectively. + */ + public String calculateInOrderNodesSearched(int key1, int key2, int key3){ + + String nodesSearched = ""; + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + nodesSearched += String.valueOf(calculateInOrderNodesSearched(this.binaryTreeDatabase, focusNode, key1)); + nodesSearched += " "; + + nodesSearched += String.valueOf(calculateInOrderNodesSearched(this.binaryTreeDatabase, focusNode, key2)); + nodesSearched += " "; + + nodesSearched += String.valueOf(calculateInOrderNodesSearched(this.binaryTreeDatabase, focusNode, key3)); + + return nodesSearched; + } + + /* + * Calculates the amount of nodes searched for locating a given key using a preorder search. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculatePreorderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ + + int nodesSearched = calculatePreorderNodesSearched(binaryTreeDatabase, focusNode, key, true); + + return nodesSearched; + + } + + /* + * Helper recursive method used to calculates the amount of nodes searched for locating a given key using a preorder search. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * @param continueSearch Boolean value corresponding to whether the node has been located. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculatePreorderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key, boolean continueSearching){ + + // Begin each recursion with zero nodes searched. + int nodesSearched = 0; + + // Ignore the recursion loop if the node is already found, or if the node is non existant. + if (!continueSearching){ + return 0; + } else if (focusNode == null){ + return 0; + } else { + // Count the node. + nodesSearched++; + } + + // If the focus node has the desired key, increament the amount of nodesSearched, and skip all other recursions. + if (focusNode.getKey() == key){ + + continueSearching = false; + return nodesSearched; + + } + + if (focusNode.leftChild != null){ + nodesSearched += calculatePreorderNodesSearched(binaryTreeDatabase, focusNode.leftChild, key, continueSearching); + } + + if (focusNode.rightChild != null){ + nodesSearched += calculatePreorderNodesSearched(binaryTreeDatabase, focusNode.rightChild, key, continueSearching); + } + + return nodesSearched; + + } + + /* + * Calculates the amount of nodes searched for locating a given key using an in order search. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculateInOrderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ + + int nodesSearched = calculateInOrderNodesSearched(binaryTreeDatabase, focusNode, key, true); + + return nodesSearched; + } + + /* + * Helper recursive method used to calculates the amount of nodes searched for locating a given key using an in order search. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * @param continueSearch Boolean value corresponding to whether the node has been located. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculateInOrderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key, boolean continueSearching){ + + // Begin each recursion with zero nodes searched. + int nodesSearched = 0; + + // Ignore the recursion loop if the node is already found, or if the node is non existant. + if (!continueSearching){ + return 0; + } else if (focusNode == null){ + return 0; + } else { + // Count the node. + nodesSearched++; + } + + if (focusNode.leftChild != null){ + nodesSearched += calculateInOrderNodesSearched(binaryTreeDatabase, focusNode.leftChild, key, continueSearching); + } + + // If the focus node has the desired key, increament the amount of nodesSearched, and + if (focusNode.getKey() == key){ + + continueSearching = false; + return nodesSearched; + + } + + if (focusNode.rightChild != null){ + nodesSearched += calculateInOrderNodesSearched(binaryTreeDatabase, focusNode.rightChild, key, continueSearching); + } + + return nodesSearched; + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct a preorder search on each of the three integer keys provided. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns duration String value corresponding to the time elapsed durring each of the searches respectively. + */ + public String calculatePreorderSearchDuration(int key1, int key2, int key3){ + + String duration = ""; + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + duration += Double.toString(calculatePreorderSearchDuration(this.binaryTreeDatabase, focusNode, key1)); + duration += " "; + + duration += Double.toString(calculatePreorderSearchDuration(this.binaryTreeDatabase, focusNode, key2)); + duration += " "; + + duration += Double.toString(calculatePreorderSearchDuration(this.binaryTreeDatabase, focusNode, key3)); + + return duration; + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct an in order search on each of the three integer keys provided. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns duration String value corresponding to the time elapsed durring each of the searches respectively. + */ + public String calculateInOrderSearchDuration(int key1, int key2, int key3){ + + String duration = ""; + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + duration += Double.toString(calculateInOrderSearchDuration(this.binaryTreeDatabase, focusNode, key1)); + duration += " "; + + duration += Double.toString(calculateInOrderSearchDuration(this.binaryTreeDatabase, focusNode, key2)); + duration += " "; + + duration += Double.toString(calculateInOrderSearchDuration(this.binaryTreeDatabase, focusNode, key3)); + + return duration; + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct a preorder search on the integer key provided. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns double Double type corresponding to time taken to search the binaryTreeDatabase. + */ + private double calculatePreorderSearchDuration(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ + + double startTime = System.currentTimeMillis(); + int temporary = calculatePreorderNodesSearched(binaryTreeDatabase, focusNode, key); + double endTime = System.currentTimeMillis(); + + return (endTime - startTime); + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct an in order search on the key provided. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns double Double type corresponding to time taken to search the binaryTreeDatabase. + */ + private double calculateInOrderSearchDuration(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ + + double startTime = System.currentTimeMillis(); + int temporary = calculateInOrderNodesSearched(binaryTreeDatabase, focusNode, key); + double endTime = System.currentTimeMillis(); + + return (endTime - startTime); + } + + /* + * Gathers data for the BigO notaion, returning a string of the duration spent searching after each recursion, as well as the description of the notation. + * + * @returns bigO String value corresponding to the big O notation and data set as proof. + */ + public String calculateBigORelationship(){ + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + String bigO = ""; + + // Description of the BigO notation. + bigO += "After each recursion, the time spent searching is halved" + + "since you can only move down either the left or right child nodes." + + "This halving of the data can be represented as O (log N)"; + + // Introduction to the data set + bigO += "\nThe time spent searching during each recursion are as follows:\n"; + + //the key is -1 so the search method goes through the entire tree + bigO += calculateInOrderTimeElapsed(focusNode, -1, true); + + return bigO; + } + + /* + * Calculates durration of each recursion of the method. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Node object. + * @param key Integer value corresponding to the key of a given node object. + * @param continueSearching Boolean value that tells the method whether or not it needs to continue searching. + * + * @returns time String value that returns data regarding time spent during each recursion of the method. + */ + private String calculateInOrderTimeElapsed(Node focusNode, int key, boolean continueSearching){ + + String time = ""; + + //Capture the start time. + double startTime = System.currentTimeMillis(); + + // Ignore the recursion loop if the node is already found, or if the node is non existant. + if (!continueSearching){ + return ""; + } else if (focusNode == null){ + return ""; + } + + if (focusNode.leftChild != null){ + time += " "; + time += calculateInOrderTimeElapsed(focusNode.leftChild, key, continueSearching); + } + + // If the focus node has the desired key, stop searching + if (focusNode.getKey == key){ + continueSearching = false; + } + + if (focusNode.rightChild != null){ + time += " "; + time += calculateInOrderTimeElapsed(focusNode.rightChild, key, continueSearching); + } + + double endTime = System.currentTimeMillis(); + + time += " "; + time += (Double.toString(endTime-startTime)); + return time; + } + + /* + * Generates a non-duplicate random number list, given a minimumValue, maximumValue, and size. + * + * @param minimumValue Integer value corresponding to the minimum possible random value generated. + * @param maximumValue Integer value corresponding to the maximum possible random value generated. + * + * @returns List List type, shuffled to mimic non-duplicate random numbers. + */ + private List createNonDuplicateRandomNumbers(int minimumValue, int maximumValue, int size){ + + // Create an instance of ArrayList, with type int. + ArrayList nonDuplicateRandomNumbers = new ArrayList(); + + //Test for errors with provided data. If there arent enough possible numbers, return null. + if ((maximumValue - minimumValue) < size){ + + //There has been an error. + return null; + + } + + // For the range of numbers provided. + // Creates an ArrayList of integers from minimumValue to maximumValue. + for (int i = minimumValue; i <= maximumValue; i++){ + + // Add that number to the ArrayList. + nonDuplicateRandomNumbers.add(i); + } + + // Shuffle the ArrayList, randomizing the numbers. + Collections.shuffle(nonDuplicateRandomNumbers); + + // Return a immutable List object, created from the ArrayList, trimming off unnecessary values. + return nonDuplicateRandomNumbers.subList(0, size - 1); + } + + /* + * Retrieves the BinaryTreeDatabaseObject. + * + * @returns BinaryTreeDB + */ + public BinaryTreeDB getBinaryTreeDatabase(){ + + return this.binaryTreeDatabase; + } +} \ No newline at end of file diff --git a/Middleware/CSE231-ClassProject b/Middleware/CSE231-ClassProject new file mode 160000 index 0000000..c935a0d --- /dev/null +++ b/Middleware/CSE231-ClassProject @@ -0,0 +1 @@ +Subproject commit c935a0d64d1bbaa6d538c0a736ed40d903466338 diff --git a/Middleware/StackCut.java b/Middleware/StackCut.java new file mode 100644 index 0000000..7d4c7a4 --- /dev/null +++ b/Middleware/StackCut.java @@ -0,0 +1,57 @@ +/* + * 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 edu.oakland.production.ClassProject.middleware; +import java.util.*; +/** + *@version 1.0 + * @author Sam + */ +public class StackCut extends Stack{ + private int stackSize; + private Object[] stackArray; + private int topOfStack = -1; + + + public StackCut(int param){ + this.stackSize = param; + stackArray = new Object[stackSize]; + } + + public Object push(Object param) { + if(topOfStack+1=0){ + stackArray[topOfStack]=null; + return stackArray[topOfStack--]; + } + else{ + return null; + } + } + + public void displayStacks(){ + for(int n=0; n= 0) + return stackArray[topOfStack]; + else + return null; + } + +} diff --git a/Middleware/Student.java b/Middleware/Student.java new file mode 100644 index 0000000..d03c464 --- /dev/null +++ b/Middleware/Student.java @@ -0,0 +1,35 @@ +package edu.oakland.production.ClassProject.middleware; +import java.util.*; +import edu.oakland.production.ClassProject.middleware.*; +//version 2.0 +public class Student{ + private int gID; + private String name; + private String major; + private double gpa; + private int tg; + + public Student(int gID, String name, String major, double gpa, int tg){ + this.gID = gID; + this.name = name; + this.major = major; + this.gpa = gpa ; + this.tg = tg; + } + public int getID(){ + return gID; + } + public String getName(){ + return name; + } + public String getMajor(){ + return major; + } + public double getGPA(){ + return gpa; + } + + public int getTG(){ + return tg; + } + } \ No newline at end of file diff --git a/Middleware/StudentTest.java b/Middleware/StudentTest.java new file mode 100644 index 0000000..220a7d7 --- /dev/null +++ b/Middleware/StudentTest.java @@ -0,0 +1,204 @@ +package edu.oakland.production.ClassProject.middleware; +import junit.framework.*; +import edu.oakland.production.ClassProject.middleware.*; +//version 2.2 +public class StudentTest extends TestCase{ + private static Student student1; + private static Student student2; + private static Student student3; + private static Student student4; + private static Student student5; + private static Student student6; + private static Student student7; + private static Student student8; + private static Student student9; + private static Student student10; + + public void setUp(){ + student1 = new Student(677422, "Jones", "IT", 3.82, 95); + student2 = new Student(177993, "Smith", "IT", 3.47, 78); + student3 = new Student(444811, "Breaux", "CS", 3.95, 98); + student4 = new Student(113625, "Brady", "CS", 3.77, 92); + student5 = new Student(382707, "Rominske", "CS", 3.82, 79); + student6 = new Student(447447, "Hardy", "IT", 3.68, 99); + student7 = new Student(661284, "Kominsky", "IT", 3.23, 70); + student8 = new Student(855462, "O'Brien", "IT", 3.44, 85); + student9 = new Student(223344, "Chamberlain", "CS", 3.99, 96); + student10 = new Student(348689, "Grant", "CS", 3.88, 99); + } + + public void testStudent(){ + + final String firstStudentName = "Jones"; + + assertEquals(firstStudentName, student1.getName()); + + final String secondStudentName = "Smith"; + student2 = new Student(177993, "Smith", "IT", 3.47, 78); + assertEquals(secondStudentName, student2.getName()); + + final String thirdStudentName = "Breaux"; + student3 = new Student(444811, "Breaux", "CS", 3.95, 98); + assertEquals(thirdStudentName, student3.getName()); + + final String fourthStudentName = "Brady"; + student4 = new Student(113625, "Brady", "CS", 3.77, 92); + assertEquals(fourthStudentName, student4.getName()); + + final String fifthStudentName = "Rominske"; + student5 = new Student(382707, "Rominske", "CS", 3.82, 79); + assertEquals(fifthStudentName, student5.getName()); + + final String sixthStudentName = "Hardy"; + student6 = new Student(447447, "Hardy", "IT", 3.68, 99); + assertEquals(sixthStudentName, student6.getName()); + + final String seventhStudentName = "Kominsky"; + student7 = new Student(661284, "Kominsky", "IT", 3.23, 70); + assertEquals(seventhStudentName, student7.getName()); + + final String eighthStudentName = "O'Brien"; + student8 = new Student(855462, "O'Brien", "IT", 3.44, 85); + assertEquals(eighthStudentName, student8.getName()); + + final String ninethStudentName = "Chamberlain"; + student9 = new Student(223344, "Chamberlain", "CS", 3.99, 96); + assertEquals(ninethStudentName, student9.getName()); + + final String tenthStudentName = "Grant"; + student10 = new Student(348689, "Grant", "CS", 3.88, 99); + assertEquals(tenthStudentName, student10.getName()); + } + + public void testStack(){ + StackCut stackcut = new StackCut(10); + stackcut.push(student1.getID()); + stackcut.push(student2.getID()); + stackcut.push(student3.getID()); + stackcut.push(student4.getID()); + stackcut.push(student5.getID()); + stackcut.push(student6.getID()); + stackcut.push(student7.getID()); + stackcut.push(student8.getID()); + stackcut.push(student9.getID()); + stackcut.push(student10.getID()); + System.out.println("The current stack is: "); + stackcut.displayStacks(); + System.out.println(); + for(int i=0;i<5;i++){ + Object sgid = stackcut.peek(); + int h = (Integer) sgid; + if(h == student1.getID()){ + System.out.println("Student of name: "+student1.getName()+" and GID: "+student1.getID()+" was removed from the list."); + System.out.println(student1.getName()+" had a major of: "+student1.getMajor()+" a GPA of: "+student1.getGPA()+" and a thesis grade of: "+student1.getTG()); + System.out.println(); + } + if(h == student2.getID()){ + System.out.println("Student of name: "+student2.getName()+" and GID: "+student2.getID()+" was removed from the list."); + System.out.println(student2.getName()+" had a major of: "+student2.getMajor()+" a GPA of: "+student2.getGPA()+" and a thesis grade of: "+student2.getTG()); + System.out.println(); + } + if(h == student3.getID()){ + System.out.println("Student of name: "+student3.getName()+" and GID: "+student3.getID()+" was removed from the list."); + System.out.println(student3.getName()+" had a major of: "+student3.getMajor()+" a GPA of: "+student3.getGPA()+" and a thesis grade of: "+student3.getTG()); + System.out.println(); + } + if(h == student4.getID()){ + System.out.println("Student of name: "+student4.getName()+" and GID: "+student4.getID()+" was removed from the list."); + System.out.println(student4.getName()+" had a major of: "+student4.getMajor()+" a GPA of: "+student4.getGPA()+" and a thesis grade of: "+student4.getTG()); + System.out.println(); + } + if(h == student5.getID()){ + System.out.println("Student of name: "+student5.getName()+" and GID: "+student5.getID()+" was removed from the list."); + System.out.println(student5.getName()+" had a major of: "+student5.getMajor()+" a GPA of: "+student5.getGPA()+" and a thesis grade of: "+student5.getTG()); + System.out.println(); + } + if(h == student6.getID()){ + System.out.println("Student of name: "+student6.getName()+" and GID: "+student6.getID()+" was removed from the list."); + System.out.println(student6.getName()+" had a major of: "+student6.getMajor()+" a GPA of: "+student6.getGPA()+" and a thesis grade of: "+student6.getTG()); + System.out.println(); + } + if(h == student7.getID()){ + System.out.println("Student of name: "+student7.getName()+" and GID: "+student7.getID()+" was removed from the list."); + System.out.println(student7.getName()+" had a major of: "+student7.getMajor()+" a GPA of: "+student7.getGPA()+" and a thesis grade of: "+student7.getTG()); + System.out.println(); + } + if(h == student8.getID()){ + System.out.println("Student of name: "+student8.getName()+" and GID: "+student8.getID()+" was removed from the list."); + System.out.println(student8.getName()+" had a major of: "+student8.getMajor()+" a GPA of: "+student8.getGPA()+" and a thesis grade of: "+student8.getTG()); + System.out.println(); + } + if(h == student9.getID()){ + System.out.println("Student of name: "+student9.getName()+" and GID: "+student9.getID()+" was removed from the list."); + System.out.println(student9.getName()+" had a major of: "+student9.getMajor()+" a GPA of: "+student9.getGPA()+" and a thesis grade of: "+student9.getTG()); + System.out.println(); + } + if(h == student10.getID()){ + System.out.println("Student of name: "+student10.getName()+" and GID: "+student10.getID()+" was removed from the list."); + System.out.println(student10.getName()+" had a major of: "+student10.getMajor()+" a GPA of: "+student10.getGPA()+" and a thesis grade of: "+student10.getTG()); + System.out.println(); + } + stackcut.pop(); + + + } + System.out.println(); + System.out.println("The stack after the cut is: "); + stackcut.displayStacks(); + System.out.println(); + Object unluckystudentone =stackcut.peek(); + stackcut.pop(); + Object unluckystudenttwo = stackcut.peek(); + stackcut.pop(); + System.out.println("The stack after the cut is: "); + stackcut.displayStacks(); + System.out.println(); + System.out.println("The student with GID: "+unluckystudentone+" did not receive the scholarship."); + System.out.println("The student with GID: "+unluckystudenttwo+" also did not receive the scholarship."); + + + Object sgid = stackcut.peek(); + System.out.println(); + System.out.println("The Student with GID: " + sgid + " received the Scholarship."); + assertEquals(sgid , 444811); + stackcut.pop(); + + sgid = stackcut.peek(); + System.out.println("The Student with GID: " + sgid + " received the Scholarship."); + assertEquals(sgid, 177993); + stackcut.pop(); + + sgid = stackcut.peek(); + System.out.println("The Student with GID: " + sgid + " received the Scholarship."); + assertEquals(sgid, 677422); + stackcut.pop(); + } + public void testTree(){ + BinaryTree tree = new BinaryTree(); + + System.out.println(); + tree.addNode(student1.getName(),student1.getGPA(),student1.getTG()); + tree.addNode(student2.getName(),student2.getGPA(),student2.getTG()); + tree.addNode(student3.getName(),student3.getGPA(),student3.getTG()); + tree.addNode(student4.getName(),student4.getGPA(),student4.getTG()); + tree.addNode(student5.getName(),student5.getGPA(),student5.getTG()); + tree.addNode(student6.getName(),student6.getGPA(),student6.getTG()); + tree.addNode(student7.getName(),student7.getGPA(),student7.getTG()); + tree.addNode(student8.getName(),student8.getGPA(),student8.getTG()); + tree.addNode(student9.getName(),student9.getGPA(),student9.getTG()); + tree.addNode(student10.getName(),student10.getGPA(),student10.getTG()); + + tree.preorderTraverseTree(tree.root); + System.out.println(); + System.out.println("Students with a tg of less than 90"); + System.out.println(tree.findNode(90)); + + System.out.println(); + + } +} + + + + + From a18e20b884d5fc266a1a57a9c65bc2ed155145ca Mon Sep 17 00:00:00 2001 From: Humam Abusitta Date: Mon, 6 Apr 2015 16:11:57 -0400 Subject: [PATCH 07/10] New update from Eldari Update 4:10 PM 20150604 --- Middleware/Middleware.java | 92 +++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/Middleware/Middleware.java b/Middleware/Middleware.java index 54252d1..c564b51 100644 --- a/Middleware/Middleware.java +++ b/Middleware/Middleware.java @@ -57,11 +57,11 @@ public void bubbleSortLL(){ } public void linearSearchLL(){ mw.linearSearch(); - return + return int TaskTime } - public void binarySearchLL(){ + public String binarySearchLL(){ mw.binarySearch(); - return + return int TaskTime +" "+ int TimesThrough } /** @@ -74,15 +74,19 @@ public void alMW(){ } public void bubbleSortAL(){ mw1.bubbleSort(); + return int TaskTime } public void selectionSortAL(){ mw1.selectionSort(); + return int TaskTime } public void linearSearchAL(){ mw1.linearSearch(); + return int TaskTime } - public void binarySearchAL(){ + public String binarySearchAL(){ mw1.binarySearch(); + return int TaskTime +" "+ int TimesThrough } /** @@ -94,22 +98,24 @@ public void binarySearchAL(){ *Calls the createBinaryTree, calculatePreorderNodesSearched, calculateInOrderNodesSearched, calculatePreorderSearchDuration, calculateInOrderSearchDuration, calculateBigORelationship, getDatabase, and setDatabase methods. */ public void BinaryTreeMW(){ - mw2.BinaryTreeMW(int size); + mw2.BinaryTreeMW(int size); } - public void calculatePreorderNodesSearched(){ - mw2.calculatePreorderNodesSearched(int key1, int key2, int key3); + public String calculatePreorderNodesSearched() { + return mw2.calculatePreorderNodesSearched(int key1, int key2, int key3); } - public void calculateInOrderNodesSearched(){ - mw2.calculateInOrderNodesSearched(int key1, int key2, int key3); + public String calculateInOrderNodesSearched() { + return mw2.calculateInOrderNodesSearched(int key1, int key2, int key3); + } - public void calculatePreorderSearchDuration(){ - mw2.calculatePreorderSearchDuration(int key1, int key2, int key3); + public String calculatePreorderSearchDuration() { + return mw2.calculatePreorderSearchDuration(int key1, int key2, int key3); } - public void calculateInOrderSearchDuration(){ - mw2.calculateInOrderSearchDuration(int key1, int key2, int key3); + public String calculateInOrderSearchDuration() { + return mw2.calculateInOrderSearchDuration(int key1, int key2, int key3); } - public void calculateBigORelationship(){ - mw2.calculateBigORelationship(); + + public String calculateBigORelationship() { + return mw2.calculateBigORelationship(); } /** @@ -118,44 +124,37 @@ public void calculateBigORelationship(){ *Calls the createHashTable, findHashTableValue, and BigONotation methods. */ public void createHashTable(){ - mw3.createHashTable(int n); + mw3.createHashTable(int n); } - public void findHashTableValue(int value){ - mw3.findHashTableValue(int value); - return int index + public int findHashTableValue(int value){ + return mw3.findHashTableValue(int value); } - public void bigONotation(){ - mw3.bigONotation(); - return string Time + public String bigONotation() { + return mw3.bigONotation(); } /** *Constructor for HashFinder. *@param input Passes integer to the HashFinder instance. *@param size Passes integer to the HashFinder instance. *@param array Passes array to the HashFinder instance. + *@return the location of the value */ - public void findHashValue(){ - mw4.findHashValue(int input, int size, int array); + public int findHashValue(){ + return mw4.findHashValue(int input, int size, int array); } /** *Constructor for StackCut. *@param param Passes a parameter to the StackCut instance. */ - public void StackCut(){ - mw5.StackCut(int param); - } - public void push(){ - mw5.push(Object param); + public void StackCut() { + mw5.StackCut(int param); } - public void pop(){ - mw5.pop(Object param); + public String displayStacks(){ + return mw5.displayStacks(); } - public void displayStacks(){ - mw5.displayStacks(); - } - public void peek(){ - mw5.peek(); + public String peek(){ + return mw5.peek().toString(); } /** @@ -167,10 +166,23 @@ public void peek(){ *@param TG *Creates a Student Object and pushes it to the stack. */ - public static void createStudent(int ID, string Name, string Major, double GPA, double TG){ - Student newStudent = new Student(ID, Name, Major, GPA, TG); - studentStack.push(newStudent); -} + public void createStudent(int ID, string Name, string Major, double GPA, double TG) { + Student newStudent = new Student(ID, Name, Major, GPA, TG); + studentStack.push(newStudent); + } + + /** + * This method cuts the list of students down to size + */ + public String[] cutStudents() { + studentStack.cut(5); + } + + /** + * This method will return an array of Who got Scholarships + */ + public String[] getScholarships() { + } } /** *This class was created for Middleware. From 56e5204b199dbe06b72b000c3a1fca6a0f88bb3a Mon Sep 17 00:00:00 2001 From: Humam Abusitta Date: Mon, 6 Apr 2015 16:26:56 -0400 Subject: [PATCH 08/10] Update 4:26 PM 20150604 --- ...istDatabase.java => ArrayListDatabase.java | 0 ...kDisplay.java => ArrayListMockDisplay.java | 0 Middleware/BinaryTree.java => BinaryTree.java | 0 .../BinaryTreeMW.java => BinaryTreeMW.java | 0 Middleware/HashClient.java => HashClient.java | 0 Middleware/HashFinder.java => HashFinder.java | 0 ...ddlewareTest.java => LLMiddlewareTest.java | 0 Middleware/LinkListDB.java => LinkListDB.java | 0 .../LinkedListDB.java => LinkedListDB.java | 0 ...ddleware.java => LinkedListMiddleware.java | 0 .../MidArrayList.java => MidArrayList.java | 0 Middleware methods.docx | Bin 16312 -> 16862 bytes Middleware/Middleware.java => Middleware.java | 0 ...Middleware_1_B.java => Middleware_1_B.java | 0 .../MockDisplay.java => MockDisplay.java | 0 Middleware/Node.java => Node.java | 0 Middleware/StackCut.java => StackCut.java | 0 Middleware/Student.java => Student.java | 0 .../StudentTest.java => StudentTest.java | 0 ~$ddleware methods.docx | Bin 162 -> 0 bytes 20 files changed, 0 insertions(+), 0 deletions(-) rename Middleware/ArrayListDatabase.java => ArrayListDatabase.java (100%) rename Middleware/ArrayListMockDisplay.java => ArrayListMockDisplay.java (100%) rename Middleware/BinaryTree.java => BinaryTree.java (100%) rename Middleware/BinaryTreeMW.java => BinaryTreeMW.java (100%) rename Middleware/HashClient.java => HashClient.java (100%) rename Middleware/HashFinder.java => HashFinder.java (100%) rename Middleware/LLMiddlewareTest.java => LLMiddlewareTest.java (100%) rename Middleware/LinkListDB.java => LinkListDB.java (100%) rename Middleware/LinkedListDB.java => LinkedListDB.java (100%) rename Middleware/LinkedListMiddleware.java => LinkedListMiddleware.java (100%) rename Middleware/MidArrayList.java => MidArrayList.java (100%) rename Middleware/Middleware.java => Middleware.java (100%) rename Middleware/Middleware_1_B.java => Middleware_1_B.java (100%) rename Middleware/MockDisplay.java => MockDisplay.java (100%) rename Middleware/Node.java => Node.java (100%) rename Middleware/StackCut.java => StackCut.java (100%) rename Middleware/Student.java => Student.java (100%) rename Middleware/StudentTest.java => StudentTest.java (100%) delete mode 100644 ~$ddleware methods.docx diff --git a/Middleware/ArrayListDatabase.java b/ArrayListDatabase.java similarity index 100% rename from Middleware/ArrayListDatabase.java rename to ArrayListDatabase.java diff --git a/Middleware/ArrayListMockDisplay.java b/ArrayListMockDisplay.java similarity index 100% rename from Middleware/ArrayListMockDisplay.java rename to ArrayListMockDisplay.java diff --git a/Middleware/BinaryTree.java b/BinaryTree.java similarity index 100% rename from Middleware/BinaryTree.java rename to BinaryTree.java diff --git a/Middleware/BinaryTreeMW.java b/BinaryTreeMW.java similarity index 100% rename from Middleware/BinaryTreeMW.java rename to BinaryTreeMW.java diff --git a/Middleware/HashClient.java b/HashClient.java similarity index 100% rename from Middleware/HashClient.java rename to HashClient.java diff --git a/Middleware/HashFinder.java b/HashFinder.java similarity index 100% rename from Middleware/HashFinder.java rename to HashFinder.java diff --git a/Middleware/LLMiddlewareTest.java b/LLMiddlewareTest.java similarity index 100% rename from Middleware/LLMiddlewareTest.java rename to LLMiddlewareTest.java diff --git a/Middleware/LinkListDB.java b/LinkListDB.java similarity index 100% rename from Middleware/LinkListDB.java rename to LinkListDB.java diff --git a/Middleware/LinkedListDB.java b/LinkedListDB.java similarity index 100% rename from Middleware/LinkedListDB.java rename to LinkedListDB.java diff --git a/Middleware/LinkedListMiddleware.java b/LinkedListMiddleware.java similarity index 100% rename from Middleware/LinkedListMiddleware.java rename to LinkedListMiddleware.java diff --git a/Middleware/MidArrayList.java b/MidArrayList.java similarity index 100% rename from Middleware/MidArrayList.java rename to MidArrayList.java diff --git a/Middleware methods.docx b/Middleware methods.docx index 478448d94f265b9fd94dddc78f4a9fb5dc894d27..586c5682b25c0e8bb8cee56bb630582d7ace5d64 100644 GIT binary patch delta 7048 zcmZ9RWlWvX)~#_06nA%bio0uZcZ#(ecZU}%?ohP2yKLMxv{-Q|4#gdcJ8W*xmwR(= zzBT{Mtc;ATA9E(p$Z7}vguyo8p`d;vh;yUGfPrZ)Nu@wx0AP*H9NX3%e#zxIhBTw6 zI6V7EDK$?R;vl9dr$cWu(yST1Qj8MlV^h>Zh8ALJfJAo;=B$@j$eS#6hmDpiH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wiKnK-d40YRQ8+Pau?X4DaKaFxo&%3cTqv~Y1-lj<5$_JvI3VWEi4UF$+)+o5&rc< zf;4$ce0w>%@(8|gD&D?TOLb~7sc_3^kQ9O_D*g5clcF8CY0E_KOPI7LbxLK1N`R?I zAZ)IpWOpm7DlmqqEr&QxDJFxrcj->HR#S1B`E)R;LL3#9&YI)EhD-4vP{w&B+uoWP zkgssI+oWw}zq^Um75TJyTl`UIxR6LipuWG<%nNnISJ&ht7TaJ8*CSJ+E%2Si{#7zwnC8L51XG=l4Ka5VFI!>RfgxpGdF( zuP9pzZGPI8QN$wollt1~+%1bDd)OWTXX~97`H4=d{YAtvjrC29{2o#?WF*pwNy1TY zB8G{0H!j-7jKi1&TXvbSzCdIEE~99orscUt)U%^w1Z6ADpJ3n@elAnio`f+>y*hT{Hd0-3KbBiA^ktQ8wA4r-*^9Azf(dxsqmpO;!LoWw9r;@ zs{ipbbVD2uR+JNZFD?Rm@&U>#AqxAz3x!C~{*Sbv*%ElL@dD6B32MY#;r}%HFO0Nk AUjP6A diff --git a/Middleware/Middleware.java b/Middleware.java similarity index 100% rename from Middleware/Middleware.java rename to Middleware.java diff --git a/Middleware/Middleware_1_B.java b/Middleware_1_B.java similarity index 100% rename from Middleware/Middleware_1_B.java rename to Middleware_1_B.java diff --git a/Middleware/MockDisplay.java b/MockDisplay.java similarity index 100% rename from Middleware/MockDisplay.java rename to MockDisplay.java diff --git a/Middleware/Node.java b/Node.java similarity index 100% rename from Middleware/Node.java rename to Node.java diff --git a/Middleware/StackCut.java b/StackCut.java similarity index 100% rename from Middleware/StackCut.java rename to StackCut.java diff --git a/Middleware/Student.java b/Student.java similarity index 100% rename from Middleware/Student.java rename to Student.java diff --git a/Middleware/StudentTest.java b/StudentTest.java similarity index 100% rename from Middleware/StudentTest.java rename to StudentTest.java diff --git a/~$ddleware methods.docx b/~$ddleware methods.docx deleted file mode 100644 index 23095ada55a72eed6d7d045e76c8c891629fd2cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 162 zcmd<{D9ugGRd7ryEzT?{Nn{`n@G*EWlrrQpBm%JlgCj!{kXOu*$xs4>$Yw12zqR}( l149oZ149D{I|B(Adm0mhy&A{{fyEH@9S|M^!;fc+m;h0Y8a)62 From 4d8876cecfd26dcf8c901844c55013a7799d2c3f Mon Sep 17 00:00:00 2001 From: Humam Abusitta Date: Mon, 6 Apr 2015 16:36:03 -0400 Subject: [PATCH 09/10] Update 4:35 20150604 --- ArrayListDatabase.java | 55 -- ArrayListMockDisplay.java | 33 - BinaryTree.java | 62 -- BinaryTreeMW.java | 467 ------------ LLMiddlewareTest.java | 76 -- LinkListDB.java | 24 - LinkedListDB.java | 27 - Middleware methods.docx | Bin 16862 -> 0 bytes Middleware.java | 189 ----- Middleware/CSE231-ClassProject | 1 - MockDisplay.java | 35 - Node.java | 19 - README.md | 1 - Student.java | 35 - production/.DS_Store | Bin 0 -> 10244 bytes production/ClassProject/.DS_Store | Bin 0 -> 8196 bytes production/ClassProject/ClassProject.java | 20 + production/ClassProject/Database/.DS_Store | Bin 0 -> 6148 bytes .../Database/ArrayListDatabase.java | 62 ++ .../ClassProject/Database/BinaryTreeDB.java | 257 +++++++ .../Database/DatabaseHashTable.java | 102 +++ .../ClassProject/Database/LinkedListDB.java | 154 ++++ production/ClassProject/Database/Node.java | 30 + .../ClassProject/Database/StackCut.java | 13 +- production/ClassProject/Database/Student.java | 135 ++++ production/ClassProject/Display/.DS_Store | Bin 0 -> 6148 bytes production/ClassProject/Display/Display.java | 548 ++++++++++++++ production/ClassProject/LICENSE | 675 ++++++++++++++++++ production/ClassProject/Middleware/.DS_Store | Bin 0 -> 6148 bytes .../Middleware/BinaryTreeMiddleWare.java | 20 +- .../ClassProject/Middleware/HashClient.java | 15 +- .../ClassProject/Middleware/HashFinder.java | 7 +- .../Middleware/LinkedListMiddleware.java | 33 +- .../ClassProject/Middleware/MidArrayList.java | 8 +- .../ClassProject/Middleware/Middleware.java | 115 +++ test/.DS_Store | Bin 0 -> 6148 bytes test/ClassProject/.DS_Store | Bin 0 -> 6148 bytes test/ClassProject/Database/TestStack.java | 32 + .../ClassProject/Database/testBinaryTree.java | 57 ++ test/ClassProject/Middleware/.DS_Store | Bin 0 -> 6148 bytes .../ClassProject/Middleware/StudentTest.java | 34 +- 41 files changed, 2233 insertions(+), 1108 deletions(-) delete mode 100644 ArrayListDatabase.java delete mode 100644 ArrayListMockDisplay.java delete mode 100644 BinaryTree.java delete mode 100644 BinaryTreeMW.java delete mode 100644 LLMiddlewareTest.java delete mode 100644 LinkListDB.java delete mode 100644 LinkedListDB.java delete mode 100644 Middleware methods.docx delete mode 100644 Middleware.java delete mode 160000 Middleware/CSE231-ClassProject delete mode 100644 MockDisplay.java delete mode 100644 Node.java delete mode 100644 README.md delete mode 100644 Student.java create mode 100644 production/.DS_Store create mode 100644 production/ClassProject/.DS_Store create mode 100644 production/ClassProject/ClassProject.java create mode 100644 production/ClassProject/Database/.DS_Store create mode 100644 production/ClassProject/Database/ArrayListDatabase.java create mode 100644 production/ClassProject/Database/BinaryTreeDB.java create mode 100644 production/ClassProject/Database/DatabaseHashTable.java create mode 100644 production/ClassProject/Database/LinkedListDB.java create mode 100644 production/ClassProject/Database/Node.java rename StackCut.java => production/ClassProject/Database/StackCut.java (78%) create mode 100644 production/ClassProject/Database/Student.java create mode 100644 production/ClassProject/Display/.DS_Store create mode 100644 production/ClassProject/Display/Display.java create mode 100644 production/ClassProject/LICENSE create mode 100644 production/ClassProject/Middleware/.DS_Store rename Middleware_1_B.java => production/ClassProject/Middleware/BinaryTreeMiddleWare.java (97%) rename HashClient.java => production/ClassProject/Middleware/HashClient.java (79%) rename HashFinder.java => production/ClassProject/Middleware/HashFinder.java (93%) rename LinkedListMiddleware.java => production/ClassProject/Middleware/LinkedListMiddleware.java (84%) rename MidArrayList.java => production/ClassProject/Middleware/MidArrayList.java (95%) create mode 100644 production/ClassProject/Middleware/Middleware.java create mode 100644 test/.DS_Store create mode 100644 test/ClassProject/.DS_Store create mode 100644 test/ClassProject/Database/TestStack.java create mode 100644 test/ClassProject/Database/testBinaryTree.java create mode 100644 test/ClassProject/Middleware/.DS_Store rename StudentTest.java => test/ClassProject/Middleware/StudentTest.java (89%) diff --git a/ArrayListDatabase.java b/ArrayListDatabase.java deleted file mode 100644 index f21b186..0000000 --- a/ArrayListDatabase.java +++ /dev/null @@ -1,55 +0,0 @@ -package edu.oakland.production.ClassProject; - -import java.util.*; - - -/** -*@author Eldari Gogiashvili -*@version version 1.0.1 date 150331 -*since version 1.0.0 -*/ - -/** -*This class represents the middleware -*/ - -public class ArrayListDatabase{ - - ArrayList students; - - ArrayListDatabase(int size){ - students = new ArrayList(size); - } - - - public Integer getStudent(int i){ - return students.get(i); - } - - - public void setStudent(int i, int j){ - students.add(i,j); - } - - - public void addStudent(int i){ - students.add(i); - } - - - public void removeStudent(int i){ - students.remove(i); - } - - - public int returnSize(){ - return students.size(); - } - - public void clearAllStudents(){ - students.clear(); - } -} -/** -*This class was created for Middleware. -*/ \ No newline at end of file diff --git a/ArrayListMockDisplay.java b/ArrayListMockDisplay.java deleted file mode 100644 index 8e8ae60..0000000 --- a/ArrayListMockDisplay.java +++ /dev/null @@ -1,33 +0,0 @@ -package edu.oakland.production.ClassProject; - -import edu.oakland.production.ClassProject.*; -/** -*@author Eldari Gogiashvili -*@version version 1.0.1 date 150331 -*since version 1.0.0 -*/ - -/** -*This class represents the middleware -*/ - -public class ArrayListMockDisplay { - public void main(String[] args){ - - int ListSize = 100; - int searchKey = 100; - - /** - *Constructor for Middleware. - */ - MidArrayList mw = new MidArrayList(ListSize); - mw.selectionSort(); - mw.linearSearch(searchKey); - mw.binarySearch(searchKey); - - MidArrayList mw1 = new MidArrayList(ListSize); - mw1.bubbleSort(); - mw1.linearSearch(searchKey); - mw1.binarySearch(searchKey); - } -} \ No newline at end of file diff --git a/BinaryTree.java b/BinaryTree.java deleted file mode 100644 index 62ecdf8..0000000 --- a/BinaryTree.java +++ /dev/null @@ -1,62 +0,0 @@ -package edu.oakland.production.ClassProject.middleware; - -public class BinaryTree{ - - public Node root; - - public void addNode(String name, double gpa, int tg){ - Node newNode = new Node(name, gpa, tg); - if(root == null){ - root = newNode; - } - else{ - Node focusNode = root; - Node parent; - while(true){ - parent = focusNode; - if(tg < focusNode.tg){ - focusNode = focusNode.leftChild; - - if(focusNode == null){ - parent.leftChild = newNode; - return; - } - } - else { - focusNode = focusNode.rightChild; - if(focusNode == null){ - parent.rightChild = newNode; - return; - } - } - } - } - } - - public void preorderTraverseTree(Node focusNode){ - if(focusNode != null){ - System.out.println(focusNode); - preorderTraverseTree(focusNode.leftChild); - preorderTraverseTree(focusNode.rightChild); - } - } - - public Node findNode(int tg){ - Node focusNode = root; - while(focusNode.tg != tg){ - if(tg > focusNode.tg){ - return focusNode; - } - if(tg < focusNode.tg){ - focusNode = focusNode.leftChild; - } - else{ - focusNode = focusNode.rightChild; - } - } - return focusNode; - - } - - } - diff --git a/BinaryTreeMW.java b/BinaryTreeMW.java deleted file mode 100644 index f2a68a4..0000000 --- a/BinaryTreeMW.java +++ /dev/null @@ -1,467 +0,0 @@ -package edu.oakland.production.ClassProject.Middleware; - -//Import java util framework -import java.util.*; - -//Import BinaryTreeDB.java & Node.java -import edu.oakland.production.ClassProject.Database.*; - - -/* - * BinaryTreeMW. - * - * @author Joshua Herkness, Trevor Luebbert Middleware - * @version version 2.0 - * @since version 1.0 - */ -public class BinaryTreeMW { - - /// Minimum possible key value, used with generating a random key. - private int minimumKeyValue = 400000; - /// Maximum possible key value, used with generating a random key. - private int maximumKeyValue = 800000; - - /// Minimum possible name value, used with generating a random name. - private int minimumNameValue = 200000; - /// Maximum possible key value, used with generating a random name. - private int maximumNameValue = 600000; - - private BinaryTreeDB binaryTreeDatabase; - - /* - * Default constructor for the BinaryTreeMW Class. - * - * @returns BinaryTreeMW - */ - public BinaryTreeMW(){ - - this.binaryTreeDatabase = new BinaryTreeDB(); - } - - /* - * Overloaded constructor for the BinaryTreeMW Class. Popluates the binaryTreeDatabase given a size. - * - * @param size Integer value corresponding to the desired size of the BinaryTreeDB object. - * - * @returns BinaryTreeMW - */ - public BinaryTreeMW(int size){ - - this.binaryTreeDatabase = new BinaryTreeDB(); - - // Populates the BinaryTreeDB object - populateBinaryTreeDB(size); - } - - /* - * Populates a private global BinaryTreeDB object with a given amount of nodes. Creates a non-duplicate random key and name for each node. - * - * @param size Integer value corresponding to the size of the binary tree. - * - */ - public void populateBinaryTreeDB(int size){ - - // Refresh the BinaryTreeDB object. - this.binaryTreeDatabase = new BinaryTreeDB(); - - // Create a non-duplicate random number list for keys. - List nonDuplicateRandomNumberKeys = new ArrayList(); - // Create a non-duplicate random number list for names. - List nonDuplicateRandomNumberNames = new ArrayList(); - - // Populate both key and name lists. - nonDuplicateRandomNumberKeys = createNonDuplicateRandomNumbers(minimumKeyValue, maximumKeyValue, size); - nonDuplicateRandomNumberNames = createNonDuplicateRandomNumbers(minimumNameValue, maximumNameValue, size); - - for (int i = 0; i < size; i++){ - - // Reference key integer from a given index. - int key = nonDuplicateRandomNumberKeys.get(i); - // Reference name integer from a given index, then convert to a string. - String name = String.valueOf(nonDuplicateRandomNumberNames.get(i)); - - // Add a node to the BinaryTreeDB, given the key and name. - this.binaryTreeDatabase.addNode(key, name); - - } - } - - /* - * Searches for three integer key values, providing a record of the amount of nodes searched durring a preorder search. - * - * @param key1 Integer value corresponding to a key value. - * @param key2 Integer value corresponding to a key value. - * @param key3 Integer value corresponding to a key value. - * - * @returns nodesSearched String value corresponding to the number of nodes searched respectively. - */ - public String calculatePreorderNodesSearched(int key1, int key2, int key3){ - - String nodesSearched = ""; - - Node focusNode = this.binaryTreeDatabase.getRootNode(); - - nodesSearched += String.valueOf(calculatePreorderNodesSearched(this.binaryTreeDatabase, focusNode, key1)); - nodesSearched += " "; - - nodesSearched += String.valueOf(calculatePreorderNodesSearched(this.binaryTreeDatabase, focusNode, key2)); - nodesSearched += " "; - - nodesSearched += String.valueOf(calculatePreorderNodesSearched(this.binaryTreeDatabase, focusNode, key3)); - - return nodesSearched; - } - - /* - * Searches for three integer key values, providing a record of the amount of nodes searched durring an in order search. - * - * @param key1 Integer value corresponding to a key value. - * @param key2 Integer value corresponding to a key value. - * @param key3 Integer value corresponding to a key value. - * - * @returns nodesSearched String value corresponding to the number of nodes searched respectively. - */ - public String calculateInOrderNodesSearched(int key1, int key2, int key3){ - - String nodesSearched = ""; - - Node focusNode = this.binaryTreeDatabase.getRootNode(); - - nodesSearched += String.valueOf(calculateInOrderNodesSearched(this.binaryTreeDatabase, focusNode, key1)); - nodesSearched += " "; - - nodesSearched += String.valueOf(calculateInOrderNodesSearched(this.binaryTreeDatabase, focusNode, key2)); - nodesSearched += " "; - - nodesSearched += String.valueOf(calculateInOrderNodesSearched(this.binaryTreeDatabase, focusNode, key3)); - - return nodesSearched; - } - - /* - * Calculates the amount of nodes searched for locating a given key using a preorder search. - * - * @param binaryTreeDatabase BinaryTreeDB object. - * @param focusNode Start or begining node of the binary tree. - * @param key Integer value corresponding with desired search value. - * - * @returns int Integer type corresponding to the number of nodes searched through. - */ - private int calculatePreorderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ - - int nodesSearched = calculatePreorderNodesSearched(binaryTreeDatabase, focusNode, key, true); - - return nodesSearched; - - } - - /* - * Helper recursive method used to calculates the amount of nodes searched for locating a given key using a preorder search. - * - * @param binaryTreeDatabase BinaryTreeDB object. - * @param focusNode Start or begining node of the binary tree. - * @param key Integer value corresponding with desired search value. - * @param continueSearch Boolean value corresponding to whether the node has been located. - * - * @returns int Integer type corresponding to the number of nodes searched through. - */ - private int calculatePreorderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key, boolean continueSearching){ - - // Begin each recursion with zero nodes searched. - int nodesSearched = 0; - - // Ignore the recursion loop if the node is already found, or if the node is non existant. - if (!continueSearching){ - return 0; - } else if (focusNode == null){ - return 0; - } else { - // Count the node. - nodesSearched++; - } - - // If the focus node has the desired key, increament the amount of nodesSearched, and skip all other recursions. - if (focusNode.getKey() == key){ - - continueSearching = false; - return nodesSearched; - - } - - if (focusNode.leftChild != null){ - nodesSearched += calculatePreorderNodesSearched(binaryTreeDatabase, focusNode.leftChild, key, continueSearching); - } - - if (focusNode.rightChild != null){ - nodesSearched += calculatePreorderNodesSearched(binaryTreeDatabase, focusNode.rightChild, key, continueSearching); - } - - return nodesSearched; - - } - - /* - * Calculates the amount of nodes searched for locating a given key using an in order search. - * - * @param binaryTreeDatabase BinaryTreeDB object. - * @param focusNode Start or begining node of the binary tree. - * @param key Integer value corresponding with desired search value. - * - * @returns int Integer type corresponding to the number of nodes searched through. - */ - private int calculateInOrderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ - - int nodesSearched = calculateInOrderNodesSearched(binaryTreeDatabase, focusNode, key, true); - - return nodesSearched; - } - - /* - * Helper recursive method used to calculates the amount of nodes searched for locating a given key using an in order search. - * - * @param binaryTreeDatabase BinaryTreeDB object. - * @param focusNode Start or begining node of the binary tree. - * @param key Integer value corresponding with desired search value. - * @param continueSearch Boolean value corresponding to whether the node has been located. - * - * @returns int Integer type corresponding to the number of nodes searched through. - */ - private int calculateInOrderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key, boolean continueSearching){ - - // Begin each recursion with zero nodes searched. - int nodesSearched = 0; - - // Ignore the recursion loop if the node is already found, or if the node is non existant. - if (!continueSearching){ - return 0; - } else if (focusNode == null){ - return 0; - } else { - // Count the node. - nodesSearched++; - } - - if (focusNode.leftChild != null){ - nodesSearched += calculateInOrderNodesSearched(binaryTreeDatabase, focusNode.leftChild, key, continueSearching); - } - - // If the focus node has the desired key, increament the amount of nodesSearched, and - if (focusNode.getKey() == key){ - - continueSearching = false; - return nodesSearched; - - } - - if (focusNode.rightChild != null){ - nodesSearched += calculateInOrderNodesSearched(binaryTreeDatabase, focusNode.rightChild, key, continueSearching); - } - - return nodesSearched; - } - - /* - * Calculates the amount of time (in milliseconds) needed to conduct a preorder search on each of the three integer keys provided. - * - * @param key1 Integer value corresponding to a key value. - * @param key2 Integer value corresponding to a key value. - * @param key3 Integer value corresponding to a key value. - * - * @returns duration String value corresponding to the time elapsed durring each of the searches respectively. - */ - public String calculatePreorderSearchDuration(int key1, int key2, int key3){ - - String duration = ""; - - Node focusNode = this.binaryTreeDatabase.getRootNode(); - - duration += Double.toString(calculatePreorderSearchDuration(this.binaryTreeDatabase, focusNode, key1)); - duration += " "; - - duration += Double.toString(calculatePreorderSearchDuration(this.binaryTreeDatabase, focusNode, key2)); - duration += " "; - - duration += Double.toString(calculatePreorderSearchDuration(this.binaryTreeDatabase, focusNode, key3)); - - return duration; - } - - /* - * Calculates the amount of time (in milliseconds) needed to conduct an in order search on each of the three integer keys provided. - * - * @param key1 Integer value corresponding to a key value. - * @param key2 Integer value corresponding to a key value. - * @param key3 Integer value corresponding to a key value. - * - * @returns duration String value corresponding to the time elapsed durring each of the searches respectively. - */ - public String calculateInOrderSearchDuration(int key1, int key2, int key3){ - - String duration = ""; - - Node focusNode = this.binaryTreeDatabase.getRootNode(); - - duration += Double.toString(calculateInOrderSearchDuration(this.binaryTreeDatabase, focusNode, key1)); - duration += " "; - - duration += Double.toString(calculateInOrderSearchDuration(this.binaryTreeDatabase, focusNode, key2)); - duration += " "; - - duration += Double.toString(calculateInOrderSearchDuration(this.binaryTreeDatabase, focusNode, key3)); - - return duration; - } - - /* - * Calculates the amount of time (in milliseconds) needed to conduct a preorder search on the integer key provided. - * - * @param binaryTreeDatabase BinaryTreeDB object. - * @param focusNode Start or begining node of the binary tree. - * @param key Integer value corresponding with desired search value. - * - * @returns double Double type corresponding to time taken to search the binaryTreeDatabase. - */ - private double calculatePreorderSearchDuration(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ - - double startTime = System.currentTimeMillis(); - int temporary = calculatePreorderNodesSearched(binaryTreeDatabase, focusNode, key); - double endTime = System.currentTimeMillis(); - - return (endTime - startTime); - } - - /* - * Calculates the amount of time (in milliseconds) needed to conduct an in order search on the key provided. - * - * @param binaryTreeDatabase BinaryTreeDB object. - * @param focusNode Start or begining node of the binary tree. - * @param key Integer value corresponding with desired search value. - * - * @returns double Double type corresponding to time taken to search the binaryTreeDatabase. - */ - private double calculateInOrderSearchDuration(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ - - double startTime = System.currentTimeMillis(); - int temporary = calculateInOrderNodesSearched(binaryTreeDatabase, focusNode, key); - double endTime = System.currentTimeMillis(); - - return (endTime - startTime); - } - - /* - * Gathers data for the BigO notaion, returning a string of the duration spent searching after each recursion, as well as the description of the notation. - * - * @returns bigO String value corresponding to the big O notation and data set as proof. - */ - public String calculateBigORelationship(){ - - Node focusNode = this.binaryTreeDatabase.getRootNode(); - - String bigO = ""; - - // Description of the BigO notation. - bigO += "After each recursion, the time spent searching is halved" + - "since you can only move down either the left or right child nodes." + - "This halving of the data can be represented as O (log N)"; - - // Introduction to the data set - bigO += "\nThe time spent searching during each recursion are as follows:\n"; - - //the key is -1 so the search method goes through the entire tree - bigO += calculateInOrderTimeElapsed(focusNode, -1, true); - - return bigO; - } - - /* - * Calculates durration of each recursion of the method. - * - * @param binaryTreeDatabase BinaryTreeDB object. - * @param focusNode Node object. - * @param key Integer value corresponding to the key of a given node object. - * @param continueSearching Boolean value that tells the method whether or not it needs to continue searching. - * - * @returns time String value that returns data regarding time spent during each recursion of the method. - */ - private String calculateInOrderTimeElapsed(Node focusNode, int key, boolean continueSearching){ - - String time = ""; - - //Capture the start time. - double startTime = System.currentTimeMillis(); - - // Ignore the recursion loop if the node is already found, or if the node is non existant. - if (!continueSearching){ - return ""; - } else if (focusNode == null){ - return ""; - } - - if (focusNode.leftChild != null){ - time += " "; - time += calculateInOrderTimeElapsed(focusNode.leftChild, key, continueSearching); - } - - // If the focus node has the desired key, stop searching - if (focusNode.getKey == key){ - continueSearching = false; - } - - if (focusNode.rightChild != null){ - time += " "; - time += calculateInOrderTimeElapsed(focusNode.rightChild, key, continueSearching); - } - - double endTime = System.currentTimeMillis(); - - time += " "; - time += (Double.toString(endTime-startTime)); - return time; - } - - /* - * Generates a non-duplicate random number list, given a minimumValue, maximumValue, and size. - * - * @param minimumValue Integer value corresponding to the minimum possible random value generated. - * @param maximumValue Integer value corresponding to the maximum possible random value generated. - * - * @returns List List type, shuffled to mimic non-duplicate random numbers. - */ - private List createNonDuplicateRandomNumbers(int minimumValue, int maximumValue, int size){ - - // Create an instance of ArrayList, with type int. - ArrayList nonDuplicateRandomNumbers = new ArrayList(); - - //Test for errors with provided data. If there arent enough possible numbers, return null. - if ((maximumValue - minimumValue) < size){ - - //There has been an error. - return null; - - } - - // For the range of numbers provided. - // Creates an ArrayList of integers from minimumValue to maximumValue. - for (int i = minimumValue; i <= maximumValue; i++){ - - // Add that number to the ArrayList. - nonDuplicateRandomNumbers.add(i); - } - - // Shuffle the ArrayList, randomizing the numbers. - Collections.shuffle(nonDuplicateRandomNumbers); - - // Return a immutable List object, created from the ArrayList, trimming off unnecessary values. - return nonDuplicateRandomNumbers.subList(0, size - 1); - } - - /* - * Retrieves the BinaryTreeDatabaseObject. - * - * @returns BinaryTreeDB - */ - public BinaryTreeDB getBinaryTreeDatabase(){ - - return this.binaryTreeDatabase; - } -} \ No newline at end of file diff --git a/LLMiddlewareTest.java b/LLMiddlewareTest.java deleted file mode 100644 index 5803d38..0000000 --- a/LLMiddlewareTest.java +++ /dev/null @@ -1,76 +0,0 @@ -package edu.oakland.test.ClassProject; - -import java.util.*; -import junit.framework.*; -import edu.oakland.production.ClassProject.*; - -/** -*@author Zack Waldrup -*@version version 1.1 150403 -*@since version 1.0 150401 -*/ -public class LLMiddlewareTest extends TestCase { - - /** - *Instance variables needed for test classes - */ - int listSize = 10; - int searchInt = 200; - LinkedListMiddleware mw1; - - /** - *setUp method to ensure a new LinkedListMiddleware class on each test - */ - public void setUp() { - mw1 = new LinkedListMiddleware(listSize); - } - - /** - *This method tests whether the elements in the list are in order - */ - public void testSelectSort() { - boolean goodSort = true; - mw1.selectSort(); - for(int i = 1; i < listSize; i++){ - if(mw1.db.get(i) > mw1.db.get(i+1)) { - goodsort = false; - } - } - assertTrue(goodsort); - } - - /** - *This method tests whether the elements in the list are in order - */ - public void testBubbleSort() { - boolean goodSort = true; - mw1.bubbleSort(); - for(int i = 1; i < listSize; i++){ - if(mw1.db.get(i) > mw1.db.get(i+1)) { - goodsort = false; - } - } - assertTrue(goodsort); - } - - /** - *This method tests whether the linear search finds the given integer - */ - public void testLinearSearch() { - mw1.db.add(searchInt); - mw1.selectSort(); - mw1.linearSearch(searchInt); - assertTrue(valuePresent); - } - - /** - *This method tests whether the binary search finds the given integer - */ - public void testBinarySearch() { - mw1.db.add(searchInt); - mw1.selectSort(); - mw1.binarySearch(searchInt); - assertTrue(valuePresent); - } - -} \ No newline at end of file diff --git a/LinkListDB.java b/LinkListDB.java deleted file mode 100644 index 0bbf3d3..0000000 --- a/LinkListDB.java +++ /dev/null @@ -1,24 +0,0 @@ - -/** -*@author Eldari Gogiashvili -*@version version 1.0.0 date 150331 -*since version 1.0.0 -*/ - -/** -*This class represents the middleware -*/ - -public class LinkListDB{ - - public static add(){ - -} - public static get(){ -} - - public static set(){ -} -/** -*This class was created for Middleware. -*/ \ No newline at end of file diff --git a/LinkedListDB.java b/LinkedListDB.java deleted file mode 100644 index d72f126..0000000 --- a/LinkedListDB.java +++ /dev/null @@ -1,27 +0,0 @@ -package edu.oakland.production.ClassProject; - -/** -*@author Eldari Gogiashvili, Zack Waldrup -*@version version 1.0.1 date 150331 -*since version 1.0.0 -*/ - -/** -*This class represents the middleware -*/ - -public class LinkedListDB{ - - public void add(int index, int value){ - } - - public int get(int value){ - return 1; - } - - public void set(int index, int value){ - } -} -/** -*This class was created for Middleware. -*/ \ No newline at end of file diff --git a/Middleware methods.docx b/Middleware methods.docx deleted file mode 100644 index 586c5682b25c0e8bb8cee56bb630582d7ace5d64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16862 zcmeHugL`Gm()W%v$;1=ewrxyoX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aAx%a;_8_ zPV~!%$p3q!1_Gx3aESi*MD{-f;E(HnNo$vt{5ylcr`rAj{Oy|g@yNd<-u@H#_Z-B( z0y{qf0RMj(iT~vE&os0@d4Ye-K>v}H_D}dfV-Ej>tA2Qv{{{bN1mZtg{4>DhPZkx} zzq9yjxXC}^|MXS=3D3d*9sUo`^*=fM(|hwLhiQ^OI`BWfoPUD|2N~|pZLFz>VKj?(px$I(*57Zcv(rX U5Agy3K7E`(9}+si^V{A31M+IRGynhq diff --git a/Middleware.java b/Middleware.java deleted file mode 100644 index c564b51..0000000 --- a/Middleware.java +++ /dev/null @@ -1,189 +0,0 @@ -package edu.oakland.production.ClassProject.middleware; -import edu.oakland.production.ClassProject.middleware.*; -/** -*@author Eldari Gogiashvili -*@version version 2.0.0 date 150405 -*since version 1.0.0 date 150331 -*/ - -/** -*This class represents the middleware. -*/ - -public class Middleware { - - /** - *Instance variables used in subsequent methods. - */ - int ListSize; - int Size; - int size; - int key1; - int key2; - int key3; - int n; - int input; - int size; - int array; - int param; - int ID; - string Name; - string Major; - double GPA; - double TG; - - LinkedListMiddleware mw = new LinkedListMiddleware(); - MidArrayList mw1 = new MidArrayList(); - BinaryTreeMW mw2 = new BinaryTreeMW(); - HashClient mw3 = new HashClient(); - HashFinder mw4 = new HashFinder(); - StackCut mw5 = new StackCut(); - StudentStack studentStack = new StudentStack(10); - /** - *Constructor for LinkedListMiddleware. - *@param ListSize Takes an integer and passes it to the LinkedListMiddleware instance. - *Calls the LinkedListMiddleware, selectSort, bubbleSort,linearSearch, and binarySearch methods. - */ - public void llMW(){ - mw.LinkedListMiddleware(int ListSize); - } - public void selectSortLL(){ - mw.selectSort(); - return int TaskTime - } - public void bubbleSortLL(){ - mw.bubbleSort(); - return int TaskTime - } - public void linearSearchLL(){ - mw.linearSearch(); - return int TaskTime - } - public String binarySearchLL(){ - mw.binarySearch(); - return int TaskTime +" "+ int TimesThrough - } - - /** - *Constructor for MidArrayList. - *@param Size Takes an integer and passes it to the MidArrayList instance. - *Calls the MidArrayList, bubbleSort, selectionSort, linearSearch, and binarySearch methods. - */ - public void alMW(){ - mw1.MidArrayList(int Size); - } - public void bubbleSortAL(){ - mw1.bubbleSort(); - return int TaskTime - } - public void selectionSortAL(){ - mw1.selectionSort(); - return int TaskTime - } - public void linearSearchAL(){ - mw1.linearSearch(); - return int TaskTime - } - public String binarySearchAL(){ - mw1.binarySearch(); - return int TaskTime +" "+ int TimesThrough - } - - /** - *Constructor for BinaryTree. - *@param size Takes an integer and passes it to the BinaryTree instance. - *@param key1 Passes random string value to the BinaryTree instance. - *@param key2 Passes random string value to the BniaryTree instance. - *@param key3 Passes random string value to the BinaryTree instance. - *Calls the createBinaryTree, calculatePreorderNodesSearched, calculateInOrderNodesSearched, calculatePreorderSearchDuration, calculateInOrderSearchDuration, calculateBigORelationship, getDatabase, and setDatabase methods. - */ - public void BinaryTreeMW(){ - mw2.BinaryTreeMW(int size); - } - public String calculatePreorderNodesSearched() { - return mw2.calculatePreorderNodesSearched(int key1, int key2, int key3); - } - public String calculateInOrderNodesSearched() { - return mw2.calculateInOrderNodesSearched(int key1, int key2, int key3); - - } - public String calculatePreorderSearchDuration() { - return mw2.calculatePreorderSearchDuration(int key1, int key2, int key3); - } - public String calculateInOrderSearchDuration() { - return mw2.calculateInOrderSearchDuration(int key1, int key2, int key3); - } - - public String calculateBigORelationship() { - return mw2.calculateBigORelationship(); - } - - /** - *Constructor for HashClient. - *@param n Takes an integer and passes it to the HashClient instance. - *Calls the createHashTable, findHashTableValue, and BigONotation methods. - */ - public void createHashTable(){ - mw3.createHashTable(int n); - } - public int findHashTableValue(int value){ - return mw3.findHashTableValue(int value); - } - public String bigONotation() { - return mw3.bigONotation(); - } - /** - *Constructor for HashFinder. - *@param input Passes integer to the HashFinder instance. - *@param size Passes integer to the HashFinder instance. - *@param array Passes array to the HashFinder instance. - *@return the location of the value - */ - public int findHashValue(){ - return mw4.findHashValue(int input, int size, int array); - } - - /** - *Constructor for StackCut. - *@param param Passes a parameter to the StackCut instance. - */ - public void StackCut() { - mw5.StackCut(int param); - } - public String displayStacks(){ - return mw5.displayStacks(); - } - public String peek(){ - return mw5.peek().toString(); - } - - /** - *Method for creating a Student. - *@param ID - *@param Name - *@param Major - *@param GPA - *@param TG - *Creates a Student Object and pushes it to the stack. - */ - public void createStudent(int ID, string Name, string Major, double GPA, double TG) { - Student newStudent = new Student(ID, Name, Major, GPA, TG); - studentStack.push(newStudent); - } - - /** - * This method cuts the list of students down to size - */ - public String[] cutStudents() { - studentStack.cut(5); - } - - /** - * This method will return an array of Who got Scholarships - */ - public String[] getScholarships() { - } -} -/** -*This class was created for Middleware. -*/ diff --git a/Middleware/CSE231-ClassProject b/Middleware/CSE231-ClassProject deleted file mode 160000 index c935a0d..0000000 --- a/Middleware/CSE231-ClassProject +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c935a0d64d1bbaa6d538c0a736ed40d903466338 diff --git a/MockDisplay.java b/MockDisplay.java deleted file mode 100644 index c167935..0000000 --- a/MockDisplay.java +++ /dev/null @@ -1,35 +0,0 @@ -package edu.oakland.production.ClassProject; - -/** -*@author Eldari Gogiashvili, Zack Waldrup -*@version version 1.0.1 date 150331 -*since version 1.0.0 -*/ - -/** -*This class represents the middleware -*/ - -public class MockDisplay { - - int ListSize = 10; - - /** - *Method for testing the LinkedListMiddleware class - */ - public void testLL(){ - /** - *Constructor for Middleware. - */ - LinkedListMiddleware mw = new LinkedListMiddleware(ListSize); - mw.selectSort(); - mw.linearSearch(100); - mw.binarySearch(100); - - LinkedListMiddleware mw1 = new LinkedListMiddleware(ListSize); - mw1.bubbleSort(); - mw1.linearSearch(100); - mw1.binarySearch(100); - - } -} \ No newline at end of file diff --git a/Node.java b/Node.java deleted file mode 100644 index d47c86f..0000000 --- a/Node.java +++ /dev/null @@ -1,19 +0,0 @@ -package edu.oakland.production.ClassProject.middleware; - -public class Node{ - - public int tg; - public String name; - public double gpa; - public Node leftChild; - public Node rightChild; - - Node(String stringName, double doubleGpa, int intTg){ - this.name = stringName; - this.gpa = doubleGpa; - this.tg = intTg; - } - public String toString(){ - return name + " has a thesis grade of " + tg; - } -} \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 9ff6815..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# CSE231-ClassProject diff --git a/Student.java b/Student.java deleted file mode 100644 index d03c464..0000000 --- a/Student.java +++ /dev/null @@ -1,35 +0,0 @@ -package edu.oakland.production.ClassProject.middleware; -import java.util.*; -import edu.oakland.production.ClassProject.middleware.*; -//version 2.0 -public class Student{ - private int gID; - private String name; - private String major; - private double gpa; - private int tg; - - public Student(int gID, String name, String major, double gpa, int tg){ - this.gID = gID; - this.name = name; - this.major = major; - this.gpa = gpa ; - this.tg = tg; - } - public int getID(){ - return gID; - } - public String getName(){ - return name; - } - public String getMajor(){ - return major; - } - public double getGPA(){ - return gpa; - } - - public int getTG(){ - return tg; - } - } \ No newline at end of file diff --git a/production/.DS_Store b/production/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ef099819c571ee4b894cdafad8a54dd3638522e7 GIT binary patch literal 10244 zcmeHMU2GIp6h5aEIy1B|ZGmpfj~i-J#Dc8?4S%w1%TEK?rvHV)I=eG11G6*h%;fsmH7=tAK#iTKyh8Leqd?4zB`hw@)JG(6{ZQ=uw#JQV$ z&%NiKbMNeTzk7GiT>!v%R&N4`0)RxBNwt)U`y|%S@{CjzXi7*T`2%>+0WLUj42&7p zp&~>eL?A>UL?A>UMBrgSfPS-Ck`@XXmLUQm0wDqg1laiyrOae3kmEw~qk{?_0+1{w zHBVHhIDq>^0~rhCxRBhH#uU*52Cf){7%1GSKg!HW#sWDmq;Llm?tsC}7(^(@XD7cX zHwTOf8I~aeAp$cIV6l5Cw15Q~MekGN_Z0YhIy)M(p6`-PF+4*SX&%?lYTsr#sifs3 z$)0V)-IUi*#=Cc^oMWEkh?fcc{!V5r)AJh}Z(-5A;`s|oBw1O=K5Dsgxa+7h(&cM@ z){ATIA>J}|BN@~?H2-M6-t9P6p{^x+O=BdXE@^RWUo&mPo#Hy!XWF_m5_ht;?hST{ z@%l{NKblaNcDP24Tst(|=ruhvXe{AE<0|S|{*Up{4@b1O;E`5HTV*nT&U{ERAh4PEJ5HeG_03p1XN9gtx zgi6a6Emq4bDwix>Ru!qPsacUwE0bF4_^`{qSBqmgZrsWm{btIsyUgc}e&0CZvr0m( zm}b{$=tm}1-J=<@Su&~MW9@Mb!#*_ZntJ=tkZ1V)Q|beQ9xYRwZ=~DoA&16i2)1W@ z)3Lo?!}UlGXs)Z-!$y4cu%#sptKE(}zVDSFFo4;diO$L-2!DbpUV-El{NRU7Nb zR~Wr06}r^PYOUy^&U{5uvD?R>Ch!U0IabMPv>3GcuM@ELpsKftf> zCn73Xi7Rjw)?*`X#x1xFcVZk{gnvz-`hIw3fvCDfP1I z$=%0kdkWXJN`s{8au27BP(7hEN$NhiFDG~TRKt3DN7)O5bT(#S z6i&fuI0I+lJbVaO;Tl|rFX3zW2EK)xa0`BfpWqkx4St6|5Kty|m0}rI;BwBfNAOWx zhwF)HP1uYvVpb#}`*<0z;8pxYJW_#??DU6m{N@ku|NAyZ$3a-kLny1TnY83M)HpIj8c9Q%P`zb12Ud&eVH}$&bwC z%E~;Mr<0+FC}^DEoKj0BxOKEo4z9q*oO9p7_i!72hCA>V zonj?ej#U^5cvg>Va4kMgT-!uE6Q|lP+>Lv&4fkO;@vRU0Ip1^~!eKPgMGv!>!xQ)d zzKAd3%Xk{k;OqDXp2hQmW(DT$nL<0N;)S`Gm+NwE%dv-<;k|xgD?}hfAVeTUAVeTU z-~k{oPmCF5_y4nMLUI=> zmv(Fg>v$e5lP(CBd4DXh8yAwhlOJ~{DQ@#0_@4n`{6Focmu{rO`2T+u|NjH& C+V@ic literal 0 HcmV?d00001 diff --git a/production/ClassProject/.DS_Store b/production/ClassProject/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..0bd330210765ddecd06253e72fdfc2130c40bc7b GIT binary patch literal 8196 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assProject.java new file mode 100644 index 0000000..6fefa6b --- /dev/null +++ b/production/ClassProject/ClassProject.java @@ -0,0 +1,20 @@ +package edu.oakland.production.ClassProject; + +import edu.oakland.production.ClassProject.Display.Display; + +/** + * CSE 231 -- Class Project main class. + * This class will instantiate a Display object, and the whole program + * will run from there. + * @author Evan Bradley + * @version 1.0 + * @since 2015-04-01 + */ + +public class ClassProject { + + public static void main(String[] args) { + Display display = new Display(); + display.mainMenu(); + } +} diff --git a/production/ClassProject/Database/.DS_Store b/production/ClassProject/Database/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c96d7afc4148c890f9742f98fcc76051791577ae GIT binary patch literal 6148 zcmeHKOG*Pl5PcnkNl1ja2`*>pO7I3_97RD~7!P26;3p)I7{T2fBZu+;-X^}PE_ANt;(VKl==@=fFO~x}S9!0#Yc2CwkJ{{riOV$ Rw$S`XKxOd475G&Jz5u13W-kB$ literal 0 HcmV?d00001 diff --git a/production/ClassProject/Database/ArrayListDatabase.java b/production/ClassProject/Database/ArrayListDatabase.java new file mode 100644 index 0000000..d37c6f9 --- /dev/null +++ b/production/ClassProject/Database/ArrayListDatabase.java @@ -0,0 +1,62 @@ +package edu.oakland.production.ClassProject.Database; +import java.util.*; + +/** +* This is a class for ArrayList +*Fill the following Data Structures with Random Numbers from 100 to 1000 Each Data St +*ructure shall have (1) 100K elements; (2) 200K elements; (3) 400K elements; +*1.Create an ArrayList +*@author "Arpan Rughani and Bryan Purakal" +*@version "version 1.1" +*@since "152503" +*/ +public class ArrayListDatabase{ + + /** Declare arraylist + */ + private ArrayList students; + + /**Overloaded constructor to create ArrayList object of size "size" + */ + ArrayListDatabase(int size){ + students = new ArrayList(size); + } + + /**Get Student Method + * + * @param index of student from array + * @return student from selected index + */ + public Integer getStudent(int i){ + return students.get(i); + } + + /**set Student Method + * @param index of student from array + */ + public void setStudent(int i, int j){ + students.add(i,j); + } + + /**Add student method + */ + public void addStudent(int i){ + students.add(i); + } + + /**remove Student Method + * @param index of student from array + */ + public void removeStudent(int i){ + students.remove(i); + } + + + public int returnSize(){ + return students.size(); + } + + public void clearAllStudents(){ + students.clear(); + } +} diff --git a/production/ClassProject/Database/BinaryTreeDB.java b/production/ClassProject/Database/BinaryTreeDB.java new file mode 100644 index 0000000..10d8d7b --- /dev/null +++ b/production/ClassProject/Database/BinaryTreeDB.java @@ -0,0 +1,257 @@ +package edu.oakland.production.ClassProject.Database; + +/** +*@author Bryan J. and David M. +*@version version 2.0 150324 +*@since version 1.0 +*/ + +public class BinaryTreeDB { + + Node root; + +/** +*The addNode method adds a node to the binary tree +*@param key The integer being added/stored withing the binaryTree +*@param name The name of the node being added/stored +*/ + public void addNode(int key, T name) { + + Node newNode = new Node(key, name); + + if(root == null){ + + root = newNode; + }else { + + Node focusNode = root; + + Node parent; + + while(true){ + + parent = focusNode; + + if(key < focusNode.key){ + + focusNode = focusNode.leftChild; + + if(focusNode == null){ + + parent.leftChild = newNode; + return; + } + }else { + focusNode = focusNode.rightChild; + + if(focusNode == null){ + parent.rightChild = newNode; + return; + + } + } + } + } + } + + +/** +*The inOrderTraverseTree method uses an In-Order search and prints out the value of each node as it traverses +*@param focusNode The node that you want to begin your search at +*/ + public void inOrderTraverseTree(Node focusNode) { + + if( focusNode != null){ + + inOrderTraverseTree(focusNode.leftChild); + + System.out.println(focusNode); + + inOrderTraverseTree(focusNode.rightChild); + } + } +/** +*The preorderTraverseTree method uses an Pre-Order search and prints out the value of each node as it traverses +*@param focusNode The node that you want to begin your search at +*/ + public void preorderTraverseTree(Node focusNode) { + + if( focusNode != null){ + + System.out.println(focusNode); + + preorderTraverseTree(focusNode.leftChild); + + preorderTraverseTree(focusNode.rightChild); + } + } + +/** +*The findNode method finds a node containing the specified key value +*@param key The int value you want to find +*@return The node containing the specified int value +*/ + public Node findNode(int key){ + + Node focusNode = root; + + while(focusNode.key != key){ + + if(key < focusNode.key){ + + focusNode = focusNode.leftChild; + }else { + + focusNode = focusNode.rightChild; + } + + if (focusNode == null) + return null; + } + + return focusNode; + } + +/** +*The remove method removes a node from the tree +*@param key The integer you want to remove +*@return A boolean representing whether the node was removed or not, true for yes, false for no +*/ + public boolean remove(int key){ + + Node focusNode = root; + Node parent = root; + + boolean isItALeftChild = true; + + while(focusNode.key != key){ + + parent = focusNode; + + if(key < focusNode.key){ + + isItALeftChild = true; + + focusNode = focusNode.leftChild; + }else { + + isItALeftChild = false; + + focusNode = focusNode.rightChild; + } + + if(focusNode == null) + return false; + } + + if(focusNode.leftChild == null && focusNode.rightChild == null){ + + if(focusNode == root) + root = null; + + else if(isItALeftChild) + parent.leftChild = null; + + else + parent.rightChild = null; + } + + + else if(focusNode.rightChild == null){ + + if(focusNode == root) + root = focusNode.leftChild; + + else if(isItALeftChild) + parent.leftChild = focusNode.leftChild; + + else + parent.rightChild = focusNode.leftChild; + } + + else if(focusNode.leftChild == null){ + + if(focusNode == root) + root = focusNode.rightChild; + + else if(isItALeftChild) + parent.leftChild = focusNode.leftChild; + + else + parent.rightChild = focusNode.rightChild; + } + + else { + + Node replacement = getReplacementNode(focusNode); + + if(focusNode == root) + root = replacement; + + else if(isItALeftChild) + parent.leftChild = replacement; + + else + parent.rightChild = replacement; + + replacement.leftChild = focusNode.leftChild; + + } + + return true; + } + + public Node getReplacementNode(Node replacedNode){ + + Node replacementParent = replacedNode; + Node replacement = replacedNode; + + Node focusNode = replacedNode.rightChild; + + while(focusNode != null){ + + replacementParent = replacement; + + replacement = focusNode; + + focusNode = focusNode.leftChild; + } + + if(replacement != replacedNode.rightChild){ + + replacementParent.leftChild = replacement.rightChild; + replacement.rightChild = replacedNode.rightChild; + } + + return replacement; + } + + +/** +*The getRootNode method finds the root node for the given Binary Tree +*@param tree The Binary Tree of which you're trying to find the root node +*@return The root node +*/ + public Node getRootNode(){ + return root; + } + + public static void main(String[] args) { + + BinaryTreeDB theTree = new BinaryTreeDB(); + + theTree.addNode(1, "first"); + theTree.addNode(5, "second"); + theTree.addNode(10, "third"); + theTree.addNode(25, "fourth"); + theTree.addNode(50, "fifth"); + theTree.addNode(100, "sixth"); + + BinaryTreeDB theTree1 = new BinaryTreeDB(); + + BinaryTreeDB theTree2 = new BinaryTreeDB(); + System.out.println("ie. Removing 25"); + theTree.remove(25); + theTree.preorderTraverseTree(theTree.root); + } +} diff --git a/production/ClassProject/Database/DatabaseHashTable.java b/production/ClassProject/Database/DatabaseHashTable.java new file mode 100644 index 0000000..95d761b --- /dev/null +++ b/production/ClassProject/Database/DatabaseHashTable.java @@ -0,0 +1,102 @@ +/** +* This class stores the data structure to store an array of values passed to us by middleware. +* If we need to populate the array (or make any other changes), just let Chris or Mike know. +* THIS IS A VERY ROUGH DRAFT +* +* @author Chris Spencer and Mike Opiola +* @version "version-1.0" "150330" +* @since "version-1.0" +*/ + +package edu.oakland.production.ClassProject.Database; + +import java.util.Hashtable; + +public class DatabaseHashTable { + private Hashtable hashTable; + private int[] hashTableElementContainer; + private int[] hashTableArray; + private int hashTableArraySize; + + /*public static void main(String[] args) { + int[] testArray = {1,2,3,4,5,6,7,8,9,10}; + + DatabaseHashTable hashFunction = new DatabaseHashTable(testArray, 20); + + hashFunction.insert(1,101); + System.out.println(hashFunction.select(1)); + hashFunction.remove(1); + System.out.println(hashFunction.select(1)); + + for (int i = 1; i < 10; i++){ + System.out.println(hashFunction.select(i)); + } + } */ + + /** + *Construcor for DatabaseHashTable + */ + DatabaseHashTable(int[] containerArray, int hashArraySize){ + generateHashTable(containerArray, hashArraySize); + } + + /** + *This function generates a hash table based upon an array and hash table size specified + * @param containerArray An array that contains the elements to be added. This will be specified by middleware unless changed + * @param hashArraySize The size of the hash table to be made. This is changeable to allow more flexibility and possible speed improvements. + */ + public void generateHashTable(int[] containerArray, int hashArraySize){ + hashTableElementContainer = containerArray; + hashTableArraySize = hashArraySize; + hashTableArray = new int[hashTableArraySize]; + + hashTable = new Hashtable(); + + for (int i = 0; i < hashTableArray.length; i++){ + hashTableArray[i] = -1; + hashTable.put(i, -1); + } + + for (int j = 0; j < hashTableElementContainer.length; j++){ + int newElementValue = hashTableElementContainer[j]; + int hashTableArrayIndex = newElementValue % (hashTableArray.length - 1); + + System.out.println("Index = " + hashTableArrayIndex + ", Value = " + newElementValue); + + while(hashTableArray[hashTableArrayIndex] != -1){ + ++hashTableArrayIndex; + System.out.println("Collision Occurred. Try " + hashTableArrayIndex + " instead"); + hashTableArrayIndex %= hashTableArraySize; + } + hashTableArray[hashTableArrayIndex] = newElementValue; + hashTable.put(hashTableArrayIndex, newElementValue); + } + + } + + /** + *select takes a key and returns the integer value of what is stored at said key + * @param key Where the hashtable will look to find the value that it will return + * @return int Value found at key + */ + public int select(int key){ + return(hashTable.get(key)); + } + + /** + *remove resets the value of the element with the specified key to -1 + * @param key Where the hashtable will look to find the value to be reset to -1 + */ + public void remove(int key){ + hashTable.put(key, -1); + } + + /** + *insert Takes a value and inserts it into the hash table at the specified key + * @param key Where the hashtable will look to set the value + * @param value The value to be put into the hashtable + */ + public void insert(int key, int value){ + hashTable.put(key, value); + } +} diff --git a/production/ClassProject/Database/LinkedListDB.java b/production/ClassProject/Database/LinkedListDB.java new file mode 100644 index 0000000..79c3733 --- /dev/null +++ b/production/ClassProject/Database/LinkedListDB.java @@ -0,0 +1,154 @@ +package edu.oakland.production.ClassProject.Database; + +/** +*@author Nicholas Herman, Craig Hardy +*@version 1.0 150325 +*@since version 2.0 +*/ + + +/** +*This class provides middleware with the ability to store, get, and set links in +* in a LinkedList. +*/ + +public class LinkedListDB { + + public Link firstLink; + + public LinkedListDB(){ + firstLink = null; + } + + /** + *This method sets the the firstLink to null + */ + public boolean isEmpty(){ + return(firstLink == null); + } + + /** + *This method inserts a link and assigns it to first link + */ + public void insertFirstLink( T obj ){ + + Link newLink = new Link(obj); + + newLink.next = firstLink; + + firstLink = newLink; + } + + /** + *This method removes a link from the linkedList + */ + + public Link removeFirst(){ + + Link linkReference = firstLink; + + if(!isEmpty()){ + + firstLink = firstLink.next; + }else{ + + System.out.println("Empty LinkedList"); + } + + return linkReference; + } + + /** + *This method takes an object as a parameter and finds it in the linked list + */ + + public Link find(T obj){ + + Link theLink = firstLink; + + if(!isEmpty()){ + + while(theLink.getData() != obj){ + + if(theLink.next == null){ + + return null; + }else { + + theLink = theLink.next; + } + } + }else { + + System.out.println("Empty LinkedLint"); + } + return theLink; + } + + /** + *This method takes an object as a parameter, removes it form the list, + * and assigns the nextLink to link + */ + public Link removeLink(T obj){ + + Link currentLink = firstLink; + Link previousLink = firstLink; + + while(currentLink.getData() != obj) { + + if(currentLink.next == null){ + + return null; + }else { + + previousLink = currentLink; + + currentLink = currentLink.next; + + } + } + + if(currentLink == firstLink){ + + firstLink = firstLink.next; + }else{ + + System.out.println("FOUND A MATCH"); + System.out.println("currentLink: " + currentLink); + System.out.println("firstLink: " + firstLink); + + previousLink.next = currentLink.next; + } + + return currentLink; + } + + /** + *This method takes an int and returns the object at that link + */ + public Link get(int id){ + + if (id <= 0) + return null; + + Link currentLink = firstLink.next; + for (int i = 1; i < id; i++) { + if (currentLink.next == null) + return null; + + currentLink = currentLink.next; + } + return currentLink; + } + + /** + * This method replaces existing value at the index with the given value + */ + public void setLink(int index){ + + if (id <= 0) + return; + + Link currentLink = firstLink.next; + } +} diff --git a/production/ClassProject/Database/Node.java b/production/ClassProject/Database/Node.java new file mode 100644 index 0000000..d8353cb --- /dev/null +++ b/production/ClassProject/Database/Node.java @@ -0,0 +1,30 @@ +package edu.oakland.production.ClassProject.Database; + +public class Node { + + int key; + T val; + + Node leftChild; + Node rightChild; + + Node(int key, T value){ + + this.key = key; + + this.val = value; + } + + public T getValue(){ + return val; + } + + public int getKey(){ + return key; + } + + public String toString(){ + + return val + " has a key " + key; + } +} diff --git a/StackCut.java b/production/ClassProject/Database/StackCut.java similarity index 78% rename from StackCut.java rename to production/ClassProject/Database/StackCut.java index 7d4c7a4..ba956c1 100644 --- a/StackCut.java +++ b/production/ClassProject/Database/StackCut.java @@ -1,13 +1,10 @@ -/* - * 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 edu.oakland.production.ClassProject.middleware; +package edu.oakland.production.ClassProject.Database; + import java.util.*; + /** - *@version 1.0 - * @author Sam + * @version "version 2.0" "20150104" + * @author Sam Bell and Binh Ton */ public class StackCut extends Stack{ private int stackSize; diff --git a/production/ClassProject/Database/Student.java b/production/ClassProject/Database/Student.java new file mode 100644 index 0000000..227ae5f --- /dev/null +++ b/production/ClassProject/Database/Student.java @@ -0,0 +1,135 @@ +package edu.oakland.production.ClassProject.Database; + +import java.util.*; +/** + * @version "version 2.0" "20150104" + * @author Sam Bell and Binh Ton + */ +public class Student{ + private int gID; + private String name; + private String major; + private double GPA; + private int TG; + + public Student(int gID, String name, String major, double GPA, int TG){ + this.gID = gID; + this.name = name; + this.major = major; + this.GPA = GPA; + this.TG = TG; + } + public int getID(){ + return gID; + } + public String getName(){ + return name; + } + public String getMajor(){ + return major; + } + public double getGPA(){ + return GPA; + } + public int getTG(){ + return TG; + } + public static void main(String [] args){ + Student student1 = new Student(677422, "Jones", "IT", 3.82, 95); + Student student2 = new Student(177993, "Smith", "IT", 3.47, 78); + Student student3 = new Student(444811, "Breaux", "CS", 3.95, 98); + Student student4 = new Student(113625, "Brady", "CS", 3.77, 92); + Student student5 = new Student(382707, "Rominske", "CS", 3.82, 79); + Student student6 = new Student(447447, "Hardy", "IT", 3.68, 99); + Student student7 = new Student(661284, "Kominsky", "IT", 3.23, 70); + Student student8 = new Student(855462, "O'Brien", "IT", 3.44, 85); + Student student9 = new Student(223344, "Chamberlain", "CS", 3.99, 96); + Student student10 = new Student(348689, "Grant", "CS", 3.88, 99); + StackCut stackcut = new StackCut(10); + + stackcut.push(student1.getID()); + stackcut.push(student2.getID()); + stackcut.push(student3.getID()); + stackcut.push(student4.getID()); + stackcut.push(student5.getID()); + stackcut.push(student6.getID()); + stackcut.push(student7.getID()); + stackcut.push(student8.getID()); + stackcut.push(student9.getID()); + stackcut.push(student10.getID()); + + System.out.println("The current stack is: "); + stackcut.displayStacks(); + System.out.println(); + + for(int i=0;i<5;i++){ + Object sgid = stackcut.peek(); + int h = (Integer) sgid; + if(h == student1.getID()){ + System.out.println("Student of name: "+student1.getName()+" and GID: "+student1.getID()+" was removed from the list."); + System.out.println(student1.getName()+" had a major of: "+student1.getMajor()+" a GPA of: "+student1.getGPA()+" and a thesis grade of: "+student1.getTG()); + System.out.println(); + } + if(h == student2.getID()){ + System.out.println("Student of name: "+student2.getName()+" and GID: "+student2.getID()+" was removed from the list."); + System.out.println(student2.getName()+" had a major of: "+student2.getMajor()+" a GPA of: "+student2.getGPA()+" and a thesis grade of: "+student2.getTG()); + System.out.println(); + } + if(h == student3.getID()){ + System.out.println("Student of name: "+student3.getName()+" and GID: "+student3.getID()+" was removed from the list."); + System.out.println(student3.getName()+" had a major of: "+student3.getMajor()+" a GPA of: "+student3.getGPA()+" and a thesis grade of: "+student3.getTG()); + System.out.println(); + } + if(h == student4.getID()){ + System.out.println("Student of name: "+student4.getName()+" and GID: "+student4.getID()+" was removed from the list."); + System.out.println(student4.getName()+" had a major of: "+student4.getMajor()+" a GPA of: "+student4.getGPA()+" and a thesis grade of: "+student4.getTG()); + System.out.println(); + } + if(h == student5.getID()){ + System.out.println("Student of name: "+student5.getName()+" and GID: "+student5.getID()+" was removed from the list."); + System.out.println(student5.getName()+" had a major of: "+student5.getMajor()+" a GPA of: "+student5.getGPA()+" and a thesis grade of: "+student5.getTG()); + System.out.println(); + } + if(h == student6.getID()){ + System.out.println("Student of name: "+student6.getName()+" and GID: "+student6.getID()+" was removed from the list."); + System.out.println(student6.getName()+" had a major of: "+student6.getMajor()+" a GPA of: "+student6.getGPA()+" and a thesis grade of: "+student6.getTG()); + System.out.println(); + } + if(h == student7.getID()){ + System.out.println("Student of name: "+student7.getName()+" and GID: "+student7.getID()+" was removed from the list."); + System.out.println(student7.getName()+" had a major of: "+student7.getMajor()+" a GPA of: "+student7.getGPA()+" and a thesis grade of: "+student7.getTG()); + System.out.println(); + } + if(h == student8.getID()){ + System.out.println("Student of name: "+student8.getName()+" and GID: "+student8.getID()+" was removed from the list."); + System.out.println(student8.getName()+" had a major of: "+student8.getMajor()+" a GPA of: "+student8.getGPA()+" and a thesis grade of: "+student8.getTG()); + System.out.println(); + } + if(h == student9.getID()){ + System.out.println("Student of name: "+student9.getName()+" and GID: "+student9.getID()+" was removed from the list."); + System.out.println(student9.getName()+" had a major of: "+student9.getMajor()+" a GPA of: "+student9.getGPA()+" and a thesis grade of: "+student9.getTG()); + System.out.println(); + } + if(h == student10.getID()){ + System.out.println("Student of name: "+student10.getName()+" and GID: "+student10.getID()+" was removed from the list."); + System.out.println(student10.getName()+" had a major of: "+student10.getMajor()+" a GPA of: "+student10.getGPA()+" and a thesis grade of: "+student10.getTG()); + System.out.println(); + } + stackcut.pop(); + } + System.out.println(); + System.out.println("The stack after the cut is: "); + stackcut.displayStacks(); + System.out.println(); + Object unluckystudentone =stackcut.peek(); + stackcut.pop(); + Object unluckystudenttwo = stackcut.peek(); + stackcut.pop(); + System.out.println("The stack after the cut is: "); + stackcut.displayStacks(); + System.out.println(); + System.out.println("The student with GID: "+unluckystudentone+" did not recieve the scholarship."); + System.out.println("The student with GID: "+unluckystudenttwo+" also did not recieve the scholarship."); + + } +} \ No newline at end of file diff --git a/production/ClassProject/Display/.DS_Store b/production/ClassProject/Display/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a54e3f9a32d89913949e22b5c199f3f9db2fe34b GIT binary patch literal 6148 zcmeHKJxjz;5S-O34z#$^@|9MC{~#Puu=Wplr;QRg;ZU$k!@5L8DIf)=3LNKl<^BJP{>}V9C21!Gq`<#Yz!v>&zve4dZ=JoI_u59kqkGK< r-Hq#@Fhn~hMmy%l+woZxWnJ?%uXlxGV$hinI#E9Zu8T|x{Ivp~YNr?? literal 0 HcmV?d00001 diff --git a/production/ClassProject/Display/Display.java b/production/ClassProject/Display/Display.java new file mode 100644 index 0000000..f353637 --- /dev/null +++ b/production/ClassProject/Display/Display.java @@ -0,0 +1,548 @@ +package edu.oakland.production.ClassProject.Display; + +import java.util.*; +import edu.oakland.production.ClassProject.Middleware.Middleware; + +/** + * + * @author Display Group + * @version 3.0 Integration with Middleware + * @since 3/30/2015 + */ +public class Display +{ + Middleware mw = new Middleware(); + Scanner scan = new Scanner(System.in); + int first; + int second; + int third; + /** + * Constructor + */ + public Display(){ + + } + + public void mainMenu(){ + + scan = new Scanner(System.in); + boolean stayIn = true; + do{ + + System.out.println("What do you want to do, 1,2,3,4"); + System.out.println("1 Create ArrayList and LinkedList and Search"); + System.out.println("2 Create Binary and Search"); + System.out.println("3 Create HashTable and Search"); + System.out.println("4 Class Schedule"); + System.out.println("Anything else will quit."); + + + switch (scan.next()) + { + case "1": + Lists(); + System.out.println("lists done"); + break; + + case "2": + BinaryTree(); + System.out.println("Binary Completed"); + break; + case "3": + HashTable(); + System.out.println("Hash Completed"); + break; + case "4": + SchedulingClass(); + System.out.println("Schedule Completed"); + break; + case "5": + stayIn = false; + break; + default: + System.out.println("Invalid Entry"); + } + + if (stayIn == false){ + System.out.println("Exit"); + break; + } + + System.out.println("Would you like to do another search? (y/n) search"); + switch (scan.next()) + { + case "y": + break; + case "n": + default: + stayIn = false; + break; + } + + + }while (stayIn); + System.out.println("Exit program"); + scan.close(); + } + + public void lists(){ + boolean stayIn = true; + boolean notSuccessful = true; + boolean invalidOption = false; + int numberOfElements; + int element; + String tempToParse; + do{ + + System.out.println("Choose the amount of elements for your arraylist and linkedlist: "); + System.out.println("1.) 100,000 Elements (1)"); + System.out.println("2.) 200,000 Elements (2)"); + System.out.println("3.) 400,000 Elements (3)"); + System.out.println("4.) Exit ArrayList and LinkedList Menu (4)"); + System.out.print(""); + + switch (scan.next()) + { + case "1": + numberOfElements = 100000; + System.out.println("You have selected 100,000 elements"); + break; + case "2": + numberOfElements = 200000; + System.out.println("You have selected 200,000 elements"); + break; + case "3": + numberOfElements = 400000; + System.out.println("You have selected 400,000 elements"); + break; + case "4": + stayIn = false; + break; + default: + System.out.println("Invalid Entry"); + invalidOption = true; + break; + + } + + if (stayIn == false){ + System.out.println("Exit"); + break; + } + + if (!invalidOption){ + + //Linked List + mw.LinkedListMiddleware(numberofElements); + //Select Sort + String timeLinkedSelectSort = mw.LinkedListSelectSort(); + System.out.println("It took " + timeLinkedSelectSort + " ms to sort the Linked List by Select sort"); + String bigOhLinkedSelectSort = mw.LinkedListSelectBigOh(); + System.out.println("Select Sort BIG OH is " + bigOhLinkedSelectSort); + + //Bubble Sort + String timeLinkedBubbleSort = mw.LinkedListBubbleSort(); + System.out.println("It took " + timeLinkedBubbleSort + " ms to sort the Linked List by Bubble sort"); + String bigOhLinkedBubbleSort = mw.LinkedListBubbleBigOh(); + System.out.println("Bubble Sort BIG OH is " + bigOhLinkedBubbleSort); + + //Array List + mw.ArrayListMiddleware(numberofElements); + //Select Sort + String timeArraySelectSort = mw.ArrayListSelectSort(); + System.out.println("It took " + timeArraySelectSort + " ms to sort the Array List by Select sort"); + String bigOhArraySelectSort = mw.ArrayListSelectBigOh(); + System.out.println("Select Sort BIG OH is " + bigOhArraySelectSort); + + //Bubble Sort + String timeArrayBubbleSort = mw.ArrayListBubbleSort(); + System.out.println("It took " + timeArrayBubbleSort + " ms to sort the Array List by Bubble sort"); + String bigOhArrayBubbleSort = mw.LinkedListArrayBigOh(); + System.out.println("Bubble Sort BIG OH is " + bigOhArrayBubbleSort); + + System.out.println("What element do you want to see?"); + tempToParse = scan.next(); + + do{ + try{ + element = Integer.parseInt(tempToParse); + notSuccessful = false; + } catch (Exception e) { + System.out.println("NOT A VALID NUMBER, GIVE A NUMBER"); + tempToParse = scan.next(); + } + } while (notSuccessful); + notSuccessful = true; + + String linearTimes = mw.linearSearch(element); + String binaryTimes = mw.binarySearch(element); + + } + invalidOption = false; + + System.out.println("Would you like to do another LinkedList search? (y/n) search"); + switch (scan.next()) + { + case "y": + break; + case "n": + default: + stayIn = false; + break; + } + + + } while(stayIn); + } + + public void binaryTree(){ + + boolean stayIn = true; + String temp; + int numberOfElements; + boolean invalidOption = false; + + do{ + System.out.println("Choose the number of elements."); + System.out.println("1. 100k Elements (1)"); + System.out.println("2. 200k Elements (2)"); + System.out.println("3. 400k Elements (3)"); + System.out.println("4. Exit to main menu (4)"); + System.out.print(""); + + String response = scan.next(); + + if (response.equals("4")){ + stayIn = false; + break; + } + + switch(response) + { + case "1": + numberOfElements = 100000; + break; + case "2": + numberOfElements = 200000; + break; + case "3": + numberOfElements = 400000; + break; + case "4": + stayIn = false; + break; + default : + System.out.println("Did not choose a correct version"); + invalidOption = true; + break; + } + + if (stayIn == false){ + System.out.println("Exit"); + break; + } + + if (!invalidOption){ + mw.createBinaryTree(numberofElements); + // SELECT 3 Ints + if (first == "" && second == "" && third == "") + { + System.out.println("What is the first string to search?"); + first = scan.nextInt(); + System.out.println("What is the second string to search?"); + second = scan.nextInt(); + System.out.println("What is the third string to search?"); + third = scan.nextInt(); + } + else + { + System.out.println("Values of the search have been set, replace? (y/n)"); + temp = scan.next(); + if ("y".equals(response)) + { + System.out.println("What is the first string to search?"); + first = scan.nextInt(); + System.out.println("What is the second string to search?"); + second = scan.nextInt(); + System.out.println("What is the third string to search?"); + third = scan.nextInt(); + } + } + invalidOption = false; + + // PREORDER SEARCH + mw.calculatePreorderNodesSearched(first, second, third); + + // ORDER SEARCH + mw.calculateInOrderNodesSearched(first, second, third); + + // Duration + mw.calculatePreorderSearchDuration(first, second, third); + mw.calculateInOrderSearchDuration(first, second, third); + + // Get BigOh Relationship + mw.calculateBigORelationship(); + } + + System.out.println("Would you like to do another search? (y/n)"); + response = scan.next(); + if ("y".equals(response)) + { + //Run again + } + else + { + stayIn = false; + break; + } + + + } while (stayIn); + } + + public void hashTable(){ + boolean stayIn = true; + String temp; + int numberOfElements; + boolean invalidOption = false; + do{ + + System.out.println("Choose the amount of elements for your Random HashTable: "); + System.out.println("1.) 100,000 Elements (1)"); + System.out.println("2.) 200,000 Elements (2)"); + System.out.println("3.) 400,000 Elements (3)"); + System.out.println("4.) Exit Hashtable Menu (4)"); + System.out.print(""); + + switch (scan.next()) + { + case "1": + numberOfElements = 100000; + break; + case "2": + numberOfElements = 200000; + break; + case "3": + numberOfElements = 400000; + break; + case "4": + stayIn = false; + break; + default : + System.out.println("Did not choose a correct version"); + invalidOption = true; + break; + } + + if (stayIn == false){ + System.out.println("Exit"); + break; + } + + if (!invalidOption){ + mw.createHashTable(numberofElements); + // SELECT 3 Int + if (first == "" && second == "" && third == "") + { + System.out.println("What is the first int to search?"); + first = scan.nextInt(); + System.out.println("What is the second int to search?"); + second = scan.next(); + System.out.println("What is the third int to search?"); + third = scan.next(); + } + else + { + System.out.println("Values of the search have been set, replace? (y/n)"); + temp = scan.next(); + if ("y".equals(temp)) + { + System.out.println("What is the first int to search?"); + first = scan.next(); + System.out.println("What is the second int to search?"); + second = scan.next(); + System.out.println("What is the third int to search?"); + third = scan.next(); + } + } + invalidOption = false; + + + // PREORDER SEARCH + // searchPreorderHash(first, second, third); + // ORDER SEARCH + // searchOrderedHash(first, second, third); + // GET TIME ELAPSED + // timeElapsedHash(); + // GET BIG O RELATIONSHIP + // bigOHash(); + } + + + + + System.out.println("Would you like to do another hashtable search? (y/n) search"); + switch (scan.next()) + { + case "y": + break; + case "n": + default: + stayIn = false; + break; + } + + + } while(stayIn); + } + + public void schedulingClass(){ + boolean isClassMade = false; + boolean stayIn = true; + do { + System.out.println("Select an option"); + System.out.println("1.) Input student data into class. Enter 1"); + System.out.println("2.) Cut Last 5 students Enter 2"); + System.out.println("3.) Process Scholarships Enter 3"); + System.out.println("4.) Reinstate Students to class Enter 4"); + System.out.println("5.) Exit Enter 5" ); + String response = scan.next(); + String temp = ""; + + if ("5".equals(response)){ + stayIn = false; + } + else if (!"1".equals(response) && isClassMade == false){ + System.out.println("Class has not been made yet. Do you want to make the class? (y/n)"); + response = scan.next(); + if ("y".equals(response)) + { + temp = mw.CreateClass(); + isClassMade = true; + } + + } + else{ + + switch(response) + { + case "1": + if (isClassMade){ + System.out.println("Class already was made, do you want to enter new data? (y/n)"); + if ("y".equals(response)) + { + //CLEAR + createClass(); + isClassMade = true; + } + } + else{ + createClass(); + System.out.println("Class Made"); + isClassMade = true; + } + break; + case "2": + temp = mw.CutClass(); + System.out.println("Cut Class"); + break; + case "3": + temp = mw.Scholarship(); + System.out.println("Scholar"); + break; + case "4": + temp = mw.ResetClass(); + System.out.println("Reset Class"); + break; + default: + System.out.println("Invalid entry."); + } + System.out.println("Would you like to do continue in the class edit menu? (y/n)"); + response = scan.next(); + if ("y".equals(response)) + { + //Run again + } + else + { + stayIn = false; + } + } + + }while(stayIn); + + } + + private void createClass(){ + + boolean stayIn = true; + + do{ + boolean notSuccessful = true; + String tempToParse; + String temp; + int grizzlyID; + String name; + String major; + double gpa; + int thesisGrade; + System.out.println("Enter student data:"); + System.out.println("What is the student's Grizzly ID?"); + tempToParse = scan.next(); + do{ + try{ + grizzlyID = Integer.parseInt(tempToParse); + notSuccessful = false; + } catch (Exception e) { + System.out.println("ID Entered is not a valid number, What is the student's Grizzly ID?"); + tempToParse = scan.next(); + } + } while (notSuccessful); + notSuccessful = true; + + System.out.println("What is the student's name?"); + name = scan.next(); + System.out.println("What is the major of the student"); + major = scan.next(); + + System.out.println("What is the GPA"); + tempToParse = scan.next(); + do{ + try{ + gpa = Double.parseDouble(tempToParse); + notSuccessful = false; + } catch (Exception e) { + System.out.println("GPA Entered is not a valid number, What is the GPA?"); + tempToParse = scan.next(); + } + } while (notSuccessful); + notSuccessful = true; + System.out.println("Thesis grade?"); + tempToParse = scan.next(); + do{ + try{ + thesisGrade = Integer.parseInt(tempToParse); + notSuccessful = false; + } catch (Exception e) { + System.out.println("Thesis Entered is not a valid number, What is the student's thesis grade?"); + tempToParse = scan.next(); + } + } while (notSuccessful); + notSuccessful = true; + + /// CREATE STUDENT + + + System.out.println("Would you like to do continue in the class edit menu? (y/n)"); + temp = scan.next(); + if ("y".equals(temp)) + { + //Run again + } + else + { + stayIn = false; + } + } while (stayIn); + } +} diff --git a/production/ClassProject/LICENSE b/production/ClassProject/LICENSE new file mode 100644 index 0000000..6b156fe --- /dev/null +++ b/production/ClassProject/LICENSE @@ -0,0 +1,675 @@ +GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/production/ClassProject/Middleware/.DS_Store b/production/ClassProject/Middleware/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..3d79d05d3c115ad4c9eb86a4177ae7da5e582877 GIT binary patch literal 6148 zcmeHKOHKko5Pgj#V$_H`+0D|Gi8mM#i6*)c6So3GB0|7`XxPm$Jd8*10Is}>zN+rv z@EMjSnyN|ltLg4nJ^gwzJq^HBC&@8T22i347PeTdFliTGvO=iYBs$G8!W1_cp~K7U zFDM{uS3wnB4AA7t{jA>=>k?jluH~(^b#R0SM$c$o^oQ+Mf7l{hUY$Dq^-GNru!nQ@ z8{;0Q5e(440dJ=KLH zhVyjRN1Eti#=Lt3YY@(3T*h>vh4q7`RD(6lHHjC zrog{az!htaT9s1@d+XBVWUr0rcXTo7mwKF080c2azOoe`(A8KUNkEJPrXE>CvmXJK L!3tC0R~7gMT>XPR literal 0 HcmV?d00001 diff --git a/Middleware_1_B.java b/production/ClassProject/Middleware/BinaryTreeMiddleWare.java similarity index 97% rename from Middleware_1_B.java rename to production/ClassProject/Middleware/BinaryTreeMiddleWare.java index e48ceef..35addf9 100644 --- a/Middleware_1_B.java +++ b/production/ClassProject/Middleware/BinaryTreeMiddleWare.java @@ -7,7 +7,7 @@ import edu.oakland.production.ClassProject.Middleware.*; //Import BinaryTree.java -import edu.oakland.production.ClassProject.Database.*; +import edu.oakland.production.ClassProject.BinaryTreeDB.*; /* @@ -17,7 +17,7 @@ * @version version 1.1 * @since version 1.0 */ -public class Middleware { +public class BinaryTreeMiddleware { /// Minimum possible key value, used with generating a random key. private int minimumKeyValue = 400000; @@ -29,16 +29,16 @@ public class Middleware { /// Maximum possible key value, used with generating a random name. private int maximumNameValue = 600000; - Database database; + BinaryTreeDB database; /* * Default constructor for the Middleware Class. * - * @param database Database object. + * @param database BinaryTreeDB object. * * @returns Middleware */ - public Middleware(Database database){ + public BinaryTreeMiddleware(BinaryTreeDB database){ //Link the database this.database = database @@ -409,18 +409,18 @@ private List createNonDuplicateRandomNumbers(int minimumValue, int maximumV /* * Retrieves the database object. * - * @returns database Database object. + * @returns database BinaryTreeDB object. */ - public Database getDatabase(){ + public BinaryTreeDB getBinaryTreeDB(){ return this.database; } /* * Modifies the database object stored in Middleware. * - * @param database Database object corresponding to the new database. + * @param database BinaryTreeDB object corresponding to the new database. */ - public void setDatabase(Database database){ + public void setBinaryTreeDB(BinaryTreeDB database){ this.database = database; } -} \ No newline at end of file +} diff --git a/HashClient.java b/production/ClassProject/Middleware/HashClient.java similarity index 79% rename from HashClient.java rename to production/ClassProject/Middleware/HashClient.java index fb02029..562deb1 100644 --- a/HashClient.java +++ b/production/ClassProject/Middleware/HashClient.java @@ -1,11 +1,10 @@ -package edu.oakland.production.GroupProject.Middleware; +package edu.oakland.production.ClassProject.Middleware; import java.util.*; -import edu.oakland.production.GroupProject.Middleware.*; /** * @author Dean DeHart, Middleware - * @version 2.0 150401 + * @version 1.0 150330 * @since 1.0 150328 */ public class HashClient { @@ -13,7 +12,7 @@ public class HashClient { * Creates an instance of the Database HashTable class. * Error is currently caused by missing import statement for this class. -Dean */ - private HashTable hashTable; + //private HashTable hashTable; /** * Creates an instance of the Middleware HashArrayCreator class, located in the * edu.oakland.production.GroupProject.Middleware package. -Dean @@ -51,17 +50,15 @@ private String bigONotation() { } private void createHashTable(int n) { hashTable = new HashTable(n); - hashTableArray = hashTable.containerArray; } /** * Method for searching the hashTable. -Dean */ - private int findHashTableValue() { + private void findHashTableValue() { hashFinder = new HashFinder(); - hashValue = hashTableArray[10]; + hashValue = hashArray[10]; System.out.println("The hash value to be retrieved is: " + hashValue); - int valueIndex = hashFinder.findHashValue(hashValue, hashTableArraySize, hashTableArray); - return valueindex; + hashFinder.findHashValue(hashValue, hashTableArraySize, hashTableArray); } } diff --git a/HashFinder.java b/production/ClassProject/Middleware/HashFinder.java similarity index 93% rename from HashFinder.java rename to production/ClassProject/Middleware/HashFinder.java index 5c2c3e2..13b4652 100644 --- a/HashFinder.java +++ b/production/ClassProject/Middleware/HashFinder.java @@ -1,7 +1,8 @@ -package edu.oakland.production.GroupProject.Middleware; +package edu.oakland.production.ClassProject.Middleware; + /** *@author Jared Okoniewski, Jesse Rominske, Dean DeHart -*@version version 3.0 150401 +*@version version 2.0 150330 *@since version 1.0 152403 */ public class HashFinder { @@ -57,7 +58,7 @@ public int findHashValue(int input, int size, int[] array) { System.out.println(items + " items were searched"); //spit out the number of items searched - return arrayIndex;//spit out the index of the value found + return hashOutput;//spit out the value found } } /** diff --git a/LinkedListMiddleware.java b/production/ClassProject/Middleware/LinkedListMiddleware.java similarity index 84% rename from LinkedListMiddleware.java rename to production/ClassProject/Middleware/LinkedListMiddleware.java index 7ea4c91..a07d93b 100644 --- a/LinkedListMiddleware.java +++ b/production/ClassProject/Middleware/LinkedListMiddleware.java @@ -1,11 +1,12 @@ -package edu.oakland.production.ClassProject; +package edu.oakland.production.ClassProject.Middleware; import java.util.*; -import edu.oakland.production.ClassProject.*; +//import edu.oakland.helper.*; +import edu.oakland.production.ClassProject.Database.LinkedListDB; /** *@author Zack Waldrup -*@version version 2.4 150403 +*@version version 2.1 150325 *@since version 1.0 150323 */ public class LinkedListMiddleware { @@ -15,10 +16,9 @@ public class LinkedListMiddleware { */ int listSize; int iMin; - long taskTime; + int taskTime; int value; static long startTime, endTime; - public boolean valuePresent = false; LinkedListDB db; /** @@ -34,7 +34,6 @@ public LinkedListMiddleware(int listSize) { /** *This method performs a Selection Sort on a LinkedList - *Big O: O(n^2) */ public void selectSort() { startTime = System.currentTimeMillis(); @@ -52,12 +51,11 @@ public void selectSort() { } endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Selection Sort time taken: " + taskTime); + System.out.println("Selection Sort time taken: " + tasktime); } /** *This method performs a Bubble Sort on a LinkedList - *Big O: O(n^2) */ public void bubbleSort() { startTime = System.currentTimeMillis(); @@ -71,17 +69,16 @@ public void bubbleSort() { } endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Bubble Sort time taken: " + taskTime); + System.out.println("Bubble Sort time taken: " + tasktime); } /** *This method linearly searches a LinkedList - *Big O: O(n) *@param value of type "int" */ public void linearSearch(int value) { this.value = value; - valuePresent = false; + boolean valuePresent = false; String indexWithValue = ""; startTime = System.currentTimeMillis(); @@ -94,12 +91,11 @@ public void linearSearch(int value) { System.out.println("Value found: " + valuePresent); endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Linear Search time taken: " + taskTime); + System.out.println("Linear Search time taken: " + tasktime); } /** *This method conducts a binary searche on a LinkedList - *Big O: O(log(n)) *@param value of type "int" */ public void binarySearch(int value) { @@ -115,19 +111,16 @@ public void binarySearch(int value) { lowIndex = middleIndex + 1; } else if(db.get(middleIndex) > value) { highIndex = middleIndex - 1; - } else if(db.get(middleIndex) == value){ - valuePresent = true; + } else { System.out.println("Found " + value + "at " + middleIndex); lowIndex = highIndex + 1; - } else { - System.out.println("Value is not in this list"); } timesThrough++; } endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Binary Search time taken: " + taskTime); + System.out.println("Binary Search time taken: " + tasktime); System.out.println("Binary Search times through: " + timesThrough); } @@ -151,7 +144,7 @@ public void createLinkedList(int listSize) { this.listSize = listSize; for(int i = 0; i < listSize; i++) { - db.add(randomInt(100, 1000)); + db.add(i, randomInt(100, 1000)); } } @@ -168,4 +161,4 @@ public static int randomInt(int min, int max) { return randomNumber; } -} \ No newline at end of file +} diff --git a/MidArrayList.java b/production/ClassProject/Middleware/MidArrayList.java similarity index 95% rename from MidArrayList.java rename to production/ClassProject/Middleware/MidArrayList.java index 6839275..d2c1dec 100644 --- a/MidArrayList.java +++ b/production/ClassProject/Middleware/MidArrayList.java @@ -1,7 +1,7 @@ -package edu.oakland.production.ClassProject; +package edu.oakland.production.ClassProject.Middleware; import java.util.ArrayList; -import edu.oakland.production.ClassProject.*; +import edu.oakland.production.ClassProject.Database.ArrayListDatabase; /** *@author Toufiq Hussain @@ -24,7 +24,7 @@ public class MidArrayList { */ MidArrayList(int size){ arraySize =size; - theArray = new ArrayListDatabase(size); + ArrayListDatabase theArray = new ArrayListDatabase(size); } /** @@ -194,4 +194,4 @@ public void linearSearch(int value) { System.out.println("Linear search took " + (endTime - startTime) + " ms"); } -} \ No newline at end of file +} diff --git a/production/ClassProject/Middleware/Middleware.java b/production/ClassProject/Middleware/Middleware.java new file mode 100644 index 0000000..25aef57 --- /dev/null +++ b/production/ClassProject/Middleware/Middleware.java @@ -0,0 +1,115 @@ +package edu.oakland.production.ClassProject.Middleware; + +/** +*@author Eldari Gogiashvili +*@version version 1.0.0 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class Middleware { + + /** + *Instance variables. + */ + int ListSize; + + int Size; + + int size; + int key1; + int key2; + int key3; + + int n; + + int input; + int size; + int array; + + int param; + + /** + *Constructor for LinkedListMiddleware. + *@param ListSize Takes an integer and passes it to the LinkedListMiddleware instance. + */ + LinkedListMiddleware mw = new LinkedListMiddleware(); + mw.LinkedListMiddleware(int ListSize); + mw.selectSort(); + mw.bubbleSort(); + mw.linearSearch(); + mw.binarySearch(); + + + /** + *Constructor for MidArrayList. + *@param ListSize Takes an integer and passes it to the MidArrayList instance. + */ + MidArrayList mw1 = new MidArrayList(); + mw1.MidArrayList(int Size); + mw1.bubbleSort(); + mw1.selectionSort(); + mw1.linearSearch(); + mw1.binarySearch(); + + /** + *Constructor for Middleware1. + *@param ListSize Takes an integer and passes it to the Middleware1 instance. + */ + Middleware1 mw2 = new Middleware1(); + mw2.createBinaryTree(int size); + mw2.populateBinaryTree(); + mw2.calculatePreorderNodesSearched(int key1, int key2, int key3); + mw2.calculateInOrderNodesSearched(int key1, int key2, int key3); + mw2.calculatePreorderSearchDuration(int key1, int key2, int key3); + mw2.calculateInOrderSearchDuration(int key1, int key2, int key3); + mw2.calculateBigORelationship(BinaryTree binaryTree); + mw2.getDatabase(); + mw2.setDatabase(Database database); + + /** + *Constructor for HashClient. + *@param ListSize Takes an integer and passes it to the HashClient instance. + */ + HashClient mw3 = new HashClient(); + mw3.createHashTable(int n); + mw3.findHashTableValue(); + mw3.bigONotation(); + + /** + *Constructor for HashFinder. + *@param ListSize Takes an integer and passes it to the HashClient instance. + */ + HashFinder mw4 = new HashFinder(); + mw4.findHashValue(int input, int size, int array); + + /** + *Constructor for StackCut. + *@param ListSize Takes an integer and passes it to the HashClient instance. + */ + StackCut mw5 = new StackCut(); + mw5.StackCut(int param); + mw5.push(Object param); + mw5.pop(Object param); + mw5.displayStacks(); + mw5.peek(); + + /** + *Constructor for Student. + *@param ListSize Takes an integer and passes it to the HashClient instance. + */ + Student mw6 = new Student(); + mw6.getID(); + mw6.getName(); + mw6.getMajor(); + mw6.getGPA(); + mw6.getTG(); + +/** +*This class was created for Middleware. +*/ + +} diff --git a/test/.DS_Store b/test/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c25aaebefd738dcec81d0ce615604929b159df9e GIT binary patch literal 6148 zcmeHK&2G~`5S~o~I4uVwKmu{uBS<+UqLr_1T97y(MKWrIC<=CMkwum_vYkdKisUno z!T)1$K=2H_3YRjoyD6YhZbg7*Rx{stJhLl*wst)LAO_R458wlUhf3J$p!tQ+ebN(Cha*XQ$oe>3RHt)RE)%6Smt?l~{CyN&^U%h_w z_TBrBp9}{e@XI%H+2ImCqjM^=M^Rbix_F8?%lc&~xAfEoCi0qXrwd^-Q{oZkPNBsRhAlkdp z?f{?7ovkZRNoTD@eS%6td5y)B5_HT_jJb3aUqdy5aY+th=&-Sf5fuIrFf_1X2L31m F-vDLrb3*_C literal 0 HcmV?d00001 diff --git a/test/ClassProject/.DS_Store b/test/ClassProject/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..525114880caffe8ad7f7f28ebae6b243b8c60b73 GIT binary patch literal 6148 zcmeHK&1%~~5T141R(38bZK0u;J+|P3O%rrg9kw)%zmTY`Bvy#dw&3c^`~(Uzy$yYov_iu>I$QN z@)c{CmL?)oV?+=_0m;i$zFWz*4gaG8G5wQ$0PT_Fi#GVIt;U9PZS~&sVI+}7L}2^F`M;zn_h=+dEI%3&pfZ&;hRsr`P}{P zIFFueJ==LTnSc2B>GPMb$KQVZB*{=b{D&yJXK(?(Ft}3D!ywO6nZ3vU1$V)*Xce#u zSOu=9fLT?X_3I5|*;WCozztM@)(4JG=o_pxs-*)fbp=4AW27>S>BvYNZqPSaYs4Nj zrm2XU%FGpmX*#xZljj?(HEKFAbNOKA&CJ|Tn0h;o&s91wU!$$90#<>`3asfzm-heX zf4=`;CfO&efK}i|DZrY8V9>`;GJEUF$I)KP(chwzQC_X_f`WnCiZPeA;)m$Uu$@zY W=o_pxVhfr*2q+nBWfl0R3j79Z$$H2D literal 0 HcmV?d00001 diff --git a/test/ClassProject/Database/TestStack.java b/test/ClassProject/Database/TestStack.java new file mode 100644 index 0000000..a9d1e7b --- /dev/null +++ b/test/ClassProject/Database/TestStack.java @@ -0,0 +1,32 @@ +package edu.oakland.test.ClassProject.Database; + +import edu.oakland.production.ClassProject.Database.*; +import junit.framework.*; +/** + * @version "version 2.0" "20150104" + * @author Sam Bell and Binh Ton + */ +public class TestStack extends TestCase{ + /*private int getID;*/ + private Object firstStudent = 677422; + private Object lastStudent = 177993; + + public void testStack(){ + Student student1 = new Student(677422, "Jones", "IT", 3.82, 95); + Student student2 = new Student(177993, "Smith", "IT", 3.47, 78); + StackCut stackcut = new StackCut(5); + stackcut.push(student1.getID()); + Object compares2 = stackcut.peek(); + assertEquals(firstStudent, compares2); + stackcut.push(student2.getID()); + System.out.println(stackcut.peek()); + stackcut.displayStacks(); + Object compares = stackcut.pop(); + //assertEquals(lastStudent, compares); //this is meant to fail + } + /* + public int getID(){ + return getID; + }*/ + +} \ No newline at end of file diff --git a/test/ClassProject/Database/testBinaryTree.java b/test/ClassProject/Database/testBinaryTree.java new file mode 100644 index 0000000..6e86274 --- /dev/null +++ b/test/ClassProject/Database/testBinaryTree.java @@ -0,0 +1,57 @@ +package edu.oakland.test.ClassProject.Database; + +import edu.oakland.production.ClassProject.Database.*; +import junit.framework.*; + +/** This class utilizes JUnit to test the ATM's ability to verify whether +* sufficient funds are in a bank account prior to withdrawal. +*@author "Bryan Jagielo CSE231" +*@version "1.1" dated 150329 +*@since version 1.0 dated 150329 +*/ +public class testBinaryTree extends TestCase{ + BinaryTreeDB tree; + /** The testAdd() method tests whether the binary tree may add a node to + * the existing set of nodes that it contains + */ + public void testAdd(){ + initTest(); + String name = "Brett"; + int key = 4; + tree.addNode(key,name); + Node foundNode = tree.findNode(key); + String nodeString = foundNode.toString(); + assertTrue(nodeString.equals(name + " has a key " + key)); + } + /** The testRemove() method tests whether the binary tree may remove a + * node from its existing set of nodes. + */ + public void testRemove(){ + initTest(); + String name = "John"; + int key = 1; + tree.remove(key); + Node foundNode = tree.findNode(key); + assertEquals(null,foundNode); + } + /** The testFind() method tests whether the binary tree may find a node + * using a key. + */ + public void testFind(){ + initTest(); + String name = "John"; + int key = 1; + Node foundNode = tree.findNode(key); + String nodeString = foundNode.toString(); + assertTrue(nodeString.equals(name + " has a key " + key)); + } + /** The initTest() method initializes a standard binary tree and + * populates it with nodes in order to prepare the class for each test. + */ + public void initTest(){ + tree = new BinaryTreeDB(); + tree.addNode(0,"Tim"); + tree.addNode(1,"John"); + tree.addNode(2,"Jim"); + } +} diff --git a/test/ClassProject/Middleware/.DS_Store b/test/ClassProject/Middleware/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..795af2364c6c18029545f9dcfe71f94e42bd9c70 GIT binary patch literal 6148 zcmeH~y-ou$5QN8&A`;D&lrE`|cmpd+kf_50kPsRak%EN!x;!?_{(v}L(o&#VY5kqo zyS8qM+cSVNJ8bTN4#1Rd#L^5)a+^rnhR0VyB_q<|EV0%sMl-b z-cX94&Up27lor$|1*E`Gfy Date: Mon, 6 Apr 2015 16:37:34 -0400 Subject: [PATCH 10/10] For real --- production/ClassProject/Middleware/.DS_Store | Bin 6148 -> 0 bytes .../Middleware/ArrayListDatabase.java | 55 +++ .../Middleware/ArrayListMockDisplay.java | 33 ++ .../ClassProject/Middleware/BinaryTree.java | 62 +++ .../ClassProject/Middleware/BinaryTreeMW.java | 467 ++++++++++++++++++ .../ClassProject/Middleware/HashClient.java | 15 +- .../ClassProject/Middleware/HashFinder.java | 7 +- .../ClassProject/Middleware/LinkListDB.java | 24 + .../ClassProject/Middleware/LinkedListDB.java | 27 + .../Middleware/LinkedListMiddleware.java | 33 +- .../ClassProject/Middleware/MidArrayList.java | 8 +- .../Middleware/Middleware methods.docx | Bin 0 -> 16862 bytes .../ClassProject/Middleware/Middleware.java | 188 ++++--- ...reeMiddleWare.java => Middleware_1_B.java} | 20 +- .../ClassProject/Middleware/MockDisplay.java | 35 ++ production/ClassProject/Middleware/Node.java | 19 + production/ClassProject/Middleware/README.md | 1 + .../ClassProject/Middleware/StackCut.java | 57 +++ .../ClassProject/Middleware/Student.java | 35 ++ .../Middleware/LLMiddlewareTest.java | 76 +++ test/ClassProject/Middleware/StudentTest.java | 34 +- 21 files changed, 1098 insertions(+), 98 deletions(-) delete mode 100644 production/ClassProject/Middleware/.DS_Store create mode 100644 production/ClassProject/Middleware/ArrayListDatabase.java create mode 100644 production/ClassProject/Middleware/ArrayListMockDisplay.java create mode 100644 production/ClassProject/Middleware/BinaryTree.java create mode 100644 production/ClassProject/Middleware/BinaryTreeMW.java create mode 100644 production/ClassProject/Middleware/LinkListDB.java create mode 100644 production/ClassProject/Middleware/LinkedListDB.java create mode 100644 production/ClassProject/Middleware/Middleware methods.docx rename production/ClassProject/Middleware/{BinaryTreeMiddleWare.java => Middleware_1_B.java} (97%) create mode 100644 production/ClassProject/Middleware/MockDisplay.java create mode 100644 production/ClassProject/Middleware/Node.java create mode 100644 production/ClassProject/Middleware/README.md create mode 100644 production/ClassProject/Middleware/StackCut.java create mode 100644 production/ClassProject/Middleware/Student.java create mode 100644 test/ClassProject/Middleware/LLMiddlewareTest.java diff --git a/production/ClassProject/Middleware/.DS_Store b/production/ClassProject/Middleware/.DS_Store deleted file mode 100644 index 3d79d05d3c115ad4c9eb86a4177ae7da5e582877..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKOHKko5Pgj#V$_H`+0D|Gi8mM#i6*)c6So3GB0|7`XxPm$Jd8*10Is}>zN+rv z@EMjSnyN|ltLg4nJ^gwzJq^HBC&@8T22i347PeTdFliTGvO=iYBs$G8!W1_cp~K7U zFDM{uS3wnB4AA7t{jA>=>k?jluH~(^b#R0SM$c$o^oQ+Mf7l{hUY$Dq^-GNru!nQ@ z8{;0Q5e(440dJ=KLH zhVyjRN1Eti#=Lt3YY@(3T*h>vh4q7`RD(6lHHjC zrog{az!htaT9s1@d+XBVWUr0rcXTo7mwKF080c2azOoe`(A8KUNkEJPrXE>CvmXJK L!3tC0R~7gMT>XPR diff --git a/production/ClassProject/Middleware/ArrayListDatabase.java b/production/ClassProject/Middleware/ArrayListDatabase.java new file mode 100644 index 0000000..f21b186 --- /dev/null +++ b/production/ClassProject/Middleware/ArrayListDatabase.java @@ -0,0 +1,55 @@ +package edu.oakland.production.ClassProject; + +import java.util.*; + + +/** +*@author Eldari Gogiashvili +*@version version 1.0.1 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class ArrayListDatabase{ + + ArrayList students; + + ArrayListDatabase(int size){ + students = new ArrayList(size); + } + + + public Integer getStudent(int i){ + return students.get(i); + } + + + public void setStudent(int i, int j){ + students.add(i,j); + } + + + public void addStudent(int i){ + students.add(i); + } + + + public void removeStudent(int i){ + students.remove(i); + } + + + public int returnSize(){ + return students.size(); + } + + public void clearAllStudents(){ + students.clear(); + } +} +/** +*This class was created for Middleware. +*/ \ No newline at end of file diff --git a/production/ClassProject/Middleware/ArrayListMockDisplay.java b/production/ClassProject/Middleware/ArrayListMockDisplay.java new file mode 100644 index 0000000..8e8ae60 --- /dev/null +++ b/production/ClassProject/Middleware/ArrayListMockDisplay.java @@ -0,0 +1,33 @@ +package edu.oakland.production.ClassProject; + +import edu.oakland.production.ClassProject.*; +/** +*@author Eldari Gogiashvili +*@version version 1.0.1 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class ArrayListMockDisplay { + public void main(String[] args){ + + int ListSize = 100; + int searchKey = 100; + + /** + *Constructor for Middleware. + */ + MidArrayList mw = new MidArrayList(ListSize); + mw.selectionSort(); + mw.linearSearch(searchKey); + mw.binarySearch(searchKey); + + MidArrayList mw1 = new MidArrayList(ListSize); + mw1.bubbleSort(); + mw1.linearSearch(searchKey); + mw1.binarySearch(searchKey); + } +} \ No newline at end of file diff --git a/production/ClassProject/Middleware/BinaryTree.java b/production/ClassProject/Middleware/BinaryTree.java new file mode 100644 index 0000000..62ecdf8 --- /dev/null +++ b/production/ClassProject/Middleware/BinaryTree.java @@ -0,0 +1,62 @@ +package edu.oakland.production.ClassProject.middleware; + +public class BinaryTree{ + + public Node root; + + public void addNode(String name, double gpa, int tg){ + Node newNode = new Node(name, gpa, tg); + if(root == null){ + root = newNode; + } + else{ + Node focusNode = root; + Node parent; + while(true){ + parent = focusNode; + if(tg < focusNode.tg){ + focusNode = focusNode.leftChild; + + if(focusNode == null){ + parent.leftChild = newNode; + return; + } + } + else { + focusNode = focusNode.rightChild; + if(focusNode == null){ + parent.rightChild = newNode; + return; + } + } + } + } + } + + public void preorderTraverseTree(Node focusNode){ + if(focusNode != null){ + System.out.println(focusNode); + preorderTraverseTree(focusNode.leftChild); + preorderTraverseTree(focusNode.rightChild); + } + } + + public Node findNode(int tg){ + Node focusNode = root; + while(focusNode.tg != tg){ + if(tg > focusNode.tg){ + return focusNode; + } + if(tg < focusNode.tg){ + focusNode = focusNode.leftChild; + } + else{ + focusNode = focusNode.rightChild; + } + } + return focusNode; + + } + + } + diff --git a/production/ClassProject/Middleware/BinaryTreeMW.java b/production/ClassProject/Middleware/BinaryTreeMW.java new file mode 100644 index 0000000..f2a68a4 --- /dev/null +++ b/production/ClassProject/Middleware/BinaryTreeMW.java @@ -0,0 +1,467 @@ +package edu.oakland.production.ClassProject.Middleware; + +//Import java util framework +import java.util.*; + +//Import BinaryTreeDB.java & Node.java +import edu.oakland.production.ClassProject.Database.*; + + +/* + * BinaryTreeMW. + * + * @author Joshua Herkness, Trevor Luebbert Middleware + * @version version 2.0 + * @since version 1.0 + */ +public class BinaryTreeMW { + + /// Minimum possible key value, used with generating a random key. + private int minimumKeyValue = 400000; + /// Maximum possible key value, used with generating a random key. + private int maximumKeyValue = 800000; + + /// Minimum possible name value, used with generating a random name. + private int minimumNameValue = 200000; + /// Maximum possible key value, used with generating a random name. + private int maximumNameValue = 600000; + + private BinaryTreeDB binaryTreeDatabase; + + /* + * Default constructor for the BinaryTreeMW Class. + * + * @returns BinaryTreeMW + */ + public BinaryTreeMW(){ + + this.binaryTreeDatabase = new BinaryTreeDB(); + } + + /* + * Overloaded constructor for the BinaryTreeMW Class. Popluates the binaryTreeDatabase given a size. + * + * @param size Integer value corresponding to the desired size of the BinaryTreeDB object. + * + * @returns BinaryTreeMW + */ + public BinaryTreeMW(int size){ + + this.binaryTreeDatabase = new BinaryTreeDB(); + + // Populates the BinaryTreeDB object + populateBinaryTreeDB(size); + } + + /* + * Populates a private global BinaryTreeDB object with a given amount of nodes. Creates a non-duplicate random key and name for each node. + * + * @param size Integer value corresponding to the size of the binary tree. + * + */ + public void populateBinaryTreeDB(int size){ + + // Refresh the BinaryTreeDB object. + this.binaryTreeDatabase = new BinaryTreeDB(); + + // Create a non-duplicate random number list for keys. + List nonDuplicateRandomNumberKeys = new ArrayList(); + // Create a non-duplicate random number list for names. + List nonDuplicateRandomNumberNames = new ArrayList(); + + // Populate both key and name lists. + nonDuplicateRandomNumberKeys = createNonDuplicateRandomNumbers(minimumKeyValue, maximumKeyValue, size); + nonDuplicateRandomNumberNames = createNonDuplicateRandomNumbers(minimumNameValue, maximumNameValue, size); + + for (int i = 0; i < size; i++){ + + // Reference key integer from a given index. + int key = nonDuplicateRandomNumberKeys.get(i); + // Reference name integer from a given index, then convert to a string. + String name = String.valueOf(nonDuplicateRandomNumberNames.get(i)); + + // Add a node to the BinaryTreeDB, given the key and name. + this.binaryTreeDatabase.addNode(key, name); + + } + } + + /* + * Searches for three integer key values, providing a record of the amount of nodes searched durring a preorder search. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns nodesSearched String value corresponding to the number of nodes searched respectively. + */ + public String calculatePreorderNodesSearched(int key1, int key2, int key3){ + + String nodesSearched = ""; + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + nodesSearched += String.valueOf(calculatePreorderNodesSearched(this.binaryTreeDatabase, focusNode, key1)); + nodesSearched += " "; + + nodesSearched += String.valueOf(calculatePreorderNodesSearched(this.binaryTreeDatabase, focusNode, key2)); + nodesSearched += " "; + + nodesSearched += String.valueOf(calculatePreorderNodesSearched(this.binaryTreeDatabase, focusNode, key3)); + + return nodesSearched; + } + + /* + * Searches for three integer key values, providing a record of the amount of nodes searched durring an in order search. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns nodesSearched String value corresponding to the number of nodes searched respectively. + */ + public String calculateInOrderNodesSearched(int key1, int key2, int key3){ + + String nodesSearched = ""; + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + nodesSearched += String.valueOf(calculateInOrderNodesSearched(this.binaryTreeDatabase, focusNode, key1)); + nodesSearched += " "; + + nodesSearched += String.valueOf(calculateInOrderNodesSearched(this.binaryTreeDatabase, focusNode, key2)); + nodesSearched += " "; + + nodesSearched += String.valueOf(calculateInOrderNodesSearched(this.binaryTreeDatabase, focusNode, key3)); + + return nodesSearched; + } + + /* + * Calculates the amount of nodes searched for locating a given key using a preorder search. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculatePreorderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ + + int nodesSearched = calculatePreorderNodesSearched(binaryTreeDatabase, focusNode, key, true); + + return nodesSearched; + + } + + /* + * Helper recursive method used to calculates the amount of nodes searched for locating a given key using a preorder search. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * @param continueSearch Boolean value corresponding to whether the node has been located. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculatePreorderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key, boolean continueSearching){ + + // Begin each recursion with zero nodes searched. + int nodesSearched = 0; + + // Ignore the recursion loop if the node is already found, or if the node is non existant. + if (!continueSearching){ + return 0; + } else if (focusNode == null){ + return 0; + } else { + // Count the node. + nodesSearched++; + } + + // If the focus node has the desired key, increament the amount of nodesSearched, and skip all other recursions. + if (focusNode.getKey() == key){ + + continueSearching = false; + return nodesSearched; + + } + + if (focusNode.leftChild != null){ + nodesSearched += calculatePreorderNodesSearched(binaryTreeDatabase, focusNode.leftChild, key, continueSearching); + } + + if (focusNode.rightChild != null){ + nodesSearched += calculatePreorderNodesSearched(binaryTreeDatabase, focusNode.rightChild, key, continueSearching); + } + + return nodesSearched; + + } + + /* + * Calculates the amount of nodes searched for locating a given key using an in order search. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculateInOrderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ + + int nodesSearched = calculateInOrderNodesSearched(binaryTreeDatabase, focusNode, key, true); + + return nodesSearched; + } + + /* + * Helper recursive method used to calculates the amount of nodes searched for locating a given key using an in order search. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * @param continueSearch Boolean value corresponding to whether the node has been located. + * + * @returns int Integer type corresponding to the number of nodes searched through. + */ + private int calculateInOrderNodesSearched(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key, boolean continueSearching){ + + // Begin each recursion with zero nodes searched. + int nodesSearched = 0; + + // Ignore the recursion loop if the node is already found, or if the node is non existant. + if (!continueSearching){ + return 0; + } else if (focusNode == null){ + return 0; + } else { + // Count the node. + nodesSearched++; + } + + if (focusNode.leftChild != null){ + nodesSearched += calculateInOrderNodesSearched(binaryTreeDatabase, focusNode.leftChild, key, continueSearching); + } + + // If the focus node has the desired key, increament the amount of nodesSearched, and + if (focusNode.getKey() == key){ + + continueSearching = false; + return nodesSearched; + + } + + if (focusNode.rightChild != null){ + nodesSearched += calculateInOrderNodesSearched(binaryTreeDatabase, focusNode.rightChild, key, continueSearching); + } + + return nodesSearched; + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct a preorder search on each of the three integer keys provided. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns duration String value corresponding to the time elapsed durring each of the searches respectively. + */ + public String calculatePreorderSearchDuration(int key1, int key2, int key3){ + + String duration = ""; + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + duration += Double.toString(calculatePreorderSearchDuration(this.binaryTreeDatabase, focusNode, key1)); + duration += " "; + + duration += Double.toString(calculatePreorderSearchDuration(this.binaryTreeDatabase, focusNode, key2)); + duration += " "; + + duration += Double.toString(calculatePreorderSearchDuration(this.binaryTreeDatabase, focusNode, key3)); + + return duration; + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct an in order search on each of the three integer keys provided. + * + * @param key1 Integer value corresponding to a key value. + * @param key2 Integer value corresponding to a key value. + * @param key3 Integer value corresponding to a key value. + * + * @returns duration String value corresponding to the time elapsed durring each of the searches respectively. + */ + public String calculateInOrderSearchDuration(int key1, int key2, int key3){ + + String duration = ""; + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + duration += Double.toString(calculateInOrderSearchDuration(this.binaryTreeDatabase, focusNode, key1)); + duration += " "; + + duration += Double.toString(calculateInOrderSearchDuration(this.binaryTreeDatabase, focusNode, key2)); + duration += " "; + + duration += Double.toString(calculateInOrderSearchDuration(this.binaryTreeDatabase, focusNode, key3)); + + return duration; + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct a preorder search on the integer key provided. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns double Double type corresponding to time taken to search the binaryTreeDatabase. + */ + private double calculatePreorderSearchDuration(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ + + double startTime = System.currentTimeMillis(); + int temporary = calculatePreorderNodesSearched(binaryTreeDatabase, focusNode, key); + double endTime = System.currentTimeMillis(); + + return (endTime - startTime); + } + + /* + * Calculates the amount of time (in milliseconds) needed to conduct an in order search on the key provided. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Start or begining node of the binary tree. + * @param key Integer value corresponding with desired search value. + * + * @returns double Double type corresponding to time taken to search the binaryTreeDatabase. + */ + private double calculateInOrderSearchDuration(BinaryTreeDB binaryTreeDatabase, Node focusNode, int key){ + + double startTime = System.currentTimeMillis(); + int temporary = calculateInOrderNodesSearched(binaryTreeDatabase, focusNode, key); + double endTime = System.currentTimeMillis(); + + return (endTime - startTime); + } + + /* + * Gathers data for the BigO notaion, returning a string of the duration spent searching after each recursion, as well as the description of the notation. + * + * @returns bigO String value corresponding to the big O notation and data set as proof. + */ + public String calculateBigORelationship(){ + + Node focusNode = this.binaryTreeDatabase.getRootNode(); + + String bigO = ""; + + // Description of the BigO notation. + bigO += "After each recursion, the time spent searching is halved" + + "since you can only move down either the left or right child nodes." + + "This halving of the data can be represented as O (log N)"; + + // Introduction to the data set + bigO += "\nThe time spent searching during each recursion are as follows:\n"; + + //the key is -1 so the search method goes through the entire tree + bigO += calculateInOrderTimeElapsed(focusNode, -1, true); + + return bigO; + } + + /* + * Calculates durration of each recursion of the method. + * + * @param binaryTreeDatabase BinaryTreeDB object. + * @param focusNode Node object. + * @param key Integer value corresponding to the key of a given node object. + * @param continueSearching Boolean value that tells the method whether or not it needs to continue searching. + * + * @returns time String value that returns data regarding time spent during each recursion of the method. + */ + private String calculateInOrderTimeElapsed(Node focusNode, int key, boolean continueSearching){ + + String time = ""; + + //Capture the start time. + double startTime = System.currentTimeMillis(); + + // Ignore the recursion loop if the node is already found, or if the node is non existant. + if (!continueSearching){ + return ""; + } else if (focusNode == null){ + return ""; + } + + if (focusNode.leftChild != null){ + time += " "; + time += calculateInOrderTimeElapsed(focusNode.leftChild, key, continueSearching); + } + + // If the focus node has the desired key, stop searching + if (focusNode.getKey == key){ + continueSearching = false; + } + + if (focusNode.rightChild != null){ + time += " "; + time += calculateInOrderTimeElapsed(focusNode.rightChild, key, continueSearching); + } + + double endTime = System.currentTimeMillis(); + + time += " "; + time += (Double.toString(endTime-startTime)); + return time; + } + + /* + * Generates a non-duplicate random number list, given a minimumValue, maximumValue, and size. + * + * @param minimumValue Integer value corresponding to the minimum possible random value generated. + * @param maximumValue Integer value corresponding to the maximum possible random value generated. + * + * @returns List List type, shuffled to mimic non-duplicate random numbers. + */ + private List createNonDuplicateRandomNumbers(int minimumValue, int maximumValue, int size){ + + // Create an instance of ArrayList, with type int. + ArrayList nonDuplicateRandomNumbers = new ArrayList(); + + //Test for errors with provided data. If there arent enough possible numbers, return null. + if ((maximumValue - minimumValue) < size){ + + //There has been an error. + return null; + + } + + // For the range of numbers provided. + // Creates an ArrayList of integers from minimumValue to maximumValue. + for (int i = minimumValue; i <= maximumValue; i++){ + + // Add that number to the ArrayList. + nonDuplicateRandomNumbers.add(i); + } + + // Shuffle the ArrayList, randomizing the numbers. + Collections.shuffle(nonDuplicateRandomNumbers); + + // Return a immutable List object, created from the ArrayList, trimming off unnecessary values. + return nonDuplicateRandomNumbers.subList(0, size - 1); + } + + /* + * Retrieves the BinaryTreeDatabaseObject. + * + * @returns BinaryTreeDB + */ + public BinaryTreeDB getBinaryTreeDatabase(){ + + return this.binaryTreeDatabase; + } +} \ No newline at end of file diff --git a/production/ClassProject/Middleware/HashClient.java b/production/ClassProject/Middleware/HashClient.java index 562deb1..fb02029 100644 --- a/production/ClassProject/Middleware/HashClient.java +++ b/production/ClassProject/Middleware/HashClient.java @@ -1,10 +1,11 @@ -package edu.oakland.production.ClassProject.Middleware; +package edu.oakland.production.GroupProject.Middleware; import java.util.*; +import edu.oakland.production.GroupProject.Middleware.*; /** * @author Dean DeHart, Middleware - * @version 1.0 150330 + * @version 2.0 150401 * @since 1.0 150328 */ public class HashClient { @@ -12,7 +13,7 @@ public class HashClient { * Creates an instance of the Database HashTable class. * Error is currently caused by missing import statement for this class. -Dean */ - //private HashTable hashTable; + private HashTable hashTable; /** * Creates an instance of the Middleware HashArrayCreator class, located in the * edu.oakland.production.GroupProject.Middleware package. -Dean @@ -50,15 +51,17 @@ private String bigONotation() { } private void createHashTable(int n) { hashTable = new HashTable(n); + hashTableArray = hashTable.containerArray; } /** * Method for searching the hashTable. -Dean */ - private void findHashTableValue() { + private int findHashTableValue() { hashFinder = new HashFinder(); - hashValue = hashArray[10]; + hashValue = hashTableArray[10]; System.out.println("The hash value to be retrieved is: " + hashValue); - hashFinder.findHashValue(hashValue, hashTableArraySize, hashTableArray); + int valueIndex = hashFinder.findHashValue(hashValue, hashTableArraySize, hashTableArray); + return valueindex; } } diff --git a/production/ClassProject/Middleware/HashFinder.java b/production/ClassProject/Middleware/HashFinder.java index 13b4652..5c2c3e2 100644 --- a/production/ClassProject/Middleware/HashFinder.java +++ b/production/ClassProject/Middleware/HashFinder.java @@ -1,8 +1,7 @@ -package edu.oakland.production.ClassProject.Middleware; - +package edu.oakland.production.GroupProject.Middleware; /** *@author Jared Okoniewski, Jesse Rominske, Dean DeHart -*@version version 2.0 150330 +*@version version 3.0 150401 *@since version 1.0 152403 */ public class HashFinder { @@ -58,7 +57,7 @@ public int findHashValue(int input, int size, int[] array) { System.out.println(items + " items were searched"); //spit out the number of items searched - return hashOutput;//spit out the value found + return arrayIndex;//spit out the index of the value found } } /** diff --git a/production/ClassProject/Middleware/LinkListDB.java b/production/ClassProject/Middleware/LinkListDB.java new file mode 100644 index 0000000..0bbf3d3 --- /dev/null +++ b/production/ClassProject/Middleware/LinkListDB.java @@ -0,0 +1,24 @@ + +/** +*@author Eldari Gogiashvili +*@version version 1.0.0 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class LinkListDB{ + + public static add(){ + +} + public static get(){ +} + + public static set(){ +} +/** +*This class was created for Middleware. +*/ \ No newline at end of file diff --git a/production/ClassProject/Middleware/LinkedListDB.java b/production/ClassProject/Middleware/LinkedListDB.java new file mode 100644 index 0000000..d72f126 --- /dev/null +++ b/production/ClassProject/Middleware/LinkedListDB.java @@ -0,0 +1,27 @@ +package edu.oakland.production.ClassProject; + +/** +*@author Eldari Gogiashvili, Zack Waldrup +*@version version 1.0.1 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class LinkedListDB{ + + public void add(int index, int value){ + } + + public int get(int value){ + return 1; + } + + public void set(int index, int value){ + } +} +/** +*This class was created for Middleware. +*/ \ No newline at end of file diff --git a/production/ClassProject/Middleware/LinkedListMiddleware.java b/production/ClassProject/Middleware/LinkedListMiddleware.java index a07d93b..7ea4c91 100644 --- a/production/ClassProject/Middleware/LinkedListMiddleware.java +++ b/production/ClassProject/Middleware/LinkedListMiddleware.java @@ -1,12 +1,11 @@ -package edu.oakland.production.ClassProject.Middleware; +package edu.oakland.production.ClassProject; import java.util.*; -//import edu.oakland.helper.*; -import edu.oakland.production.ClassProject.Database.LinkedListDB; +import edu.oakland.production.ClassProject.*; /** *@author Zack Waldrup -*@version version 2.1 150325 +*@version version 2.4 150403 *@since version 1.0 150323 */ public class LinkedListMiddleware { @@ -16,9 +15,10 @@ public class LinkedListMiddleware { */ int listSize; int iMin; - int taskTime; + long taskTime; int value; static long startTime, endTime; + public boolean valuePresent = false; LinkedListDB db; /** @@ -34,6 +34,7 @@ public LinkedListMiddleware(int listSize) { /** *This method performs a Selection Sort on a LinkedList + *Big O: O(n^2) */ public void selectSort() { startTime = System.currentTimeMillis(); @@ -51,11 +52,12 @@ public void selectSort() { } endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Selection Sort time taken: " + tasktime); + System.out.println("Selection Sort time taken: " + taskTime); } /** *This method performs a Bubble Sort on a LinkedList + *Big O: O(n^2) */ public void bubbleSort() { startTime = System.currentTimeMillis(); @@ -69,16 +71,17 @@ public void bubbleSort() { } endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Bubble Sort time taken: " + tasktime); + System.out.println("Bubble Sort time taken: " + taskTime); } /** *This method linearly searches a LinkedList + *Big O: O(n) *@param value of type "int" */ public void linearSearch(int value) { this.value = value; - boolean valuePresent = false; + valuePresent = false; String indexWithValue = ""; startTime = System.currentTimeMillis(); @@ -91,11 +94,12 @@ public void linearSearch(int value) { System.out.println("Value found: " + valuePresent); endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Linear Search time taken: " + tasktime); + System.out.println("Linear Search time taken: " + taskTime); } /** *This method conducts a binary searche on a LinkedList + *Big O: O(log(n)) *@param value of type "int" */ public void binarySearch(int value) { @@ -111,16 +115,19 @@ public void binarySearch(int value) { lowIndex = middleIndex + 1; } else if(db.get(middleIndex) > value) { highIndex = middleIndex - 1; - } else { + } else if(db.get(middleIndex) == value){ + valuePresent = true; System.out.println("Found " + value + "at " + middleIndex); lowIndex = highIndex + 1; + } else { + System.out.println("Value is not in this list"); } timesThrough++; } endTime = System.currentTimeMillis(); taskTime = endTime - startTime; - System.out.println("Binary Search time taken: " + tasktime); + System.out.println("Binary Search time taken: " + taskTime); System.out.println("Binary Search times through: " + timesThrough); } @@ -144,7 +151,7 @@ public void createLinkedList(int listSize) { this.listSize = listSize; for(int i = 0; i < listSize; i++) { - db.add(i, randomInt(100, 1000)); + db.add(randomInt(100, 1000)); } } @@ -161,4 +168,4 @@ public static int randomInt(int min, int max) { return randomNumber; } -} +} \ No newline at end of file diff --git a/production/ClassProject/Middleware/MidArrayList.java b/production/ClassProject/Middleware/MidArrayList.java index d2c1dec..6839275 100644 --- a/production/ClassProject/Middleware/MidArrayList.java +++ b/production/ClassProject/Middleware/MidArrayList.java @@ -1,7 +1,7 @@ -package edu.oakland.production.ClassProject.Middleware; +package edu.oakland.production.ClassProject; import java.util.ArrayList; -import edu.oakland.production.ClassProject.Database.ArrayListDatabase; +import edu.oakland.production.ClassProject.*; /** *@author Toufiq Hussain @@ -24,7 +24,7 @@ public class MidArrayList { */ MidArrayList(int size){ arraySize =size; - ArrayListDatabase theArray = new ArrayListDatabase(size); + theArray = new ArrayListDatabase(size); } /** @@ -194,4 +194,4 @@ public void linearSearch(int value) { System.out.println("Linear search took " + (endTime - startTime) + " ms"); } -} +} \ No newline at end of file diff --git a/production/ClassProject/Middleware/Middleware methods.docx b/production/ClassProject/Middleware/Middleware methods.docx new file mode 100644 index 0000000000000000000000000000000000000000..586c5682b25c0e8bb8cee56bb630582d7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L{v|PN||Z;8yN`xS&^Ua71&KBx32y8<2&B@tp2<5t{Hps^aAx%a;_8_ zPV~!%$p3q!1_Gx3aESi*MD{-f;E(HnNo$vt{5ylcr`rAj{Oy|g@yNd<-u@H#_Z-B( z0y{qf0RMj(iT~vE&os0@d4Ye-K>v}H_D}dfV-Ej>tA2Qv{{{bN1mZtg{4>DhPZkx} zzq9yjxXC}^|MXS=3D3d*9sUo`^*=fM(|hwLhiQ^OI`BWfoPUD|2N~|pZLFz>VKj?(px$I(*57Zcv(rX U5Agy3K7E`(9}+si^V{A31M+IRGynhq literal 0 HcmV?d00001 diff --git a/production/ClassProject/Middleware/Middleware.java b/production/ClassProject/Middleware/Middleware.java index 25aef57..c564b51 100644 --- a/production/ClassProject/Middleware/Middleware.java +++ b/production/ClassProject/Middleware/Middleware.java @@ -1,115 +1,189 @@ -package edu.oakland.production.ClassProject.Middleware; - +package edu.oakland.production.ClassProject.middleware; +import edu.oakland.production.ClassProject.middleware.*; /** *@author Eldari Gogiashvili -*@version version 1.0.0 date 150331 -*since version 1.0.0 +*@version version 2.0.0 date 150405 +*since version 1.0.0 date 150331 */ /** -*This class represents the middleware +*This class represents the middleware. */ public class Middleware { - + /** - *Instance variables. + *Instance variables used in subsequent methods. */ int ListSize; - int Size; - int size; int key1; int key2; int key3; - int n; - int input; int size; int array; - int param; - + int ID; + string Name; + string Major; + double GPA; + double TG; + + LinkedListMiddleware mw = new LinkedListMiddleware(); + MidArrayList mw1 = new MidArrayList(); + BinaryTreeMW mw2 = new BinaryTreeMW(); + HashClient mw3 = new HashClient(); + HashFinder mw4 = new HashFinder(); + StackCut mw5 = new StackCut(); + StudentStack studentStack = new StudentStack(10); /** *Constructor for LinkedListMiddleware. *@param ListSize Takes an integer and passes it to the LinkedListMiddleware instance. + *Calls the LinkedListMiddleware, selectSort, bubbleSort,linearSearch, and binarySearch methods. */ - LinkedListMiddleware mw = new LinkedListMiddleware(); + public void llMW(){ mw.LinkedListMiddleware(int ListSize); + } + public void selectSortLL(){ mw.selectSort(); + return int TaskTime + } + public void bubbleSortLL(){ mw.bubbleSort(); + return int TaskTime + } + public void linearSearchLL(){ mw.linearSearch(); + return int TaskTime + } + public String binarySearchLL(){ mw.binarySearch(); - + return int TaskTime +" "+ int TimesThrough + } /** *Constructor for MidArrayList. - *@param ListSize Takes an integer and passes it to the MidArrayList instance. - */ - MidArrayList mw1 = new MidArrayList(); + *@param Size Takes an integer and passes it to the MidArrayList instance. + *Calls the MidArrayList, bubbleSort, selectionSort, linearSearch, and binarySearch methods. + */ + public void alMW(){ mw1.MidArrayList(int Size); + } + public void bubbleSortAL(){ mw1.bubbleSort(); + return int TaskTime + } + public void selectionSortAL(){ mw1.selectionSort(); + return int TaskTime + } + public void linearSearchAL(){ mw1.linearSearch(); + return int TaskTime + } + public String binarySearchAL(){ mw1.binarySearch(); - + return int TaskTime +" "+ int TimesThrough + } + /** - *Constructor for Middleware1. - *@param ListSize Takes an integer and passes it to the Middleware1 instance. + *Constructor for BinaryTree. + *@param size Takes an integer and passes it to the BinaryTree instance. + *@param key1 Passes random string value to the BinaryTree instance. + *@param key2 Passes random string value to the BniaryTree instance. + *@param key3 Passes random string value to the BinaryTree instance. + *Calls the createBinaryTree, calculatePreorderNodesSearched, calculateInOrderNodesSearched, calculatePreorderSearchDuration, calculateInOrderSearchDuration, calculateBigORelationship, getDatabase, and setDatabase methods. */ - Middleware1 mw2 = new Middleware1(); - mw2.createBinaryTree(int size); - mw2.populateBinaryTree(); - mw2.calculatePreorderNodesSearched(int key1, int key2, int key3); - mw2.calculateInOrderNodesSearched(int key1, int key2, int key3); - mw2.calculatePreorderSearchDuration(int key1, int key2, int key3); - mw2.calculateInOrderSearchDuration(int key1, int key2, int key3); - mw2.calculateBigORelationship(BinaryTree binaryTree); - mw2.getDatabase(); - mw2.setDatabase(Database database); + public void BinaryTreeMW(){ + mw2.BinaryTreeMW(int size); + } + public String calculatePreorderNodesSearched() { + return mw2.calculatePreorderNodesSearched(int key1, int key2, int key3); + } + public String calculateInOrderNodesSearched() { + return mw2.calculateInOrderNodesSearched(int key1, int key2, int key3); + } + public String calculatePreorderSearchDuration() { + return mw2.calculatePreorderSearchDuration(int key1, int key2, int key3); + } + public String calculateInOrderSearchDuration() { + return mw2.calculateInOrderSearchDuration(int key1, int key2, int key3); + } + + public String calculateBigORelationship() { + return mw2.calculateBigORelationship(); + } + /** *Constructor for HashClient. - *@param ListSize Takes an integer and passes it to the HashClient instance. + *@param n Takes an integer and passes it to the HashClient instance. + *Calls the createHashTable, findHashTableValue, and BigONotation methods. */ - HashClient mw3 = new HashClient(); - mw3.createHashTable(int n); - mw3.findHashTableValue(); - mw3.bigONotation(); - + public void createHashTable(){ + mw3.createHashTable(int n); + } + public int findHashTableValue(int value){ + return mw3.findHashTableValue(int value); + } + public String bigONotation() { + return mw3.bigONotation(); + } /** *Constructor for HashFinder. - *@param ListSize Takes an integer and passes it to the HashClient instance. + *@param input Passes integer to the HashFinder instance. + *@param size Passes integer to the HashFinder instance. + *@param array Passes array to the HashFinder instance. + *@return the location of the value */ - HashFinder mw4 = new HashFinder(); - mw4.findHashValue(int input, int size, int array); + public int findHashValue(){ + return mw4.findHashValue(int input, int size, int array); + } /** *Constructor for StackCut. - *@param ListSize Takes an integer and passes it to the HashClient instance. + *@param param Passes a parameter to the StackCut instance. */ - StackCut mw5 = new StackCut(); - mw5.StackCut(int param); - mw5.push(Object param); - mw5.pop(Object param); - mw5.displayStacks(); - mw5.peek(); + public void StackCut() { + mw5.StackCut(int param); + } + public String displayStacks(){ + return mw5.displayStacks(); + } + public String peek(){ + return mw5.peek().toString(); + } /** - *Constructor for Student. - *@param ListSize Takes an integer and passes it to the HashClient instance. + *Method for creating a Student. + *@param ID + *@param Name + *@param Major + *@param GPA + *@param TG + *Creates a Student Object and pushes it to the stack. */ - Student mw6 = new Student(); - mw6.getID(); - mw6.getName(); - mw6.getMajor(); - mw6.getGPA(); - mw6.getTG(); + public void createStudent(int ID, string Name, string Major, double GPA, double TG) { + Student newStudent = new Student(ID, Name, Major, GPA, TG); + studentStack.push(newStudent); + } + /** + * This method cuts the list of students down to size + */ + public String[] cutStudents() { + studentStack.cut(5); + } + + /** + * This method will return an array of Who got Scholarships + */ + public String[] getScholarships() { + } +} /** *This class was created for Middleware. */ - -} diff --git a/production/ClassProject/Middleware/BinaryTreeMiddleWare.java b/production/ClassProject/Middleware/Middleware_1_B.java similarity index 97% rename from production/ClassProject/Middleware/BinaryTreeMiddleWare.java rename to production/ClassProject/Middleware/Middleware_1_B.java index 35addf9..e48ceef 100644 --- a/production/ClassProject/Middleware/BinaryTreeMiddleWare.java +++ b/production/ClassProject/Middleware/Middleware_1_B.java @@ -7,7 +7,7 @@ import edu.oakland.production.ClassProject.Middleware.*; //Import BinaryTree.java -import edu.oakland.production.ClassProject.BinaryTreeDB.*; +import edu.oakland.production.ClassProject.Database.*; /* @@ -17,7 +17,7 @@ * @version version 1.1 * @since version 1.0 */ -public class BinaryTreeMiddleware { +public class Middleware { /// Minimum possible key value, used with generating a random key. private int minimumKeyValue = 400000; @@ -29,16 +29,16 @@ public class BinaryTreeMiddleware { /// Maximum possible key value, used with generating a random name. private int maximumNameValue = 600000; - BinaryTreeDB database; + Database database; /* * Default constructor for the Middleware Class. * - * @param database BinaryTreeDB object. + * @param database Database object. * * @returns Middleware */ - public BinaryTreeMiddleware(BinaryTreeDB database){ + public Middleware(Database database){ //Link the database this.database = database @@ -409,18 +409,18 @@ private List createNonDuplicateRandomNumbers(int minimumValue, int maximumV /* * Retrieves the database object. * - * @returns database BinaryTreeDB object. + * @returns database Database object. */ - public BinaryTreeDB getBinaryTreeDB(){ + public Database getDatabase(){ return this.database; } /* * Modifies the database object stored in Middleware. * - * @param database BinaryTreeDB object corresponding to the new database. + * @param database Database object corresponding to the new database. */ - public void setBinaryTreeDB(BinaryTreeDB database){ + public void setDatabase(Database database){ this.database = database; } -} +} \ No newline at end of file diff --git a/production/ClassProject/Middleware/MockDisplay.java b/production/ClassProject/Middleware/MockDisplay.java new file mode 100644 index 0000000..c167935 --- /dev/null +++ b/production/ClassProject/Middleware/MockDisplay.java @@ -0,0 +1,35 @@ +package edu.oakland.production.ClassProject; + +/** +*@author Eldari Gogiashvili, Zack Waldrup +*@version version 1.0.1 date 150331 +*since version 1.0.0 +*/ + +/** +*This class represents the middleware +*/ + +public class MockDisplay { + + int ListSize = 10; + + /** + *Method for testing the LinkedListMiddleware class + */ + public void testLL(){ + /** + *Constructor for Middleware. + */ + LinkedListMiddleware mw = new LinkedListMiddleware(ListSize); + mw.selectSort(); + mw.linearSearch(100); + mw.binarySearch(100); + + LinkedListMiddleware mw1 = new LinkedListMiddleware(ListSize); + mw1.bubbleSort(); + mw1.linearSearch(100); + mw1.binarySearch(100); + + } +} \ No newline at end of file diff --git a/production/ClassProject/Middleware/Node.java b/production/ClassProject/Middleware/Node.java new file mode 100644 index 0000000..d47c86f --- /dev/null +++ b/production/ClassProject/Middleware/Node.java @@ -0,0 +1,19 @@ +package edu.oakland.production.ClassProject.middleware; + +public class Node{ + + public int tg; + public String name; + public double gpa; + public Node leftChild; + public Node rightChild; + + Node(String stringName, double doubleGpa, int intTg){ + this.name = stringName; + this.gpa = doubleGpa; + this.tg = intTg; + } + public String toString(){ + return name + " has a thesis grade of " + tg; + } +} \ No newline at end of file diff --git a/production/ClassProject/Middleware/README.md b/production/ClassProject/Middleware/README.md new file mode 100644 index 0000000..9ff6815 --- /dev/null +++ b/production/ClassProject/Middleware/README.md @@ -0,0 +1 @@ +# CSE231-ClassProject diff --git a/production/ClassProject/Middleware/StackCut.java b/production/ClassProject/Middleware/StackCut.java new file mode 100644 index 0000000..7d4c7a4 --- /dev/null +++ b/production/ClassProject/Middleware/StackCut.java @@ -0,0 +1,57 @@ +/* + * 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 edu.oakland.production.ClassProject.middleware; +import java.util.*; +/** + *@version 1.0 + * @author Sam + */ +public class StackCut extends Stack{ + private int stackSize; + private Object[] stackArray; + private int topOfStack = -1; + + + public StackCut(int param){ + this.stackSize = param; + stackArray = new Object[stackSize]; + } + + public Object push(Object param) { + if(topOfStack+1=0){ + stackArray[topOfStack]=null; + return stackArray[topOfStack--]; + } + else{ + return null; + } + } + + public void displayStacks(){ + for(int n=0; n= 0) + return stackArray[topOfStack]; + else + return null; + } + +} diff --git a/production/ClassProject/Middleware/Student.java b/production/ClassProject/Middleware/Student.java new file mode 100644 index 0000000..d03c464 --- /dev/null +++ b/production/ClassProject/Middleware/Student.java @@ -0,0 +1,35 @@ +package edu.oakland.production.ClassProject.middleware; +import java.util.*; +import edu.oakland.production.ClassProject.middleware.*; +//version 2.0 +public class Student{ + private int gID; + private String name; + private String major; + private double gpa; + private int tg; + + public Student(int gID, String name, String major, double gpa, int tg){ + this.gID = gID; + this.name = name; + this.major = major; + this.gpa = gpa ; + this.tg = tg; + } + public int getID(){ + return gID; + } + public String getName(){ + return name; + } + public String getMajor(){ + return major; + } + public double getGPA(){ + return gpa; + } + + public int getTG(){ + return tg; + } + } \ No newline at end of file diff --git a/test/ClassProject/Middleware/LLMiddlewareTest.java b/test/ClassProject/Middleware/LLMiddlewareTest.java new file mode 100644 index 0000000..5803d38 --- /dev/null +++ b/test/ClassProject/Middleware/LLMiddlewareTest.java @@ -0,0 +1,76 @@ +package edu.oakland.test.ClassProject; + +import java.util.*; +import junit.framework.*; +import edu.oakland.production.ClassProject.*; + +/** +*@author Zack Waldrup +*@version version 1.1 150403 +*@since version 1.0 150401 +*/ +public class LLMiddlewareTest extends TestCase { + + /** + *Instance variables needed for test classes + */ + int listSize = 10; + int searchInt = 200; + LinkedListMiddleware mw1; + + /** + *setUp method to ensure a new LinkedListMiddleware class on each test + */ + public void setUp() { + mw1 = new LinkedListMiddleware(listSize); + } + + /** + *This method tests whether the elements in the list are in order + */ + public void testSelectSort() { + boolean goodSort = true; + mw1.selectSort(); + for(int i = 1; i < listSize; i++){ + if(mw1.db.get(i) > mw1.db.get(i+1)) { + goodsort = false; + } + } + assertTrue(goodsort); + } + + /** + *This method tests whether the elements in the list are in order + */ + public void testBubbleSort() { + boolean goodSort = true; + mw1.bubbleSort(); + for(int i = 1; i < listSize; i++){ + if(mw1.db.get(i) > mw1.db.get(i+1)) { + goodsort = false; + } + } + assertTrue(goodsort); + } + + /** + *This method tests whether the linear search finds the given integer + */ + public void testLinearSearch() { + mw1.db.add(searchInt); + mw1.selectSort(); + mw1.linearSearch(searchInt); + assertTrue(valuePresent); + } + + /** + *This method tests whether the binary search finds the given integer + */ + public void testBinarySearch() { + mw1.db.add(searchInt); + mw1.selectSort(); + mw1.binarySearch(searchInt); + assertTrue(valuePresent); + } + +} \ No newline at end of file diff --git a/test/ClassProject/Middleware/StudentTest.java b/test/ClassProject/Middleware/StudentTest.java index f12c8ba..220a7d7 100644 --- a/test/ClassProject/Middleware/StudentTest.java +++ b/test/ClassProject/Middleware/StudentTest.java @@ -1,4 +1,4 @@ -package edu.oakland.test.ClassProject.Middleware; +package edu.oakland.production.ClassProject.middleware; import junit.framework.*; import edu.oakland.production.ClassProject.middleware.*; //version 2.2 @@ -157,7 +157,6 @@ public void testStack(){ System.out.println("The student with GID: "+unluckystudenttwo+" also did not receive the scholarship."); - Object sgid = stackcut.peek(); System.out.println(); System.out.println("The Student with GID: " + sgid + " received the Scholarship."); @@ -173,6 +172,33 @@ public void testStack(){ System.out.println("The Student with GID: " + sgid + " received the Scholarship."); assertEquals(sgid, 677422); stackcut.pop(); - } -} \ No newline at end of file + public void testTree(){ + BinaryTree tree = new BinaryTree(); + + System.out.println(); + tree.addNode(student1.getName(),student1.getGPA(),student1.getTG()); + tree.addNode(student2.getName(),student2.getGPA(),student2.getTG()); + tree.addNode(student3.getName(),student3.getGPA(),student3.getTG()); + tree.addNode(student4.getName(),student4.getGPA(),student4.getTG()); + tree.addNode(student5.getName(),student5.getGPA(),student5.getTG()); + tree.addNode(student6.getName(),student6.getGPA(),student6.getTG()); + tree.addNode(student7.getName(),student7.getGPA(),student7.getTG()); + tree.addNode(student8.getName(),student8.getGPA(),student8.getTG()); + tree.addNode(student9.getName(),student9.getGPA(),student9.getTG()); + tree.addNode(student10.getName(),student10.getGPA(),student10.getTG()); + + tree.preorderTraverseTree(tree.root); + System.out.println(); + System.out.println("Students with a tg of less than 90"); + System.out.println(tree.findNode(90)); + + System.out.println(); + + } +} + + + + +