MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / compareTo

Method compareTo

src/main/java/core/org/xbill/DNS/Name.java:832–858  ·  view source on GitHub ↗

Compares this Name to another Object. @param o The Object to be compared. @return The value 0 if the argument is a name equivalent to this name; a value less than 0 if the argument is less than this name in the canonical ordering, and a value greater than 0 if the argument is greater than this name

(Object o)

Source from the content-addressed store, hash-verified

830 * @throws ClassCastException if the argument is not a Name.
831 */
832public int
833compareTo(Object o) {
834 Name arg = (Name) o;
835
836 if (this == arg)
837 return (0);
838
839 int labels = labels();
840 int alabels = arg.labels();
841 int compares = labels > alabels ? alabels : labels;
842
843 for (int i = 1; i <= compares; i++) {
844 int start = offset(labels - i);
845 int astart = arg.offset(alabels - i);
846 int length = name[start];
847 int alength = arg.name[astart];
848 for (int j = 0; j < length && j < alength; j++) {
849 int n = lowercase[(name[j + start + 1]) & 0xFF] -
850 lowercase[(arg.name[j + astart + 1]) & 0xFF];
851 if (n != 0)
852 return (n);
853 }
854 if (length != alength)
855 return (length - alength);
856 }
857 return (labels - alabels);
858}
859
860}

Callers 2

verifyMethod · 0.45
verifyMessageMethod · 0.45

Calls 2

labelsMethod · 0.95
offsetMethod · 0.95

Tested by

no test coverage detected