@Platform(include="<nix/Block.hpp>") @Platform(value="linux",link="nix@.1",preload="hdf5@.7") @Platform(value="windows",link="nix",preload={"hdf5","msvcp120","msvcr120","szip","zlib"}) @Namespace(value="nix") public class Block extends EntityWithMetadata
The Block entity is a top-level, summarizing element that allows to
group the other data entities belonging for example to the same recording session.
All data entities such as Source
, DataArray
, Tag
and
MultiTag
have to be associated with one Block.
File f = ...;
Block b = f.createBlock("session one", "recording_session");
Source
, DataArray
, Tag
and MultiTag
for more information.
The next example shows how some properties of a block can be accessed.
File f = ...;
Block b = f.createBlock("session one", "recording_session");
// add metadata to a block
Section s = f.getSection(sec_id);
b.setMetadata(s);
// get associated metadata from a block
Section s1 = b.getMetadata();
// remove associated metadata from a block
b.removeMetadata();
File f = ...;
boolean deleted = f.deleteBlock(some_id);
System.out.println("The block was " + (deleted ? "" : "not ") + "deleted.");
Constructor and Description |
---|
Block()
Constructor that creates an uninitialized Block.
|
Modifier and Type | Method and Description |
---|---|
DataArray |
createDataArray(String name,
String type,
int dataType,
NDSize shape)
Create a new data array associated with this block.
|
Group |
createGroup(String name,
String type)
Create a new group associated with this block.
|
MultiTag |
createMultiTag(String name,
String type,
DataArray positions)
Create a new multi tag associated with this block.
|
Source |
createSource(String name,
String type)
Create a new root source.
|
Tag |
createTag(String name,
String type,
double[] position)
Create a new tag associated with this block.
|
boolean |
deleteDataArray(DataArray dataArray)
Deletes a data array from this block.
|
boolean |
deleteDataArray(String nameOrId)
Deletes a data array from this block.
|
boolean |
deleteGroup(Group group)
Deletes a group from the block.
|
boolean |
deleteGroup(String nameOrId)
Deletes a Group from the block.
|
boolean |
deleteMultiTag(MultiTag multiTag)
Deletes a multi tag from the block.
|
boolean |
deleteMultiTag(String nameOrId)
Deletes a multi tag from the block.
|
boolean |
deleteSource(Source source)
Deletes a root source.
|
boolean |
deleteSource(String nameOrId)
Deletes a root source.
|
boolean |
deleteTag(String nameOrId)
Deletes a tag from the block.
|
boolean |
deleteTag(Tag tag)
Deletes a tag from the block.
|
List<Source> |
findSources()
Get all sources in this block recursively.
|
List<Source> |
findSources(int maxDepth)
Get all sources in this block recursively.
|
List<Source> |
findSources(java.util.function.Predicate<Source> filter)
Get all sources in this block recursively.
|
List<Source> |
findSources(java.util.function.Predicate<Source> filter,
int maxDepth)
Get all sources in this block recursively.
|
void |
forceCreatedAt(Date date)
Sets the creation date to the provided value even if the attribute is set.
|
void |
forceUpdatedAt()
Sets the time of the last update to the current time.
|
Date |
getCreatedAt()
Get the creation date of the block.
|
DataArray |
getDataArray(long index)
Retrieves a data array by index.
|
DataArray |
getDataArray(String nameOrId)
Retrieves a specific data array from the block by name or id.
|
long |
getDataArrayCount()
Returns the number of all data arrays of the block.
|
List<DataArray> |
getDataArrays()
Get data arrays within this block.
|
List<DataArray> |
getDataArrays(java.util.function.Predicate<DataArray> filter)
Get data arrays within this block.
|
String |
getDefinition()
Getter for the definition of the block.
|
Group |
getGroup(long index)
Retrieves a specific group by index.
|
Group |
getGroup(String nameOrId)
Retrieves a specific group from the block by its name or id.
|
long |
getGroupCount()
Returns the number of groups associated with this block.
|
List<Group> |
getGroups()
List all groups within this block.
|
List<Group> |
getGroups(java.util.function.Predicate<Group> filter)
List all groups within this block.
|
String |
getId()
Get id of the block
|
Section |
getMetadata()
Get metadata associated with this entity.
|
MultiTag |
getMultiTag(long index)
Retrieves a specific multi tag by index.
|
MultiTag |
getMultiTag(String nameOrId)
Retrieves a specific multi tag from the block by its id.
|
long |
getMultiTagCount()
Returns the number of multi tags associated with this block.
|
List<MultiTag> |
getMultiTags()
Get multi tags within this block.
|
List<MultiTag> |
getMultiTags(java.util.function.Predicate<MultiTag> filter)
Get multi tags within this block.
|
String |
getName()
Getter for the name of the block.
|
Source |
getSource(long index)
Retrieves a specific root source by index.
|
Source |
getSource(String nameOrId)
Retrieves a specific root source by its id.
|
long |
getSourceCount()
Returns the number of root sources in this block.
|
List<Source> |
getSources()
Get all root sources associated with this block.
|
List<Source> |
getSources(java.util.function.Predicate<Source> filter)
Get all root sources associated with this block.
|
Tag |
getTag(long index)
Retrieves a specific tag by index.
|
Tag |
getTag(String nameOrId)
Retrieves a specific tag from the block by its id.
|
long |
getTagCount()
Returns the number of tags within this block.
|
List<Tag> |
getTags()
Get tags within this block.
|
List<Tag> |
getTags(java.util.function.Predicate<Tag> filter)
Get tags within this block.
|
String |
getType()
Getter for the type of the block.
|
Date |
getUpdatedAt()
Get the date of the last update.
|
boolean |
hasDataArray(DataArray dataArray)
Checks if a specific data array exists in this block.
|
boolean |
hasDataArray(String nameOrId)
Checks if a specific data array exists in this block.
|
boolean |
hasGroup(Group group)
Checks if a specific group exists in the block.
|
boolean |
hasGroup(String nameOrId)
Checks if a specific group exists in the block.
|
boolean |
hasMultiTag(MultiTag multiTag)
Checks if a specific multi tag exists in the block.
|
boolean |
hasMultiTag(String nameOrId)
Checks if a specific multi tag exists in the block.
|
boolean |
hasSource(Source source)
Checks if this block has a specific root source.
|
boolean |
hasSource(String nameOrId)
Checks if this block has a specific root source.
|
boolean |
hasTag(String nameOrId)
Checks if a specific tag exists in the block.
|
boolean |
hasTag(Tag tag)
Checks if a specific tag exists in the block.
|
boolean |
isNone()
Check if entity is null
|
void |
removeMetadata()
Removes metadata associated with the entity.
|
void |
setCreatedAt()
Sets the creation time to the current time if the field is not set.
|
void |
setDefinition(String definition)
Setter for the definition of the block.
|
void |
setMetadata(Section metadata)
Associate the entity with some metadata.
|
void |
setMetadata(String id)
Associate the entity with some metadata.
|
void |
setType(String type)
Setter for the type of the block.
|
void |
setUpdatedAt()
Sets the time of the last update to the current time if the field is not set.
|
String |
toString() |
compareTo
isInitialized
public Block()
Calling any method on an uninitialized block will throw a RuntimeException
.
@Cast(value="bool") public boolean isNone()
ImplContainer
isNone
in class ImplContainer
@Name(value="id") @StdString public String getId()
public Date getCreatedAt()
getCreatedAt
in class Entity
public Date getUpdatedAt()
getUpdatedAt
in class Entity
public void setUpdatedAt()
setUpdatedAt
in class Entity
public void forceUpdatedAt()
forceUpdatedAt
in class Entity
public void setCreatedAt()
setCreatedAt
in class Entity
public void forceCreatedAt(Date date)
forceCreatedAt
in class Entity
date
- The creation date to set.@Name(value="type") public void setType(@StdString String type)
setType
in class NamedEntity
type
- The type of the block.@Name(value="type") @StdString public String getType()
getType
in class NamedEntity
@Name(value="name") @StdString public String getName()
getName
in class NamedEntity
public void setDefinition(String definition)
setDefinition
in class NamedEntity
definition
- The definition of block.public String getDefinition()
getDefinition
in class NamedEntity
@Name(value="metadata") public Section getMetadata()
getMetadata
in class EntityWithMetadata
Section
@Name(value="metadata") public void setMetadata(@Const @ByRef Section metadata)
Calling this method will replace previously stored information.
setMetadata
in class EntityWithMetadata
metadata
- The Section
that should be associated
with this entity.Section
@Name(value="metadata") public void setMetadata(@StdString String id)
Calling this method will replace previously stored information.
setMetadata
in class EntityWithMetadata
id
- The id of the Section
that should be associated
with this entity.Section
public void removeMetadata()
removeMetadata
in class EntityWithMetadata
Section
@Cast(value="bool") public boolean hasSource(@StdString String nameOrId)
nameOrId
- Name or id of the source.Source
@Cast(value="bool") public boolean hasSource(@Const @ByRef Source source)
source
- The source to check.Source
public Source getSource(String nameOrId)
nameOrId
- Name or id of the source.Source
public Source getSource(long index)
index
- The index of the source.Source
@Name(value="sourceCount") public long getSourceCount()
Source
public List<Source> getSources()
Source
public List<Source> getSources(java.util.function.Predicate<Source> filter)
The parameter filter can be used to filter sources by various criteria.
filter
- A filter function.Source
public List<Source> findSources(java.util.function.Predicate<Source> filter, int maxDepth)
This method traverses the tree of all sources in the block. The traversal is accomplished via breadth first and can be limited in depth. On each node or source a filter is applied. If the filter returns true the respective source will be added to the result list. By default a filter is used that accepts all sources.
filter
- A filter function.maxDepth
- The maximum depth of traversal.Source
public List<Source> findSources(java.util.function.Predicate<Source> filter)
This method traverses the tree of all sources in the block. The traversal is accomplished via breadth first and can be limited in depth. On each node or source a filter is applied. If the filter returns true the respective source will be added to the result list. By default a sources at all depths are considered.
filter
- A filter function.Source
public List<Source> findSources(int maxDepth)
This method traverses the tree of all sources in the block. The traversal is accomplished via breadth first and can be limited in depth. On each node or source a filter is applied. If the filter returns true the respective source will be added to the result list. By default a filter is used that accepts all sources.
maxDepth
- The maximum depth of traversal.Source
public List<Source> findSources()
This method traverses the tree of all sources in the block. The traversal is accomplished via breadth first and can be limited in depth. On each node or source a filter is applied. If the filter returns true the respective source will be added to the result list. By default a filter is used that accepts all sources at all depths.
Source
public Source createSource(String name, String type)
name
- The name of the source to create.type
- The type of the source.Source
@Cast(value="bool") public boolean deleteSource(@StdString String nameOrId)
This will also delete all child sources of this root source from the file. The deletion of a source can't be undone.
nameOrId
- Name or id of the source to delete.Source
@Cast(value="bool") public boolean deleteSource(@Const @ByRef Source source)
This will also delete all child sources of this root source from the file. The deletion of a source can't be undone.
source
- The source to delete.Source
@Cast(value="bool") public boolean hasGroup(@StdString String nameOrId)
nameOrId
- Name or id of a group.@Cast(value="bool") public boolean hasGroup(@Const @ByRef Group group)
group
- The group to check.public Group getGroup(String nameOrId)
nameOrId
- Name or id of the group.public Group getGroup(long index)
index
- The index of the group.@Name(value="groupCount") public long getGroupCount()
public Group createGroup(String name, String type)
name
- The name of the group to create.type
- The type of the tag.public List<Group> getGroups()
public List<Group> getGroups(java.util.function.Predicate<Group> filter)
filter
- A filter function.@Cast(value="bool") public boolean deleteGroup(@StdString String nameOrId)
nameOrId
- Name or id of the group to remove.@Cast(value="bool") public boolean deleteGroup(@Const @ByRef Group group)
group
- The group to remove.@Cast(value="bool") public boolean hasDataArray(@StdString String nameOrId)
nameOrId
- Name or id of a data array.DataArray
@Cast(value="bool") public boolean hasDataArray(@Const @ByRef DataArray dataArray)
dataArray
- The data array to check.DataArray
public DataArray getDataArray(String nameOrId)
nameOrId
- Name or id of an existing data array.DataArray
public DataArray getDataArray(long index)
index
- The index of the data array.DataArray
public List<DataArray> getDataArrays()
DataArray
public List<DataArray> getDataArrays(java.util.function.Predicate<DataArray> filter)
The parameter filter can be used to filter data arrays by various criteria.
filter
- A filter function.DataArray
@Name(value="dataArrayCount") public long getDataArrayCount()
DataArray
public DataArray createDataArray(String name, String type, int dataType, NDSize shape)
@Cast(value="bool") public boolean deleteDataArray(@StdString String nameOrId)
This deletes a data array and all its dimensions from the block and the file. The deletion can't be undone.
nameOrId
- Name or id of the data array to delete.DataArray
@Cast(value="bool") public boolean deleteDataArray(@Const @ByRef DataArray dataArray)
This deletes a data array and all its dimensions from the block and the file. The deletion can't be undone.
dataArray
- The data array to delete.DataArray
@Cast(value="bool") public boolean hasTag(@StdString String nameOrId)
nameOrId
- Name or id of a tag.Tag
@Cast(value="bool") public boolean hasTag(@Const @ByRef Tag tag)
tag
- The tag to check.Tag
public Tag getTag(String nameOrId)
nameOrId
- Name or id of the tag.Tag
public Tag getTag(long index)
index
- The index of the tag.Tag
public List<Tag> getTags()
Tag
public List<Tag> getTags(java.util.function.Predicate<Tag> filter)
The parameter filter can be used to filter tags by various criteria.
filter
- A filter function.Tag
@Name(value="tagCount") public long getTagCount()
public Tag createTag(String name, String type, double[] position)
name
- The name of the tag to create.type
- The type of the tag.position
- The position of the tag.Tag
@Cast(value="bool") public boolean deleteTag(@StdString String nameOrId)
Deletes a tag with all its features from the block and the file. The deletion can't be undone.
nameOrId
- Name or id of the tag to remove.Tag
@Cast(value="bool") public boolean deleteTag(@Const @ByRef Tag tag)
Deletes a tag with all its features from the block and the file. The deletion can't be undone.
tag
- The tag to remove.Tag
@Cast(value="bool") public boolean hasMultiTag(@StdString String nameOrId)
nameOrId
- Name or id of a multi tag.MultiTag
@Cast(value="bool") public boolean hasMultiTag(@Const @ByRef MultiTag multiTag)
multiTag
- The multi tag to check.MultiTag
public MultiTag getMultiTag(String nameOrId)
nameOrId
- Name or id of the multi tag.MultiTag
public MultiTag getMultiTag(long index)
index
- The index of the tag.MultiTag
public List<MultiTag> getMultiTags()
MultiTag
public List<MultiTag> getMultiTags(java.util.function.Predicate<MultiTag> filter)
The parameter filter can be used to filter multi tags by various * criteria.
filter
- A filter function.MultiTag
@Name(value="multiTagCount") public long getMultiTagCount()
MultiTag
public MultiTag createMultiTag(String name, String type, DataArray positions)
name
- The name of the multi tag to create.type
- The type of the tag.positions
- The positions of the tag.MultiTag
@Cast(value="bool") public boolean deleteMultiTag(@StdString String nameOrId)
Deletes a multi tag and all its features from the block and the file. The deletion can't be undone.
nameOrId
- Name or id of the tag to remove.MultiTag
@Cast(value="bool") public boolean deleteMultiTag(@Const @ByRef MultiTag multiTag)
Deletes a multi tag and all its features from the block and the file. The deletion can't be undone.
multiTag
- The tag to remove.MultiTag
public String toString()
toString
in class org.bytedeco.javacpp.Pointer
Copyright © 2016. All rights reserved.