@Test public void Compare() { BID bid = new BID("c"); UID uid = new UID("b:b"); LIT lit = new LIT("a"); assertEquals(0, comparator.compare(bid, bid)); assertEquals(0, comparator.compare(uid, uid)); assertEquals(0, comparator.compare(lit, lit)); }
@Override public int compare(NODE o1, NODE o2) { if (o1 == null) { return o2 == null ? 0 : -1; } else if (o2 == null) { return 1; } if (o1.getNodeType() != o2.getNodeType()) { return o1.getNodeType().compareTo(o2.getNodeType()); } if (!o1.getValue().equals(o2.getValue())) { return o1.getValue().compareTo(o2.getValue()); } if (o1.isLiteral() && o2.isLiteral()) { LIT l1 = o1.asLiteral(); LIT l2 = o2.asLiteral(); if (!l1.getDatatype().equals(l2.getDatatype())) { return compare(l1.getDatatype(), l2.getDatatype()); } Locale loc1 = l1.getLang() == null ? new Locale("") : l1.getLang(); Locale loc2 = l2.getLang() == null ? new Locale("") : l2.getLang(); return loc1.toString().compareTo(loc2.toString()); } return 0; }
NODEComparator implements Comparator<NODE>, Serializable { @Override public int compare(NODE o1, NODE o2) { if (o1 == null) { return o2 == null ? 0 : -1; } else if (o2 == null) { return 1; } if (o1.getNodeType() != o2.getNodeType()) { return o1.getNodeType().compareTo(o2.getNodeType()); } if (!o1.getValue().equals(o2.getValue())) { return o1.getValue().compareTo(o2.getValue()); } if (o1.isLiteral() && o2.isLiteral()) { LIT l1 = o1.asLiteral(); LIT l2 = o2.asLiteral(); if (!l1.getDatatype().equals(l2.getDatatype())) { return compare(l1.getDatatype(), l2.getDatatype()); } Locale loc1 = l1.getLang() == null ? new Locale("") : l1.getLang(); Locale loc2 = l2.getLang() == null ? new Locale("") : l2.getLang(); return loc1.toString().compareTo(loc2.toString()); } return 0; } }
NODEComparator implements Comparator<NODE>, Serializable { @Override public int compare(NODE o1, NODE o2) { if (o1 == null) { return o2 == null ? 0 : -1; } else if (o2 == null) { return 1; } if (o1.getNodeType() != o2.getNodeType()) { return o1.getNodeType().compareTo(o2.getNodeType()); } if (!o1.getValue().equals(o2.getValue())) { return o1.getValue().compareTo(o2.getValue()); } if (o1.isLiteral() && o2.isLiteral()) { LIT l1 = o1.asLiteral(); LIT l2 = o2.asLiteral(); if (!l1.getDatatype().equals(l2.getDatatype())) { return compare(l1.getDatatype(), l2.getDatatype()); } Locale loc1 = l1.getLang() == null ? new Locale("") : l1.getLang(); Locale loc2 = l2.getLang() == null ? new Locale("") : l2.getLang(); return loc1.toString().compareTo(loc2.toString()); } return 0; }  }
NODEComparator implements Comparator<NODE>, Serializable { @Override public int compare(NODE o1, NODE o2) { if (o1 == null) { return o2 == null ? 0 : -1; } else if (o2 == null) { return 1; } if (o1.getNodeType() != o2.getNodeType()) { return o1.getNodeType().compareTo(o2.getNodeType()); } if (!o1.getValue().equals(o2.getValue())) { return o1.getValue().compareTo(o2.getValue()); } if (o1.isLiteral() && o2.isLiteral()) { LIT l1 = o1.asLiteral(); LIT l2 = o2.asLiteral(); if (!l1.getDatatype().equals(l2.getDatatype())) { return compare(l1.getDatatype(), l2.getDatatype()); } Locale loc1 = l1.getLang() == null ? new Locale("") : l1.getLang(); Locale loc2 = l2.getLang() == null ? new Locale("") : l2.getLang(); return loc1.toString().compareTo(loc2.toString()); } return 0; }  @Override int compare(NODE o1, NODE o2); }
NODEComparator implements Comparator<NODE>, Serializable { @Override public int compare(NODE o1, NODE o2) { if (o1 == null) { return o2 == null ? 0 : -1; } else if (o2 == null) { return 1; } if (o1.getNodeType() != o2.getNodeType()) { return o1.getNodeType().compareTo(o2.getNodeType()); } if (!o1.getValue().equals(o2.getValue())) { return o1.getValue().compareTo(o2.getValue()); } if (o1.isLiteral() && o2.isLiteral()) { LIT l1 = o1.asLiteral(); LIT l2 = o2.asLiteral(); if (!l1.getDatatype().equals(l2.getDatatype())) { return compare(l1.getDatatype(), l2.getDatatype()); } Locale loc1 = l1.getLang() == null ? new Locale("") : l1.getLang(); Locale loc2 = l2.getLang() == null ? new Locale("") : l2.getLang(); return loc1.toString().compareTo(loc2.toString()); } return 0; }  @Override int compare(NODE o1, NODE o2);  }