Beispiel #1
0
 public int compareTo(Object o)
 {
     if (o is WikiPagePath)
     {
         WikiPagePath p = (WikiPagePath)o;
         String       compressedName         = StringUtil.join(names, "");
         String       compressedArgumentName = StringUtil.join(p.names, "");
         return(compressedName.CompareTo(compressedArgumentName));
     }
     return(1); // we are greater because we are the right type.
 }
        public void testCompareTo()
        {
            WikiPagePath a  = PathParser.parse("PageA");
            WikiPagePath ab = PathParser.parse("PageA.PageB");
            WikiPagePath b  = PathParser.parse("PageB");
            WikiPagePath aa = PathParser.parse("PageA.PageA");
            WikiPagePath bb = PathParser.parse("PageB.PageB");
            WikiPagePath ba = PathParser.parse("PageB.PageA");

            assertTrue(a.CompareTo(a) == 0);    // a == a
            assertTrue(a.CompareTo(b) != 0);    // a != b
            assertTrue(ab.CompareTo(ab) == 0);  // ab == ab
            assertTrue(a.CompareTo(b) == -1);   // a < b
            assertTrue(aa.CompareTo(ab) == -1); // aa < ab
            assertTrue(ba.CompareTo(bb) == -1); // ba < bb
            assertTrue(b.CompareTo(a) == 1);    // b > a
            assertTrue(ab.CompareTo(aa) == 1);  // ab > aa
            assertTrue(bb.CompareTo(ba) == 1);  // bb > ba
        }
 internal int CompareTo(WikiPagePath a)
 {
     throw new NotImplementedException();
 }
 internal int CompareTo(WikiPagePath a)
 {
     throw new NotImplementedException();
 }