Search in sources :

Example 1 with ListSubOperation

use of com.hazelcast.collection.impl.list.operations.ListSubOperation in project hazelcast by hazelcast.

the class CollectionDataSerializerHook method createFactory.

@Override
public DataSerializableFactory createFactory() {
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[COLLECTION_MERGE_BACKUP + 1];
    constructors[COLLECTION_ADD] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionAddOperation();
        }
    };
    constructors[COLLECTION_ADD_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionAddBackupOperation();
        }
    };
    constructors[LIST_ADD] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListAddOperation();
        }
    };
    constructors[LIST_GET] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListGetOperation();
        }
    };
    constructors[COLLECTION_REMOVE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionRemoveOperation();
        }
    };
    constructors[COLLECTION_REMOVE_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionRemoveBackupOperation();
        }
    };
    constructors[COLLECTION_SIZE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionSizeOperation();
        }
    };
    constructors[COLLECTION_CLEAR] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionClearOperation();
        }
    };
    constructors[COLLECTION_CLEAR_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionClearBackupOperation();
        }
    };
    constructors[LIST_SET] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListSetOperation();
        }
    };
    constructors[LIST_SET_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListSetBackupOperation();
        }
    };
    constructors[LIST_REMOVE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListRemoveOperation();
        }
    };
    constructors[LIST_INDEX_OF] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListIndexOfOperation();
        }
    };
    constructors[COLLECTION_CONTAINS] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionContainsOperation();
        }
    };
    constructors[COLLECTION_ADD_ALL] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionAddAllOperation();
        }
    };
    constructors[COLLECTION_ADD_ALL_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionAddAllBackupOperation();
        }
    };
    constructors[LIST_ADD_ALL] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListAddAllOperation();
        }
    };
    constructors[LIST_SUB] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListSubOperation();
        }
    };
    constructors[COLLECTION_COMPARE_AND_REMOVE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionCompareAndRemoveOperation();
        }
    };
    constructors[COLLECTION_GET_ALL] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionGetAllOperation();
        }
    };
    constructors[COLLECTION_EVENT_FILTER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionEventFilter();
        }
    };
    constructors[COLLECTION_EVENT] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionEvent();
        }
    };
    constructors[COLLECTION_ITEM] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionItem();
        }
    };
    constructors[COLLECTION_RESERVE_ADD] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionReserveAddOperation();
        }
    };
    constructors[COLLECTION_RESERVE_REMOVE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionReserveRemoveOperation();
        }
    };
    constructors[COLLECTION_TXN_ADD] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionTxnAddOperation();
        }
    };
    constructors[COLLECTION_TXN_ADD_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionTxnAddBackupOperation();
        }
    };
    constructors[COLLECTION_TXN_REMOVE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionTxnRemoveOperation();
        }
    };
    constructors[COLLECTION_TXN_REMOVE_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionTxnRemoveBackupOperation();
        }
    };
    constructors[COLLECTION_PREPARE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionPrepareOperation();
        }
    };
    constructors[COLLECTION_PREPARE_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionPrepareBackupOperation();
        }
    };
    constructors[COLLECTION_ROLLBACK] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionRollbackOperation();
        }
    };
    constructors[COLLECTION_ROLLBACK_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionRollbackBackupOperation();
        }
    };
    constructors[TX_COLLECTION_ITEM] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new TxCollectionItem();
        }
    };
    constructors[TX_ROLLBACK] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionTransactionRollbackOperation();
        }
    };
    constructors[LIST_REPLICATION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListReplicationOperation();
        }
    };
    constructors[SET_REPLICATION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new SetReplicationOperation();
        }
    };
    constructors[COLLECTION_IS_EMPTY] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionIsEmptyOperation();
        }
    };
    constructors[TXN_COMMIT] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionCommitOperation();
        }
    };
    constructors[TXN_COMMIT_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionCommitBackupOperation();
        }
    };
    constructors[SET_CONTAINER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new SetContainer();
        }
    };
    constructors[LIST_CONTAINER] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new ListContainer();
        }
    };
    constructors[COLLECTION_TRANSACTION_LOG_RECORD] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionTransactionLogRecord();
        }
    };
    constructors[QUEUE_TRANSACTION_LOG_RECORD] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new QueueTransactionLogRecord();
        }
    };
    constructors[COLLECTION_MERGE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionMergeOperation();
        }
    };
    constructors[COLLECTION_MERGE_BACKUP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        public IdentifiedDataSerializable createNew(Integer arg) {
            return new CollectionMergeBackupOperation();
        }
    };
    return new ArrayDataSerializableFactory(constructors);
}
Also used : CollectionAddAllBackupOperation(com.hazelcast.collection.impl.collection.operations.CollectionAddAllBackupOperation) ListAddAllOperation(com.hazelcast.collection.impl.list.operations.ListAddAllOperation) CollectionTransactionLogRecord(com.hazelcast.collection.impl.txncollection.CollectionTransactionLogRecord) CollectionReserveAddOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionReserveAddOperation) CollectionMergeOperation(com.hazelcast.collection.impl.collection.operations.CollectionMergeOperation) ListSetBackupOperation(com.hazelcast.collection.impl.list.operations.ListSetBackupOperation) IdentifiedDataSerializable(com.hazelcast.nio.serialization.IdentifiedDataSerializable) CollectionMergeBackupOperation(com.hazelcast.collection.impl.collection.operations.CollectionMergeBackupOperation) CollectionClearBackupOperation(com.hazelcast.collection.impl.collection.operations.CollectionClearBackupOperation) ListReplicationOperation(com.hazelcast.collection.impl.list.operations.ListReplicationOperation) CollectionPrepareBackupOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionPrepareBackupOperation) ListGetOperation(com.hazelcast.collection.impl.list.operations.ListGetOperation) CollectionTransactionRollbackOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionTransactionRollbackOperation) CollectionRollbackOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionRollbackOperation) ListIndexOfOperation(com.hazelcast.collection.impl.list.operations.ListIndexOfOperation) SetReplicationOperation(com.hazelcast.collection.impl.set.operations.SetReplicationOperation) CollectionContainsOperation(com.hazelcast.collection.impl.collection.operations.CollectionContainsOperation) CollectionCompareAndRemoveOperation(com.hazelcast.collection.impl.collection.operations.CollectionCompareAndRemoveOperation) CollectionClearOperation(com.hazelcast.collection.impl.collection.operations.CollectionClearOperation) CollectionTxnAddBackupOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionTxnAddBackupOperation) CollectionAddBackupOperation(com.hazelcast.collection.impl.collection.operations.CollectionAddBackupOperation) CollectionSizeOperation(com.hazelcast.collection.impl.collection.operations.CollectionSizeOperation) CollectionCommitOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionCommitOperation) CollectionGetAllOperation(com.hazelcast.collection.impl.collection.operations.CollectionGetAllOperation) CollectionAddOperation(com.hazelcast.collection.impl.collection.operations.CollectionAddOperation) SetContainer(com.hazelcast.collection.impl.set.SetContainer) CollectionTxnAddOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionTxnAddOperation) CollectionRemoveOperation(com.hazelcast.collection.impl.collection.operations.CollectionRemoveOperation) ListContainer(com.hazelcast.collection.impl.list.ListContainer) ListAddOperation(com.hazelcast.collection.impl.list.operations.ListAddOperation) CollectionIsEmptyOperation(com.hazelcast.collection.impl.collection.operations.CollectionIsEmptyOperation) QueueTransactionLogRecord(com.hazelcast.collection.impl.txnqueue.QueueTransactionLogRecord) CollectionReserveRemoveOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionReserveRemoveOperation) CollectionTxnRemoveBackupOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionTxnRemoveBackupOperation) CollectionRemoveBackupOperation(com.hazelcast.collection.impl.collection.operations.CollectionRemoveBackupOperation) CollectionPrepareOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionPrepareOperation) ConstructorFunction(com.hazelcast.internal.util.ConstructorFunction) ListSubOperation(com.hazelcast.collection.impl.list.operations.ListSubOperation) CollectionTxnRemoveOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionTxnRemoveOperation) CollectionAddAllOperation(com.hazelcast.collection.impl.collection.operations.CollectionAddAllOperation) CollectionRollbackBackupOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionRollbackBackupOperation) ListSetOperation(com.hazelcast.collection.impl.list.operations.ListSetOperation) ListRemoveOperation(com.hazelcast.collection.impl.list.operations.ListRemoveOperation) ArrayDataSerializableFactory(com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory) CollectionCommitBackupOperation(com.hazelcast.collection.impl.txncollection.operations.CollectionCommitBackupOperation)

Example 2 with ListSubOperation

use of com.hazelcast.collection.impl.list.operations.ListSubOperation in project hazelcast by hazelcast.

the class ListProxyImpl method dataSubList.

// used by jet
public List<Data> dataSubList(int fromIndex, int toIndex) {
    ListSubOperation operation = new ListSubOperation(name, fromIndex, toIndex);
    SerializableList result = invoke(operation);
    return Collections.unmodifiableList(result.getCollection());
}
Also used : ListSubOperation(com.hazelcast.collection.impl.list.operations.ListSubOperation) SerializableList(com.hazelcast.spi.impl.SerializableList)

Example 3 with ListSubOperation

use of com.hazelcast.collection.impl.list.operations.ListSubOperation in project hazelcast by hazelcast.

the class ListProxyImpl method subList.

@Override
public List<E> subList(int fromIndex, int toIndex) {
    ListSubOperation operation = new ListSubOperation(name, fromIndex, toIndex);
    SerializableList result = invoke(operation);
    List<Data> collection = result.getCollection();
    SerializationService serializationService = getNodeEngine().getSerializationService();
    return new UnmodifiableLazyList(collection, serializationService);
}
Also used : ListSubOperation(com.hazelcast.collection.impl.list.operations.ListSubOperation) SerializableList(com.hazelcast.spi.impl.SerializableList) SerializationService(com.hazelcast.internal.serialization.SerializationService) Data(com.hazelcast.internal.serialization.Data) UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList)

Aggregations

ListSubOperation (com.hazelcast.collection.impl.list.operations.ListSubOperation)3 SerializableList (com.hazelcast.spi.impl.SerializableList)2 CollectionAddAllBackupOperation (com.hazelcast.collection.impl.collection.operations.CollectionAddAllBackupOperation)1 CollectionAddAllOperation (com.hazelcast.collection.impl.collection.operations.CollectionAddAllOperation)1 CollectionAddBackupOperation (com.hazelcast.collection.impl.collection.operations.CollectionAddBackupOperation)1 CollectionAddOperation (com.hazelcast.collection.impl.collection.operations.CollectionAddOperation)1 CollectionClearBackupOperation (com.hazelcast.collection.impl.collection.operations.CollectionClearBackupOperation)1 CollectionClearOperation (com.hazelcast.collection.impl.collection.operations.CollectionClearOperation)1 CollectionCompareAndRemoveOperation (com.hazelcast.collection.impl.collection.operations.CollectionCompareAndRemoveOperation)1 CollectionContainsOperation (com.hazelcast.collection.impl.collection.operations.CollectionContainsOperation)1 CollectionGetAllOperation (com.hazelcast.collection.impl.collection.operations.CollectionGetAllOperation)1 CollectionIsEmptyOperation (com.hazelcast.collection.impl.collection.operations.CollectionIsEmptyOperation)1 CollectionMergeBackupOperation (com.hazelcast.collection.impl.collection.operations.CollectionMergeBackupOperation)1 CollectionMergeOperation (com.hazelcast.collection.impl.collection.operations.CollectionMergeOperation)1 CollectionRemoveBackupOperation (com.hazelcast.collection.impl.collection.operations.CollectionRemoveBackupOperation)1 CollectionRemoveOperation (com.hazelcast.collection.impl.collection.operations.CollectionRemoveOperation)1 CollectionSizeOperation (com.hazelcast.collection.impl.collection.operations.CollectionSizeOperation)1 ListContainer (com.hazelcast.collection.impl.list.ListContainer)1 ListAddAllOperation (com.hazelcast.collection.impl.list.operations.ListAddAllOperation)1 ListAddOperation (com.hazelcast.collection.impl.list.operations.ListAddOperation)1