incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [12/45] git commit: Tidying up code
Date Sat, 28 Sep 2013 02:11:58 GMT
Tidying up code

Signed-off-by: Aaron McCurry <amccurry@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/e2725de7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/e2725de7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/e2725de7

Branch: refs/heads/apache-blur-0.2
Commit: e2725de7cda1ac3261ffb8e2aeade58cc85942de
Parents: cd2c6ff
Author: hunterwilliams <hunter.williams@bti360.com>
Authored: Thu Sep 12 14:54:36 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Sep 15 20:56:22 2013 -0400

----------------------------------------------------------------------
 .../org/apache/blur/shell/TermsDataCommand.java | 95 +++++++++-----------
 1 file changed, 41 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e2725de7/blur-shell/src/main/java/org/apache/blur/shell/TermsDataCommand.java
----------------------------------------------------------------------
diff --git a/blur-shell/src/main/java/org/apache/blur/shell/TermsDataCommand.java b/blur-shell/src/main/java/org/apache/blur/shell/TermsDataCommand.java
index 1ce646b..3744612 100644
--- a/blur-shell/src/main/java/org/apache/blur/shell/TermsDataCommand.java
+++ b/blur-shell/src/main/java/org/apache/blur/shell/TermsDataCommand.java
@@ -59,69 +59,56 @@ public class TermsDataCommand extends Command implements TableFirstArgCommand
{
   }
 
   private void doitInternal(PrintWriter outPw, Blur.Iface client, String[] args) throws FinishedException,
-      BlurException, TException{
-      PagingPrintWriter out = new PagingPrintWriter(outPw);
-      CommandLine cmd = parse(args, outPw);
-      /*
-      #then this starts displaying all the row ids in the system
-      terms testtable rowid
-      #This command starts displaying all the terms for column "col1" in family "fam0"in
the system
-      terms testtable fam0.col1
-      #This command starts displaying all the terms for column "col1" in family "fam0"in
the system starting at "value1"
-      terms testtable fam0.col1 -s value1
-      #This command starts displaying all the terms for column "col1" in family "fam0"in
the system starting at "value1" fetch 100 then exit
-      terms testtable fam0.col1 -s value1 -n 100
-      */
-      String tablename = args[1];
-      String namePlusValue = args[2];
-      String family = null;
-      String column = namePlusValue;
-      String startWith = "";
-      short size = 100;
+    BlurException, TException{
+    PagingPrintWriter out = new PagingPrintWriter(outPw);
+    CommandLine cmd = parse(args, outPw);
+
+    String tablename = args[1];
+    String familyPlusColumn = args[2];
+    String family = null;
+    String column = familyPlusColumn;
+    String startWith = "";
+    short size = 100;
       
         
-      if (namePlusValue.contains(".")){
-        int index = namePlusValue.indexOf(".");
-        family = namePlusValue.substring(0, index);
-        column = namePlusValue.substring(index + 1);
-      }
-
-      if (cmd.hasOption("n")){
-        size = Short.parseShort(cmd.getOptionValue("n"));
-      }
-
-      if (cmd.hasOption("s")){
-        startWith = cmd.getOptionValue("s");
-        out.println("startWith:"+startWith);
-      }
+    if (familyPlusColumn.contains(".")){
+      int index = familyPlusColumn.indexOf(".");
+      family = familyPlusColumn.substring(0, index);
+      column = familyPlusColumn.substring(index + 1);
+    }
 
-      boolean checkFreq = false;
-      if (cmd.hasOption("F")){
-        checkFreq = true;
-      }
+    if (cmd.hasOption("n")){
+      size = Short.parseShort(cmd.getOptionValue("n"));
+    }
 
-      int maxWidth = 100;
-      ConsoleReader reader = getConsoleReader();
-      if (reader != null) {
-        Terminal terminal = reader.getTerminal();
-        maxWidth = terminal.getWidth() - 15;
-        out.setLineLimit(terminal.getHeight() - 2);
-      }
+    if (cmd.hasOption("s")){
+      startWith = cmd.getOptionValue("s");
+    }
 
+    boolean checkFreq = false;
+    if (cmd.hasOption("F")){
+      checkFreq = true;
+    }
 
+    int maxWidth = 100;
+    ConsoleReader reader = getConsoleReader();
+    if (reader != null) {
+      Terminal terminal = reader.getTerminal();
+      maxWidth = terminal.getWidth() - 15;
+      out.setLineLimit(terminal.getHeight() - 2);
+    }
 
-      //todo print line by line. also break input at certain amount
-      List<String> terms = client.terms(tablename,family,column,startWith,size);
-      for (int i=0;i<terms.size(); i++){
-        if (checkFreq){
-            out.println(terms.get(i)+"\t"+client.recordFrequency(tablename,family,column,terms.get(i)));
-        }
-        else
-        {
-           out.println(terms.get(i));
-        }
+    List<String> terms = client.terms(tablename,family,column,startWith,size);
+    for (int i=0;i<terms.size(); i++){
+      if (checkFreq){
+        out.println(terms.get(i)+"\t"+client.recordFrequency(tablename,family,column,terms.get(i)));
+      }
+      else
+      {
+        out.println(terms.get(i));
       }
     }
+  }
 
   @Override
   public String description() {


Mime
View raw message