@@ -304,7 +304,7 @@ public HdfFixedPoint allocateNextSnodStorage() {
304304 }
305305 }
306306
307- HdfFixedPoint offset = metadataNextAvailableOffset . clone ( );
307+ HdfFixedPoint offset = new HdfFixedPoint ( metadataNextAvailableOffset );
308308 AllocationRecord record = new AllocationRecord (AllocationType .SNOD , "SNOD Block " + (snodRecords .size () + 1 ), offset , HDF_SNOD_STORAGE_SIZE , this );
309309 snodRecords .add (record );
310310// allocationRecords.add(record);
@@ -332,7 +332,7 @@ public HdfFixedPoint allocateAndSetDataBlock(String datasetName, HdfFixedPoint d
332332 throw new IllegalStateException ("Data block for '" + datasetName + "' already allocated" );
333333 }
334334
335- HdfFixedPoint dataOffset = dataNextAvailableOffset . clone ( );
335+ HdfFixedPoint dataOffset = new HdfFixedPoint ( dataNextAvailableOffset );
336336 AllocationRecord record = new AllocationRecord (AllocationType .DATASET_DATA , "Data Block (" + datasetName + ")" , dataOffset , dataSize , this );
337337 datasetRecordsByName .computeIfAbsent (datasetName , k -> new HashMap <>()).put (AllocationType .DATASET_DATA , record );
338338// allocationRecords.add(record);
@@ -364,7 +364,7 @@ public HdfFixedPoint allocateAndSetContinuationBlock(String datasetName, HdfFixe
364364 moveDataNextAvailableOffset (new HdfFixedPoint (metadataNextAvailableOffset .add (continuationSize ), metadataNextAvailableOffset .getDatatype ()));
365365 }
366366
367- HdfFixedPoint continuationOffset = metadataNextAvailableOffset . clone ( );
367+ HdfFixedPoint continuationOffset = new HdfFixedPoint ( metadataNextAvailableOffset );
368368 AllocationRecord record = new AllocationRecord (AllocationType .DATASET_HEADER_CONTINUATION , "Continuation (" + datasetName + ")" , continuationOffset , continuationSize , this );
369369 datasetRecordsByName .computeIfAbsent (datasetName , k -> new HashMap <>()).put (AllocationType .DATASET_HEADER_CONTINUATION , record );
370370// allocationRecords.add(record);
@@ -384,8 +384,8 @@ public HdfFixedPoint allocateFirstGlobalHeapBlock() {
384384 throw new IllegalStateException ("First global heap already allocated" );
385385 }
386386
387- HdfFixedPoint size = HDF_GLOBAL_HEAP_BLOCK_SIZE . clone ( );
388- HdfFixedPoint offset = dataNextAvailableOffset . clone ( );
387+ HdfFixedPoint size = new HdfFixedPoint ( HDF_GLOBAL_HEAP_BLOCK_SIZE );
388+ HdfFixedPoint offset = new HdfFixedPoint ( dataNextAvailableOffset );
389389 AllocationRecord record = new AllocationRecord (AllocationType .GLOBAL_HEAP_1 , "Global Heap Block 1" , offset , size , this );
390390 globalHeapBlocks .put (AllocationType .GLOBAL_HEAP_1 , record );
391391// allocationRecords.add(record);
@@ -405,8 +405,8 @@ public HdfFixedPoint allocateNextGlobalHeapBlock() {
405405 throw new IllegalStateException ("Only two global heap blocks allowed" );
406406 }
407407
408- HdfFixedPoint size = HDF_GLOBAL_HEAP_BLOCK_SIZE . clone ( );
409- HdfFixedPoint offset = dataNextAvailableOffset . clone ( );
408+ HdfFixedPoint size = new HdfFixedPoint ( HDF_GLOBAL_HEAP_BLOCK_SIZE );
409+ HdfFixedPoint offset = new HdfFixedPoint ( dataNextAvailableOffset );
410410 AllocationRecord record = new AllocationRecord (AllocationType .GLOBAL_HEAP_2 , "Global Heap Block 2" , offset , size , this );
411411 globalHeapBlocks .put (AllocationType .GLOBAL_HEAP_2 , record );
412412// allocationRecords.add(record);
@@ -450,7 +450,7 @@ public HdfFixedPoint expandLocalHeapContents() {
450450 moveMetadataNextAvailableOffset (metadataNextAvailableOffset , newSize );
451451 }
452452
453- HdfFixedPoint newOffset = metadataNextAvailableOffset . clone ( );
453+ HdfFixedPoint newOffset = new HdfFixedPoint ( metadataNextAvailableOffset );
454454
455455 // Update existing LOCAL_HEAP record to indicate abandonment
456456 activeRecord .setType (AllocationType .LOCAL_HEAP_ABANDONED );
@@ -527,11 +527,11 @@ public HdfFixedPoint getGlobalHeapBlockSize(HdfFixedPoint offset) {
527527 * @param newOffset the new metadata offset
528528 */
529529 private void updateMetadataOffset (HdfFixedPoint newOffset ) {
530- metadataNextAvailableOffset = newOffset . clone ( );
530+ metadataNextAvailableOffset = new HdfFixedPoint ( newOffset );
531531 if (metadataNextAvailableOffset .compareTo (dataNextAvailableOffset ) >= 0 &&
532532 !isDataBlocksAllocated () &&
533533 globalHeapBlocks .isEmpty ()) {
534- dataNextAvailableOffset = metadataNextAvailableOffset . clone ( );
534+ dataNextAvailableOffset = new HdfFixedPoint ( metadataNextAvailableOffset );
535535 updateDataOffset (dataNextAvailableOffset );
536536 }
537537 }
@@ -542,10 +542,10 @@ private void updateMetadataOffset(HdfFixedPoint newOffset) {
542542 * @param newOffset the new data offset
543543 */
544544 private void updateDataOffset (HdfFixedPoint newOffset ) {
545- dataNextAvailableOffset = newOffset . clone ( );
545+ dataNextAvailableOffset = new HdfFixedPoint ( newOffset );
546546 if (metadataNextAvailableOffset .compareTo (HDF_MIN_DATA_OFFSET_THRESHOLD ) >= 0 &&
547547 metadataNextAvailableOffset .compareTo (dataNextAvailableOffset ) < 0 ) {
548- metadataNextAvailableOffset = dataNextAvailableOffset . clone ( );
548+ metadataNextAvailableOffset = new HdfFixedPoint ( dataNextAvailableOffset );
549549 }
550550 }
551551
@@ -576,7 +576,7 @@ private boolean checkForOverlap(HdfFixedPoint offset, HdfFixedPoint size) {
576576 */
577577 private void moveMetadataNextAvailableOffset (HdfFixedPoint currentOffset , HdfFixedPoint size ) {
578578// long newOffset = Math.max(currentOffset, dataNextAvailableOffset);
579- HdfFixedPoint newOffset = currentOffset .compareTo (dataNextAvailableOffset ) > 0 ? currentOffset . clone ( ) : dataNextAvailableOffset . clone ( );
579+ HdfFixedPoint newOffset = currentOffset .compareTo (dataNextAvailableOffset ) > 0 ? new HdfFixedPoint ( currentOffset ) : new HdfFixedPoint ( dataNextAvailableOffset );
580580// newOffset.mutate(new); = ((newOffset + ALIGNMENT_BOUNDARY - 1) / ALIGNMENT_BOUNDARY) * ALIGNMENT_BOUNDARY; // Next 2048-byte boundary
581581 newOffset .mutate (HdfFixedPoint .truncateTo2048Boundary (HdfFixedPoint .minusOneBytes (newOffset .add (HDF_ALIGNMENT_BOUNDARY ))));
582582 // / ALIGNMENT_BOUNDARY) * ALIGNMENT_BOUNDARY; // Next 2048-byte boundary
0 commit comments