Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
882 changes: 854 additions & 28 deletions src/main/c/generated/tiledb_wrap.cxx

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions src/main/java/io/tiledb/java/api/ArraySchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,26 @@ public Domain getDomain() throws TileDBError {
return new Domain(ctx, domainpp);
}

/**
* Returns a copy of the schema's array currentDomain. To change the currentDomain, use
* `set_current_domain()`
*
* @return The current domain
* @throws TileDBError
*/
public CurrentDomain getCurrentDomain() throws TileDBError {
SWIGTYPE_p_p_tiledb_current_domain_t currentDomainpp = tiledb.new_tiledb_current_domain_tpp();
try {
ctx.handleError(
tiledb.tiledb_array_schema_get_current_domain(
ctx.getCtxp(), getSchemap(), currentDomainpp));
} catch (TileDBError err) {
tiledb.delete_tiledb_current_domain_tpp(currentDomainpp);
throw err;
}
return new CurrentDomain(ctx, getDomain(), currentDomainpp);
}

/**
* Sets the array Domain.
*
Expand All @@ -335,6 +355,19 @@ public void setDomain(Domain domain) throws TileDBError {
domainIsSet = true;
}

/**
* Sets the currentDomain.
*
* @param currentDomain The current domain to set
* @throws TileDBError
*/
public void setCurrentDomain(CurrentDomain currentDomain) throws TileDBError {
ctx.handleError(
tiledb.tiledb_array_schema_set_current_domain(
ctx.getCtxp(), getSchemap(), currentDomain.getCurrentDomainp()));
domainIsSet = true;
}

/**
* Adds an Attribute to the array.
*
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/io/tiledb/java/api/ArraySchemaEvolution.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,20 @@ public void dropEnumeration(String name) throws TileDBError {
ctx.getCtxp(), getEvolutionp(), name));
}

/**
* Expands the current domain during array schema evolution. TileDB will enforce that the new
* current domain is expanding on the current one and not contracting during
* `tiledb_array_evolve`.
*
* @param currentDomain The current domain we want to expand the schema to
* @throws TileDBError
*/
public void expandCurrentDomain(CurrentDomain currentDomain) throws TileDBError {
ctx.handleError(
tiledb.tiledb_array_schema_evolution_expand_current_domain(
ctx.getCtxp(), getEvolutionp(), currentDomain.getCurrentDomainp()));
}

/**
* Extends an Enumeration during array schema evolution.
*
Expand Down
134 changes: 134 additions & 0 deletions src/main/java/io/tiledb/java/api/CurrentDomain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package io.tiledb.java.api;

import io.tiledb.libtiledb.*;

public class CurrentDomain implements AutoCloseable {
private Context ctx;
private Domain domain;
private SWIGTYPE_p_p_tiledb_current_domain_t currentDomainpp;
private SWIGTYPE_p_tiledb_current_domain_t currentDomainp;

/**
* Constructor
*
* @param ctx The context
* @param domain The array domain
* @param currentDomainpp The current domain c pointer
*/
protected CurrentDomain(
Context ctx, Domain domain, SWIGTYPE_p_p_tiledb_current_domain_t currentDomainpp) {
this.ctx = ctx;
this.currentDomainpp = currentDomainpp;
this.currentDomainp = tiledb.tiledb_current_domain_tpp_value(currentDomainpp);
this.domain = domain;
}

/**
* Constructor
*
* @param ctx The context
* @param domain The array domain
* @throws TileDBError
*/
public CurrentDomain(Context ctx, Domain domain) throws TileDBError {
SWIGTYPE_p_p_tiledb_current_domain_t _currentDomainpp = tiledb.new_tiledb_current_domain_tpp();
try {
ctx.handleError(tiledb.tiledb_current_domain_create(ctx.getCtxp(), _currentDomainpp));
} catch (TileDBError err) {
tiledb.delete_tiledb_current_domain_tpp(_currentDomainpp);
throw err;
}
this.ctx = ctx;
this.currentDomainp = tiledb.tiledb_current_domain_tpp_value(_currentDomainpp);
this.currentDomainpp = _currentDomainpp;
this.domain = domain;
}

/**
* Returns the c pointer for this current domain object
*
* @return
*/
protected SWIGTYPE_p_tiledb_current_domain_t getCurrentDomainp() {
return currentDomainp;
}

/**
* Set a N-dimensional rectangle representation on a current domain
*
* @param ndRectangle The ndrectangle
* @throws TileDBError
*/
public void setNDRectangle(NDRectangle ndRectangle) throws TileDBError {
ctx.handleError(
tiledb.tiledb_current_domain_set_ndrectangle(
currentDomainp, ndRectangle.getndrectanglep()));
}

/**
* Returns the currentDomain type.
*
* @return The type
* @throws TileDBError
*/
public CurrentDomainType getType() throws TileDBError {
SWIGTYPE_p_tiledb_current_domain_type_t typep = tiledb.new_tiledb_current_domain_type_tp();
CurrentDomainType currentDomainType;
try {
ctx.handleError(tiledb.tiledb_current_domain_get_type(getCurrentDomainp(), typep));
currentDomainType =
CurrentDomainType.fromSwigEnum(tiledb.tiledb_current_domain_type_tp_value(typep));
} finally {
tiledb.delete_tiledb_current_domain_type_tp(typep);
}
return currentDomainType;
}

/**
* Get the N-dimensional rectangle associated with the current domain object, error if the current
* domain is empty or a different representation is set.
*
* @return The ndrectangle
* @throws TileDBError
*/
public NDRectangle getNDRectangle() throws TileDBError {
NDRectangle nd;
SWIGTYPE_p_p_tiledb_ndrectangle_t ndpp = tiledb.new_tiledb_ndrectangle_tpp();
try {
ctx.handleError(tiledb.tiledb_current_domain_get_ndrectangle(currentDomainp, ndpp));
nd = new NDRectangle(ctx, domain, ndpp);
} catch (TileDBError err) {
tiledb.delete_tiledb_ndrectangle_tpp(ndpp);
throw err;
}
return nd;
}

/**
* Return true if the current domain is empty
*
* @return True if empty
* @throws TileDBError
*/
public boolean isEmpty() throws TileDBError {
boolean isEmpty;
SWIGTYPE_p_unsigned_int retp = tiledb.new_uintp();
try {
ctx.handleError(tiledb.tiledb_current_domain_get_is_empty(currentDomainp, retp));
isEmpty = tiledb.uintp_value(retp) != 0;
} finally {
tiledb.delete_uintp(retp);
}
return isEmpty;
}

@Override
public void close() {
if (currentDomainp != null) {
tiledb.tiledb_current_domain_free(currentDomainpp);
tiledb.delete_tiledb_current_domain_tpp(currentDomainpp);
currentDomainpp = null;
currentDomainp = null;
}
}
}
26 changes: 26 additions & 0 deletions src/main/java/io/tiledb/java/api/CurrentDomainType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.tiledb.java.api;

import io.tiledb.libtiledb.tiledb_current_domain_type_t;

public enum CurrentDomainType {
TILEDB_NDRECTANGLE;

protected tiledb_current_domain_type_t toSwigEnum() throws TileDBError {
switch (this) {
case TILEDB_NDRECTANGLE:
return tiledb_current_domain_type_t.TILEDB_NDRECTANGLE;
default:
throw new TileDBError("No such enum value" + this.name());
}
}

protected static CurrentDomainType fromSwigEnum(tiledb_current_domain_type_t e)
throws TileDBError {
switch (e) {
case TILEDB_NDRECTANGLE:
return TILEDB_NDRECTANGLE;
default:
throw new TileDBError("No such enum value" + e.name());
}
}
}
93 changes: 93 additions & 0 deletions src/main/java/io/tiledb/java/api/NDRectangle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package io.tiledb.java.api;

import io.tiledb.libtiledb.*;

public class NDRectangle implements AutoCloseable {
private SWIGTYPE_p_tiledb_ndrectangle_t ndrectanglep;
private SWIGTYPE_p_p_tiledb_ndrectangle_t ndrectanglepp;
private Context ctx;
private Domain domain;

/**
* Constructor
*
* @param ctx The TileDB context
* @param domain The array domain
* @throws TileDBError
*/
public NDRectangle(Context ctx, Domain domain) throws TileDBError {
this.ctx = ctx;
this.domain = domain;
this.ndrectanglepp = tiledb.new_tiledb_ndrectangle_tpp();
try {
ctx.handleError(
tiledb.tiledb_ndrectangle_alloc(ctx.getCtxp(), domain.getDomainp(), ndrectanglepp));
} catch (TileDBError err) {
tiledb.delete_tiledb_ndrectangle_tpp(ndrectanglepp);
throw err;
}
ndrectanglep = tiledb.tiledb_ndrectangle_tpp_value(ndrectanglepp);
}

/**
* Constructor
*
* @param ctx The TileDB context
* @param domain The array domain
* @param ndpp The c pointer to the ndrectangle object
*/
protected NDRectangle(Context ctx, Domain domain, SWIGTYPE_p_p_tiledb_ndrectangle_t ndpp) {
this.ctx = ctx;
this.ndrectanglepp = ndpp;
this.ndrectanglep = tiledb.tiledb_ndrectangle_tpp_value(ndrectanglepp);
this.domain = domain;
}

/**
* Getter for the c pointer
*
* @return The c pointer
*/
public SWIGTYPE_p_tiledb_ndrectangle_t getndrectanglep() {
return ndrectanglep;
}

/**
* Adds an 1D range along a dimension name, in the form (start, end).
*
* @param dimIdx The index of the dimension to add the range to
* @param range The range
* @throws TileDBError
*/
public void setRange(long dimIdx, Range range) throws TileDBError {
ctx.handleError(
tiledb.tiledb_ndrectangle_set_range(
ctx.getCtxp(), this.ndrectanglep, dimIdx, range.getRange_t()));
}

/**
* Retrieves a range for a given dimension index.
*
* @param dimIdx The dimension index
* @return The range
* @throws TileDBError
*/
public Range getRange(long dimIdx) throws TileDBError {
tiledb_range_t range = new tiledb_range_t();

ctx.handleError(
tiledb.tiledb_ndrectangle_get_range(ctx.getCtxp(), this.ndrectanglep, dimIdx, range));

return new Range(this.ctx, range, this.domain, dimIdx);
}

@Override
public void close() {
if (ndrectanglep != null && ndrectanglepp != null) {
tiledb.tiledb_ndrectangle_free(ndrectanglepp);
tiledb.delete_tiledb_ndrectangle_tpp(ndrectanglepp);
ndrectanglep = null;
ndrectanglepp = null;
}
}
}
Loading