MP5
This commit is contained in:
parent
a28a353b68
commit
6dff1ff71c
4
.gitignore
vendored
4
.gitignore
vendored
@ -119,3 +119,7 @@
|
|||||||
/Semester 2/Assignments/lab7_CalebFontenot/target/
|
/Semester 2/Assignments/lab7_CalebFontenot/target/
|
||||||
/Semester 2/Assignments/lab8_CalebFontenot/target/
|
/Semester 2/Assignments/lab8_CalebFontenot/target/
|
||||||
/Semester 2/Assignments/lab8_2_CalebFontenot/target/
|
/Semester 2/Assignments/lab8_2_CalebFontenot/target/
|
||||||
|
/Semester 2/Assignments/MP5_CalebFontenot/target/
|
||||||
|
/Semester 2/Assignments/JavaFX_CalebFontenot/target/
|
||||||
|
/Semester 2/Assignments/JavaFX_CalebFontenot/nbproject/private/
|
||||||
|
/Semester 2/Assignments/JavaFX_CalebFontenot/build/
|
||||||
|
@ -0,0 +1,75 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>JavaFX_CalebFontenot.java</title>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||||
|
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||||
|
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||||
|
.ST0 {color: #ffc66d}
|
||||||
|
.string {color: #6a8759}
|
||||||
|
.number {color: #6897bb}
|
||||||
|
.whitespace {color: #505050}
|
||||||
|
.ST1 {color: #9876aa; font-family: monospace; font-style: italic}
|
||||||
|
.comment {color: #808080}
|
||||||
|
.ST4 {color: #ffc66d; font-family: monospace; font-style: italic}
|
||||||
|
.ST2 {color: #808080; font-family: monospace; font-weight: bold}
|
||||||
|
.ST3 {color: #8a653b}
|
||||||
|
.literal {color: #cc7832}
|
||||||
|
.ST5 {font-family: monospace; font-style: italic}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/JavaFX_CalebFontenot/src/javafx_calebfontenot/JavaFX_CalebFontenot.java</td></tr></table>
|
||||||
|
<pre>
|
||||||
|
<span class="literal">package</span> javafx_calebfontenot;
|
||||||
|
<span class="literal">import</span> javafx.application.Application;
|
||||||
|
<span class="literal">import</span> javafx.event.ActionEvent;
|
||||||
|
<span class="literal">import</span> javafx.event.EventHandler;
|
||||||
|
<span class="literal">import</span> javafx.scene.Scene;
|
||||||
|
<span class="literal">import</span> javafx.scene.control.Button;
|
||||||
|
<span class="literal">import</span> javafx.scene.layout.StackPane;
|
||||||
|
<span class="literal">import</span> javafx.stage.Stage;
|
||||||
|
|
||||||
|
<span class="literal">public</span> <span class="literal">class</span> JavaFX_CalebFontenot <span class="literal">extends</span> Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<span class="literal">public</span> <span class="literal">void</span> <span class="ST0">start</span>(Stage primaryStage)
|
||||||
|
{
|
||||||
|
Button btn = <span class="literal">new</span> Button();
|
||||||
|
btn.setText(<span class="string">"</span><span class="string">Say 'Hello World'</span><span class="string">"</span>);
|
||||||
|
btn.setOnAction(<span class="literal">new</span> EventHandler<ActionEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<span class="literal">public</span> <span class="literal">void</span> <span class="ST0">handle</span>(ActionEvent event)
|
||||||
|
{
|
||||||
|
System.<span class="ST1">out</span>.println(<span class="string">"</span><span class="string">Hello World!</span><span class="string">"</span>);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
StackPane root = <span class="literal">new</span> StackPane();
|
||||||
|
root.getChildren().add(btn);
|
||||||
|
|
||||||
|
Scene scene = <span class="literal">new</span> Scene(root, <span class="number">3</span><span class="number">00</span>, <span class="number">2</span><span class="number">50</span>);
|
||||||
|
|
||||||
|
primaryStage.setTitle(<span class="string">"</span><span class="string">Hello World!</span><span class="string">"</span>);
|
||||||
|
primaryStage.setScene(scene);
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="comment">/**</span>
|
||||||
|
<span class="comment"> * </span><span class="ST2">@param</span> <span class="ST3">args</span> <span class="comment">the</span> <span class="comment">command</span> <span class="comment">line</span> <span class="comment">arguments</span>
|
||||||
|
<span class="comment">*/</span>
|
||||||
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST4">main</span>(String[] args)
|
||||||
|
{
|
||||||
|
<span class="ST5">launch</span>(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</pre></body>
|
||||||
|
</html>
|
@ -0,0 +1,67 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>ShowCircle.java</title>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||||
|
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||||
|
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||||
|
.ST2 {color: #ffc66d}
|
||||||
|
.number {color: #6897bb}
|
||||||
|
.comment {color: #808080}
|
||||||
|
.whitespace {color: #505050}
|
||||||
|
.ST3 {color: #9876aa; font-family: monospace; font-style: italic}
|
||||||
|
.ST4 {color: #ffc66d; font-family: monospace; font-style: italic}
|
||||||
|
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
|
||||||
|
.ST0 {color: #287bde}
|
||||||
|
.literal {color: #cc7832}
|
||||||
|
.ST5 {font-family: monospace; font-style: italic}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/JavaFX_CalebFontenot/src/javafx_calebfontenot/ShowCircle.java</td></tr></table>
|
||||||
|
<pre>
|
||||||
|
<span class="comment">/*</span>
|
||||||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
|
||||||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
|
||||||
|
<span class="comment"> */</span>
|
||||||
|
<span class="literal">package</span> javafx_calebfontenot;
|
||||||
|
|
||||||
|
<span class="literal">import</span> javafx.application.Application;
|
||||||
|
<span class="literal">import</span> javafx.scene.Scene;
|
||||||
|
<span class="literal">import</span> javafx.scene.layout.Pane;
|
||||||
|
<span class="literal">import</span> javafx.scene.paint.Color;
|
||||||
|
<span class="literal">import</span> javafx.scene.shape.Circle;
|
||||||
|
<span class="literal">import</span> javafx.stage.Stage;
|
||||||
|
|
||||||
|
<span class="comment">/**</span>
|
||||||
|
<span class="comment"> *</span>
|
||||||
|
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
|
||||||
|
<span class="comment">*/</span>
|
||||||
|
<span class="literal">public</span> <span class="literal">class</span> ShowCircle <span class="literal">extends</span> Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<span class="literal">public</span> <span class="literal">void</span> <span class="ST2">start</span>(Stage primaryStage)
|
||||||
|
{
|
||||||
|
Pane pane = <span class="literal">new</span> Pane(); <span class="comment">// Create a pane object</span>
|
||||||
|
Scene scene = <span class="literal">new</span> Scene(pane, <span class="number">3</span><span class="number">00</span>, <span class="number">2</span><span class="number">00</span>); <span class="comment">// Create a scene object</span>
|
||||||
|
primaryStage.setScene(scene); <span class="comment">// Set the stage scene to the scene object</span>
|
||||||
|
primaryStage.show(); <span class="comment">// Make the window display on the screen</span>
|
||||||
|
Circle c = <span class="literal">new</span> Circle(<span class="number">2</span><span class="number">0</span>); <span class="comment">// Create a circle object</span>
|
||||||
|
c.setCenterX(<span class="number">1</span><span class="number">50</span>); <span class="comment">// Set the center X for the circle object to '150'</span>
|
||||||
|
c.setCenterY(<span class="number">8</span><span class="number">0</span>); <span class="comment">// Set the center Y for the circle object to '80'</span>
|
||||||
|
c.setStroke(Color.<span class="ST3">BLUE</span>); <span class="comment">// Set the circle outline to Blue</span>
|
||||||
|
c.setFill(Color.<span class="ST3">RED</span>); <span class="comment">// Set the interior of the circle to Red</span>
|
||||||
|
pane.getChildren().add(c); <span class="comment">// Add the circle object to the pane</span>
|
||||||
|
}
|
||||||
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST4">main</span>(String[] args)
|
||||||
|
{
|
||||||
|
<span class="ST5">launch</span>(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</pre></body>
|
||||||
|
</html>
|
@ -0,0 +1,76 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>ShowCircleCentered.java</title>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||||
|
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||||
|
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||||
|
.ST2 {color: #ffc66d}
|
||||||
|
.number {color: #6897bb}
|
||||||
|
.string {color: #6a8759}
|
||||||
|
.comment {color: #808080}
|
||||||
|
.whitespace {color: #505050}
|
||||||
|
.ST3 {color: #9876aa; font-family: monospace; font-style: italic}
|
||||||
|
.ST4 {color: #ffc66d; font-family: monospace; font-style: italic}
|
||||||
|
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
|
||||||
|
.ST0 {color: #287bde}
|
||||||
|
.literal {color: #cc7832}
|
||||||
|
.ST5 {font-family: monospace; font-style: italic}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/JavaFX_CalebFontenot/src/javafx_calebfontenot/ShowCircleCentered.java</td></tr></table>
|
||||||
|
<pre>
|
||||||
|
<span class="comment">/*</span>
|
||||||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
|
||||||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
|
||||||
|
<span class="comment"> */</span>
|
||||||
|
<span class="literal">package</span> javafx_calebfontenot;
|
||||||
|
|
||||||
|
<span class="literal">import</span> javafx.application.Application;
|
||||||
|
<span class="literal">import</span> javafx.scene.Scene;
|
||||||
|
<span class="literal">import</span> javafx.scene.layout.Pane;
|
||||||
|
<span class="literal">import</span> javafx.scene.paint.Color;
|
||||||
|
<span class="literal">import</span> javafx.scene.shape.Circle;
|
||||||
|
<span class="literal">import</span> javafx.stage.Stage;
|
||||||
|
|
||||||
|
<span class="comment">/**</span>
|
||||||
|
<span class="comment"> *</span>
|
||||||
|
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
|
||||||
|
<span class="comment">*/</span>
|
||||||
|
<span class="literal">public</span> <span class="literal">class</span> ShowCircleCentered <span class="literal">extends</span> Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<span class="literal">public</span> <span class="literal">void</span> <span class="ST2">start</span>(Stage primaryStage)
|
||||||
|
{
|
||||||
|
<span class="comment">// Create a pane to hold the Circle</span>
|
||||||
|
Pane pane = <span class="literal">new</span> Pane();
|
||||||
|
|
||||||
|
<span class="comment">// Create a circle and set its properties</span>
|
||||||
|
Circle circle = <span class="literal">new</span> Circle();
|
||||||
|
circle.centerXProperty().bind(pane.widthProperty().divide(<span class="number">2</span>));
|
||||||
|
circle.centerYProperty().bind(pane.heightProperty().divide(<span class="number">2</span>));
|
||||||
|
circle.setRadius(<span class="number">5</span><span class="number">0</span>);
|
||||||
|
circle.setStroke(Color.<span class="ST3">BLACK</span>);
|
||||||
|
circle.setFill(Color.<span class="ST3">WHITE</span>);
|
||||||
|
pane.getChildren().add(circle); <span class="comment">// Add the circle to the pane</span>
|
||||||
|
|
||||||
|
<span class="comment">// Create a scene and place it in the stage</span>
|
||||||
|
Scene scene = <span class="literal">new</span> Scene(pane, <span class="number">2</span><span class="number">00</span>, <span class="number">2</span><span class="number">00</span>);
|
||||||
|
primaryStage.setTitle(<span class="string">"</span><span class="string">ShowCircleCentered</span><span class="string">"</span>); <span class="comment">// Set the stage title</span>
|
||||||
|
primaryStage.setScene(scene); <span class="comment">// Place the scene in the stage</span>
|
||||||
|
primaryStage.show(); <span class="comment">// Display the stage</span>
|
||||||
|
}
|
||||||
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST4">main</span>(String[] args)
|
||||||
|
{
|
||||||
|
<span class="ST5">launch</span>(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</pre></body>
|
||||||
|
</html>
|
@ -0,0 +1,69 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>ShowRectangle.java</title>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
<style type="text/css">
|
||||||
|
<!--
|
||||||
|
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||||
|
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace}
|
||||||
|
table {color: #888888; background-color: #313335; font-family: monospace}
|
||||||
|
.ST2 {color: #ffc66d}
|
||||||
|
.number {color: #6897bb}
|
||||||
|
.comment {color: #808080}
|
||||||
|
.whitespace {color: #505050}
|
||||||
|
.ST3 {color: #9876aa; font-family: monospace; font-style: italic}
|
||||||
|
.ST4 {color: #ffc66d; font-family: monospace; font-style: italic}
|
||||||
|
.ST1 {color: #808080; font-family: monospace; font-weight: bold}
|
||||||
|
.ST0 {color: #287bde}
|
||||||
|
.literal {color: #cc7832}
|
||||||
|
.ST5 {font-family: monospace; font-style: italic}
|
||||||
|
-->
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/JavaFX_CalebFontenot/src/javafx_calebfontenot/ShowRectangle.java</td></tr></table>
|
||||||
|
<pre>
|
||||||
|
<span class="comment">/*</span>
|
||||||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt</span><span class="comment"> to change this license</span>
|
||||||
|
<span class="comment"> * Click </span><span class="ST0">nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java</span><span class="comment"> to edit this template</span>
|
||||||
|
<span class="comment"> */</span>
|
||||||
|
<span class="literal">package</span> javafx_calebfontenot;
|
||||||
|
|
||||||
|
<span class="literal">import</span> javafx.application.Application;
|
||||||
|
<span class="literal">import</span> <span class="literal">static</span> javafx.application.Application.launch;
|
||||||
|
<span class="literal">import</span> javafx.scene.Scene;
|
||||||
|
<span class="literal">import</span> javafx.scene.layout.Pane;
|
||||||
|
<span class="literal">import</span> javafx.scene.paint.Color;
|
||||||
|
<span class="literal">import</span> javafx.scene.shape.Rectangle;
|
||||||
|
<span class="literal">import</span> javafx.stage.Stage;
|
||||||
|
|
||||||
|
<span class="comment">/**</span>
|
||||||
|
<span class="comment"> *</span>
|
||||||
|
<span class="comment"> * </span><span class="ST1">@author</span> <span class="comment">caleb</span>
|
||||||
|
<span class="comment">*/</span>
|
||||||
|
<span class="literal">public</span> <span class="literal">class</span> ShowRectangle <span class="literal">extends</span> Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
<span class="literal">public</span> <span class="literal">void</span> <span class="ST2">start</span>(Stage primaryStage)
|
||||||
|
{
|
||||||
|
Pane pane = <span class="literal">new</span> Pane(); <span class="comment">// Create a pane object</span>
|
||||||
|
Scene scene = <span class="literal">new</span> Scene(pane, <span class="number">3</span><span class="number">00</span>, <span class="number">2</span><span class="number">00</span>); <span class="comment">// Create a scene object</span>
|
||||||
|
primaryStage.setScene(scene); <span class="comment">// Set the stage scene to the scene object</span>
|
||||||
|
primaryStage.show(); <span class="comment">// Make the window display on the screen</span>
|
||||||
|
Rectangle r = <span class="literal">new</span> Rectangle(<span class="number">3</span><span class="number">0</span>, <span class="number">3</span><span class="number">0</span>, <span class="number">8</span><span class="number">8</span>, <span class="number">4</span><span class="number">4</span>);
|
||||||
|
r.setX(<span class="number">3</span><span class="number">0</span>);
|
||||||
|
r.setY(<span class="number">3</span><span class="number">0</span>);
|
||||||
|
r.setStroke(Color.<span class="ST3">BLUE</span>); <span class="comment">// Set the rectangle outline to Blue</span>
|
||||||
|
r.setFill(Color.<span class="ST3">RED</span>); <span class="comment">// Set the interior of the rectangle to Red</span>
|
||||||
|
pane.getChildren().add(r); <span class="comment">// Add the circle object to the pane</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> <span class="ST4">main</span>(String[] args)
|
||||||
|
{
|
||||||
|
<span class="ST5">launch</span>(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</pre></body>
|
||||||
|
</html>
|
53
Semester 2/Assignments/JavaFX_CalebFontenot/build.xml
Normal file
53
Semester 2/Assignments/JavaFX_CalebFontenot/build.xml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See commented blocks below for --><!-- some examples of how to customize the build. --><!-- (If you delete it and reopen the project it will be recreated.) --><!-- By default, only the Clean and Build commands use this build script. --><project name="JavaFX_CalebFontenot" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
|
||||||
|
<description>Builds, tests, and runs the project JavaFX_CalebFontenot.</description>
|
||||||
|
<import file="nbproject/build-impl.xml"/>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
There exist several targets which are by default empty and which can be
|
||||||
|
used for execution of your tasks. These targets are usually executed
|
||||||
|
before and after some main targets. Those of them relevant for JavaFX project are:
|
||||||
|
|
||||||
|
-pre-init: called before initialization of project properties
|
||||||
|
-post-init: called after initialization of project properties
|
||||||
|
-pre-compile: called before javac compilation
|
||||||
|
-post-compile: called after javac compilation
|
||||||
|
-pre-compile-test: called before javac compilation of JUnit tests
|
||||||
|
-post-compile-test: called after javac compilation of JUnit tests
|
||||||
|
-pre-jfx-jar: called before FX SDK specific <fx:jar> task
|
||||||
|
-post-jfx-jar: called after FX SDK specific <fx:jar> task
|
||||||
|
-pre-jfx-deploy: called before FX SDK specific <fx:deploy> task
|
||||||
|
-post-jfx-deploy: called after FX SDK specific <fx:deploy> task
|
||||||
|
-pre-jfx-native: called just after -pre-jfx-deploy if <fx:deploy> runs in native packaging mode
|
||||||
|
-post-jfx-native: called just after -post-jfx-deploy if <fx:deploy> runs in native packaging mode
|
||||||
|
-post-clean: called after cleaning build products
|
||||||
|
|
||||||
|
(Targets beginning with '-' are not intended to be called on their own.)
|
||||||
|
|
||||||
|
Example of inserting a HTML postprocessor after javaFX SDK deployment:
|
||||||
|
|
||||||
|
<target name="-post-jfx-deploy">
|
||||||
|
<basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/>
|
||||||
|
<property name="jfx.deployment.html" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.html"/>
|
||||||
|
<custompostprocess>
|
||||||
|
<fileset dir="${jfx.deployment.html}"/>
|
||||||
|
</custompostprocess>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
Example of calling an Ant task from JavaFX SDK. Note that access to JavaFX SDK Ant tasks must be
|
||||||
|
initialized; to ensure this is done add the dependence on -check-jfx-sdk-version target:
|
||||||
|
|
||||||
|
<target name="-post-jfx-jar" depends="-check-jfx-sdk-version">
|
||||||
|
<echo message="Calling jar task from JavaFX SDK"/>
|
||||||
|
<fx:jar ...>
|
||||||
|
...
|
||||||
|
</fx:jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
For more details about JavaFX SDK Ant tasks go to
|
||||||
|
http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm
|
||||||
|
|
||||||
|
For list of available properties check the files
|
||||||
|
nbproject/build-impl.xml and nbproject/jfx-impl.xml.
|
||||||
|
|
||||||
|
-->
|
||||||
|
</project>
|
BIN
Semester 2/Assignments/JavaFX_CalebFontenot/lab16-1.pdf
Normal file
BIN
Semester 2/Assignments/JavaFX_CalebFontenot/lab16-1.pdf
Normal file
Binary file not shown.
3
Semester 2/Assignments/JavaFX_CalebFontenot/manifest.mf
Normal file
3
Semester 2/Assignments/JavaFX_CalebFontenot/manifest.mf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
X-COMMENT: Main-Class will be added automatically by build
|
||||||
|
|
1800
Semester 2/Assignments/JavaFX_CalebFontenot/nbproject/build-impl.xml
Normal file
1800
Semester 2/Assignments/JavaFX_CalebFontenot/nbproject/build-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,2 @@
|
|||||||
|
# Do not modify this property in this configuration. It can be re-generated.
|
||||||
|
$label=Run as WebStart
|
@ -0,0 +1,2 @@
|
|||||||
|
# Do not modify this property in this configuration. It can be re-generated.
|
||||||
|
$label=Run in Browser
|
@ -0,0 +1,8 @@
|
|||||||
|
build.xml.data.CRC32=ebd628e2
|
||||||
|
build.xml.script.CRC32=94f41b4f
|
||||||
|
build.xml.stylesheet.CRC32=f85dc8f2@1.105.0.48
|
||||||
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
|
nbproject/build-impl.xml.data.CRC32=ebd628e2
|
||||||
|
nbproject/build-impl.xml.script.CRC32=58460c11
|
||||||
|
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.105.0.48
|
4197
Semester 2/Assignments/JavaFX_CalebFontenot/nbproject/jfx-impl.xml
Normal file
4197
Semester 2/Assignments/JavaFX_CalebFontenot/nbproject/jfx-impl.xml
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,120 @@
|
|||||||
|
annotation.processing.enabled=true
|
||||||
|
annotation.processing.enabled.in.editor=false
|
||||||
|
annotation.processing.processor.options=
|
||||||
|
annotation.processing.processors.list=
|
||||||
|
annotation.processing.run.all.processors=true
|
||||||
|
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||||
|
application.title=JavaFX_CalebFontenot
|
||||||
|
application.vendor=caleb
|
||||||
|
build.classes.dir=${build.dir}/classes
|
||||||
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
|
# This directory is removed when the project is cleaned:
|
||||||
|
build.dir=build
|
||||||
|
build.generated.dir=${build.dir}/generated
|
||||||
|
build.generated.sources.dir=${build.dir}/generated-sources
|
||||||
|
# Only compile against the classpath explicitly listed here:
|
||||||
|
build.sysclasspath=ignore
|
||||||
|
build.test.classes.dir=${build.dir}/test/classes
|
||||||
|
build.test.results.dir=${build.dir}/test/results
|
||||||
|
compile.on.save=true
|
||||||
|
compile.on.save.unsupported.javafx=true
|
||||||
|
# Uncomment to specify the preferred debugger connection transport:
|
||||||
|
#debug.transport=dt_socket
|
||||||
|
debug.classpath=\
|
||||||
|
${run.classpath}
|
||||||
|
debug.modulepath=\
|
||||||
|
${run.modulepath}
|
||||||
|
debug.test.classpath=\
|
||||||
|
${run.test.classpath}
|
||||||
|
debug.test.modulepath=\
|
||||||
|
${run.test.modulepath}
|
||||||
|
# This directory is removed when the project is cleaned:
|
||||||
|
dist.dir=dist
|
||||||
|
dist.jar=${dist.dir}/JavaFX_CalebFontenot.jar
|
||||||
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
|
endorsed.classpath=
|
||||||
|
excludes=
|
||||||
|
includes=**
|
||||||
|
# Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects
|
||||||
|
jar.archive.disabled=true
|
||||||
|
jar.compress=false
|
||||||
|
javac.classpath=
|
||||||
|
# Space-separated list of extra javac options
|
||||||
|
javac.compilerargs=
|
||||||
|
javac.deprecation=false
|
||||||
|
javac.modulepath=
|
||||||
|
javac.processormodulepath=
|
||||||
|
javac.processorpath=\
|
||||||
|
${javac.classpath}
|
||||||
|
javac.source=1.8
|
||||||
|
javac.target=1.8
|
||||||
|
javac.test.classpath=\
|
||||||
|
${javac.classpath}:\
|
||||||
|
${build.classes.dir}
|
||||||
|
javac.test.modulepath=\
|
||||||
|
${javac.modulepath}
|
||||||
|
javac.test.processorpath=\
|
||||||
|
${javac.test.classpath}
|
||||||
|
javadoc.additionalparam=
|
||||||
|
javadoc.author=false
|
||||||
|
javadoc.encoding=${source.encoding}
|
||||||
|
javadoc.noindex=false
|
||||||
|
javadoc.nonavbar=false
|
||||||
|
javadoc.notree=false
|
||||||
|
javadoc.private=false
|
||||||
|
javadoc.splitindex=true
|
||||||
|
javadoc.use=true
|
||||||
|
javadoc.version=false
|
||||||
|
javadoc.windowtitle=
|
||||||
|
javafx.application.implementation.version=1.0
|
||||||
|
javafx.binarycss=false
|
||||||
|
javafx.deploy.allowoffline=true
|
||||||
|
# If true, application update mode is set to 'background', if false, update mode is set to 'eager'
|
||||||
|
javafx.deploy.backgroundupdate=false
|
||||||
|
javafx.deploy.embedJNLP=true
|
||||||
|
javafx.deploy.includeDT=true
|
||||||
|
# Set true to prevent creation of temporary copy of deployment artifacts before each run (disables concurrent runs)
|
||||||
|
javafx.disable.concurrent.runs=false
|
||||||
|
# Set true to enable multiple concurrent runs of the same WebStart or Run-in-Browser project
|
||||||
|
javafx.enable.concurrent.external.runs=false
|
||||||
|
# This is a JavaFX project
|
||||||
|
javafx.enabled=true
|
||||||
|
javafx.fallback.class=com.javafx.main.NoJavaFXFallback
|
||||||
|
# Main class for JavaFX
|
||||||
|
javafx.main.class=javafx_calebfontenot.JavaFX_CalebFontenot
|
||||||
|
javafx.preloader.class=
|
||||||
|
# This project does not use Preloader
|
||||||
|
javafx.preloader.enabled=false
|
||||||
|
javafx.preloader.jar.filename=
|
||||||
|
javafx.preloader.jar.path=
|
||||||
|
javafx.preloader.project.path=
|
||||||
|
javafx.preloader.type=none
|
||||||
|
# Set true for GlassFish only. Rebases manifest classpaths of JARs in lib dir. Not usable with signed JARs.
|
||||||
|
javafx.rebase.libs=false
|
||||||
|
javafx.run.height=600
|
||||||
|
javafx.run.width=800
|
||||||
|
# Pre-JavaFX 2.0 WebStart is deactivated in JavaFX 2.0+ projects
|
||||||
|
jnlp.enabled=false
|
||||||
|
# Main class for Java launcher
|
||||||
|
main.class=com.javafx.main.Main
|
||||||
|
# For improved security specify narrower Codebase manifest attribute to prevent RIAs from being repurposed
|
||||||
|
manifest.custom.codebase=*
|
||||||
|
# Specify Permissions manifest attribute to override default (choices: sandbox, all-permissions)
|
||||||
|
manifest.custom.permissions=
|
||||||
|
manifest.file=manifest.mf
|
||||||
|
meta.inf.dir=${src.dir}/META-INF
|
||||||
|
platform.active=JDK_1.8
|
||||||
|
run.classpath=\
|
||||||
|
${dist.jar}:\
|
||||||
|
${javac.classpath}:\
|
||||||
|
${build.classes.dir}
|
||||||
|
run.modulepath=\
|
||||||
|
${javac.modulepath}
|
||||||
|
run.test.classpath=\
|
||||||
|
${javac.test.classpath}:\
|
||||||
|
${build.test.classes.dir}
|
||||||
|
run.test.modulepath=\
|
||||||
|
${javac.test.modulepath}
|
||||||
|
source.encoding=UTF-8
|
||||||
|
src.dir=src
|
||||||
|
test.src.dir=test
|
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||||
|
<type>org.netbeans.modules.java.j2seproject</type>
|
||||||
|
<configuration>
|
||||||
|
<buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1">
|
||||||
|
<extension file="jfx-impl.xml" id="jfx3">
|
||||||
|
<dependency dependsOn="-jfx-copylibs" target="-post-jar"/>
|
||||||
|
<dependency dependsOn="-rebase-libs" target="-post-jar"/>
|
||||||
|
<dependency dependsOn="jfx-deployment" target="-post-jar"/>
|
||||||
|
<dependency dependsOn="jar" target="debug"/>
|
||||||
|
<dependency dependsOn="jar" target="profile"/>
|
||||||
|
<dependency dependsOn="jar" target="run"/>
|
||||||
|
</extension>
|
||||||
|
</buildExtensions>
|
||||||
|
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||||
|
<name>JavaFX_CalebFontenot</name>
|
||||||
|
<explicit-platform explicit-source-supported="true"/>
|
||||||
|
<source-roots>
|
||||||
|
<root id="src.dir"/>
|
||||||
|
</source-roots>
|
||||||
|
<test-roots>
|
||||||
|
<root id="test.src.dir"/>
|
||||||
|
</test-roots>
|
||||||
|
</data>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
@ -0,0 +1,45 @@
|
|||||||
|
package javafx_calebfontenot;
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.layout.StackPane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class JavaFX_CalebFontenot extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage)
|
||||||
|
{
|
||||||
|
Button btn = new Button();
|
||||||
|
btn.setText("Say 'Hello World'");
|
||||||
|
btn.setOnAction(new EventHandler<ActionEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(ActionEvent event)
|
||||||
|
{
|
||||||
|
System.out.println("Hello World!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
StackPane root = new StackPane();
|
||||||
|
root.getChildren().add(btn);
|
||||||
|
|
||||||
|
Scene scene = new Scene(root, 300, 250);
|
||||||
|
|
||||||
|
primaryStage.setTitle("Hello World!");
|
||||||
|
primaryStage.setScene(scene);
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param args the command line arguments
|
||||||
|
*/
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package javafx_calebfontenot;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.shape.Circle;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
public class ShowCircle extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage)
|
||||||
|
{
|
||||||
|
Pane pane = new Pane(); // Create a pane object
|
||||||
|
Scene scene = new Scene(pane, 300, 200); // Create a scene object
|
||||||
|
primaryStage.setScene(scene); // Set the stage scene to the scene object
|
||||||
|
primaryStage.show(); // Make the window display on the screen
|
||||||
|
Circle c = new Circle(20); // Create a circle object
|
||||||
|
c.setCenterX(150); // Set the center X for the circle object to '150'
|
||||||
|
c.setCenterY(80); // Set the center Y for the circle object to '80'
|
||||||
|
c.setStroke(Color.BLUE); // Set the circle outline to Blue
|
||||||
|
c.setFill(Color.RED); // Set the interior of the circle to Red
|
||||||
|
pane.getChildren().add(c); // Add the circle object to the pane
|
||||||
|
}
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package javafx_calebfontenot;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.shape.Circle;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
public class ShowCircleCentered extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage)
|
||||||
|
{
|
||||||
|
// Create a pane to hold the Circle
|
||||||
|
Pane pane = new Pane();
|
||||||
|
|
||||||
|
// Create a circle and set its properties
|
||||||
|
Circle circle = new Circle();
|
||||||
|
circle.centerXProperty().bind(pane.widthProperty().divide(2));
|
||||||
|
circle.centerYProperty().bind(pane.heightProperty().divide(2));
|
||||||
|
circle.setRadius(50);
|
||||||
|
circle.setStroke(Color.BLACK);
|
||||||
|
circle.setFill(Color.WHITE);
|
||||||
|
pane.getChildren().add(circle); // Add the circle to the pane
|
||||||
|
|
||||||
|
// Create a scene and place it in the stage
|
||||||
|
Scene scene = new Scene(pane, 200, 200);
|
||||||
|
primaryStage.setTitle("ShowCircleCentered"); // Set the stage title
|
||||||
|
primaryStage.setScene(scene); // Place the scene in the stage
|
||||||
|
primaryStage.show(); // Display the stage
|
||||||
|
}
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package javafx_calebfontenot;
|
||||||
|
|
||||||
|
import javafx.application.Application;
|
||||||
|
import static javafx.application.Application.launch;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.shape.Rectangle;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
public class ShowRectangle extends Application {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage)
|
||||||
|
{
|
||||||
|
Pane pane = new Pane(); // Create a pane object
|
||||||
|
Scene scene = new Scene(pane, 300, 200); // Create a scene object
|
||||||
|
primaryStage.setScene(scene); // Set the stage scene to the scene object
|
||||||
|
primaryStage.show(); // Make the window display on the screen
|
||||||
|
Rectangle r = new Rectangle(30, 30, 88, 44);
|
||||||
|
r.setX(30);
|
||||||
|
r.setY(30);
|
||||||
|
r.setStroke(Color.BLUE); // Set the rectangle outline to Blue
|
||||||
|
r.setFill(Color.RED); // Set the interior of the rectangle to Red
|
||||||
|
pane.getChildren().add(r); // Add the circle object to the pane
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
}
|
14
Semester 2/Assignments/MP5_CalebFontenot/pom.xml
Normal file
14
Semester 2/Assignments/MP5_CalebFontenot/pom.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.calebfontenot</groupId>
|
||||||
|
<artifactId>MP5_CalebFontenot</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<exec.mainClass>com.calebfontenot.mp5_calebfontenot.MP5_CalebFontenot</exec.mainClass>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -0,0 +1,97 @@
|
|||||||
|
package com.calebfontenot.mp5_calebfontenot;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ASDV2
|
||||||
|
*/
|
||||||
|
public class FD
|
||||||
|
{
|
||||||
|
|
||||||
|
private String lhs;
|
||||||
|
|
||||||
|
private String rhs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param lhs the LHS of the FD
|
||||||
|
* @param rhs the RHS of the FD
|
||||||
|
* @throws IllegalArgumentException if the length of the LHS or the length
|
||||||
|
* of the RHS are less than 1 or if they are null.
|
||||||
|
*/
|
||||||
|
public FD(String lhs, String rhs)
|
||||||
|
throws IllegalArgumentException
|
||||||
|
{
|
||||||
|
if (lhs == null || rhs == null )
|
||||||
|
throw new IllegalArgumentException( "the LHS and/or RHS cannot be null.");
|
||||||
|
|
||||||
|
if (lhs.length() < 1 || rhs.length() < 1 )
|
||||||
|
throw new IllegalArgumentException( "the LHS and/or RHS cannot be of lenght less than 1.");
|
||||||
|
|
||||||
|
this.lhs = lhs;
|
||||||
|
this.rhs = rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value of rhs
|
||||||
|
*
|
||||||
|
* @return the value of rhs
|
||||||
|
*/
|
||||||
|
public String getRhs()
|
||||||
|
{
|
||||||
|
return rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of rhs
|
||||||
|
*
|
||||||
|
* @param rhs new value of rhs
|
||||||
|
*/
|
||||||
|
public void setRhs(String rhs)
|
||||||
|
{
|
||||||
|
this.rhs = rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value of lhs
|
||||||
|
*
|
||||||
|
* @return the value of lhs
|
||||||
|
*/
|
||||||
|
public String getLhs()
|
||||||
|
{
|
||||||
|
return lhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of lhs
|
||||||
|
*
|
||||||
|
* @param lhs new value of lhs
|
||||||
|
*/
|
||||||
|
public void setLhs(String lhs)
|
||||||
|
{
|
||||||
|
this.lhs = lhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return lhs + " -> " + rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decomposes the RHS of the FD into singletons. where the LHS is the same
|
||||||
|
* as this FD and the RHS is 1 character of each character of the FD.
|
||||||
|
*
|
||||||
|
* @return array of FD he
|
||||||
|
*/
|
||||||
|
public FD[] decomposeRightHandSide()
|
||||||
|
{
|
||||||
|
FD[] fdDecomosition = new FD[this.rhs.length()];
|
||||||
|
|
||||||
|
for (int i = 0; i < this.rhs.length(); ++i)
|
||||||
|
{
|
||||||
|
fdDecomosition[i] = new FD(this.lhs, Character.toString(rhs.charAt(i)));
|
||||||
|
}
|
||||||
|
return fdDecomosition;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.calebfontenot.mp5_calebfontenot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
public class MP5_CalebFontenot {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||||
|
*/
|
||||||
|
package com.calebfontenot.mp5_calebfontenot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author caleb
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author ASDV2
|
||||||
|
*/
|
||||||
|
public class NormalizeDatabase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the closure of a set of attributes given a set of FDs of a relation R
|
||||||
|
*
|
||||||
|
* @param attributes attributes to find their closure
|
||||||
|
* @param fds set of FDs of relation R
|
||||||
|
* @return the closure of the parameter attributes.
|
||||||
|
*/
|
||||||
|
public static String closure(String attributes, ArrayList<FD> fds)
|
||||||
|
{
|
||||||
|
attributes = attributes.toUpperCase();
|
||||||
|
String closurePrevious = attributes;
|
||||||
|
String closure = attributes;
|
||||||
|
for (int i = 0; i < fds.size(); ++i) {
|
||||||
|
|
||||||
|
if (closure.contains(fds.get(i).getRhs())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
FD capitalFD = new FD(fds.get(i).getLhs().toUpperCase(),
|
||||||
|
fds.get(i).getRhs().toUpperCase());
|
||||||
|
}
|
||||||
|
//1. Set x+ = x
|
||||||
|
//2. Starting with x+ apply each FD xF —> y in F where
|
||||||
|
//xF belongs in closure x+, but whre the rhs y is not already in the closure x+
|
||||||
|
//to find the determined attribute
|
||||||
|
//3. x+ = x+ U y
|
||||||
|
while (true) {
|
||||||
|
for (int i = 0; i < fds.size(); ++i) {
|
||||||
|
//the LHS of the FD is contained in the closure
|
||||||
|
//then add to the closure the RHS of the FD
|
||||||
|
if (attributes.contains(fds.get(i).getLhs())) {
|
||||||
|
attributes += fds.get(i).getRhs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (closurePrevious.equals(closure)) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
closurePrevious = closure;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//4, If y not empty go to (2)
|
||||||
|
//5. Return x+
|
||||||
|
|
||||||
|
return closure;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Eliminates redundant attributes from the LHS of each FD of a set of FDs given as parameters.
|
||||||
|
*
|
||||||
|
* @param fds the set of FDs to eliminate the redundancy
|
||||||
|
* @return and ArrayList with no redundancy on LHS of each FD.
|
||||||
|
*/
|
||||||
|
public static ArrayList<FD> eliminateRedundantAttributes(ArrayList<FD> fds)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
ArrayList<FD> fds = new ArrayList<FD>();
|
||||||
|
FD fd = new FD("a", "bc");
|
||||||
|
FD[] fdDecomposed = fd.decomposeRightHandSide();
|
||||||
|
for (int i = 0; i < fdDecomposed.length; ++i) {
|
||||||
|
fds.add(new FD(fdDecomposed[i].getLhs(), fdDecomposed[i].getRhs()));
|
||||||
|
}
|
||||||
|
fds.add(new FD("a", "bc"));
|
||||||
|
fds.add(new FD("b", "c"));
|
||||||
|
fds.add(new FD("AB", "B"));
|
||||||
|
System.out.println(fds);
|
||||||
|
System.out.println(closure("ac", fds));
|
||||||
|
|
||||||
|
/* TEST it with
|
||||||
|
Let F1 = {1. A -> BC
|
||||||
|
2. B -> C,
|
||||||
|
3. AB -> D }.
|
||||||
|
Attribute B is extraneous in FD 3 AB -> D
|
||||||
|
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
F2 = { 1. AB -> C,
|
||||||
|
2. C -> A,
|
||||||
|
3. BC -> D,
|
||||||
|
4. ACD -> B,
|
||||||
|
5. D -> E,
|
||||||
|
6. D -> G,
|
||||||
|
7. BE -> C,
|
||||||
|
8. CG -> B,
|
||||||
|
9. CG -> D,
|
||||||
|
10. CE -> A,
|
||||||
|
11. CE -> G}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
BIN
Semester 2/ZIPs/JavaFX_CalebFontenot.zip
Normal file
BIN
Semester 2/ZIPs/JavaFX_CalebFontenot.zip
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user