Document Equals and Compare_To methods in each class
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/08ccc759 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/08ccc759 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/08ccc759 Branch: refs/heads/master Commit: 08ccc759fc672c79ace5d346da39b495c7170e8b Parents: fe3b37b Author: Nick Wellnhofer <[email protected]> Authored: Thu Feb 4 13:55:58 2016 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Thu Feb 4 14:33:30 2016 +0100 ---------------------------------------------------------------------- runtime/core/Clownfish/Blob.cfh | 17 ++++++++++++++--- runtime/core/Clownfish/Boolean.cfh | 4 ++++ runtime/core/Clownfish/ByteBuf.cfh | 18 +++++++++++++++--- runtime/core/Clownfish/Hash.cfh | 6 ++++++ runtime/core/Clownfish/Num.cfh | 14 ++++++++------ runtime/core/Clownfish/String.cfh | 32 +++++++++++++++++++++++++++++--- runtime/core/Clownfish/Vector.cfh | 5 +++++ 7 files changed, 81 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/08ccc759/runtime/core/Clownfish/Blob.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Blob.cfh b/runtime/core/Clownfish/Blob.cfh index 0fa3028..9d21a31 100644 --- a/runtime/core/Clownfish/Blob.cfh +++ b/runtime/core/Clownfish/Blob.cfh @@ -89,6 +89,13 @@ public final class Clownfish::Blob inherits Clownfish::Obj { public const char* Get_Buf(Blob *self); + /** Equality test. + * + * @return true if `other` is a Blob and has the same content as `self`. + */ + public bool + Equals(Blob *self, Obj *other); + /** Test whether the Blob matches the passed-in bytes. * * @param bytes Pointer to an array of bytes. @@ -97,6 +104,13 @@ public final class Clownfish::Blob inherits Clownfish::Obj { public bool Equals_Bytes(Blob *self, const void *bytes, size_t size); + /** Indicate whether one Blob is less than, equal to, or greater than + * another. The byte contents of the Blobs are compared + * lexicographically. Throws an exception if `other` is not a Blob. + * + * @return 0 if the Blobs are equal, a negative number if `self` is less + * than `other`, and a positive number if `self` is greater than `other`. + */ public int32_t Compare_To(Blob *self, Obj *other); @@ -105,9 +119,6 @@ public final class Clownfish::Blob inherits Clownfish::Obj { public void Destroy(Blob *self); - - public bool - Equals(Blob *self, Obj *other); } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/08ccc759/runtime/core/Clownfish/Boolean.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Boolean.cfh b/runtime/core/Clownfish/Boolean.cfh index 6d389db..453b414 100644 --- a/runtime/core/Clownfish/Boolean.cfh +++ b/runtime/core/Clownfish/Boolean.cfh @@ -53,6 +53,10 @@ public final class Clownfish::Boolean nickname Bool { public incremented Boolean* Clone(Boolean *self); + /** Equality test. + * + * @return true if `other` is a Boolean with the same value as `self`. + */ public bool Equals(Boolean *self, Obj *other); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/08ccc759/runtime/core/Clownfish/ByteBuf.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/ByteBuf.cfh b/runtime/core/Clownfish/ByteBuf.cfh index f07c3de..5e60ed3 100644 --- a/runtime/core/Clownfish/ByteBuf.cfh +++ b/runtime/core/Clownfish/ByteBuf.cfh @@ -140,6 +140,13 @@ public final class Clownfish::ByteBuf nickname BB inherits Clownfish::Obj { public incremented String* Trusted_Utf8_To_String(ByteBuf *self); + /** Equality test. + * + * @return true if `other` is a ByteBuf with the same content as `self`. + */ + public bool + Equals(ByteBuf *self, Obj *other); + /** Test whether the ByteBuf matches the passed-in bytes. * * @param bytes Pointer to an array of bytes. @@ -148,6 +155,14 @@ public final class Clownfish::ByteBuf nickname BB inherits Clownfish::Obj { public bool Equals_Bytes(ByteBuf *self, const void *bytes, size_t size); + /** Indicate whether one ByteBuf is less than, equal to, or greater than + * another. The byte contents of the ByteBufs are compared + * lexicographically. Throws an exception if `other` is not a ByteBuf. + * + * @return 0 if the ByteBufs are equal, a negative number if `self` is + * less than `other`, and a positive number if `self` is greater than + * `other`. + */ public int32_t Compare_To(ByteBuf *self, Obj *other); @@ -156,9 +171,6 @@ public final class Clownfish::ByteBuf nickname BB inherits Clownfish::Obj { public void Destroy(ByteBuf *self); - - public bool - Equals(ByteBuf *self, Obj *other); } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/08ccc759/runtime/core/Clownfish/Hash.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Hash.cfh b/runtime/core/Clownfish/Hash.cfh index 473ad15..320138d 100644 --- a/runtime/core/Clownfish/Hash.cfh +++ b/runtime/core/Clownfish/Hash.cfh @@ -130,6 +130,12 @@ public final class Clownfish::Hash inherits Clownfish::Obj { public size_t Get_Size(Hash *self); + /** Equality test. + * + * @return true if `other` is a Hash with the same key-value pairs as + * `self`. Keys and values are compared using their respective `Equals` + * methods. + */ public bool Equals(Hash *self, Obj *other); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/08ccc759/runtime/core/Clownfish/Num.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Num.cfh b/runtime/core/Clownfish/Num.cfh index 0f74f9d..d32787c 100644 --- a/runtime/core/Clownfish/Num.cfh +++ b/runtime/core/Clownfish/Num.cfh @@ -55,15 +55,16 @@ public final class Clownfish::Float { /** Indicate whether two numbers are the same. * - * @param other A Float or an Integer. + * @return true if `other` is a Float or Integer with the same value as + * `self`. */ public bool Equals(Float *self, Obj *other); /** Indicate whether one number is less than, equal to, or greater than - * another. + * another. Throws an exception if `other` is neither a Float nor an + * Integer. * - * @param other A Float or an Integer. * @return 0 if the numbers are equal, a negative number if `self` is * less than `other`, and a positive number if `self` is greater than * `other`. @@ -114,15 +115,16 @@ public final class Clownfish::Integer nickname Int { /** Indicate whether two numbers are the same. * - * @param other An Integer or a Float. + * @return true if `other` is an Integer or Float with the same value as + * `self`. */ public bool Equals(Integer *self, Obj *other); /** Indicate whether one number is less than, equal to, or greater than - * another. + * another. Throws an exception if `other` is neither an Integer nor a + * Float. * - * @param other An Integer or a Float. * @return 0 if the numbers are equal, a negative number if `self` is * less than `other`, and a positive number if `self` is greater than * `other`. http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/08ccc759/runtime/core/Clownfish/String.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/String.cfh b/runtime/core/Clownfish/String.cfh index 3d7ba5d..6272a1a 100644 --- a/runtime/core/Clownfish/String.cfh +++ b/runtime/core/Clownfish/String.cfh @@ -245,6 +245,14 @@ public final class Clownfish::String nickname Str public incremented nullable StringIterator* Find_Utf8(String *self, const char *utf8, size_t size); + /** Equality test. + * + * @return true if `other` is a String with the same character data as + * `self`. + */ + public bool + Equals(String *self, Obj *other); + /** Test whether the String matches the supplied UTF-8 character data. */ public bool @@ -287,9 +295,13 @@ public final class Clownfish::String nickname Str public void Destroy(String *self); - public bool - Equals(String *self, Obj *other); - + /** Indicate whether one String is less than, equal to, or greater than + * another. The Unicode code points of the Strings are compared + * lexicographically. Throws an exception if `other` is not a String. + * + * @return 0 if the Strings are equal, a negative number if `self` is less + * than `other`, and a positive number if `self` is greater than `other`. + */ public int32_t Compare_To(String *self, Obj *other); @@ -380,9 +392,23 @@ public final class Clownfish::StringIterator nickname StrIter public void Assign(StringIterator *self, StringIterator *other); + /** Equality test. + * + * @return true if `other` is a StringIterator with the same source + * string and character position as `self`. + */ public bool Equals(StringIterator *self, Obj *other); + /** Indicate whether one StringIterator is less than, equal to, or + * greater than another by comparing their character positions. Throws an + * exception if `other` is not a StringIterator pointing to the same + * source string as `self`. + * + * @return 0 if the StringIterators are equal, a negative number if `self` + * is less than `other`, and a positive number if `self` is greater than + * `other`. + */ public int32_t Compare_To(StringIterator *self, Obj *other); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/08ccc759/runtime/core/Clownfish/Vector.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Vector.cfh b/runtime/core/Clownfish/Vector.cfh index 3f902f9..b671261 100644 --- a/runtime/core/Clownfish/Vector.cfh +++ b/runtime/core/Clownfish/Vector.cfh @@ -148,6 +148,11 @@ public final class Clownfish::Vector nickname Vec inherits Clownfish::Obj { public incremented Vector* Slice(Vector *self, size_t offset, size_t length); + /** Equality test. + * + * @return true if `other` is a Vector with the same values as `self`. + * Values are compared using their respective `Equals` methods. + */ public bool Equals(Vector *self, Obj *other);
