Package io.tiledb.java.api
Class Domain
- java.lang.Object
-
- io.tiledb.java.api.Domain
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class Domain extends java.lang.Object implements java.lang.AutoCloseableRepresents the domain of an array.
A Domain defines the set of Dimension objects for a given array. The properties of a Domain derive from the underlying dimensions. A Domain is a component of an ArraySchema.
Note: The dimension can only be integral types, as well as floating point for sparse array domains.Example:
Context ctx = new Context(); Domain domain = new Domain(ctx); // Note the dimension bounds are inclusive. Dimension<Integer> d1 = new Dimension<Integer>(ctx, "d1", Integer.class, new Pair<Integer, Integer>(-10, 10), 1); Dimension<Long> d2 = new Dimension<Long>(ctx, "d2", Long.class, new Pair<Long, Long>(1l, 10l), 1l); Dimension<Integer> d3 = new Dimension<Integer>(ctx, "d3", Integer.class, new Pair<Integer, Integer>(-100, 100), 10); domain.addDimension(d1); domain.addDimension(d2); // Throws error, all dims must be same type domain.addDimension(d3); domain.getType(); // TILEDB_INT32, determined from the dimensions domain.getRank(); // 2, d1 and d3 ArraySchema schema = new ArraySchema(ctx, TILEDB_SPARSE); schema.setDomain(domain); // Set the array's domain
-
-
Constructor Summary
Constructors Modifier Constructor Description Domain(Context ctx)protectedDomain(Context ctx, SWIGTYPE_p_p_tiledb_domain_t domainpp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DomainaddDimension(Dimension dimension)Adds a new dimension to the domain.voidaddDimensions(java.util.Collection<Dimension> dims)Adds multiple Dimensions.voidclose()Free's native TileDB resources associated with the Domain objectvoiddump()Dumps the Domain in an ASCII representation to stdout.voiddump(java.lang.String filename)Dumps the Domain in an ASCII representation to stdout.DimensiongetDimension(java.lang.Integer idx)Retrieves a Dimension Object from a Domain by indexDimensiongetDimension(java.lang.Long idx)Retrieves a Dimension Object from a Domain by indexDimensiongetDimension(java.lang.String name)Retrieves a Dimension Object from a Domain by name / labeljava.util.List<Dimension>getDimensions()protected SWIGTYPE_p_tiledb_domain_tgetDomainp()longgetNDim()longgetRank()DatatypegetType()booleanhasDimension(java.lang.String name)Checks if the Domain has the given dimension with name
-
-
-
Constructor Detail
-
Domain
protected Domain(Context ctx, SWIGTYPE_p_p_tiledb_domain_t domainpp)
-
Domain
public Domain(Context ctx) throws TileDBError
- Throws:
TileDBError
-
-
Method Detail
-
getDomainp
protected SWIGTYPE_p_tiledb_domain_t getDomainp()
-
dump
public void dump() throws TileDBErrorDumps the Domain in an ASCII representation to stdout.- Throws:
TileDBError- A TileDB exception
-
dump
public void dump(java.lang.String filename) throws TileDBErrorDumps the Domain in an ASCII representation to stdout.- Parameters:
filename- A string filename- Throws:
TileDBError- A TileDB exception
-
getType
public Datatype getType() throws TileDBError
- Returns:
- The domain Enumerated type.
- Throws:
TileDBError- A TileDB exception
-
getRank
public long getRank() throws TileDBError- Returns:
- The rank of the domain (number of dimensions)
- Throws:
TileDBError- A TileDB exception
-
getNDim
public long getNDim() throws TileDBError- Returns:
- The number of dimensions in the domain
- Throws:
TileDBError- A TileDB exception
-
getDimensions
public java.util.List<Dimension> getDimensions() throws TileDBError
- Returns:
- A List containing the Dimensions in domain.
- Throws:
TileDBError- A TileDB exception
-
hasDimension
public boolean hasDimension(java.lang.String name) throws TileDBErrorChecks if the Domain has the given dimension with name- Parameters:
name- Name of the dimension in the domain- Returns:
- True if the dimension exists in the domain
- Throws:
TileDBError
-
getDimension
public Dimension getDimension(java.lang.String name) throws TileDBError
Retrieves a Dimension Object from a Domain by name / label- Parameters:
name- The name of the domain dimension- Returns:
- A TileDB Dimension object
- Throws:
TileDBError
-
getDimension
public Dimension getDimension(java.lang.Long idx) throws TileDBError
Retrieves a Dimension Object from a Domain by index- Parameters:
idx- The index of the domain dimension- Returns:
- A TileDB Dimension object
- Throws:
TileDBError
-
getDimension
public Dimension getDimension(java.lang.Integer idx) throws TileDBError
Retrieves a Dimension Object from a Domain by index- Parameters:
idx- The index of the domain dimension- Returns:
- A TileDB Dimension object
- Throws:
TileDBError
-
addDimension
public Domain addDimension(Dimension dimension) throws TileDBError
Adds a new dimension to the domain.- Parameters:
dimension- The Dimension object to be added.- Throws:
TileDBError- A TileDB exception
-
addDimensions
public void addDimensions(java.util.Collection<Dimension> dims) throws TileDBError
Adds multiple Dimensions.- Parameters:
dims- A list of Dimension objects to be added.- Throws:
TileDBError- A TileDB exception
-
close
public void close()
Free's native TileDB resources associated with the Domain object- Specified by:
closein interfacejava.lang.AutoCloseable
-
-