summaryrefslogtreecommitdiff
path: root/src/main/FarmShell.java
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-05-14 15:32:29 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-05-14 15:32:40 +0200
commit709c04082ffdcc30c93cd13e7aef06eab1f1f428 (patch)
treec4ac4347da7e63b295ae4d563f525b902ac67d11 /src/main/FarmShell.java
parent4e6c764a4f143b6055fd357d444efbbd8237b91e (diff)
downloadGoldfarmer-709c04082ffdcc30c93cd13e7aef06eab1f1f428.tar.gz
Fixups
Diffstat (limited to 'src/main/FarmShell.java')
-rw-r--r--src/main/FarmShell.java37
1 files changed, 9 insertions, 28 deletions
diff --git a/src/main/FarmShell.java b/src/main/FarmShell.java
index 82478ec..c41ad6b 100644
--- a/src/main/FarmShell.java
+++ b/src/main/FarmShell.java
@@ -1,43 +1,24 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-
package main;
import java.io.IOException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.Scanner;
-import java.util.Set;
/**
*
* @author s123188
*/
public class FarmShell {
-
+
private final Scanner scanner = new Scanner(System.in);
-
+
Analyzor analyzor;
-
- /*
+
private void printPrompt() {
- if (stream_cached == null) {
- // "dollars are worthless"
- System.out.print("$ ");
- } else if (stream_cached.isValid()) {
- // "we make money now by receiving tweets"
- System.out.print("€ ");
- } else {
- // "we previously made money, but not anymore"
- System.out.print("ƒ ");
- }
+ System.out.print("$ ");
}
-*/
+
/**
* Processes commands from stdin until the exit command is received or EOF.
*/
@@ -46,7 +27,7 @@ public class FarmShell {
+ "or 'exit' to leave. '.' repeats the previous interactive "
+ "command.");
// print prompt for reading first command
- //printPrompt();
+ printPrompt();
String lastLine = "";
while (scanner.hasNextLine()) {
String line = scanner.nextLine().trim();
@@ -62,7 +43,7 @@ public class FarmShell {
lastLine = line;
}
// print prompt for reading next line
- //printPrompt();
+ printPrompt();
}
// prevent corrupted compressed files when exiting without a command
throw new NoSuchElementException();
@@ -88,7 +69,7 @@ public class FarmShell {
public boolean execute(String[] args) {
//make a new Analyzor
analyzor = new Analyzor();
-
+
try {
Command command = Command.fromString(args[0]);
String[] params = Arrays.copyOfRange(args, 1, args.length);
@@ -107,7 +88,7 @@ public class FarmShell {
}
enum Command {
-
+
query("make a query to the database; needed to do analysis", 1),
filterbots("marks all users as bot or not"),
sentiment("analyzes all tweets on positivity (about a brand)"),