[tor-commits] [onionoo/release] renamed all getter methods that return [Bb]oolean to follow isXY() pattern

karsten at torproject.org karsten at torproject.org
Tue Nov 20 13:43:09 UTC 2018


commit e4b1c696d61c0026054a1595a6fc19b917019eda
Author: tordinge <tordinge at aprivatesub.net>
Date:   Fri Oct 12 19:45:12 2018 -0400

    renamed all getter methods that return [Bb]oolean to follow isXY() pattern
---
 CHANGELOG.md                                                      | 2 ++
 .../java/org/torproject/metrics/onionoo/docs/DetailsDocument.java | 8 ++++----
 .../java/org/torproject/metrics/onionoo/docs/DetailsStatus.java   | 6 +++---
 src/main/java/org/torproject/metrics/onionoo/docs/NodeStatus.java | 2 +-
 .../java/org/torproject/metrics/onionoo/docs/SummaryDocument.java | 2 +-
 .../java/org/torproject/metrics/onionoo/server/NodeIndexer.java   | 4 ++--
 .../org/torproject/metrics/onionoo/server/ResponseBuilder.java    | 8 ++++----
 .../metrics/onionoo/updater/NodeDetailsStatusUpdater.java         | 4 ++--
 .../torproject/metrics/onionoo/writer/DetailsDocumentWriter.java  | 8 ++++----
 .../torproject/metrics/onionoo/writer/SummaryDocumentWriter.java  | 2 +-
 10 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b013d9e..c7fc775 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,8 @@
  * Minor changes
    - Rename root package org.torproject.onionoo to
      org.torproject.metrics.onionoo.
+   - Rename all [Bb]oolean field getter methods to follow isXY()
+     pattern.
 
 
 # Changes in version 7.0-1.18.1 - 2018-09-11
diff --git a/src/main/java/org/torproject/metrics/onionoo/docs/DetailsDocument.java b/src/main/java/org/torproject/metrics/onionoo/docs/DetailsDocument.java
index 003ba07..3e2b8a6 100644
--- a/src/main/java/org/torproject/metrics/onionoo/docs/DetailsDocument.java
+++ b/src/main/java/org/torproject/metrics/onionoo/docs/DetailsDocument.java
@@ -128,7 +128,7 @@ public class DetailsDocument extends Document {
     this.running = running;
   }
 
-  public Boolean getRunning() {
+  public Boolean isRunning() {
     return this.running;
   }
 
@@ -527,7 +527,7 @@ public class DetailsDocument extends Document {
     this.recommendedVersion = recommendedVersion;
   }
 
-  public Boolean getRecommendedVersion() {
+  public Boolean isRecommendedVersion() {
     return this.recommendedVersion;
   }
 
@@ -537,7 +537,7 @@ public class DetailsDocument extends Document {
     this.hibernating = hibernating;
   }
 
-  public Boolean getHibernating() {
+  public Boolean isHibernating() {
     return this.hibernating;
   }
 
@@ -558,7 +558,7 @@ public class DetailsDocument extends Document {
     this.measured = measured;
   }
 
-  public Boolean getMeasured() {
+  public Boolean isMeasured() {
     return this.measured;
   }
 
diff --git a/src/main/java/org/torproject/metrics/onionoo/docs/DetailsStatus.java b/src/main/java/org/torproject/metrics/onionoo/docs/DetailsStatus.java
index 6b93db9..b6dd8be 100644
--- a/src/main/java/org/torproject/metrics/onionoo/docs/DetailsStatus.java
+++ b/src/main/java/org/torproject/metrics/onionoo/docs/DetailsStatus.java
@@ -171,7 +171,7 @@ public class DetailsStatus extends Document {
     this.hibernating = hibernating;
   }
 
-  public Boolean getHibernating() {
+  public Boolean isHibernating() {
     return this.hibernating;
   }
 
@@ -369,7 +369,7 @@ public class DetailsStatus extends Document {
     this.recommendedVersion = recommendedVersion;
   }
 
-  public Boolean getRecommendedVersion() {
+  public Boolean isRecommendedVersion() {
     return this.recommendedVersion;
   }
 
@@ -379,7 +379,7 @@ public class DetailsStatus extends Document {
     this.measured = measured;
   }
 
-  public Boolean getMeasured() {
+  public Boolean isMeasured() {
     return this.measured;
   }
 
diff --git a/src/main/java/org/torproject/metrics/onionoo/docs/NodeStatus.java b/src/main/java/org/torproject/metrics/onionoo/docs/NodeStatus.java
index 4c8dc68..826db9e 100644
--- a/src/main/java/org/torproject/metrics/onionoo/docs/NodeStatus.java
+++ b/src/main/java/org/torproject/metrics/onionoo/docs/NodeStatus.java
@@ -367,7 +367,7 @@ public class NodeStatus extends Document {
     this.recommendedVersion = recommendedVersion;
   }
 
-  public Boolean getRecommendedVersion() {
+  public Boolean isRecommendedVersion() {
     return this.recommendedVersion;
   }
 
diff --git a/src/main/java/org/torproject/metrics/onionoo/docs/SummaryDocument.java b/src/main/java/org/torproject/metrics/onionoo/docs/SummaryDocument.java
index d5dba7c..dc7230b 100644
--- a/src/main/java/org/torproject/metrics/onionoo/docs/SummaryDocument.java
+++ b/src/main/java/org/torproject/metrics/onionoo/docs/SummaryDocument.java
@@ -360,7 +360,7 @@ public class SummaryDocument extends Document {
     this.recommendedVersion = recommendedVersion;
   }
 
-  public Boolean getRecommendedVersion() {
+  public Boolean isRecommendedVersion() {
     return this.recommendedVersion;
   }
 
diff --git a/src/main/java/org/torproject/metrics/onionoo/server/NodeIndexer.java b/src/main/java/org/torproject/metrics/onionoo/server/NodeIndexer.java
index a5128e1..33cabb6 100644
--- a/src/main/java/org/torproject/metrics/onionoo/server/NodeIndexer.java
+++ b/src/main/java/org/torproject/metrics/onionoo/server/NodeIndexer.java
@@ -293,7 +293,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
         newRelaysByHostName.get(hostNameLowerCase).add(fingerprint);
         newRelaysByHostName.get(hostNameLowerCase).add(hashedFingerprint);
       }
-      Boolean recommendedVersion = entry.getRecommendedVersion();
+      Boolean recommendedVersion = entry.isRecommendedVersion();
       if (null != recommendedVersion) {
         newRelaysByRecommendedVersion.get(recommendedVersion).add(fingerprint);
         newRelaysByRecommendedVersion.get(recommendedVersion).add(
@@ -362,7 +362,7 @@ public class NodeIndexer implements ServletContextListener, Runnable {
         newBridgesByOperatingSystem.get(operatingSystem)
             .add(hashedHashedFingerprint);
       }
-      Boolean recommendedVersion = entry.getRecommendedVersion();
+      Boolean recommendedVersion = entry.isRecommendedVersion();
       if (null != recommendedVersion) {
         newBridgesByRecommendedVersion.get(recommendedVersion).add(
             hashedFingerprint);
diff --git a/src/main/java/org/torproject/metrics/onionoo/server/ResponseBuilder.java b/src/main/java/org/torproject/metrics/onionoo/server/ResponseBuilder.java
index fafa20b..7d4dcde 100644
--- a/src/main/java/org/torproject/metrics/onionoo/server/ResponseBuilder.java
+++ b/src/main/java/org/torproject/metrics/onionoo/server/ResponseBuilder.java
@@ -273,7 +273,7 @@ public class ResponseBuilder {
               dd.setFirstSeen(detailsDocument.getFirstSeen());
               break;
             case "running":
-              dd.setRunning(detailsDocument.getRunning());
+              dd.setRunning(detailsDocument.isRunning());
               break;
             case "flags":
               dd.setFlags(detailsDocument.getFlags());
@@ -362,10 +362,10 @@ public class ResponseBuilder {
               break;
             case "recommended_version":
               dd.setRecommendedVersion(
-                  detailsDocument.getRecommendedVersion());
+                  detailsDocument.isRecommendedVersion());
               break;
             case "hibernating":
-              dd.setHibernating(detailsDocument.getHibernating());
+              dd.setHibernating(detailsDocument.isHibernating());
               break;
             case "transports":
               dd.setTransports(detailsDocument.getTransports());
@@ -374,7 +374,7 @@ public class ResponseBuilder {
               dd.setEffectiveFamily(detailsDocument.getEffectiveFamily());
               break;
             case "measured":
-              dd.setMeasured(detailsDocument.getMeasured());
+              dd.setMeasured(detailsDocument.isMeasured());
               break;
             case "alleged_family":
               dd.setAllegedFamily(detailsDocument.getAllegedFamily());
diff --git a/src/main/java/org/torproject/metrics/onionoo/updater/NodeDetailsStatusUpdater.java b/src/main/java/org/torproject/metrics/onionoo/updater/NodeDetailsStatusUpdater.java
index e5a3f48..2bdf03f 100644
--- a/src/main/java/org/torproject/metrics/onionoo/updater/NodeDetailsStatusUpdater.java
+++ b/src/main/java/org/torproject/metrics/onionoo/updater/NodeDetailsStatusUpdater.java
@@ -489,7 +489,7 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
           updatedNodeStatus.setAsNumber(nodeStatus.getAsNumber());
           updatedNodeStatus.setAsName(nodeStatus.getAsName());
           updatedNodeStatus.setRecommendedVersion(
-              nodeStatus.getRecommendedVersion());
+              nodeStatus.isRecommendedVersion());
           updatedNodeStatus.setVersion(nodeStatus.getVersion());
         }
         if (nodeStatus.getFirstSeenMillis()
@@ -935,7 +935,7 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
       detailsStatus.setDefaultPolicy(nodeStatus.getDefaultPolicy());
       detailsStatus.setPortList(nodeStatus.getPortList());
       detailsStatus.setRecommendedVersion(
-          nodeStatus.getRecommendedVersion());
+          nodeStatus.isRecommendedVersion());
       detailsStatus.setLastChangedOrAddressOrPort(
           nodeStatus.getLastChangedOrAddressOrPort());
       detailsStatus.setVersion(nodeStatus.getVersion());
diff --git a/src/main/java/org/torproject/metrics/onionoo/writer/DetailsDocumentWriter.java b/src/main/java/org/torproject/metrics/onionoo/writer/DetailsDocumentWriter.java
index 0be2b21..a497cfd 100644
--- a/src/main/java/org/torproject/metrics/onionoo/writer/DetailsDocumentWriter.java
+++ b/src/main/java/org/torproject/metrics/onionoo/writer/DetailsDocumentWriter.java
@@ -89,7 +89,7 @@ public class DetailsDocumentWriter implements DocumentWriter {
       detailsDocument.setExitPolicySummary(exitPolicySummary);
     }
     detailsDocument.setRecommendedVersion(
-        detailsStatus.getRecommendedVersion());
+        detailsStatus.isRecommendedVersion());
     detailsDocument.setCountry(detailsStatus.getCountryCode());
     detailsDocument.setLatitude(detailsStatus.getLatitude());
     detailsDocument.setLongitude(detailsStatus.getLongitude());
@@ -135,13 +135,13 @@ public class DetailsDocumentWriter implements DocumentWriter {
     }
     detailsDocument.setExitPolicyV6Summary(
         detailsStatus.getExitPolicyV6Summary());
-    detailsDocument.setHibernating(detailsStatus.getHibernating());
+    detailsDocument.setHibernating(detailsStatus.isHibernating());
     if (detailsStatus.getExitAddresses() != null) {
       List<String> exitAddresses = new ArrayList<>(new TreeSet<>(
           detailsStatus.getExitAddresses().keySet()));
       detailsDocument.setExitAddresses(exitAddresses);
     }
-    detailsDocument.setMeasured(detailsStatus.getMeasured());
+    detailsDocument.setMeasured(detailsStatus.isMeasured());
     List<String> unreachableOrAddresses = new ArrayList<>();
     if (null != detailsStatus.getAdvertisedOrAddresses()) {
       unreachableOrAddresses.addAll(detailsStatus.getAdvertisedOrAddresses());
@@ -178,7 +178,7 @@ public class DetailsDocumentWriter implements DocumentWriter {
     detailsDocument.setRunning(detailsStatus.isRunning());
     detailsDocument.setFlags(detailsStatus.getRelayFlags());
     detailsDocument.setRecommendedVersion(
-        detailsStatus.getRecommendedVersion());
+        detailsStatus.isRecommendedVersion());
     detailsDocument.setLastRestarted(detailsStatus.getLastRestarted());
     detailsDocument.setAdvertisedBandwidth(
         detailsStatus.getAdvertisedBandwidth());
diff --git a/src/main/java/org/torproject/metrics/onionoo/writer/SummaryDocumentWriter.java b/src/main/java/org/torproject/metrics/onionoo/writer/SummaryDocumentWriter.java
index 4b20ba8..0103c31 100644
--- a/src/main/java/org/torproject/metrics/onionoo/writer/SummaryDocumentWriter.java
+++ b/src/main/java/org/torproject/metrics/onionoo/writer/SummaryDocumentWriter.java
@@ -97,7 +97,7 @@ public class SummaryDocumentWriter implements DocumentWriter {
       SortedSet<String> verifiedHostNames = nodeStatus.getVerifiedHostNames();
       SortedSet<String> unverifiedHostNames =
           nodeStatus.getUnverifiedHostNames();
-      Boolean recommendedVersion = nodeStatus.getRecommendedVersion();
+      Boolean recommendedVersion = nodeStatus.isRecommendedVersion();
       SummaryDocument summaryDocument = new SummaryDocument(isRelay,
           nickname, fingerprint, addresses, lastSeenMillis, running,
           relayFlags, consensusWeight, countryCode, firstSeenMillis,





More information about the tor-commits mailing list