public class EmuUtilities
extends java.lang.Object
Constructor and Description |
---|
EmuUtilities() |
Modifier and Type | Method and Description |
---|---|
static java.nio.ByteBuffer |
deepCopy(java.nio.ByteBuffer source)
Method to deep copy a ByteBuffer object.
|
static java.lang.String |
doubleToString(double d,
int places)
Method to convert a double to a string with a specified number of decimal places.
|
static java.lang.String |
inputStr(java.lang.String s)
Method to wait on string from keyboard.
|
static int |
powerOfTwo(int x,
boolean roundUp)
Return the power of 2 closest to the given argument.
|
static void |
printStackTrace()
This method prints out the current stack trace.
|
static void |
setEventType(java.util.BitSet bSet,
EventType eType)
Encode the event type into the bit info word
which will be in each evio block header.
|
static void |
setFirstEvent(java.util.BitSet bSet)
Encode the "is first event" into the bit info word
which will be in evio block header.
|
static void |
sleepNanos(long nanoDuration)
Spin-yield loop based alternative to Thread.sleep
Based on the code of Andy Malakov
http://andy-malakov.blogspot.fr/2010/06/alternative-to-threadsleep.html .
|
static void |
unsetFirstEvent(java.util.BitSet bSet)
Encode the "is NOT first event" into the bit info word
which will be in evio block header.
|
public static void sleepNanos(long nanoDuration) throws java.lang.InterruptedException
nanoDuration
- nonoseconds to sleep.java.lang.InterruptedException
- if thread interrupted.public static void printStackTrace()
public static java.nio.ByteBuffer deepCopy(java.nio.ByteBuffer source)
source
- source ByteBuffer.public static java.lang.String doubleToString(double d, int places)
d
- double to convert to a stringplaces
- number of decimal placespublic static java.lang.String inputStr(java.lang.String s)
s
- prompt string to printpublic static void setEventType(java.util.BitSet bSet, EventType eType)
bSet
- bit set which will become part of the bit info wordeType
- event type to be encodedpublic static void setFirstEvent(java.util.BitSet bSet)
bSet
- bit set which will become part of the bit info wordpublic static void unsetFirstEvent(java.util.BitSet bSet)
bSet
- bit set which will become part of the bit info wordpublic static int powerOfTwo(int x, boolean roundUp)
x
- value to get the power of 2 closest to.roundUp
- if true, round up, else down