vault backup: 2024-01-21 00:27:23
This commit is contained in:
27
.obsidian/workspace.json
vendored
27
.obsidian/workspace.json
vendored
@@ -175,27 +175,29 @@
|
|||||||
"switcher:Open quick switcher": false
|
"switcher:Open quick switcher": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"active": "671043c113c40804",
|
"active": "13f4c5e19c9ab3c8",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
|
"Semester 2/Programming 2/Week 1/java-apps/HelloWorld/HelloWorldApp.class",
|
||||||
|
"Semester 2/Programming 2/Week 1/java-apps/HelloWorld/start.sh",
|
||||||
|
"Semester 2/Programming 2/Week 1/java-apps/HelloWorld/HelloWorldApp.java",
|
||||||
|
"Semester 2/Programming 2/Week 1/java-apps/HelloWorld",
|
||||||
|
"Semester 2/Programming 2/Week 1/java-apps",
|
||||||
|
"Semester 2/Programming 2/Week 1/zoo-io-v3/ZooApp.java#",
|
||||||
|
"Semester 2/Programming 2/Week 1/zoo-io-v3/__SHELL31.class",
|
||||||
|
"Semester 2/Programming 2/Week 1/zoo-io-v3/__SHELL31$1.class",
|
||||||
|
"Semester 2/Programming 2/Week 1/zoo-io-v3/__SHELL31.java",
|
||||||
|
"Semester 2/Programming 2/Week 1/zoo-io-v3/__SHELL30.class",
|
||||||
|
"Semester 2/Programming 2/Week 1/zoo-io-v3/__SHELL30$1.class",
|
||||||
|
"Semester 2/Computer Systems Internals & Linux/Week 1/workshop/testdir/test.md",
|
||||||
|
"Semester 2/Computer Systems Internals & Linux/Week 1/Week 1 Computer Systems Internals.md",
|
||||||
"Semester 1/Database Systems/Week 11/Week 11 Database Systems.md",
|
"Semester 1/Database Systems/Week 11/Week 11 Database Systems.md",
|
||||||
"Semester 1/Database Systems/Week 10/Week 10 Database Systems.md",
|
"Semester 1/Database Systems/Week 10/Week 10 Database Systems.md",
|
||||||
"Semester 2/Database Systems/Week 1/Week 1 Database Systems.md",
|
"Semester 2/Database Systems/Week 1/Week 1 Database Systems.md",
|
||||||
"Semester 1/Database Systems/Assignment/Querying Database.md",
|
"Semester 1/Database Systems/Assignment/Querying Database.md",
|
||||||
"Semester 2/Database Systems/Week 1",
|
|
||||||
"Semester 2/Computer Systems Internals & Linux/Week 1/Week 1 Computer Systems Internals.md",
|
|
||||||
"Semester 2/Database Systems",
|
|
||||||
"README.md",
|
"README.md",
|
||||||
"Semester 2/Programming 2/Week 1/Week 1 Programming 2.md",
|
"Semester 2/Programming 2/Week 1/Week 1 Programming 2.md",
|
||||||
"Semester 2/Computer Systems Internals & Linux/Week 1",
|
|
||||||
"Semester 2/Programming 2/Week 1",
|
|
||||||
"Semester 2/Computer Systems Internals & Linux",
|
|
||||||
"Semester 2/Programming 2",
|
|
||||||
"Semester 2",
|
|
||||||
"Semester 1",
|
|
||||||
"2023-10-31.md",
|
"2023-10-31.md",
|
||||||
"2024-01-15.md",
|
"2024-01-15.md",
|
||||||
"Semester 1/Web Development and HCI/Assignment.odt",
|
|
||||||
"Web Development and HCI/lu11370hmnm.tmp",
|
|
||||||
"Semester 1/Web Development and HCI/Assignment 1/src/images/proxmox-03.jpg",
|
"Semester 1/Web Development and HCI/Assignment 1/src/images/proxmox-03.jpg",
|
||||||
"Semester 1/Web Development and HCI/Assignment 1/src/images/proxmox-04.jpg",
|
"Semester 1/Web Development and HCI/Assignment 1/src/images/proxmox-04.jpg",
|
||||||
"Web Development and HCI/Assignment 1/src/images/Screenshot from 2023-12-07 18-29-51.png",
|
"Web Development and HCI/Assignment 1/src/images/Screenshot from 2023-12-07 18-29-51.png",
|
||||||
@@ -221,7 +223,6 @@
|
|||||||
"Semester 1/Computer Systems Internals & Linux/Coursework 1/Task 5.md",
|
"Semester 1/Computer Systems Internals & Linux/Coursework 1/Task 5.md",
|
||||||
"Semester 1/Computer Systems Internals & Linux/Coursework 1/Task 3.md",
|
"Semester 1/Computer Systems Internals & Linux/Coursework 1/Task 3.md",
|
||||||
"Semester 1/Computer Systems Internals & Linux/Coursework 1/Task 1.md",
|
"Semester 1/Computer Systems Internals & Linux/Coursework 1/Task 1.md",
|
||||||
"Semester 1/Computer Systems Internals & Linux/Coursework 1/Task 2.md",
|
|
||||||
"Database Systems/Untitled.canvas",
|
"Database Systems/Untitled.canvas",
|
||||||
"Untitled 1.canvas",
|
"Untitled 1.canvas",
|
||||||
"Untitled.canvas"
|
"Untitled.canvas"
|
||||||
|
10
Semester 2/Computer Systems Internals & Linux/Week 1/workshop/delete.sh
Executable file
10
Semester 2/Computer Systems Internals & Linux/Week 1/workshop/delete.sh
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ $# -eq 1 ] && [ -f $1 ]; then
|
||||||
|
mv $1 ./wastebasket/$1
|
||||||
|
echo "file $1 moved to ./wastebasket/$1"
|
||||||
|
elif [ $# -eq 1] && [ -d $1 ]; then
|
||||||
|
mv -R $1 ./wastebasket/$1
|
||||||
|
echo "directory $1 moved to ./wastebasket/$1"
|
||||||
|
else
|
||||||
|
echo "More than one file supplied"
|
||||||
|
fi
|
14
Semester 2/Computer Systems Internals & Linux/Week 1/workshop/script1.sh
Executable file
14
Semester 2/Computer Systems Internals & Linux/Week 1/workshop/script1.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo -n Enter num:
|
||||||
|
read num
|
||||||
|
if [ "$num" = "" ]; then
|
||||||
|
echo No input
|
||||||
|
elif echo $num | grep -Eq '[^0-9]'; then
|
||||||
|
echo Not an integer
|
||||||
|
elif [ $num -gt 5 ]; then
|
||||||
|
echo Greater than 5
|
||||||
|
elif [ $num -eq 5 ]; then
|
||||||
|
echo Equal to 5
|
||||||
|
else
|
||||||
|
echo Less than 5
|
||||||
|
fi
|
9
Semester 2/Computer Systems Internals & Linux/Week 1/workshop/script2.sh
Executable file
9
Semester 2/Computer Systems Internals & Linux/Week 1/workshop/script2.sh
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
for file in ~/*; do #For every item in the user's home directory.
|
||||||
|
if [ -d "$file" ]; then
|
||||||
|
echo $file is a directory
|
||||||
|
elif [ -f "$file" ]; then
|
||||||
|
lines=$(cat "$file" | wc -l)
|
||||||
|
echo $file is a file with $lines lines
|
||||||
|
fi
|
||||||
|
done
|
6
Semester 2/Computer Systems Internals & Linux/Week 1/workshop/script3.sh
Executable file
6
Semester 2/Computer Systems Internals & Linux/Week 1/workshop/script3.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
echo "2 arguments (\"$1\" and \"$2\")"
|
||||||
|
else
|
||||||
|
echo Please give me 2 arguments
|
||||||
|
fi
|
@@ -1,7 +1,10 @@
|
|||||||
### [Relational Algebra - Recap](obsidian://open?vault=Computer%20Science%20Year%201&file=Semester%201%2FDatabase%20Systems%2FWeek%2010%2FWeek%2010)
|
### [Relational Algebra - Recap](obsidian://open?vault=Computer%20Science%20Year%201&file=Semester%201%2FDatabase%20Systems%2FWeek%2010%2FWeek%2010%20Database%20Systems)
|
||||||
|
|
||||||
- High level & procedural
|
- High level & procedural
|
||||||
- Defines how to build relations
|
- Defines how to build relations
|
||||||
|
- SELECT represented by pi ( projection )
|
||||||
|
- FROM represented by sigma ( selection )
|
||||||
|
- WHERE represented by x ( cartesian product )
|
||||||
|
|
||||||
#### Data Manipulation Language
|
#### Data Manipulation Language
|
||||||
|
|
||||||
@@ -14,3 +17,21 @@
|
|||||||
- Operations work on one or more relations to define another relation without changing the original
|
- Operations work on one or more relations to define another relation without changing the original
|
||||||
- Both operands and results are relations, output from one operation can become the input for another operation.
|
- Both operands and results are relations, output from one operation can become the input for another operation.
|
||||||
- This allows nested expressions.
|
- This allows nested expressions.
|
||||||
|
|
||||||
|
#### Theta Join
|
||||||
|
|
||||||
|
R theta(f) S defines a relation that contains tuples satisfying F from the Cartesian product of two relations R and S.
|
||||||
|
Takes the Cartesian product of two relations r and s than selects the rows which satisfy the condition F.
|
||||||
|
R theta(f) S is the same as sigma(f) (R x S ).
|
||||||
|
F may contain comparison operators to form a condition.
|
||||||
|
|
||||||
|
#### Query Processing
|
||||||
|
The activities involved in parsing, validating, optimising and executing a query.
|
||||||
|
Purpose is to transform a query written in a high level language into correct and efficient strategy in low level language. Also to execute strategy to retrieve data.
|
||||||
|
|
||||||
|
#### Common Optimisation Rules
|
||||||
|
- Begin with initial query tree for SQL
|
||||||
|
- Move SELECT operations down the tree
|
||||||
|
- Apply more restrictive SELECT operations first ( eg. equalities before range queries )
|
||||||
|
- Replace Cartesian products followed by selection with theta joins ( eg. *sigma(f) ( RxS )* -> *R theta(f) S* )
|
||||||
|
- Move PROJECT operations down the query tree ( add project operations as inputs to theta joins )
|
Binary file not shown.
@@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* The stand-alone HelloWorld application.
|
||||||
|
*
|
||||||
|
* @author (D.Evans
|
||||||
|
* @version 10/02/2004
|
||||||
|
*/
|
||||||
|
public class HelloWorldApp
|
||||||
|
{
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
System.out.println("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
2
Semester 2/Programming 2/Week 1/java-apps/HelloWorld/start.sh
Executable file
2
Semester 2/Programming 2/Week 1/java-apps/HelloWorld/start.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
javac ./HelloWorldApp.java
|
||||||
|
java HelloWorldApp
|
40
Semester 2/Programming 2/Week 1/workshop/package.bluej
Normal file
40
Semester 2/Programming 2/Week 1/workshop/package.bluej
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#BlueJ package file
|
||||||
|
dependency1.from=Zoo
|
||||||
|
dependency1.to=Animal
|
||||||
|
dependency1.type=UsesDependency
|
||||||
|
objectbench.height=76
|
||||||
|
objectbench.width=852
|
||||||
|
package.editor.height=400
|
||||||
|
package.editor.width=726
|
||||||
|
package.editor.x=754
|
||||||
|
package.editor.y=257
|
||||||
|
package.numDependencies=1
|
||||||
|
package.numTargets=2
|
||||||
|
package.showExtends=true
|
||||||
|
package.showUses=true
|
||||||
|
project.charset=UTF-8
|
||||||
|
target1.editor.height=700
|
||||||
|
target1.editor.width=900
|
||||||
|
target1.editor.x=70
|
||||||
|
target1.editor.y=51
|
||||||
|
target1.height=50
|
||||||
|
target1.name=Animal
|
||||||
|
target1.showInterface=false
|
||||||
|
target1.type=ClassTarget
|
||||||
|
target1.typeParameters=
|
||||||
|
target1.width=80
|
||||||
|
target1.x=70
|
||||||
|
target1.y=10
|
||||||
|
target2.editor.height=700
|
||||||
|
target2.editor.width=900
|
||||||
|
target2.editor.x=350
|
||||||
|
target2.editor.y=130
|
||||||
|
target2.height=50
|
||||||
|
target2.name=Zoo
|
||||||
|
target2.naviview.expanded=true
|
||||||
|
target2.showInterface=false
|
||||||
|
target2.type=ClassTarget
|
||||||
|
target2.typeParameters=
|
||||||
|
target2.width=80
|
||||||
|
target2.x=150
|
||||||
|
target2.y=60
|
BIN
Semester 2/Programming 2/Week 1/zoo-io-v1/Animal.class
Normal file
BIN
Semester 2/Programming 2/Week 1/zoo-io-v1/Animal.class
Normal file
Binary file not shown.
14
Semester 2/Programming 2/Week 1/zoo-io-v1/Animal.ctxt
Normal file
14
Semester 2/Programming 2/Week 1/zoo-io-v1/Animal.ctxt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.params=species\ name
|
||||||
|
comment0.target=Animal(java.lang.String,\ java.lang.String)
|
||||||
|
comment0.text=\n\ Create\ an\ animal\ of\ the\ specified\ species\ and\ with\ the\ specified\ name\n\ \n\ @param\ \ <code>species</code>\ a\ <code>String</code>\ specifying\ the\n\ type\ of\ animal\n\ @param\ \ <code>name</code>\ a\ <code>String</code>\ specifying\ the\ \n\ name\ of\ animal\n
|
||||||
|
comment1.params=
|
||||||
|
comment1.target=java.lang.String\ getSpecies()
|
||||||
|
comment1.text=\n\ Returns\ the\ species\ of\ the\ <code>Animal</code>\ object\n\ \n\ @return\ \ \ the\ species\ of\ animal,\ as\ a\ <code>String</code>\n
|
||||||
|
comment2.params=
|
||||||
|
comment2.target=java.lang.String\ getName()
|
||||||
|
comment2.text=\n\ Returns\ the\ name\ of\ the\ <code>Animal</code>\ object\n\ \n\ @return\ \ \ the\ name\ of\ animal,\ as\ a\ <code>String</code>\n
|
||||||
|
comment3.params=
|
||||||
|
comment3.target=java.lang.String\ toString()
|
||||||
|
comment3.text=\n\ Returns\ a\ string\ representing\ the\ <code>Animal</code>\ object.\ \ For\ a\ \n\ lion\ with\ name\ Leo\ it\ will\ return\ the\ <code>String</code>\ "Leo,\ a\ lion"\n\ \n\ @return\ \ \ a\ <code>String</code>\ representation\ of\ the\ animal\n
|
||||||
|
numComments=4
|
59
Semester 2/Programming 2/Week 1/zoo-io-v1/Animal.java
Normal file
59
Semester 2/Programming 2/Week 1/zoo-io-v1/Animal.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* class <code>Animal</code> simulates an animal and stores
|
||||||
|
* the species and name.
|
||||||
|
*
|
||||||
|
* @author D Newton
|
||||||
|
* @version Version 1, 1 November 2010
|
||||||
|
*/
|
||||||
|
public class Animal
|
||||||
|
{
|
||||||
|
// species of the animal e.g. lion, tiger
|
||||||
|
private String species;
|
||||||
|
// name of the animal e.g. Leo, Tommy
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an animal of the specified species and with the specified name
|
||||||
|
*
|
||||||
|
* @param <code>species</code> a <code>String</code> specifying the
|
||||||
|
* type of animal
|
||||||
|
* @param <code>name</code> a <code>String</code> specifying the
|
||||||
|
* name of animal
|
||||||
|
*/
|
||||||
|
public Animal(String species, String name)
|
||||||
|
{
|
||||||
|
this.species = species;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the species of the <code>Animal</code> object
|
||||||
|
*
|
||||||
|
* @return the species of animal, as a <code>String</code>
|
||||||
|
*/
|
||||||
|
public String getSpecies()
|
||||||
|
{
|
||||||
|
return species;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the <code>Animal</code> object
|
||||||
|
*
|
||||||
|
* @return the name of animal, as a <code>String</code>
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representing the <code>Animal</code> object. For a
|
||||||
|
* lion with name Leo it will return the <code>String</code> "Leo, a lion"
|
||||||
|
*
|
||||||
|
* @return a <code>String</code> representation of the animal
|
||||||
|
*/
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return name + ", a " + species;
|
||||||
|
}
|
||||||
|
}
|
12
Semester 2/Programming 2/Week 1/zoo-io-v1/README.TXT
Normal file
12
Semester 2/Programming 2/Week 1/zoo-io-v1/README.TXT
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
------------------------------------------------------------------------
|
||||||
|
This is the project README file. Here, you should describe your project.
|
||||||
|
Tell the reader (someone who does not know anything about this project)
|
||||||
|
all he/she needs to know. The comments should usually include at least:
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
PROJECT TITLE:
|
||||||
|
PURPOSE OF PROJECT:
|
||||||
|
VERSION or DATE:
|
||||||
|
HOW TO START THIS PROJECT:
|
||||||
|
AUTHORS:
|
||||||
|
USER INSTRUCTIONS:
|
BIN
Semester 2/Programming 2/Week 1/zoo-io-v1/Zoo.class
Normal file
BIN
Semester 2/Programming 2/Week 1/zoo-io-v1/Zoo.class
Normal file
Binary file not shown.
35
Semester 2/Programming 2/Week 1/zoo-io-v1/Zoo.ctxt
Normal file
35
Semester 2/Programming 2/Week 1/zoo-io-v1/Zoo.ctxt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.params=
|
||||||
|
comment0.target=Zoo()
|
||||||
|
comment0.text=\n\ Create\ an\ "empty"\ zoo\n
|
||||||
|
comment1.params=fileName
|
||||||
|
comment1.target=Zoo(java.lang.String)
|
||||||
|
comment1.text=\n\ Create\ a\ zoo\ and\ populate\ it\ using\ data\ from\ a\ text\ file\n
|
||||||
|
comment10.params=fileName
|
||||||
|
comment10.target=void\ readAnimalData(java.lang.String)
|
||||||
|
comment10.text=\n\ Reads\ animal\ data\ from\ a\ file\ and\ adds\ corresponding\ animals\ to\ the\ zoo\n\n\ @param\ \ \ <code>fileName</code>\ a\ <code>String</code>,\ the\ name\ of\ the\ \n\ \ \ \ \ \ \ \ \ \ text\ file\ in\ which\ the\ data\ is\ stored.\n\ \n\ @throws\ \ FileNotFoundException\n
|
||||||
|
comment2.params=animal
|
||||||
|
comment2.target=void\ storeAnimal(Animal)
|
||||||
|
comment2.text=\n\ Adds\ an\ animal\ to\ the\ zoo\n\n\ @param\ \ \ <code>animal</code>\ an\ <code>Animal</code>\ object,\ the\ animal\ to\ be\ added\n
|
||||||
|
comment3.params=listPosition
|
||||||
|
comment3.target=void\ showAnimal(int)
|
||||||
|
comment3.text=\n\ Shows\ an\ animal\ by\ printing\ it's\ details.\ \ This\ includes\n\ it's\ position\ in\ the\ collection.\n\n\ @param\ \ <code>listPosition</code>\ the\ position\ of\ the\ animal\n
|
||||||
|
comment4.params=
|
||||||
|
comment4.target=int\ numberOfAnimals()
|
||||||
|
comment4.text=\n\ Returns\ how\ many\ animals\ are\ stored\ in\ the\ collection\n\n\ @return\ \ \ the\ number\ of\ animals\ in\ the\ collection\n
|
||||||
|
comment5.params=
|
||||||
|
comment5.target=void\ showAllAnimals()
|
||||||
|
comment5.text=\n\ Displays\ all\ the\ animals\ in\ the\ collection\n\n
|
||||||
|
comment6.params=listPosition
|
||||||
|
comment6.target=void\ removeAnimal(int)
|
||||||
|
comment6.text=\n\ Remove\ an\ animal\ from\ the\ collection\n\n\ @param\ \ <code>listPosition</code>\ the\ position\ of\ the\ animal\n
|
||||||
|
comment7.params=
|
||||||
|
comment7.target=void\ populate()
|
||||||
|
comment7.text=\n\ Adds\ a\ pre-defined\ set\ of\ animals\ to\ the\ current\ collection\n\n
|
||||||
|
comment8.params=
|
||||||
|
comment8.target=void\ countAnimals()
|
||||||
|
comment8.text=\n\ Counts\ the\ number\ of\ lions,\ tigers\ and\ elephants\n\n
|
||||||
|
comment9.params=fileName
|
||||||
|
comment9.target=void\ writeAnimalData(java.lang.String)
|
||||||
|
comment9.text=\n\ Writes\ animal\ data\ to\ a\ file\n\n\ @param\ \ \ <code>fileName</code>\ a\ <code>String</code>,\ the\ name\ of\ the\ \n\ \ \ \ \ \ \ \ \ \ text\ file\ in\ which\ the\ data\ will\ be\ stored.\n\ \n\ @throws\ \ FileNotFoundException\n
|
||||||
|
numComments=11
|
192
Semester 2/Programming 2/Week 1/zoo-io-v1/Zoo.java
Normal file
192
Semester 2/Programming 2/Week 1/zoo-io-v1/Zoo.java
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
import java.util.*;
|
||||||
|
import java.io.*;
|
||||||
|
/**
|
||||||
|
* class <code>Zoo</code> simulates storing animals in a collection.
|
||||||
|
*
|
||||||
|
* @author D Newton
|
||||||
|
* */
|
||||||
|
public class Zoo
|
||||||
|
{
|
||||||
|
private ArrayList<Animal> animalCollection;
|
||||||
|
private int lionCount;
|
||||||
|
private int tigerCount;
|
||||||
|
private int elephantCount;
|
||||||
|
private int otherCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an "empty" zoo
|
||||||
|
*/
|
||||||
|
public Zoo()
|
||||||
|
{
|
||||||
|
animalCollection = new ArrayList<Animal>();
|
||||||
|
lionCount = 0;
|
||||||
|
tigerCount = 0;
|
||||||
|
elephantCount = 0;
|
||||||
|
otherCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a zoo and populate it using data from a text file
|
||||||
|
*/
|
||||||
|
public Zoo(String fileName) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
this();
|
||||||
|
readAnimalData(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an animal to the zoo
|
||||||
|
*
|
||||||
|
* @param <code>animal</code> an <code>Animal</code> object, the animal to be added
|
||||||
|
*/
|
||||||
|
public void storeAnimal(Animal animal)
|
||||||
|
{
|
||||||
|
animalCollection.add(animal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows an animal by printing it's details. This includes
|
||||||
|
* it's position in the collection.
|
||||||
|
*
|
||||||
|
* @param <code>listPosition</code> the position of the animal
|
||||||
|
*/
|
||||||
|
public void showAnimal(int listPosition)
|
||||||
|
{
|
||||||
|
Animal animal;
|
||||||
|
if( listPosition < animalCollection.size() )
|
||||||
|
{
|
||||||
|
animal = animalCollection.get(listPosition);
|
||||||
|
System.out.println("Position " + listPosition + ": " + animal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns how many animals are stored in the collection
|
||||||
|
*
|
||||||
|
* @return the number of animals in the collection
|
||||||
|
*/
|
||||||
|
public int numberOfAnimals()
|
||||||
|
{
|
||||||
|
return animalCollection.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays all the animals in the collection
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void showAllAnimals()
|
||||||
|
{
|
||||||
|
System.out.println("Zoo");
|
||||||
|
System.out.println("===");
|
||||||
|
|
||||||
|
int listPosition = 0;
|
||||||
|
while( listPosition<animalCollection.size() )
|
||||||
|
{
|
||||||
|
showAnimal(listPosition);
|
||||||
|
listPosition++;
|
||||||
|
}
|
||||||
|
System.out.println(listPosition + " animals shown" ); // display number of animals shown
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an animal from the collection
|
||||||
|
*
|
||||||
|
* @param <code>listPosition</code> the position of the animal
|
||||||
|
*/
|
||||||
|
public void removeAnimal(int listPosition)
|
||||||
|
{
|
||||||
|
if( listPosition>=0 && listPosition<animalCollection.size() )
|
||||||
|
{
|
||||||
|
animalCollection.remove(listPosition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("Invalid position");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a pre-defined set of animals to the current collection
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void populate()
|
||||||
|
{
|
||||||
|
storeAnimal( new Animal("lion", "Leo") );
|
||||||
|
storeAnimal( new Animal("tiger", "Tommy") );
|
||||||
|
storeAnimal( new Animal("elephant", "Ollie") );
|
||||||
|
storeAnimal( new Animal("rat", "Roland") );
|
||||||
|
storeAnimal( new Animal("reindeer", "Rudolph") );
|
||||||
|
storeAnimal( new Animal("Lion", "Lenny") );
|
||||||
|
storeAnimal( new Animal("Elephant", "Nellie") );
|
||||||
|
storeAnimal( new Animal("tiger", "Tessa") );
|
||||||
|
storeAnimal( new Animal("eLephant", "Hetty") );
|
||||||
|
storeAnimal( new Animal("LION", "Leslie") );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counts the number of lions, tigers and elephants
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void countAnimals( )
|
||||||
|
{
|
||||||
|
lionCount = 0; tigerCount = 0;
|
||||||
|
elephantCount= 0; otherCount = 0;
|
||||||
|
Iterator<Animal> it = animalCollection.iterator();
|
||||||
|
while( it.hasNext() )
|
||||||
|
{
|
||||||
|
Animal currentAnimal = it.next();
|
||||||
|
String species = currentAnimal.getSpecies();
|
||||||
|
if( species.equalsIgnoreCase("lion") )
|
||||||
|
lionCount++;
|
||||||
|
else if( species.equalsIgnoreCase("tiger") )
|
||||||
|
tigerCount++;
|
||||||
|
else if( species.equalsIgnoreCase("elephant") )
|
||||||
|
elephantCount++;
|
||||||
|
else
|
||||||
|
otherCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes animal data to a file
|
||||||
|
*
|
||||||
|
* @param <code>fileName</code> a <code>String</code>, the name of the
|
||||||
|
* text file in which the data will be stored.
|
||||||
|
*
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
public void writeAnimalData(String fileName) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
PrintWriter pWriter = new PrintWriter(fileName);
|
||||||
|
|
||||||
|
for(Animal a: animalCollection)
|
||||||
|
{
|
||||||
|
String lineOfOutput = a.getName() + " " + a.getSpecies();
|
||||||
|
pWriter.println(lineOfOutput);
|
||||||
|
}
|
||||||
|
pWriter.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads animal data from a file and adds corresponding animals to the zoo
|
||||||
|
*
|
||||||
|
* @param <code>fileName</code> a <code>String</code>, the name of the
|
||||||
|
* text file in which the data is stored.
|
||||||
|
*
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
public void readAnimalData(String fileName) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
File dataFile = new File(fileName);
|
||||||
|
Scanner scanner = new Scanner(dataFile);
|
||||||
|
|
||||||
|
while( scanner.hasNext() )
|
||||||
|
{
|
||||||
|
String name = scanner.next();
|
||||||
|
String species = scanner.next();
|
||||||
|
storeAnimal( new Animal(species, name) );
|
||||||
|
}
|
||||||
|
|
||||||
|
scanner.close();
|
||||||
|
}
|
||||||
|
}
|
10
Semester 2/Programming 2/Week 1/zoo-io-v1/animal_data.txt
Normal file
10
Semester 2/Programming 2/Week 1/zoo-io-v1/animal_data.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Leo lion
|
||||||
|
Tommy tiger
|
||||||
|
Ollie elephant
|
||||||
|
Roland rat
|
||||||
|
Rudolph reindeer
|
||||||
|
Lenny Lion
|
||||||
|
Nellie Elephant
|
||||||
|
Tessa tiger
|
||||||
|
Hetty eLephant
|
||||||
|
Leslie LION
|
@@ -0,0 +1,3 @@
|
|||||||
|
Bobby bear
|
||||||
|
Andy aardvark
|
||||||
|
Polly parrot
|
3
Semester 2/Programming 2/Week 1/zoo-io-v1/package.bluej
Normal file
3
Semester 2/Programming 2/Week 1/zoo-io-v1/package.bluej
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#BlueJ package file
|
||||||
|
#Thu Jan 18 14:27:41 GMT 2024
|
||||||
|
project.charset=UTF-8
|
BIN
Semester 2/Programming 2/Week 1/zoo-io-v2/Animal.class
Normal file
BIN
Semester 2/Programming 2/Week 1/zoo-io-v2/Animal.class
Normal file
Binary file not shown.
14
Semester 2/Programming 2/Week 1/zoo-io-v2/Animal.ctxt
Normal file
14
Semester 2/Programming 2/Week 1/zoo-io-v2/Animal.ctxt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.params=species\ name
|
||||||
|
comment0.target=Animal(java.lang.String,\ java.lang.String)
|
||||||
|
comment0.text=\n\ Create\ an\ animal\ of\ the\ specified\ species\ and\ with\ the\ specified\ name\n\ \n\ @param\ \ <code>species</code>\ a\ <code>String</code>\ specifying\ the\n\ type\ of\ animal\n\ @param\ \ <code>name</code>\ a\ <code>String</code>\ specifying\ the\ \n\ name\ of\ animal\n
|
||||||
|
comment1.params=
|
||||||
|
comment1.target=java.lang.String\ getSpecies()
|
||||||
|
comment1.text=\n\ Returns\ the\ species\ of\ the\ <code>Animal</code>\ object\n\ \n\ @return\ \ \ the\ species\ of\ animal,\ as\ a\ <code>String</code>\n
|
||||||
|
comment2.params=
|
||||||
|
comment2.target=java.lang.String\ getName()
|
||||||
|
comment2.text=\n\ Returns\ the\ name\ of\ the\ <code>Animal</code>\ object\n\ \n\ @return\ \ \ the\ name\ of\ animal,\ as\ a\ <code>String</code>\n
|
||||||
|
comment3.params=
|
||||||
|
comment3.target=java.lang.String\ toString()
|
||||||
|
comment3.text=\n\ Returns\ a\ string\ representing\ the\ <code>Animal</code>\ object.\ \ For\ a\ \n\ lion\ with\ name\ Leo\ it\ will\ return\ the\ <code>String</code>\ "Leo,\ a\ lion"\n\ \n\ @return\ \ \ a\ <code>String</code>\ representation\ of\ the\ animal\n
|
||||||
|
numComments=4
|
59
Semester 2/Programming 2/Week 1/zoo-io-v2/Animal.java
Normal file
59
Semester 2/Programming 2/Week 1/zoo-io-v2/Animal.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* class <code>Animal</code> simulates an animal and stores
|
||||||
|
* the species and name.
|
||||||
|
*
|
||||||
|
* @author D Newton
|
||||||
|
* @version Version 1, 1 November 2010
|
||||||
|
*/
|
||||||
|
public class Animal
|
||||||
|
{
|
||||||
|
// species of the animal e.g. lion, tiger
|
||||||
|
private String species;
|
||||||
|
// name of the animal e.g. Leo, Tommy
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an animal of the specified species and with the specified name
|
||||||
|
*
|
||||||
|
* @param <code>species</code> a <code>String</code> specifying the
|
||||||
|
* type of animal
|
||||||
|
* @param <code>name</code> a <code>String</code> specifying the
|
||||||
|
* name of animal
|
||||||
|
*/
|
||||||
|
public Animal(String species, String name)
|
||||||
|
{
|
||||||
|
this.species = species;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the species of the <code>Animal</code> object
|
||||||
|
*
|
||||||
|
* @return the species of animal, as a <code>String</code>
|
||||||
|
*/
|
||||||
|
public String getSpecies()
|
||||||
|
{
|
||||||
|
return species;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the <code>Animal</code> object
|
||||||
|
*
|
||||||
|
* @return the name of animal, as a <code>String</code>
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representing the <code>Animal</code> object. For a
|
||||||
|
* lion with name Leo it will return the <code>String</code> "Leo, a lion"
|
||||||
|
*
|
||||||
|
* @return a <code>String</code> representation of the animal
|
||||||
|
*/
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return name + ", a " + species;
|
||||||
|
}
|
||||||
|
}
|
12
Semester 2/Programming 2/Week 1/zoo-io-v2/README.TXT
Normal file
12
Semester 2/Programming 2/Week 1/zoo-io-v2/README.TXT
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
------------------------------------------------------------------------
|
||||||
|
This is the project README file. Here, you should describe your project.
|
||||||
|
Tell the reader (someone who does not know anything about this project)
|
||||||
|
all he/she needs to know. The comments should usually include at least:
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
PROJECT TITLE:
|
||||||
|
PURPOSE OF PROJECT:
|
||||||
|
VERSION or DATE:
|
||||||
|
HOW TO START THIS PROJECT:
|
||||||
|
AUTHORS:
|
||||||
|
USER INSTRUCTIONS:
|
BIN
Semester 2/Programming 2/Week 1/zoo-io-v2/Zoo.class
Normal file
BIN
Semester 2/Programming 2/Week 1/zoo-io-v2/Zoo.class
Normal file
Binary file not shown.
35
Semester 2/Programming 2/Week 1/zoo-io-v2/Zoo.ctxt
Normal file
35
Semester 2/Programming 2/Week 1/zoo-io-v2/Zoo.ctxt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.params=
|
||||||
|
comment0.target=Zoo()
|
||||||
|
comment0.text=\n\ Create\ an\ "empty"\ zoo\n
|
||||||
|
comment1.params=fileName
|
||||||
|
comment1.target=Zoo(java.lang.String)
|
||||||
|
comment1.text=\n\ Create\ a\ zoo\ and\ populate\ it\ using\ data\ from\ a\ text\ file\n
|
||||||
|
comment10.params=fileName
|
||||||
|
comment10.target=void\ readAnimalData(java.lang.String)
|
||||||
|
comment10.text=\n\ Reads\ animal\ data\ from\ a\ file\ and\ adds\ corresponding\ animals\ to\ the\ zoo\n\n\ @param\ \ \ <code>fileName</code>\ a\ <code>String</code>,\ the\ name\ of\ the\ \n\ \ \ \ \ \ \ \ \ \ text\ file\ in\ which\ the\ data\ is\ stored.\n\ \n\ @throws\ \ FileNotFoundException\n
|
||||||
|
comment2.params=animal
|
||||||
|
comment2.target=void\ storeAnimal(Animal)
|
||||||
|
comment2.text=\n\ Adds\ an\ animal\ to\ the\ zoo\n\n\ @param\ \ \ <code>animal</code>\ an\ <code>Animal</code>\ object,\ the\ animal\ to\ be\ added\n
|
||||||
|
comment3.params=listPosition
|
||||||
|
comment3.target=void\ showAnimal(int)
|
||||||
|
comment3.text=\n\ Shows\ an\ animal\ by\ printing\ it's\ details.\ \ This\ includes\n\ it's\ position\ in\ the\ collection.\n\n\ @param\ \ <code>listPosition</code>\ the\ position\ of\ the\ animal\n
|
||||||
|
comment4.params=
|
||||||
|
comment4.target=int\ numberOfAnimals()
|
||||||
|
comment4.text=\n\ Returns\ how\ many\ animals\ are\ stored\ in\ the\ collection\n\n\ @return\ \ \ the\ number\ of\ animals\ in\ the\ collection\n
|
||||||
|
comment5.params=
|
||||||
|
comment5.target=void\ showAllAnimals()
|
||||||
|
comment5.text=\n\ Displays\ all\ the\ animals\ in\ the\ collection\n\n
|
||||||
|
comment6.params=listPosition
|
||||||
|
comment6.target=void\ removeAnimal(int)
|
||||||
|
comment6.text=\n\ Remove\ an\ animal\ from\ the\ collection\n\n\ @param\ \ <code>listPosition</code>\ the\ position\ of\ the\ animal\n
|
||||||
|
comment7.params=
|
||||||
|
comment7.target=void\ populate()
|
||||||
|
comment7.text=\n\ Adds\ a\ pre-defined\ set\ of\ animals\ to\ the\ current\ collection\n\n
|
||||||
|
comment8.params=
|
||||||
|
comment8.target=void\ countAnimals()
|
||||||
|
comment8.text=\n\ Counts\ the\ number\ of\ lions,\ tigers\ and\ elephants\n\n
|
||||||
|
comment9.params=fileName
|
||||||
|
comment9.target=void\ writeAnimalData(java.lang.String)
|
||||||
|
comment9.text=\n\ Writes\ animal\ data\ to\ a\ file\n\n\ @param\ \ \ <code>fileName</code>\ a\ <code>String</code>,\ the\ name\ of\ the\ \n\ \ \ \ \ \ \ \ \ \ text\ file\ in\ which\ the\ data\ will\ be\ stored.\n\ \n\ @throws\ \ FileNotFoundException\n
|
||||||
|
numComments=11
|
194
Semester 2/Programming 2/Week 1/zoo-io-v2/Zoo.java
Normal file
194
Semester 2/Programming 2/Week 1/zoo-io-v2/Zoo.java
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
import java.util.*;
|
||||||
|
import java.io.*;
|
||||||
|
/**
|
||||||
|
* class <code>Zoo</code> simulates storing animals in a collection.
|
||||||
|
*
|
||||||
|
* @author D Newton
|
||||||
|
* */
|
||||||
|
public class Zoo
|
||||||
|
{
|
||||||
|
private ArrayList<Animal> animalCollection;
|
||||||
|
private int lionCount;
|
||||||
|
private int tigerCount;
|
||||||
|
private int elephantCount;
|
||||||
|
private int otherCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an "empty" zoo
|
||||||
|
*/
|
||||||
|
public Zoo()
|
||||||
|
{
|
||||||
|
animalCollection = new ArrayList<Animal>();
|
||||||
|
lionCount = 0;
|
||||||
|
tigerCount = 0;
|
||||||
|
elephantCount = 0;
|
||||||
|
otherCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a zoo and populate it using data from a text file
|
||||||
|
*/
|
||||||
|
public Zoo(String fileName) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
this();
|
||||||
|
readAnimalData(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an animal to the zoo
|
||||||
|
*
|
||||||
|
* @param <code>animal</code> an <code>Animal</code> object, the animal to be added
|
||||||
|
*/
|
||||||
|
public void storeAnimal(Animal animal)
|
||||||
|
{
|
||||||
|
animalCollection.add(animal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows an animal by printing it's details. This includes
|
||||||
|
* it's position in the collection.
|
||||||
|
*
|
||||||
|
* @param <code>listPosition</code> the position of the animal
|
||||||
|
*/
|
||||||
|
public void showAnimal(int listPosition)
|
||||||
|
{
|
||||||
|
Animal animal;
|
||||||
|
if( listPosition < animalCollection.size() )
|
||||||
|
{
|
||||||
|
animal = animalCollection.get(listPosition);
|
||||||
|
System.out.println("Position " + listPosition + ": " + animal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns how many animals are stored in the collection
|
||||||
|
*
|
||||||
|
* @return the number of animals in the collection
|
||||||
|
*/
|
||||||
|
public int numberOfAnimals()
|
||||||
|
{
|
||||||
|
return animalCollection.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays all the animals in the collection
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void showAllAnimals()
|
||||||
|
{
|
||||||
|
System.out.println("Zoo");
|
||||||
|
System.out.println("===");
|
||||||
|
|
||||||
|
int listPosition = 0;
|
||||||
|
while( listPosition<animalCollection.size() )
|
||||||
|
{
|
||||||
|
showAnimal(listPosition);
|
||||||
|
listPosition++;
|
||||||
|
}
|
||||||
|
System.out.println(listPosition + " animals shown" ); // display number of animals shown
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an animal from the collection
|
||||||
|
*
|
||||||
|
* @param <code>listPosition</code> the position of the animal
|
||||||
|
*/
|
||||||
|
public void removeAnimal(int listPosition)
|
||||||
|
{
|
||||||
|
if( listPosition>=0 && listPosition<animalCollection.size() )
|
||||||
|
{
|
||||||
|
animalCollection.remove(listPosition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("Invalid position");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a pre-defined set of animals to the current collection
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void populate()
|
||||||
|
{
|
||||||
|
storeAnimal( new Animal("lion", "Leo") );
|
||||||
|
storeAnimal( new Animal("tiger", "Tommy") );
|
||||||
|
storeAnimal( new Animal("elephant", "Ollie") );
|
||||||
|
storeAnimal( new Animal("rat", "Roland") );
|
||||||
|
storeAnimal( new Animal("reindeer", "Rudolph") );
|
||||||
|
storeAnimal( new Animal("Lion", "Lenny") );
|
||||||
|
storeAnimal( new Animal("Elephant", "Nellie") );
|
||||||
|
storeAnimal( new Animal("tiger", "Tessa") );
|
||||||
|
storeAnimal( new Animal("eLephant", "Hetty") );
|
||||||
|
storeAnimal( new Animal("LION", "Leslie") );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counts the number of lions, tigers and elephants
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void countAnimals( )
|
||||||
|
{
|
||||||
|
lionCount = 0; tigerCount = 0;
|
||||||
|
elephantCount= 0; otherCount = 0;
|
||||||
|
Iterator<Animal> it = animalCollection.iterator();
|
||||||
|
while( it.hasNext() )
|
||||||
|
{
|
||||||
|
Animal currentAnimal = it.next();
|
||||||
|
String species = currentAnimal.getSpecies();
|
||||||
|
if( species.equalsIgnoreCase("lion") )
|
||||||
|
lionCount++;
|
||||||
|
else if( species.equalsIgnoreCase("tiger") )
|
||||||
|
tigerCount++;
|
||||||
|
else if( species.equalsIgnoreCase("elephant") )
|
||||||
|
elephantCount++;
|
||||||
|
else
|
||||||
|
otherCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes animal data to a file
|
||||||
|
*
|
||||||
|
* @param <code>fileName</code> a <code>String</code>, the name of the
|
||||||
|
* text file in which the data will be stored.
|
||||||
|
*
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
public void writeAnimalData(String fileName) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
PrintWriter pWriter = new PrintWriter(fileName);
|
||||||
|
|
||||||
|
for(Animal a: animalCollection)
|
||||||
|
{
|
||||||
|
String lineOfOutput = a.getName() + "," + a.getSpecies();
|
||||||
|
pWriter.println(lineOfOutput);
|
||||||
|
}
|
||||||
|
pWriter.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads animal data from a file and adds corresponding animals to the zoo
|
||||||
|
*
|
||||||
|
* @param <code>fileName</code> a <code>String</code>, the name of the
|
||||||
|
* text file in which the data is stored.
|
||||||
|
*
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
public void readAnimalData(String fileName) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
File dataFile = new File(fileName);
|
||||||
|
Scanner scanner = new Scanner(dataFile);
|
||||||
|
scanner.useDelimiter("[,\n]");
|
||||||
|
|
||||||
|
while( scanner.hasNext() )
|
||||||
|
{
|
||||||
|
String name = scanner.next();
|
||||||
|
name.trim();
|
||||||
|
String species = scanner.next();
|
||||||
|
species.trim();
|
||||||
|
storeAnimal( new Animal(species, name) );
|
||||||
|
}
|
||||||
|
scanner.close();
|
||||||
|
}
|
||||||
|
}
|
10
Semester 2/Programming 2/Week 1/zoo-io-v2/animal_data.txt
Normal file
10
Semester 2/Programming 2/Week 1/zoo-io-v2/animal_data.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Leo, Lion
|
||||||
|
Tommy, Tiger
|
||||||
|
Ollie, Elephant
|
||||||
|
Roland, Rat
|
||||||
|
Rudolph, Reindeer
|
||||||
|
Lenny, Lion
|
||||||
|
Nellie, Elephant
|
||||||
|
Tessa, Tiger
|
||||||
|
Hetty, Elephant
|
||||||
|
Leslie, Lion
|
@@ -0,0 +1,3 @@
|
|||||||
|
Bobby, Bear
|
||||||
|
Andy, Aardvark
|
||||||
|
Polly, African Grey Parrot
|
36
Semester 2/Programming 2/Week 1/zoo-io-v2/package.bluej
Normal file
36
Semester 2/Programming 2/Week 1/zoo-io-v2/package.bluej
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#BlueJ package file
|
||||||
|
dependency1.from=Zoo
|
||||||
|
dependency1.to=Animal
|
||||||
|
dependency1.type=UsesDependency
|
||||||
|
objectbench.height=76
|
||||||
|
objectbench.width=686
|
||||||
|
package.editor.height=400
|
||||||
|
package.editor.width=560
|
||||||
|
package.editor.x=774
|
||||||
|
package.editor.y=277
|
||||||
|
package.numDependencies=1
|
||||||
|
package.numTargets=2
|
||||||
|
package.showExtends=true
|
||||||
|
package.showUses=true
|
||||||
|
project.charset=UTF-8
|
||||||
|
target1.height=50
|
||||||
|
target1.name=Animal
|
||||||
|
target1.showInterface=false
|
||||||
|
target1.type=ClassTarget
|
||||||
|
target1.typeParameters=
|
||||||
|
target1.width=80
|
||||||
|
target1.x=90
|
||||||
|
target1.y=10
|
||||||
|
target2.editor.height=700
|
||||||
|
target2.editor.width=900
|
||||||
|
target2.editor.x=814
|
||||||
|
target2.editor.y=297
|
||||||
|
target2.height=50
|
||||||
|
target2.name=Zoo
|
||||||
|
target2.naviview.expanded=true
|
||||||
|
target2.showInterface=false
|
||||||
|
target2.type=ClassTarget
|
||||||
|
target2.typeParameters=
|
||||||
|
target2.width=80
|
||||||
|
target2.x=180
|
||||||
|
target2.y=10
|
BIN
Semester 2/Programming 2/Week 1/zoo-io-v3/Animal.class
Normal file
BIN
Semester 2/Programming 2/Week 1/zoo-io-v3/Animal.class
Normal file
Binary file not shown.
14
Semester 2/Programming 2/Week 1/zoo-io-v3/Animal.ctxt
Normal file
14
Semester 2/Programming 2/Week 1/zoo-io-v3/Animal.ctxt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.params=species\ name
|
||||||
|
comment0.target=Animal(java.lang.String,\ java.lang.String)
|
||||||
|
comment0.text=\n\ Create\ an\ animal\ of\ the\ specified\ species\ and\ with\ the\ specified\ name\n\ \n\ @param\ \ <code>species</code>\ a\ <code>String</code>\ specifying\ the\n\ type\ of\ animal\n\ @param\ \ <code>name</code>\ a\ <code>String</code>\ specifying\ the\ \n\ name\ of\ animal\n
|
||||||
|
comment1.params=
|
||||||
|
comment1.target=java.lang.String\ getSpecies()
|
||||||
|
comment1.text=\n\ Returns\ the\ species\ of\ the\ <code>Animal</code>\ object\n\ \n\ @return\ \ \ the\ species\ of\ animal,\ as\ a\ <code>String</code>\n
|
||||||
|
comment2.params=
|
||||||
|
comment2.target=java.lang.String\ getName()
|
||||||
|
comment2.text=\n\ Returns\ the\ name\ of\ the\ <code>Animal</code>\ object\n\ \n\ @return\ \ \ the\ name\ of\ animal,\ as\ a\ <code>String</code>\n
|
||||||
|
comment3.params=
|
||||||
|
comment3.target=java.lang.String\ toString()
|
||||||
|
comment3.text=\n\ Returns\ a\ string\ representing\ the\ <code>Animal</code>\ object.\ \ For\ a\ \n\ lion\ with\ name\ Leo\ it\ will\ return\ the\ <code>String</code>\ "Leo,\ a\ lion"\n\ \n\ @return\ \ \ a\ <code>String</code>\ representation\ of\ the\ animal\n
|
||||||
|
numComments=4
|
59
Semester 2/Programming 2/Week 1/zoo-io-v3/Animal.java
Normal file
59
Semester 2/Programming 2/Week 1/zoo-io-v3/Animal.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* class <code>Animal</code> simulates an animal and stores
|
||||||
|
* the species and name.
|
||||||
|
*
|
||||||
|
* @author D Newton
|
||||||
|
* @version Version 1, 1 November 2010
|
||||||
|
*/
|
||||||
|
public class Animal
|
||||||
|
{
|
||||||
|
// species of the animal e.g. lion, tiger
|
||||||
|
private String species;
|
||||||
|
// name of the animal e.g. Leo, Tommy
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an animal of the specified species and with the specified name
|
||||||
|
*
|
||||||
|
* @param <code>species</code> a <code>String</code> specifying the
|
||||||
|
* type of animal
|
||||||
|
* @param <code>name</code> a <code>String</code> specifying the
|
||||||
|
* name of animal
|
||||||
|
*/
|
||||||
|
public Animal(String species, String name)
|
||||||
|
{
|
||||||
|
this.species = species;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the species of the <code>Animal</code> object
|
||||||
|
*
|
||||||
|
* @return the species of animal, as a <code>String</code>
|
||||||
|
*/
|
||||||
|
public String getSpecies()
|
||||||
|
{
|
||||||
|
return species;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the <code>Animal</code> object
|
||||||
|
*
|
||||||
|
* @return the name of animal, as a <code>String</code>
|
||||||
|
*/
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representing the <code>Animal</code> object. For a
|
||||||
|
* lion with name Leo it will return the <code>String</code> "Leo, a lion"
|
||||||
|
*
|
||||||
|
* @return a <code>String</code> representation of the animal
|
||||||
|
*/
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return name + ", a " + species;
|
||||||
|
}
|
||||||
|
}
|
12
Semester 2/Programming 2/Week 1/zoo-io-v3/README.TXT
Normal file
12
Semester 2/Programming 2/Week 1/zoo-io-v3/README.TXT
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
------------------------------------------------------------------------
|
||||||
|
This is the project README file. Here, you should describe your project.
|
||||||
|
Tell the reader (someone who does not know anything about this project)
|
||||||
|
all he/she needs to know. The comments should usually include at least:
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
PROJECT TITLE:
|
||||||
|
PURPOSE OF PROJECT:
|
||||||
|
VERSION or DATE:
|
||||||
|
HOW TO START THIS PROJECT:
|
||||||
|
AUTHORS:
|
||||||
|
USER INSTRUCTIONS:
|
BIN
Semester 2/Programming 2/Week 1/zoo-io-v3/Zoo.class
Normal file
BIN
Semester 2/Programming 2/Week 1/zoo-io-v3/Zoo.class
Normal file
Binary file not shown.
35
Semester 2/Programming 2/Week 1/zoo-io-v3/Zoo.ctxt
Normal file
35
Semester 2/Programming 2/Week 1/zoo-io-v3/Zoo.ctxt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.params=
|
||||||
|
comment0.target=Zoo()
|
||||||
|
comment0.text=\n\ Create\ an\ "empty"\ zoo\n
|
||||||
|
comment1.params=fileName
|
||||||
|
comment1.target=Zoo(java.lang.String)
|
||||||
|
comment1.text=\n\ Create\ a\ zoo\ and\ populate\ it\ using\ data\ from\ a\ text\ file\n
|
||||||
|
comment10.params=fileName
|
||||||
|
comment10.target=void\ readAnimalData(java.lang.String)
|
||||||
|
comment10.text=\n\ Reads\ animal\ data\ from\ a\ file\ and\ adds\ corresponding\ animals\ to\ the\ zoo\n\n\ @param\ \ \ <code>fileName</code>\ a\ <code>String</code>,\ the\ name\ of\ the\ \n\ \ \ \ \ \ \ \ \ \ text\ file\ in\ which\ the\ data\ is\ stored.\n\ \n\ @throws\ \ FileNotFoundException\n
|
||||||
|
comment2.params=animal
|
||||||
|
comment2.target=void\ storeAnimal(Animal)
|
||||||
|
comment2.text=\n\ Adds\ an\ animal\ to\ the\ zoo\n\n\ @param\ \ \ <code>animal</code>\ an\ <code>Animal</code>\ object,\ the\ animal\ to\ be\ added\n
|
||||||
|
comment3.params=listPosition
|
||||||
|
comment3.target=void\ showAnimal(int)
|
||||||
|
comment3.text=\n\ Shows\ an\ animal\ by\ printing\ it's\ details.\ \ This\ includes\n\ it's\ position\ in\ the\ collection.\n\n\ @param\ \ <code>listPosition</code>\ the\ position\ of\ the\ animal\n
|
||||||
|
comment4.params=
|
||||||
|
comment4.target=int\ numberOfAnimals()
|
||||||
|
comment4.text=\n\ Returns\ how\ many\ animals\ are\ stored\ in\ the\ collection\n\n\ @return\ \ \ the\ number\ of\ animals\ in\ the\ collection\n
|
||||||
|
comment5.params=
|
||||||
|
comment5.target=void\ showAllAnimals()
|
||||||
|
comment5.text=\n\ Displays\ all\ the\ animals\ in\ the\ collection\n\n
|
||||||
|
comment6.params=listPosition
|
||||||
|
comment6.target=void\ removeAnimal(int)
|
||||||
|
comment6.text=\n\ Remove\ an\ animal\ from\ the\ collection\n\n\ @param\ \ <code>listPosition</code>\ the\ position\ of\ the\ animal\n
|
||||||
|
comment7.params=
|
||||||
|
comment7.target=void\ populate()
|
||||||
|
comment7.text=\n\ Adds\ a\ pre-defined\ set\ of\ animals\ to\ the\ current\ collection\n\n
|
||||||
|
comment8.params=
|
||||||
|
comment8.target=void\ countAnimals()
|
||||||
|
comment8.text=\n\ Counts\ the\ number\ of\ lions,\ tigers\ and\ elephants\n\n
|
||||||
|
comment9.params=fileName
|
||||||
|
comment9.target=void\ writeAnimalData(java.lang.String)
|
||||||
|
comment9.text=\n\ Writes\ animal\ data\ to\ a\ file\n\n\ @param\ \ \ <code>fileName</code>\ a\ <code>String</code>,\ the\ name\ of\ the\ \n\ \ \ \ \ \ \ \ \ \ text\ file\ in\ which\ the\ data\ will\ be\ stored.\n\ \n\ @throws\ \ FileNotFoundException\n
|
||||||
|
numComments=11
|
194
Semester 2/Programming 2/Week 1/zoo-io-v3/Zoo.java
Normal file
194
Semester 2/Programming 2/Week 1/zoo-io-v3/Zoo.java
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
import java.util.*;
|
||||||
|
import java.io.*;
|
||||||
|
/**
|
||||||
|
* class <code>Zoo</code> simulates storing animals in a collection.
|
||||||
|
*
|
||||||
|
* @author D Newton
|
||||||
|
* */
|
||||||
|
public class Zoo
|
||||||
|
{
|
||||||
|
private ArrayList<Animal> animalCollection;
|
||||||
|
private int lionCount;
|
||||||
|
private int tigerCount;
|
||||||
|
private int elephantCount;
|
||||||
|
private int otherCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an "empty" zoo
|
||||||
|
*/
|
||||||
|
public Zoo()
|
||||||
|
{
|
||||||
|
animalCollection = new ArrayList<Animal>();
|
||||||
|
lionCount = 0;
|
||||||
|
tigerCount = 0;
|
||||||
|
elephantCount = 0;
|
||||||
|
otherCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a zoo and populate it using data from a text file
|
||||||
|
*/
|
||||||
|
public Zoo(String fileName) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
this();
|
||||||
|
readAnimalData(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an animal to the zoo
|
||||||
|
*
|
||||||
|
* @param <code>animal</code> an <code>Animal</code> object, the animal to be added
|
||||||
|
*/
|
||||||
|
public void storeAnimal(Animal animal)
|
||||||
|
{
|
||||||
|
animalCollection.add(animal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows an animal by printing it's details. This includes
|
||||||
|
* it's position in the collection.
|
||||||
|
*
|
||||||
|
* @param <code>listPosition</code> the position of the animal
|
||||||
|
*/
|
||||||
|
public void showAnimal(int listPosition)
|
||||||
|
{
|
||||||
|
Animal animal;
|
||||||
|
if( listPosition < animalCollection.size() )
|
||||||
|
{
|
||||||
|
animal = animalCollection.get(listPosition);
|
||||||
|
System.out.println("Position " + listPosition + ": " + animal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns how many animals are stored in the collection
|
||||||
|
*
|
||||||
|
* @return the number of animals in the collection
|
||||||
|
*/
|
||||||
|
public int numberOfAnimals()
|
||||||
|
{
|
||||||
|
return animalCollection.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays all the animals in the collection
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void showAllAnimals()
|
||||||
|
{
|
||||||
|
System.out.println("Zoo");
|
||||||
|
System.out.println("===");
|
||||||
|
|
||||||
|
int listPosition = 0;
|
||||||
|
while( listPosition<animalCollection.size() )
|
||||||
|
{
|
||||||
|
showAnimal(listPosition);
|
||||||
|
listPosition++;
|
||||||
|
}
|
||||||
|
System.out.println(listPosition + " animals shown" ); // display number of animals shown
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove an animal from the collection
|
||||||
|
*
|
||||||
|
* @param <code>listPosition</code> the position of the animal
|
||||||
|
*/
|
||||||
|
public void removeAnimal(int listPosition)
|
||||||
|
{
|
||||||
|
if( listPosition>=0 && listPosition<animalCollection.size() )
|
||||||
|
{
|
||||||
|
animalCollection.remove(listPosition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("Invalid position");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a pre-defined set of animals to the current collection
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void populate()
|
||||||
|
{
|
||||||
|
storeAnimal( new Animal("lion", "Leo") );
|
||||||
|
storeAnimal( new Animal("tiger", "Tommy") );
|
||||||
|
storeAnimal( new Animal("elephant", "Ollie") );
|
||||||
|
storeAnimal( new Animal("rat", "Roland") );
|
||||||
|
storeAnimal( new Animal("reindeer", "Rudolph") );
|
||||||
|
storeAnimal( new Animal("Lion", "Lenny") );
|
||||||
|
storeAnimal( new Animal("Elephant", "Nellie") );
|
||||||
|
storeAnimal( new Animal("tiger", "Tessa") );
|
||||||
|
storeAnimal( new Animal("eLephant", "Hetty") );
|
||||||
|
storeAnimal( new Animal("LION", "Leslie") );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Counts the number of lions, tigers and elephants
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void countAnimals( )
|
||||||
|
{
|
||||||
|
lionCount = 0; tigerCount = 0;
|
||||||
|
elephantCount= 0; otherCount = 0;
|
||||||
|
Iterator<Animal> it = animalCollection.iterator();
|
||||||
|
while( it.hasNext() )
|
||||||
|
{
|
||||||
|
Animal currentAnimal = it.next();
|
||||||
|
String species = currentAnimal.getSpecies();
|
||||||
|
if( species.equalsIgnoreCase("lion") )
|
||||||
|
lionCount++;
|
||||||
|
else if( species.equalsIgnoreCase("tiger") )
|
||||||
|
tigerCount++;
|
||||||
|
else if( species.equalsIgnoreCase("elephant") )
|
||||||
|
elephantCount++;
|
||||||
|
else
|
||||||
|
otherCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes animal data to a file
|
||||||
|
*
|
||||||
|
* @param <code>fileName</code> a <code>String</code>, the name of the
|
||||||
|
* text file in which the data will be stored.
|
||||||
|
*
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
public void writeAnimalData(String fileName) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
PrintWriter pWriter = new PrintWriter(fileName);
|
||||||
|
|
||||||
|
for(Animal a: animalCollection)
|
||||||
|
{
|
||||||
|
String lineOfOutput = a.getName() + "," + a.getSpecies();
|
||||||
|
pWriter.println(lineOfOutput);
|
||||||
|
}
|
||||||
|
pWriter.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads animal data from a file and adds corresponding animals to the zoo
|
||||||
|
*
|
||||||
|
* @param <code>fileName</code> a <code>String</code>, the name of the
|
||||||
|
* text file in which the data is stored.
|
||||||
|
*
|
||||||
|
* @throws FileNotFoundException
|
||||||
|
*/
|
||||||
|
public void readAnimalData(String fileName) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
File dataFile = new File(fileName);
|
||||||
|
Scanner scanner = new Scanner(dataFile);
|
||||||
|
scanner.useDelimiter("[,\n]");
|
||||||
|
|
||||||
|
while( scanner.hasNext() )
|
||||||
|
{
|
||||||
|
String name = scanner.next();
|
||||||
|
name.trim();
|
||||||
|
String species = scanner.next();
|
||||||
|
species.trim();
|
||||||
|
storeAnimal( new Animal(species, name) );
|
||||||
|
}
|
||||||
|
scanner.close();
|
||||||
|
}
|
||||||
|
}
|
BIN
Semester 2/Programming 2/Week 1/zoo-io-v3/ZooApp.class
Normal file
BIN
Semester 2/Programming 2/Week 1/zoo-io-v3/ZooApp.class
Normal file
Binary file not shown.
5
Semester 2/Programming 2/Week 1/zoo-io-v3/ZooApp.ctxt
Normal file
5
Semester 2/Programming 2/Week 1/zoo-io-v3/ZooApp.ctxt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.params=file
|
||||||
|
comment0.target=ZooApp(java.lang.String)
|
||||||
|
comment0.text=\n\ Constructor\ for\ objects\ of\ class\ ZooApp\n
|
||||||
|
numComments=1
|
22
Semester 2/Programming 2/Week 1/zoo-io-v3/ZooApp.java
Normal file
22
Semester 2/Programming 2/Week 1/zoo-io-v3/ZooApp.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Write a description of class ZooApp here.
|
||||||
|
*
|
||||||
|
* @author (your name)
|
||||||
|
* @version (a version number or a date)
|
||||||
|
*/
|
||||||
|
import java.io.*;
|
||||||
|
public class ZooApp
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor for objects of class ZooApp
|
||||||
|
*/
|
||||||
|
public ZooApp( String file ) throws FileNotFoundException
|
||||||
|
{
|
||||||
|
System.out.println( file );
|
||||||
|
Zoo zoo = new Zoo();
|
||||||
|
zoo.showAllAnimals();
|
||||||
|
zoo.readAnimalData( "new_animals.txt" );
|
||||||
|
zoo.showAllAnimals();
|
||||||
|
}
|
||||||
|
}
|
10
Semester 2/Programming 2/Week 1/zoo-io-v3/animal_data.txt
Normal file
10
Semester 2/Programming 2/Week 1/zoo-io-v3/animal_data.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Leo, Lion
|
||||||
|
Tommy, Tiger
|
||||||
|
Ollie, Elephant
|
||||||
|
Roland, Rat
|
||||||
|
Rudolph, Reindeer
|
||||||
|
Lenny, Lion
|
||||||
|
Nellie, Elephant
|
||||||
|
Tessa, Tiger
|
||||||
|
Hetty, Elephant
|
||||||
|
Leslie, Lion
|
@@ -0,0 +1,3 @@
|
|||||||
|
Bobby, Bear
|
||||||
|
Andy, Aardvark
|
||||||
|
Polly, African Grey Parrot
|
51
Semester 2/Programming 2/Week 1/zoo-io-v3/package.bluej
Normal file
51
Semester 2/Programming 2/Week 1/zoo-io-v3/package.bluej
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
#BlueJ package file
|
||||||
|
dependency1.from=Zoo
|
||||||
|
dependency1.to=Animal
|
||||||
|
dependency1.type=UsesDependency
|
||||||
|
dependency2.from=ZooApp
|
||||||
|
dependency2.to=Zoo
|
||||||
|
dependency2.type=UsesDependency
|
||||||
|
objectbench.height=76
|
||||||
|
objectbench.width=686
|
||||||
|
package.editor.height=400
|
||||||
|
package.editor.width=560
|
||||||
|
package.editor.x=774
|
||||||
|
package.editor.y=277
|
||||||
|
package.numDependencies=2
|
||||||
|
package.numTargets=3
|
||||||
|
package.showExtends=true
|
||||||
|
package.showUses=true
|
||||||
|
project.charset=UTF-8
|
||||||
|
target1.editor.height=728
|
||||||
|
target1.editor.width=900
|
||||||
|
target1.editor.x=423
|
||||||
|
target1.editor.y=237
|
||||||
|
target1.height=50
|
||||||
|
target1.name=ZooApp
|
||||||
|
target1.showInterface=false
|
||||||
|
target1.type=ClassTarget
|
||||||
|
target1.typeParameters=
|
||||||
|
target1.width=80
|
||||||
|
target1.x=260
|
||||||
|
target1.y=60
|
||||||
|
target2.height=50
|
||||||
|
target2.name=Animal
|
||||||
|
target2.showInterface=false
|
||||||
|
target2.type=ClassTarget
|
||||||
|
target2.typeParameters=
|
||||||
|
target2.width=80
|
||||||
|
target2.x=100
|
||||||
|
target2.y=60
|
||||||
|
target3.editor.height=700
|
||||||
|
target3.editor.width=900
|
||||||
|
target3.editor.x=16
|
||||||
|
target3.editor.y=254
|
||||||
|
target3.height=50
|
||||||
|
target3.name=Zoo
|
||||||
|
target3.naviview.expanded=true
|
||||||
|
target3.showInterface=false
|
||||||
|
target3.type=ClassTarget
|
||||||
|
target3.typeParameters=
|
||||||
|
target3.width=80
|
||||||
|
target3.x=180
|
||||||
|
target3.y=10
|
Reference in New Issue
Block a user