Package PamguardMVC.uid
Class DataBlockUIDHandler
java.lang.Object
PamguardMVC.uid.DataBlockUIDHandler
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Rounding up factor for new file starts. -
Constructor Summary
ConstructorDescriptionDataBlockUIDHandler
(PamDataBlock dataBlock) Construct a UID handler for a datablock. -
Method Summary
Modifier and TypeMethodDescriptionlong
Get the current UID without incrementing itlong
getNextUID
(PamDataUnit dataUnit) Get the next available UID.void
roundUpUID
(int rounding) Round up the UID value so that the next file will start on a nice round number.void
setCurrentUID
(long uid) Set the current UID value.
-
Field Details
-
ROUNDINGFACTOR
public static final int ROUNDINGFACTORRounding up factor for new file starts. May make this as a user definable option one day.- See Also:
-
-
Constructor Details
-
DataBlockUIDHandler
Construct a UID handler for a datablock.- Parameters:
dataBlock
- Datablock owning the UID handler.
-
-
Method Details
-
getNextUID
Get the next available UID. If the dataUnit already has a UID, then return the same number, otherwise increment uid by 1, then return the new value.- Parameters:
dataUnit
- Dataunit which may or may not have an existing UID- Returns:
- old UID if it existed, otherwise a new one.
-
setCurrentUID
public void setCurrentUID(long uid) Set the current UID value.- Parameters:
uid
- UID value.
-
roundUpUID
public void roundUpUID(int rounding) Round up the UID value so that the next file will start on a nice round number.- Parameters:
rounding
- factor
-
getCurrentUID
public long getCurrentUID()Get the current UID without incrementing it- Returns:
- The current UID.
-