![JAR search and dependency download from the Maven repository](/logo.png)
org.jhotdraw8.icollection.impl.champ.NodeFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.jhotdraw8.icollection Show documentation
Show all versions of org.jhotdraw8.icollection Show documentation
JHotDraw8 Immutable Collections
The newest version!
/*
* @(#)NodeFactory.java
* Copyright © 2023 The authors and contributors of JHotDraw. MIT License.
*/
package org.jhotdraw8.icollection.impl.champ;
import org.jhotdraw8.icollection.impl.IdentityObject;
import org.jspecify.annotations.Nullable;
/**
* Provides factory methods for {@link Node}s.
*/
class NodeFactory {
/**
* Don't let anyone instantiate this class.
*/
private NodeFactory() {
}
static BitmapIndexedNode newBitmapIndexedNode(
@Nullable IdentityObject owner, int nodeMap,
int dataMap, Object[] nodes) {
return owner == null
? new BitmapIndexedNode<>(nodeMap, dataMap, nodes)
: new MutableBitmapIndexedNode<>(owner, nodeMap, dataMap, nodes);
}
static HashCollisionNode newHashCollisionNode(
@Nullable IdentityObject owner, int hash, Object[] entries) {
return owner == null
? new HashCollisionNode<>(hash, entries)
: new MutableHashCollisionNode<>(owner, hash, entries);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy