[ https://issues.apache.org/jira/browse/MNEMONIC-221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15933385#comment-15933385 ]
ASF GitHub Bot commented on MNEMONIC-221: ----------------------------------------- Github user bigdata-memory commented on a diff in the pull request: https://github.com/apache/incubator-mnemonic/pull/36#discussion_r106997111 --- Diff: mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableArrayFactory.java --- @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.mnemonic.collections; + +import org.apache.mnemonic.DurableType; +import org.apache.mnemonic.EntityFactoryProxy; +import org.apache.mnemonic.OutOfHybridMemory; +import org.apache.mnemonic.RestorableAllocator; +import org.apache.mnemonic.RestoreDurableEntityError; + +public class DurableArrayFactory { + public static <A extends RestorableAllocator<A>, E> DurableArray<E> + create(A allocator) throws OutOfHybridMemory { + return create(allocator, 0, false); + } + + public static <A extends RestorableAllocator<A>, E> DurableArray<E> + create(A allocator, int size) throws OutOfHybridMemory { + return create(allocator, size, false); + } + + public static <A extends RestorableAllocator<A>, E> DurableArray<E> + create(A allocator, int size, boolean autoreclaim) throws OutOfHybridMemory { + return create(allocator, null, null, size, autoreclaim); + } + + public static <A extends RestorableAllocator<A>, E> DurableArray<E> + create(A allocator, EntityFactoryProxy[] factoryproxys, DurableType[] gfields, + int size, boolean autoreclaim) throws OutOfHybridMemory { + DurableArrayImpl<A, E> entity = new DurableArrayImpl<A, E>(); + entity.setSize(size); --- End diff -- Could pass the size as the parameter of the constructor of class DurableArrayImpl, because, if the modifier setSize() is public, the user might misuse it as what Resize() does. > Create a DurableArray > --------------------- > > Key: MNEMONIC-221 > URL: https://issues.apache.org/jira/browse/MNEMONIC-221 > Project: Mnemonic > Issue Type: New Feature > Components: Collection > Affects Versions: 0.6.0-incubating > Reporter: Wang, Gang > Assignee: Johnu George > > The DurableArray is a data structure which stores a sequential collection of > elements of the same generic type on durable memory space. -- This message was sent by Atlassian JIRA (v6.3.15#6346)