Class Domain

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class Domain
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Represents 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
     
    • Method Detail

      • dump

        public void dump()
                  throws TileDBError
        Dumps the Domain in an ASCII representation to stdout.
        Throws:
        TileDBError - A TileDB exception
      • dump

        public void dump​(java.lang.String filename)
                  throws TileDBError
        Dumps the Domain in an ASCII representation to stdout.
        Parameters:
        filename - A string filename
        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 TileDBError
        Checks 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:
        close in interface java.lang.AutoCloseable