Record Class JupyterNotebook
java.lang.Object
java.lang.Record
smile.util.ipynb.JupyterNotebook
- Record Components:
cells- the list of cells in document order.metadata- the notebook-level metadata.nbformat- the major version of the notebook format (5).nbformatMinor- the minor version of the notebook format.
public record JupyterNotebook(List<Cell> cells, Metadata metadata, int nbformat, int nbformatMinor)
extends Record
The top-level Jupyter notebook document (nbformat 5).
A notebook document consists of an ordered list of cells, metadata about
the notebook, and version information. The current major version is
5 with the minor version indicating incremental additions (e.g.
5.4 added the cell id field as a required property).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe current (latest) major format version.static final intThe current (latest) minor format version. -
Constructor Summary
ConstructorsConstructorDescriptionJupyterNotebook(List<Cell> cells, Metadata metadata, int nbformat, int nbformatMinor) Creates an instance of aJupyterNotebookrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncells()Returns the value of thecellsrecord component.final booleanIndicates whether some other object is "equal to" this one.static JupyterNotebookReads a notebook file.final inthashCode()Returns a hash code value for this object.metadata()Returns the value of themetadatarecord component.intnbformat()Returns the value of thenbformatrecord component.intReturns the value of thenbformatMinorrecord component.final StringtoString()Returns a string representation of this record class.voidWrites the notebook to the specified file.
-
Field Details
-
NBFORMAT
public static final int NBFORMATThe current (latest) major format version.- See Also:
-
NBFORMAT_MINOR
public static final int NBFORMAT_MINORThe current (latest) minor format version.- See Also:
-
-
Constructor Details
-
JupyterNotebook
Creates an instance of aJupyterNotebookrecord class.- Parameters:
cells- the value for thecellsrecord componentmetadata- the value for themetadatarecord componentnbformat- the value for thenbformatrecord componentnbformatMinor- the value for thenbformatMinorrecord component
-
-
Method Details
-
from
Reads a notebook file.- Parameters:
path- the path to the notebook file.- Returns:
- the notebook read from the specified path.
- Throws:
IOException- when fails to read the file.
-
write
Writes the notebook to the specified file.- Parameters:
path- the file path to write the notebook to.- Throws:
IOException- when fails to write the file.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
cells
-
metadata
-
nbformat
-
nbformatMinor
public int nbformatMinor()Returns the value of thenbformatMinorrecord component.- Returns:
- the value of the
nbformatMinorrecord component
-