From bb250a5798bd54f56a5b40529c1c19cd99416a47 Mon Sep 17 00:00:00 2001 From: Emily Toop Date: Mon, 14 May 2018 19:40:46 +0100 Subject: [PATCH] Address review comments @nalexander --- .../mozilla/mentat/FFIIntegrationTest.java | 34 +++++++++---------- .../main/java/com/mozilla/mentat/Mentat.java | 14 ++++---- sdks/swift/Mentat/Mentat/Mentat.swift | 6 ++-- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/sdks/android/Mentat/library/src/androidTest/java/com/mozilla/mentat/FFIIntegrationTest.java b/sdks/android/Mentat/library/src/androidTest/java/com/mozilla/mentat/FFIIntegrationTest.java index cd86b027..8b56c2ab 100644 --- a/sdks/android/Mentat/library/src/androidTest/java/com/mozilla/mentat/FFIIntegrationTest.java +++ b/sdks/android/Mentat/library/src/androidTest/java/com/mozilla/mentat/FFIIntegrationTest.java @@ -50,6 +50,23 @@ public class FFIIntegrationTest { } } + class QueryTimer { + private long startTime = 0; + private long endTime = 0; + + public void start() { + this.startTime = System.nanoTime(); + } + + public void end() { + this.endTime = System.nanoTime(); + } + + public long duration() { + return this.endTime - this.startTime; + } + } + Mentat mentat = null; @Test @@ -1302,20 +1319,3 @@ public class FFIIntegrationTest { } } - -class QueryTimer { - private long startTime = 0; - private long endTime = 0; - - public void start() { - this.startTime = System.nanoTime(); - } - - public void end() { - this.endTime = System.nanoTime(); - } - - public long duration() { - return this.endTime - this.startTime; - } -} diff --git a/sdks/android/Mentat/library/src/main/java/com/mozilla/mentat/Mentat.java b/sdks/android/Mentat/library/src/main/java/com/mozilla/mentat/Mentat.java index 95dd0076..324ee4d6 100644 --- a/sdks/android/Mentat/library/src/main/java/com/mozilla/mentat/Mentat.java +++ b/sdks/android/Mentat/library/src/main/java/com/mozilla/mentat/Mentat.java @@ -52,7 +52,7 @@ public class Mentat extends RustObject { * Add an attribute to the cache. The {@link CacheDirection} determines how that attribute can be * looked up. * - * TODO: Throw an exception if cache action fails + * TODO: Throw an exception if cache action fails. https://github.com/mozilla/mentat/issues/700 * * @param attribute The attribute to cache * @param direction The direction the attribute should be keyed. @@ -79,7 +79,7 @@ public class Mentat extends RustObject { /** * Simple transact of an EDN string. - * TODO: Throw an exception if the transact fails + * TODO: Throw an exception if the transact fails. https://github.com/mozilla/mentat/issues/700 * @param transaction The string, as EDN, to be transacted. * @return The {@link TxReport} of the completed transaction */ @@ -117,7 +117,7 @@ public class Mentat extends RustObject { /** * Retrieve a single value of an attribute for an Entity - * TODO: Throw an exception if the result contains an error. + * TODO: Throw an exception if the result contains an error. https://github.com/mozilla/mentat/issues/700 * @param attribute The string the attribute whose value is to be returned. The string is represented as `:namespace/name`. * @param entid The `Entid` of the entity we want the value from. * @return The {@link TypedValue} containing the value of the attribute for the entity. @@ -171,7 +171,7 @@ public class Mentat extends RustObject { /** * Start a new transaction * - * TODO: Throw an exception if the result contains an error. + * TODO: Throw an exception if the result contains an error. https://github.com/mozilla/mentat/issues/700 * * @return The {@link InProgress} used to manage the transaction */ @@ -192,7 +192,7 @@ public class Mentat extends RustObject { * Creates a new transaction ({@link InProgress}) and returns an {@link InProgressBuilder} for * that transaction. * - * TODO: Throw an exception if the result contains an error. + * TODO: Throw an exception if the result contains an error. https://github.com/mozilla/mentat/issues/700 * * @return an {@link InProgressBuilder} for a new transaction. */ @@ -213,7 +213,7 @@ public class Mentat extends RustObject { * Creates a new transaction ({@link InProgress}) and returns an {@link EntityBuilder} for the * entity with `entid` for that transaction. * - * TODO: Throw an exception if the result contains an error. + * TODO: Throw an exception if the result contains an error. https://github.com/mozilla/mentat/issues/700 * * @param entid The `Entid` for this entity. * @return an {@link EntityBuilder} for a new transaction. @@ -235,7 +235,7 @@ public class Mentat extends RustObject { * Creates a new transaction ({@link InProgress}) and returns an {@link EntityBuilder} for a new * entity with `tempId` for that transaction. * - * TODO: Throw an exception if the result contains an error. + * TODO: Throw an exception if the result contains an error. https://github.com/mozilla/mentat/issues/700 * * @param tempId The temporary identifier for this entity. * @return an {@link EntityBuilder} for a new transaction. diff --git a/sdks/swift/Mentat/Mentat/Mentat.swift b/sdks/swift/Mentat/Mentat/Mentat.swift index 06a30b76..fb3fae2f 100644 --- a/sdks/swift/Mentat/Mentat/Mentat.swift +++ b/sdks/swift/Mentat/Mentat/Mentat.swift @@ -68,11 +68,11 @@ class Mentat: RustObject { - Parameter attribute: The attribute to cache - Parameter direction: The direction the attribute should be keyed. - `FORWARD` caches values for an attribute keyed by entity + `forward` caches values for an attribute keyed by entity (i.e. find values and entities that have this attribute, or find values of attribute for an entity) - `REVERSE` caches entities for an attribute keyed by value. + `reverse` caches entities for an attribute keyed by value. (i.e. find entities that have a particular value for an attribute). - `BOTH` adds an attribute such that it is cached in both directions. + `both` adds an attribute such that it is cached in both directions. - Throws: `ResultError.error` if an error occured while trying to cache the attribute. */