use of fr.lirmm.graphik.graal.api.core.Atom in project graal by graphik-team.
the class AtomTest method testIndexOf.
/**
* Test method for
* {@link fr.lirmm.graphik.graal.core.DefaultAtom#indexOf(fr.lirmm.graphik.graal.api.core.Term)}.
*/
@Theory
public void testIndexOf(AtomFactory factory) {
// given
Atom a = factory.create(TestUtils.pXA);
// when
int index = a.indexOf(TestUtils.A);
// then
Assert.assertEquals(1, index);
}
use of fr.lirmm.graphik.graal.api.core.Atom in project graal by graphik-team.
the class AtomTest method testIndexOfNotFound.
/**
* Test method for
* {@link fr.lirmm.graphik.graal.core.DefaultAtom#indexOf(fr.lirmm.graphik.graal.api.core.Term)}.
*/
@Theory
public void testIndexOfNotFound(AtomFactory factory) {
// given
Atom a = factory.create(TestUtils.pXA);
// when
int index = a.indexOf(TestUtils.B);
// then
Assert.assertEquals(-1, index);
}
use of fr.lirmm.graphik.graal.api.core.Atom in project graal by graphik-team.
the class AtomTest method testDefaultAtomAtom.
/**
* Test method for
* {@link fr.lirmm.graphik.graal.core.DefaultAtom#DefaultAtom(fr.lirmm.graphik.graal.api.core.Atom)}.
*/
@Theory
public void testDefaultAtomAtom(AtomFactory factory) {
// given
Atom a = factory.create(TestUtils.pXA);
// when
Atom copy = new DefaultAtom(a);
// then
Assert.assertEquals(a.getPredicate(), copy.getPredicate());
Assert.assertEquals(a.getTerm(0), copy.getTerm(0));
Assert.assertEquals(a.getTerm(1), copy.getTerm(1));
}
use of fr.lirmm.graphik.graal.api.core.Atom in project graal by graphik-team.
the class DefaultAtomSetFactory method create.
@Override
public InMemoryAtomSet create(AtomSet src) throws IteratorException {
InMemoryAtomSet atomset = this.create();
CloseableIterator<Atom> it = src.iterator();
while (it.hasNext()) {
Atom a = it.next();
atomset.add(a);
}
return atomset;
}
use of fr.lirmm.graphik.graal.api.core.Atom in project graal by graphik-team.
the class AtomTest method testIndexesOfNotFound.
/**
* Test method for
* {@link fr.lirmm.graphik.graal.core.DefaultAtom#indexesOf(fr.lirmm.graphik.graal.api.core.Term)}.
*/
@Theory
public void testIndexesOfNotFound(AtomFactory factory) {
// given
Atom a = factory.create(TestUtils.pXX);
// when
int[] indexes = a.indexesOf(TestUtils.A);
// then
Assert.assertEquals(0, indexes.length);
}
Aggregations