All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generated.docs.javadoc.org.eclipse.dawnsci.nexus.impl.NXobjectImpl.html Maven / Gradle / Ivy






NXobjectImpl (h5jan API)












org.eclipse.dawnsci.nexus.impl

Class NXobjectImpl

    • Constructor Detail

      • NXobjectImpl

        protected NXobjectImpl()
        Creates a new NeXus group node. This constructor is used when create a new NeXus file
      • NXobjectImpl

        protected NXobjectImpl(long oid)
        Creates a new NeXus group node. This constructor is used when loading a new NeXus file. No further nodes should be added to a NeXus tree that has been loaded from disk.
        Parameters:
        oid -
    • Method Detail

      • canAddChild

        public boolean canAddChild(NXobject nexusObject)
        Description copied from interface: NXobject
        Returns whether the given NeXus group object can be added as a child group to this base class instance according to the NXDL definition for this base class.
        Specified by:
        canAddChild in interface NXobject
        Parameters:
        nexusObject - potential child nexus group object
        Returns:
        true if the given group object can be added as a child of this base class instance, false otherwise
      • getChild

        public <N extends NXobject> N getChild(java.lang.String name,
                                               java.lang.Class<N> nxClass)
        Description copied from interface: NXobject
        Returns the child of this node of the given type with the given name.
        Specified by:
        getChild in interface NXobject
        Parameters:
        name - of child
        nxClass - class of child
        Returns:
        named child NXobject of given NeXus class or null if none
      • getDataset

        public IDataset getDataset(java.lang.String name)
        Description copied from interface: NXobject
        Gets the dataset for the field with the given name, if it exists, otherwise null. Note that this method should only be used for small datasets, i.e. those set before the scan. To get the dataset for larger datasets (i.e. data acquired during the scan) use getDataNode(name).getDataset() which returns an ILazyDataset.
        Specified by:
        getDataset in interface NXobject
        Parameters:
        name - dataset name
        Returns:
        the dataset for the field with the given name, or null if the no such dataset exists
      • getLazyWritableDataset

        public ILazyWriteableDataset getLazyWritableDataset(java.lang.String name)
        Description copied from interface: NXobject
        Returns the ILazyWriteableDataset for the field within this object with the given name, or null if no such field exists, or the dataset for this field is not a ILazyWriteableDataset
        Specified by:
        getLazyWritableDataset in interface NXobject
        Parameters:
        name - field name
        Returns:
        the ILazyWriteableDataset for the given field if it exists, otherwise null
      • setDataset

        public DataNode setDataset(java.lang.String name,
                                   IDataset value)
        Description copied from interface: NXobject
        Sets the dataset for the field with the given name
        Specified by:
        setDataset in interface NXobject
        Returns:
        the new data node, for convenience
      • initializeLazyDataset

        public ILazyWriteableDataset initializeLazyDataset(java.lang.String name,
                                                           int rank,
                                                           java.lang.Class<?> dtype)
        Description copied from interface: NXobject
        Creates and adds a new ILazyWriteableDataset to this group for the given field name, with the given rank (dimensionality) and of the given element class
        Specified by:
        initializeLazyDataset in interface NXobject
        Parameters:
        name - field name
        rank - rank
        dtype - dataset element class
        Returns:
        new lazy writable dataset
      • initializeLazyDataset

        public ILazyWriteableDataset initializeLazyDataset(java.lang.String name,
                                                           int[] maxShape,
                                                           java.lang.Class<?> dtype)
        Description copied from interface: NXobject
        Creates and adds a new ILazyWriteableDataset to this group for the given field name, with the given maximum shape and of the given element class
        Specified by:
        initializeLazyDataset in interface NXobject
        Parameters:
        name - field name
        maxShape - the maximum shape
        dtype - dataset element class
        Returns:
        new lazy writable dataset
      • initializeFixedSizeLazyDataset

        public ILazyWriteableDataset initializeFixedSizeLazyDataset(java.lang.String name,
                                                                    int[] shape,
                                                                    java.lang.Class<?> dtype)
        Description copied from interface: NXobject
        Creates and adds a new ILazyWriteableDataset to this group for the given field name with the given fixed shape and of the given element class
        Specified by:
        initializeFixedSizeLazyDataset in interface NXobject
        Parameters:
        name - field name
        dtype - dataset element class
        Returns:
        new lazy writable dataset
      • addExternalLink

        public void addExternalLink(java.lang.String name,
                                    java.lang.String externalFileName,
                                    java.lang.String pathToNode)
        Description copied from interface: NXobject
        Adds an external link within the given name within this node to the node with the given path within the file with the given name. The external file need not exist at the time this method is invoked.
        Specified by:
        addExternalLink in interface NXobject
        Parameters:
        name - name of link within this group
        externalFileName - name of external file to link to
        pathToNode - path of node within external file to link to
      • createDataNode

        public DataNode createDataNode(java.lang.String name,
                                       ILazyDataset value)
        Description copied from interface: NXobject
        Creates and adds a new datanode to this group for the given field name and with the given dataset as its value. The given dataset may be either a ILazyWriteableDataset or an IDataset.
        Specified by:
        createDataNode in interface NXobject
        Parameters:
        name - field name
        value - dataset
        Returns:
        new data node
      • getChildren

        public <N extends NXobject> java.util.Map<java.lang.String,N> getChildren(java.lang.Class<N> nxClass)
        Description copied from interface: NXobject
        Returns a map containing all the children of this node of the given class. The keys of the map are the names of the child nodes.
        Specified by:
        getChildren in interface NXobject
        Parameters:
        nxClass - class of children.
        Returns:
        map of children, key is child node's name
      • getChildren

        public java.util.Map<java.lang.String,NXobject> getChildren()
        Description copied from interface: NXobject
        Returns a map containing all the children of this node. The keys of the map are the names of the child nodes within this NXobject.
        Specified by:
        getChildren in interface NXobject
        Returns:
        map of children, key is the child node's name
      • putChild

        public <N extends NXobject> void putChild(java.lang.String name,
                                                  N child)
        Description copied from interface: NXobject
        Add a child node with the given name. This method should be used with caution as it allows a child group to be added that may not be permitted by the NXDL base class definition for this base class. In preference, the relevant set method on the base class specific sub-interface of this interface should be used.
        Specified by:
        putChild in interface NXobject
        Parameters:
        name - name of child group
        child - child group
      • setChildren

        public <N extends NXobject> void setChildren(java.util.Map<java.lang.String,N> map)
        Description copied from interface: NXobject
        Adds the child nodes with the given names. This method should be used with caution as it allows a child group to be added that may not be permitted by the NXDL base class definition for this base class. In preference, the relevant set method on the base class specific sub-interface of this interface should be used.
        Specified by:
        setChildren in interface NXobject
        Parameters:
        map - map from names to child nodes to add
      • getString

        public java.lang.String getString(java.lang.String name)
        Description copied from interface: NXobject
        Gets the value of the given field as a string.
        Specified by:
        getString in interface NXobject
        Parameters:
        name - name of field
        Returns:
        the value of the given field as a string, null if there is no field with the given name
      • setString

        public DataNode setString(java.lang.String name,
                                  java.lang.String value)
      • getAllDatasets

        public java.util.Map<java.lang.String,IDataset> getAllDatasets()
        Description copied from interface: NXobject
        Returns all datasets as a map keyed by field name
        Specified by:
        getAllDatasets in interface NXobject
        Returns:
        all datasets
      • getBoolean

        public java.lang.Boolean getBoolean(java.lang.String name)
        Description copied from interface: NXobject
        Gets the value of the given field as a boolean, or null if not set
        Specified by:
        getBoolean in interface NXobject
        Parameters:
        name - name of field
        Returns:
        the value of the given field as a boolean, null if there is no field with the given name
      • getLong

        public java.lang.Long getLong(java.lang.String name)
        Description copied from interface: NXobject
        Gets the value of the given field as a long, or null if not set.
        Specified by:
        getLong in interface NXobject
        Parameters:
        name - name of field
        Returns:
        the value of the given field as a long, null if there is no field with the given name
      • getDouble

        public java.lang.Double getDouble(java.lang.String name)
        Description copied from interface: NXobject
        Gets the value of the given field as a Double, or null if not set.
        Specified by:
        getDouble in interface NXobject
        Parameters:
        name - name of field
        Returns:
        the value of the given field as a double, null if there is no field with the given name
      • getNumber

        public java.lang.Number getNumber(java.lang.String name)
        Description copied from interface: NXobject
        Gets the value of the given field as a number, or null if not set.
        Specified by:
        getNumber in interface NXobject
        Parameters:
        name - name of field
        Returns:
        the value of the given field as a number, null if there is no field with the given name
      • getDate

        public java.util.Date getDate(java.lang.String name)
        Description copied from interface: NXobject
        Gets the value of the given field as a date.
        Specified by:
        getDate in interface NXobject
        Parameters:
        name - name of field
        Returns:
        the value of the given field as a date, null if there is no field with the given name, or the value cannot be parsed as a date
      • setField

        public DataNode setField(java.lang.String name,
                                 java.lang.Object value)
        Set the value of the given field to the given value. The value may be an atomic value (e.g. primitive wrapper, object or string), or a dataset.
        Specified by:
        setField in interface NXobject
        Parameters:
        name - name
        value - value
        Returns:
        the newly created DataNode.
      • setDate

        protected DataNode setDate(java.lang.String name,
                                   java.util.Date date)
      • setAttribute

        public void setAttribute(java.lang.String name,
                                 java.lang.String attrName,
                                 java.lang.Object attrValue)
        Description copied from interface: NXobject
        Set the value of the given attribute. If the first argument is not null then the attribute is set on the field or child group with this name
        Specified by:
        setAttribute in interface NXobject
        Parameters:
        name - name of node (if null then current group)
        attrName - attribute name
        attrValue - attribute value
      • getAttr

        public Dataset getAttr(java.lang.String name,
                               java.lang.String attrName)
        Description copied from interface: NXobject
        Get the value of the given attribute. If the first argument is not null then returns the value of attribute of the field or child group with that name.
        Specified by:
        getAttr in interface NXobject
        Parameters:
        name - name of node (if null then current group)
        attrName - attribute name
        Returns:
        value of attribute as a long
      • getAttrString

        public java.lang.String getAttrString(java.lang.String name,
                                              java.lang.String attrName)
        Description copied from interface: NXobject
        Get the value of the given attribute as a String. If the first argument is not null then returns the value of attribute of the field or child group with that name.
        Specified by:
        getAttrString in interface NXobject
        Parameters:
        name - name of node (if null then current group)
        attrName - attribute name
        Returns:
        value of attribute as a long
      • getAttrBoolean

        public java.lang.Boolean getAttrBoolean(java.lang.String name,
                                                java.lang.String attrName)
        Description copied from interface: NXobject
        Get the value of the given attribute as a Boolean, or null if not set. If the first argument is not null then returns the value of attribute of the field or child group with that name.
        Specified by:
        getAttrBoolean in interface NXobject
        Parameters:
        name - name of node (if null then current group)
        attrName - attribute name
        Returns:
        value of attribute as a Boolean, or null if not set
      • getAttrLong

        public java.lang.Long getAttrLong(java.lang.String name,
                                          java.lang.String attrName)
        Description copied from interface: NXobject
        Get the value of the given attribute as a Long, or null if not set. If the first argument is not null then returns the value of attribute of the field or child group with that name.
        Specified by:
        getAttrLong in interface NXobject
        Parameters:
        name - name of node (if null then current group)
        attrName - attribute name
        Returns:
        value of attribute as a Long, or null if not set
      • getAttrDouble

        public java.lang.Double getAttrDouble(java.lang.String name,
                                              java.lang.String attrName)
        Description copied from interface: NXobject
        Get the value of the given attribute as a Double, or null if not set. If the first argument is not null then returns the value of attribute of the field or child group with that name.
        Specified by:
        getAttrDouble in interface NXobject
        Parameters:
        name - name of node (if null then current group)
        attrName - attribute name
        Returns:
        value of attribute as a double
      • getAttrNumber

        public java.lang.Number getAttrNumber(java.lang.String name,
                                              java.lang.String attrName)
        Description copied from interface: NXobject
        Get the value of the given attribute as a number. If the first argument is not null then returns the value of attribute of the field or child group with that name.
        Specified by:
        getAttrNumber in interface NXobject
        Parameters:
        name - name of node (if null then current group)
        attrName - attribute name
        Returns:
        value of attribute as a number
      • getAttrDate

        public java.util.Date getAttrDate(java.lang.String name,
                                          java.lang.String attrName)
        Description copied from interface: NXobject
        Get the value of the given attribute as a date. If the first argument is not null then returns the value of attribute of the field or child group with that name.
        Specified by:
        getAttrDate in interface NXobject
        Parameters:
        name - name of node (if null then current group)
        attrName - attribute name
        Returns:
        value of attribute as a date, or null if no such attribute or value cannot be parsed as a date
      • appendNodeString

        protected void appendNodeString(java.lang.StringBuilder s,
                                        java.lang.String n)
        Overrides:
        appendNodeString in class GroupNodeImpl




© 2015 - 2024 Weber Informatics LLC | Privacy Policy