Search in sources :

Example 1 with ConstantEntityIterableHandle

use of jetbrains.exodus.entitystore.iterate.ConstantEntityIterableHandle in project xodus by JetBrains.

the class EntityIterableHandleTests method testTrivial.

public void testTrivial() {
    final EntityIterableHandleBase h = new ConstantEntityIterableHandle(getEntityStore(), EntityIterableType.EMPTY) {

        @Override
        public void toString(@NotNull final StringBuilder builder) {
            super.toString(builder);
            for (int i = 0; i < 31; ++i) {
                builder.append('0');
            }
        }

        @Override
        public void hashCode(@NotNull final EntityIterableHandleHash hash) {
            for (int i = 0; i < 31; ++i) {
                hash.apply("0");
            }
        }
    };
    Assert.assertEquals("00000000000000000000000000000000", h.toString());
}
Also used : ConstantEntityIterableHandle(jetbrains.exodus.entitystore.iterate.ConstantEntityIterableHandle) NotNull(org.jetbrains.annotations.NotNull) EntityIterableHandleBase(jetbrains.exodus.entitystore.iterate.EntityIterableHandleBase)

Example 2 with ConstantEntityIterableHandle

use of jetbrains.exodus.entitystore.iterate.ConstantEntityIterableHandle in project xodus by JetBrains.

the class EntityIterableHandleTests method test_XD_438.

public void test_XD_438() {
    final EntityIterableHandleBase h = new ConstantEntityIterableHandle(getEntityStore(), EntityIterableType.REVERSE) {

        @Override
        public void toString(@NotNull final StringBuilder builder) {
            super.toString(builder);
            builder.append(EntityIterableType.SINGLE_ENTITY.getType());
            builder.append('-');
            new PersistentEntityId(1000000000, 10000000000000000L).toString(builder);
        }

        @Override
        public void hashCode(@NotNull final EntityIterableHandleHash hash) {
            hash.apply(EntityIterableType.SINGLE_ENTITY.getType());
            hash.applyDelimiter();
            new PersistentEntityId(1000000000, 10000000000000000L).toHash(hash);
        }
    };
    Assert.assertEquals("Reversed iterable\n" + "|   Single entity 1000000000 10000000000000000", EntityIterableBase.getHumanReadablePresentation(h));
}
Also used : ConstantEntityIterableHandle(jetbrains.exodus.entitystore.iterate.ConstantEntityIterableHandle) NotNull(org.jetbrains.annotations.NotNull) EntityIterableHandleBase(jetbrains.exodus.entitystore.iterate.EntityIterableHandleBase)

Aggregations

ConstantEntityIterableHandle (jetbrains.exodus.entitystore.iterate.ConstantEntityIterableHandle)2 EntityIterableHandleBase (jetbrains.exodus.entitystore.iterate.EntityIterableHandleBase)2 NotNull (org.jetbrains.annotations.NotNull)2