com.neeve.lang
Class XFactory

java.lang.Object
  extended by com.neeve.lang.XFactory

public class XFactory
extends Object

A factory for the X Platform's garbage optimized data structures.


Nested Class Summary
static interface XFactory.Provider
           
 
Constructor Summary
XFactory()
           
 
Method Summary
static
<T extends XString>
XString.Factory<T>
createXPooledStringFactory(Class<T> pooledStringClass, String factoryName, Map<String,Object> props)
          Creates a factory for a poolable string type.
static XString createXString(int expectedSize)
          Preallocates an uninitialized XString with a backing buffer of the expectedSize.
static XString createXString(int expectedSize, boolean mutable)
          Preallocates an uninitialized XString with the given backing buffer size.
static XString createXString(int expectedSize, boolean mutable, boolean isNative)
          Preallocates an uninitialized XString with the given backing buffer size.
static XString createXString(String value)
          Creates an immutable XString from the given String value.
static XString createXString(String value, boolean isNative)
          Creates an immutable XString from the given String value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XFactory

public XFactory()
Method Detail

createXString

public static final XString createXString(int expectedSize)
Preallocates an uninitialized XString with a backing buffer of the expectedSize. Once the XString is initialized it will become immutable.

Parameters:
expectedSize - The expected string size.
Returns:
A preallocated XString

createXString

public static final XString createXString(int expectedSize,
                                          boolean mutable)
Preallocates an uninitialized XString with the given backing buffer size.

Parameters:
expectedSize - The expected string size.
mutable - If the XString should remain mutable after initialization.
Returns:
A preallocated XString

createXString

public static final XString createXString(int expectedSize,
                                          boolean mutable,
                                          boolean isNative)
Preallocates an uninitialized XString with the given backing buffer size.

Parameters:
expectedSize - The expected string size.
mutable - If the XString should remain mutable after initialization.
isNative - If the XString should be backed by a native buffer.
Returns:
A preallocated XString

createXString

public static final XString createXString(String value)
Creates an immutable XString from the given String value.

Parameters:
value - The value of the XString
Returns:
The XString

createXString

public static final XString createXString(String value,
                                          boolean isNative)
Creates an immutable XString from the given String value.

Parameters:
value - The value of the XString
isNative - If a native (direct) buffer should be used.
Returns:
The XString

createXPooledStringFactory

public static final <T extends XString> XString.Factory<T> createXPooledStringFactory(Class<T> pooledStringClass,
                                                                                      String factoryName,
                                                                                      Map<String,Object> props)
                                                                           throws RuntimeException
Creates a factory for a poolable string type.

Parameters:
pooledStringClass - The pooled String class.
factoryName - The factory name which must be unique within the jvm.
props - The factory properties to use.
Throws:
RuntimeException


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.