@Test public void testCompareLiteralObjectsTyped() { statement1 = valueFactory.createStatement(testSubjectBNode1, testPredicateUri1, testObjectLiteral1); statement2 = valueFactory.createStatement(testSubjectBNode1, testPredicateUri1, testObjectLiteral2); statement3 = valueFactory.createStatement(testSubjectBNode1, testPredicateUri1, testObjectTypedLiteral1String); statement4 = valueFactory.createStatement(testSubjectBNode1, testPredicateUri1, testObjectTypedLiteral2String); statement5 = valueFactory.createStatement(testSubjectBNode1, testPredicateUri1, testObjectTypedLiteral1Integer); statement6 = valueFactory.createStatement(testSubjectBNode1, testPredicateUri1, testObjectTypedLiteral2Integer); statement7 = valueFactory.createStatement( testSubjectBNode1, testPredicateUri1, testObjectTypedLiteral1IntegerString); statement8 = valueFactory.createStatement( testSubjectBNode1, testPredicateUri1, testObjectTypedLiteral2IntegerString); assertTrue(testComparator.compare(statement1, statement1) == 0); assertTrue(testComparator.compare(statement2, statement2) == 0); assertTrue(testComparator.compare(statement3, statement3) == 0); assertTrue(testComparator.compare(statement4, statement4) == 0); assertTrue(testComparator.compare(statement5, statement5) == 0); assertTrue(testComparator.compare(statement6, statement6) == 0); assertTrue(testComparator.compare(statement7, statement7) == 0); assertTrue(testComparator.compare(statement8, statement8) == 0); assertTrue(testComparator.compare(statement1, statement2) < 0); assertTrue(testComparator.compare(statement2, statement1) > 0); assertTrue(testComparator.compare(statement1, statement3) == 0); assertTrue(testComparator.compare(statement3, statement1) == 0); assertTrue(testComparator.compare(statement1, statement4) < 0); assertTrue(testComparator.compare(statement4, statement1) > 0); assertTrue(testComparator.compare(statement5, statement1) < 0); assertTrue(testComparator.compare(statement1, statement5) > 0); assertTrue(testComparator.compare(statement6, statement1) < 0); assertTrue(testComparator.compare(statement1, statement6) > 0); assertTrue(testComparator.compare(statement7, statement1) < 0); assertTrue(testComparator.compare(statement1, statement7) > 0); assertTrue(testComparator.compare(statement8, statement1) < 0); assertTrue(testComparator.compare(statement1, statement8) > 0); assertTrue(testComparator.compare(statement3, statement2) < 0); assertTrue(testComparator.compare(statement2, statement3) > 0); assertTrue(testComparator.compare(statement2, statement4) == 0); assertTrue(testComparator.compare(statement4, statement2) == 0); assertTrue(testComparator.compare(statement5, statement2) < 0); assertTrue(testComparator.compare(statement2, statement5) > 0); assertTrue(testComparator.compare(statement6, statement2) < 0); assertTrue(testComparator.compare(statement2, statement6) > 0); assertTrue(testComparator.compare(statement7, statement2) < 0); assertTrue(testComparator.compare(statement2, statement7) > 0); assertTrue(testComparator.compare(statement8, statement2) < 0); assertTrue(testComparator.compare(statement2, statement8) > 0); assertTrue(testComparator.compare(statement3, statement4) < 0); assertTrue(testComparator.compare(statement4, statement3) > 0); assertTrue(testComparator.compare(statement5, statement3) < 0); assertTrue(testComparator.compare(statement3, statement5) > 0); assertTrue(testComparator.compare(statement6, statement3) < 0); assertTrue(testComparator.compare(statement3, statement6) > 0); assertTrue(testComparator.compare(statement7, statement3) < 0); assertTrue(testComparator.compare(statement3, statement7) > 0); assertTrue(testComparator.compare(statement8, statement3) < 0); assertTrue(testComparator.compare(statement3, statement8) > 0); assertTrue(testComparator.compare(statement5, statement4) < 0); assertTrue(testComparator.compare(statement4, statement5) > 0); assertTrue(testComparator.compare(statement6, statement4) < 0); assertTrue(testComparator.compare(statement4, statement6) > 0); assertTrue(testComparator.compare(statement7, statement4) < 0); assertTrue(testComparator.compare(statement4, statement7) > 0); assertTrue(testComparator.compare(statement8, statement4) < 0); assertTrue(testComparator.compare(statement4, statement8) > 0); assertTrue(testComparator.compare(statement5, statement6) < 0); assertTrue(testComparator.compare(statement6, statement5) > 0); assertTrue(testComparator.compare(statement5, statement7) < 0); assertTrue(testComparator.compare(statement7, statement5) > 0); assertTrue(testComparator.compare(statement5, statement8) < 0); assertTrue(testComparator.compare(statement8, statement5) > 0); assertTrue(testComparator.compare(statement7, statement6) < 0); assertTrue(testComparator.compare(statement6, statement7) > 0); assertTrue(testComparator.compare(statement6, statement8) < 0); assertTrue(testComparator.compare(statement8, statement6) > 0); assertTrue(testComparator.compare(statement7, statement8) < 0); assertTrue(testComparator.compare(statement8, statement7) > 0); }
@Override public int compare(Statement first, Statement second) { if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }
StatementComparator implements Comparator<Statement> { @Override public int compare(Statement first, Statement second) { if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } } }
StatementComparator implements Comparator<Statement> { @Override public int compare(Statement first, Statement second) { if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }  }
StatementComparator implements Comparator<Statement> { @Override public int compare(Statement first, Statement second) { if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }  static StatementComparator getInstance(); @Override int compare(Statement first, Statement second); }
StatementComparator implements Comparator<Statement> { @Override public int compare(Statement first, Statement second) { if (first == second) { return EQUAL; } if (first.getSubject().equals(second.getSubject())) { if (first.getPredicate().equals(second.getPredicate())) { if (first.getObject().equals(second.getObject())) { if (first.getContext() == null) { if (second.getContext() == null) { return EQUAL; } else { return BEFORE; } } else if (second.getContext() == null) { return AFTER; } else { return ValueComparator.getInstance().compare(first.getContext(), second.getContext()); } } else { return ValueComparator.getInstance().compare(first.getObject(), second.getObject()); } } else { return ValueComparator.getInstance().compare(first.getPredicate(), second.getPredicate()); } } else { return ValueComparator.getInstance().compare(first.getSubject(), second.getSubject()); } }  static StatementComparator getInstance(); @Override int compare(Statement first, Statement second); final static int BEFORE; final static int EQUAL; final static int AFTER; }