gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject gora git commit: GORA-432 Simplify if Statements this closes #36
Date Thu, 03 Sep 2015 18:56:44 GMT
Repository: gora
Updated Branches:
  refs/heads/master ea44388f9 -> 578f5f886


GORA-432 Simplify if Statements this closes #36


Project: http://git-wip-us.apache.org/repos/asf/gora/repo
Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/578f5f88
Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/578f5f88
Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/578f5f88

Branch: refs/heads/master
Commit: 578f5f88661cf60382c1e19434ccfbe761ba73f8
Parents: ea44388
Author: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Authored: Thu Sep 3 11:57:51 2015 -0700
Committer: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Committed: Thu Sep 3 11:57:51 2015 -0700

----------------------------------------------------------------------
 CHANGES.txt                                                   | 2 ++
 .../java/org/apache/gora/accumulo/encoders/HexEncoder.java    | 5 +----
 .../java/org/apache/gora/examples/mapreduce/QueryCounter.java | 4 ++--
 .../src/main/java/org/apache/gora/query/impl/ResultBase.java  | 7 ++-----
 .../main/java/org/apache/gora/query/ws/impl/ResultWSBase.java | 5 +----
 .../main/java/org/apache/gora/hbase/store/HBaseColumn.java    | 6 +-----
 .../java/org/apache/gora/hbase/util/HBaseByteInterface.java   | 2 +-
 7 files changed, 10 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/578f5f88/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3f7e94d..fb77565 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,8 @@
 
 Current Development
 
+* GORA-432 Simplify if Statements (Furkan KAMACI via lewismc)
+
 * GORA-386 Gora Spark Backend Support (Furkan KAMACI, talat, lewismc)
 
 * GORA-429 Implement Maven forbidden-apis plugin in Gora (lewismc, rmarroquin)

http://git-wip-us.apache.org/repos/asf/gora/blob/578f5f88/gora-accumulo/src/main/java/org/apache/gora/accumulo/encoders/HexEncoder.java
----------------------------------------------------------------------
diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/encoders/HexEncoder.java
b/gora-accumulo/src/main/java/org/apache/gora/accumulo/encoders/HexEncoder.java
index cba08c2..d2291c5 100644
--- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/encoders/HexEncoder.java
+++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/encoders/HexEncoder.java
@@ -147,10 +147,7 @@ public class HexEncoder implements Encoder {
   
   @Override
   public boolean decodeBoolean(byte[] val) {
-    if (decodeByte(val) == 1) {
-      return true;
-    }
-    return false;
+      return decodeByte(val) == 1;
   }
   
   @Override

http://git-wip-us.apache.org/repos/asf/gora/blob/578f5f88/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java
----------------------------------------------------------------------
diff --git a/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java
b/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java
index 50e6902..a182df6 100644
--- a/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java
+++ b/gora-core/src/examples/java/org/apache/gora/examples/mapreduce/QueryCounter.java
@@ -99,7 +99,7 @@ public class QueryCounter<K, T extends Persistent> extends Configured
implements
   public long countQuery(DataStore<K,T> dataStore, Query<K,T> query) throws Exception
{
     Job job = createJob(dataStore, query);
     job.waitForCompletion(true);
-    assert(job.isComplete() == true);
+    assert(job.isComplete());
 
     return job.getCounters().findCounter(COUNTER_GROUP, ROWS).getValue();
   }
@@ -113,7 +113,7 @@ public class QueryCounter<K, T extends Persistent> extends Configured
implements
 
     Job job = createJob(dataStore, query);
     job.waitForCompletion(true);
-    assert(job.isComplete() == true);
+    assert(job.isComplete());
 
     return job.getCounters().findCounter(COUNTER_GROUP, ROWS).getValue();
   }

http://git-wip-us.apache.org/repos/asf/gora/blob/578f5f88/gora-core/src/main/java/org/apache/gora/query/impl/ResultBase.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/query/impl/ResultBase.java b/gora-core/src/main/java/org/apache/gora/query/impl/ResultBase.java
index 334c6c7..5b828fc 100644
--- a/gora-core/src/main/java/org/apache/gora/query/impl/ResultBase.java
+++ b/gora-core/src/main/java/org/apache/gora/query/impl/ResultBase.java
@@ -86,10 +86,7 @@ public abstract class ResultBase<K, T extends Persistent>
    * Returns whether the limit for the query is reached. 
    */
   protected boolean isLimitReached() {
-    if(limit > 0 && offset >= limit) {
-      return true;
-    }
-    return false;
+    return limit > 0 && offset >= limit;
   }
   
   protected void clear() {
@@ -112,7 +109,7 @@ public abstract class ResultBase<K, T extends Persistent>
       clear();
       persistent = getOrCreatePersistent(persistent);
       ret = nextInner();
-      if (ret == false) {
+      if (!ret) {
         //this is the end
         break;
       }

http://git-wip-us.apache.org/repos/asf/gora/blob/578f5f88/gora-core/src/main/java/org/apache/gora/query/ws/impl/ResultWSBase.java
----------------------------------------------------------------------
diff --git a/gora-core/src/main/java/org/apache/gora/query/ws/impl/ResultWSBase.java b/gora-core/src/main/java/org/apache/gora/query/ws/impl/ResultWSBase.java
index af27573..eba7ca3 100644
--- a/gora-core/src/main/java/org/apache/gora/query/ws/impl/ResultWSBase.java
+++ b/gora-core/src/main/java/org/apache/gora/query/ws/impl/ResultWSBase.java
@@ -120,10 +120,7 @@ public abstract class ResultWSBase<K, T extends Persistent>
    * Returns whether the limit for the query is reached. 
    */
   protected boolean isLimitReached() {
-    if(limit > 0 && offset >= limit) {
-      return true;
-    }
-    return false;
+    return limit > 0 && offset >= limit;
   }
   
   /**

http://git-wip-us.apache.org/repos/asf/gora/blob/578f5f88/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseColumn.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseColumn.java b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseColumn.java
index b1673fa..6fef215 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseColumn.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/store/HBaseColumn.java
@@ -65,11 +65,7 @@ public class HBaseColumn {
     if (getClass() != obj.getClass())
       return false;
     HBaseColumn other = (HBaseColumn) obj;
-    if (!Arrays.equals(family, other.family))
-      return false;
-    if (!Arrays.equals(qualifier, other.qualifier))
-      return false;
-    return true;
+    return Arrays.equals(family, other.family) && Arrays.equals(qualifier, other.qualifier);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/gora/blob/578f5f88/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java
----------------------------------------------------------------------
diff --git a/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java b/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java
index e9b415f..ee19c4c 100644
--- a/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java
+++ b/gora-hbase/src/main/java/org/apache/gora/hbase/util/HBaseByteInterface.java
@@ -158,7 +158,7 @@ public class HBaseByteInterface {
     if (clazz.equals(Byte.TYPE) || clazz.equals(Byte.class)) {
       return (K) Byte.valueOf(val[0]);
     } else if (clazz.equals(Boolean.TYPE) || clazz.equals(Boolean.class)) {
-      return (K) Boolean.valueOf(val[0] == 0 ? false : true);
+      return (K) Boolean.valueOf(val[0] != 0);
     } else if (clazz.equals(Short.TYPE) || clazz.equals(Short.class)) {
       return (K) Short.valueOf(Bytes.toShort(val));
     } else if (clazz.equals(Integer.TYPE) || clazz.equals(Integer.class)) {


Mime
View raw message