first commit
This commit is contained in:
2000
Labs/Lab 4/src/barnestr/2000words.txt
Normal file
2000
Labs/Lab 4/src/barnestr/2000words.txt
Normal file
File diff suppressed because it is too large
Load Diff
13
Labs/Lab 4/src/barnestr/AutoCompleter.java
Normal file
13
Labs/Lab 4/src/barnestr/AutoCompleter.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package barnestr;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AutoCompleter {
|
||||
|
||||
void initialize(String filename);
|
||||
|
||||
List allThatBeginsWith(String prefix);
|
||||
|
||||
long getLastOperationTime();
|
||||
|
||||
}
|
||||
39
Labs/Lab 4/src/barnestr/ForEachArrayStrategy.java
Normal file
39
Labs/Lab 4/src/barnestr/ForEachArrayStrategy.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package barnestr;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ForEachArrayStrategy implements AutoCompleter{
|
||||
|
||||
ArrayList<String> entries = new ArrayList<>();
|
||||
@Override
|
||||
public void initialize(String filename) {
|
||||
//TODO
|
||||
try(Scanner in = new Scanner(new File(filename))) {
|
||||
while(in.hasNext()) {
|
||||
if (filename.endsWith(".csv")) {
|
||||
String[] line = in.nextLine().split(",");
|
||||
entries.add()
|
||||
} else if (filename.endsWith(".txt")) {
|
||||
entries.add(in.next());
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List allThatBeginsWith(String prefix) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastOperationTime() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
20
Labs/Lab 4/src/barnestr/ForEachLinkedStrategy.java
Normal file
20
Labs/Lab 4/src/barnestr/ForEachLinkedStrategy.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package barnestr;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ForEachLinkedStrategy implements AutoCompleter{
|
||||
@Override
|
||||
public void initialize(String filename) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List allThatBeginsWith(String prefix) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastOperationTime() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
20
Labs/Lab 4/src/barnestr/IndexArrayStrategy.java
Normal file
20
Labs/Lab 4/src/barnestr/IndexArrayStrategy.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package barnestr;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class IndexArrayStrategy implements AutoCompleter{
|
||||
@Override
|
||||
public void initialize(String filename) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List allThatBeginsWith(String prefix) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastOperationTime() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
20
Labs/Lab 4/src/barnestr/IndexLinkedStrategy.java
Normal file
20
Labs/Lab 4/src/barnestr/IndexLinkedStrategy.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package barnestr;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class IndexLinkedStrategy implements AutoCompleter{
|
||||
@Override
|
||||
public void initialize(String filename) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List allThatBeginsWith(String prefix) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLastOperationTime() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
7
Labs/Lab 4/src/barnestr/Lab4.java
Normal file
7
Labs/Lab 4/src/barnestr/Lab4.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package barnestr;
|
||||
|
||||
public class Lab4 {
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
72
Labs/Lab 4/src/barnestr/Lab4Controller.fxml
Normal file
72
Labs/Lab 4/src/barnestr/Lab4Controller.fxml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Menu?>
|
||||
<?import javafx.scene.control.MenuBar?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.RadioMenuItem?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.ToggleGroup?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
|
||||
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="360.0" prefWidth="360.0" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="barnestr.Lab4Controller">
|
||||
<children>
|
||||
<MenuBar>
|
||||
<menus>
|
||||
<Menu mnemonicParsing="false" text="File">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="Close" />
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="Strategy">
|
||||
<items>
|
||||
<RadioMenuItem fx:id="radioArrayListIndex" mnemonicParsing="false" selected="true" text="ArrayList Index">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="strategy" />
|
||||
</toggleGroup>
|
||||
</RadioMenuItem>
|
||||
<RadioMenuItem fx:id="radioLinkedListIndex" mnemonicParsing="false" text="LinkedList Index" toggleGroup="$strategy" />
|
||||
<RadioMenuItem fx:id="radioArrayListFor" mnemonicParsing="false" text="ArrayList For-Each" toggleGroup="$strategy" />
|
||||
<RadioMenuItem fx:id="radioLinkedListFor" mnemonicParsing="false" text="LinkedList For-Each" toggleGroup="$strategy" />
|
||||
</items>
|
||||
</Menu>
|
||||
</menus>
|
||||
</MenuBar>
|
||||
<VBox prefHeight="330.0" prefWidth="340.0">
|
||||
<children>
|
||||
<Label text="Search:" />
|
||||
<TextField fx:id="textSearch" prefWidth="300.0">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</TextField>
|
||||
<Label text="Matches:">
|
||||
<padding>
|
||||
<Insets top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<TextArea fx:id="textMatches" prefHeight="230.0" prefWidth="340.0">
|
||||
<font>
|
||||
<Font size="16.0" />
|
||||
</font>
|
||||
</TextArea>
|
||||
<BorderPane prefHeight="25.0" prefWidth="340.0">
|
||||
<left>
|
||||
<Label fx:id="labelTime" text="Time Required:" BorderPane.alignment="CENTER" />
|
||||
</left>
|
||||
<right>
|
||||
<Label fx:id="labelMatches" text="Matches found:" textAlignment="CENTER" BorderPane.alignment="CENTER" />
|
||||
</right>
|
||||
</BorderPane>
|
||||
</children>
|
||||
<VBox.margin>
|
||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
||||
</VBox.margin>
|
||||
</VBox>
|
||||
</children>
|
||||
</VBox>
|
||||
65
Labs/Lab 4/src/barnestr/Lab4Controller.java
Normal file
65
Labs/Lab 4/src/barnestr/Lab4Controller.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package barnestr;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.stage.FileChooser;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class Lab4Controller implements Initializable{
|
||||
|
||||
@FXML
|
||||
private RadioMenuItem radioArrayListIndex;
|
||||
|
||||
@FXML
|
||||
private RadioMenuItem radioLinkedListIndex;
|
||||
|
||||
@FXML
|
||||
private RadioMenuItem radioArrayListFor;
|
||||
|
||||
@FXML
|
||||
private RadioMenuItem radioLinkedListFor;
|
||||
|
||||
@FXML
|
||||
private ToggleGroup strategy;
|
||||
|
||||
@FXML
|
||||
private TextField textSearch;
|
||||
|
||||
@FXML
|
||||
private TextArea textMatches;
|
||||
|
||||
@FXML
|
||||
private Label labelTime;
|
||||
|
||||
@FXML
|
||||
private Label labelMatches;
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
void close(ActionEvent event) {
|
||||
Platform.exit();
|
||||
}
|
||||
|
||||
@FXML
|
||||
void load(ActionEvent event) {
|
||||
try {
|
||||
FileChooser fileChooser = new FileChooser();
|
||||
fileChooser.setTitle("Open Dictionary File");
|
||||
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Dictionary Files","*txt", "*.csv"));
|
||||
|
||||
}catch(Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
BIN
Labs/Lab 4/src/barnestr/barnestr.zip
Normal file
BIN
Labs/Lab 4/src/barnestr/barnestr.zip
Normal file
Binary file not shown.
1000000
Labs/Lab 4/src/barnestr/top-1m.csv
Normal file
1000000
Labs/Lab 4/src/barnestr/top-1m.csv
Normal file
File diff suppressed because it is too large
Load Diff
113809
Labs/Lab 4/src/barnestr/words.txt
Normal file
113809
Labs/Lab 4/src/barnestr/words.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user