Class Utilities
java.lang.Object
org.scictrl.mp.orbitcorrect.accessories.Utilities
Class of useful methods, which are printing lists, matrices etc, that are in
use in DataBush.
- Author:
- igor@scictrl.com
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
compareImputs
(ElementList<AbstractDataBushElement> first, ElementList<AbstractDataBushElement> second) Compares elements from two diffrent ElementLists and returns report.Method compares if there are same elements in both lists.They represent same physical element in storage ring.If this is true, method compares diffrent values of these two elements.The diffrences in lists and elements (same) are written in StringBuffer.static String
format1D
(double d) format1D.static String
format1E
(double d) format1E.static String
format2D
(double d) format2D.static String
format2E
(double d) format2E.static String
format3D
(double d) format3D.static String
format3E
(double d) format3E.static String
format4D
(double d) format4D.static String
format4E
(double d) format4E.static String
formatdMHmsS.static String
formatdMHmsS
(long d) formatdMHmsS.static String
formatdMHmsS
(Date d) formatdMHmsS.static String
formatHHHHms
(long duration) Format duration in seconds as <hours (can be more than 24)>.<minutes in hour>:<secondsin minute>static String
formatHHHHmsS
(long duration) Format duration in milliseconds as <hours (can be more than 24)>.<minutes in hour>:<secondsin minute>static final int
lazySearch
(Object[] array, Object o) Searches for Object o in array of objects.If Object is found method returns index of object in the array.Otherwise -1 is returned.static String
printBeamData
(OpticsList list) Returns formated text of beam data.static void
printBeamData
(OpticsList list, PrintWriter st) Prints parameters (beam data) of OpticElements, that are in OpticsList, in PrintWriter.static String
printBPMs
(BPMonitorList list) Returns formatted text of names and position BMPs in BPMonitorList and position of beam at BPMs.static void
printBPMs
(BPMonitorList list, PrintWriter pr) Prints in PrintWriter name and position of BMPs and position of the beam at BPMs.static String
printDBInfo
(DataBushInfo info) printDBInfo.static void
printDBInfo
(DataBushInfo info, PrintWriter pr) Returns text of information that are hold in DataBushInfo.static String
Returns string describing elements in DataBush.static void
printFormated
(DataBush db, PrintWriter p) Prints to PrintWriter string describing elements in DataBush.static String
Returns string describing elements in ElementList.static void
Prints to PrintWriter string describing elements in ElementList.static String
printMagnets
(CalMagnetList list) Returns String of names,positions, and other properties of elements, held in CalMagnetList.static void
printMagnets
(CalMagnetList list, PrintWriter pr) Prints to PrintWriter names, positions, and other properties of elements, held in CalMagnetList.static String
printMagnets
(MagnetList list) Returns String of names,positions, and other properties of elements, held in MagnetList.static void
printMagnets
(MagnetList list, PrintWriter pr) Prints to PrintWriter names,positions, and other properties of elements, held in MagnetList.static String
printMatrices
(TransferList list) Returns String of names of elements in TransferList, their position in storage ring and their matrices.static void
printMatrices
(TransferList list, PrintWriter pr) Prints to PrintWriter names of elements, their position and matrices.TransferList holds elements.static String
printMatrix
(double[] m) Returns String of matrix elements.static String
printMatrix
(double[][] m) printMatrix.static void
printMatrix
(double[][] m, PrintWriter pr) Prints matrix to PrintWriter.static void
printMatrix
(double[] m, PrintWriter pr) printMatrix.static String
Returns String of matrix elements.static void
printMatrix
(DoubleMatrix m, PrintWriter pr) Prints matrix to PrintWriter.static String
toStringBasics.
-
Method Details
-
format4E
format4E.
- Parameters:
d
- a double- Returns:
- a
String
object
-
format3E
format3E.
- Parameters:
d
- a double- Returns:
- a
String
object
-
format2E
format2E.
- Parameters:
d
- a double- Returns:
- a
String
object
-
format1E
format1E.
- Parameters:
d
- a double- Returns:
- a
String
object
-
format3D
format3D.
- Parameters:
d
- a double- Returns:
- a
String
object
-
format2D
format2D.
- Parameters:
d
- a double- Returns:
- a
String
object
-
format1D
format1D.
- Parameters:
d
- a double- Returns:
- a
String
object
-
format4D
format4D.
- Parameters:
d
- a double- Returns:
- a
String
object
-
formatdMHmsS
formatdMHmsS.
-
formatdMHmsS
formatdMHmsS.
- Parameters:
d
- a long- Returns:
- a
String
object
-
formatdMHmsS
formatdMHmsS.
- Returns:
- a
String
object
-
formatHHHHmsS
Format duration in milliseconds as <hours (can be more than 24)>.<minutes in hour>:<secondsin minute>- Parameters:
duration
- a long- Returns:
- HHH:mm:ss.SSS
-
formatHHHHms
Format duration in seconds as <hours (can be more than 24)>.<minutes in hour>:<secondsin minute>- Parameters:
duration
- a long- Returns:
- HHH:mm:ss.SSS
-
compareImputs
public static String compareImputs(ElementList<AbstractDataBushElement> first, ElementList<AbstractDataBushElement> second) Compares elements from two diffrent ElementLists and returns report.Method compares if there are same elements in both lists.They represent same physical element in storage ring.If this is true, method compares diffrent values of these two elements.The diffrences in lists and elements (same) are written in StringBuffer.- Parameters:
first
- ElementListsecond
- ElementList- Returns:
- java.lang.String
- See Also:
-
lazySearch
Searches for Object o in array of objects.If Object is found method returns index of object in the array.Otherwise -1 is returned.- Parameters:
array
- java.lang.Object[]o
- java.lang.Object- Returns:
- boolean
-
printBeamData
Returns formated text of beam data.- Parameters:
list
- DataBushInterface.ProtectedControlList- Returns:
- java.lang.String
- See Also:
-
printBeamData
Prints parameters (beam data) of OpticElements, that are in OpticsList, in PrintWriter.- Parameters:
list
- DataBushInterface.ProtectedControlListst
- aPrintWriter
object
-
printBPMs
Returns formatted text of names and position BMPs in BPMonitorList and position of beam at BPMs.- Parameters:
list
- DataBushInterface.ProtectedControlList- Returns:
- java.lang.String
-
printBPMs
Prints in PrintWriter name and position of BMPs and position of the beam at BPMs.- Parameters:
list
- DataBushInterface.ProtectedControlListpr
- aPrintWriter
object
-
printDBInfo
Returns text of information that are hold in DataBushInfo.- Parameters:
info
- aDataBushInfo
DataBushInfo holds information about energy of baem.pr
- aPrintWriter
object
-
printDBInfo
printDBInfo.
- Parameters:
info
- aDataBushInfo
object- Returns:
- a
String
object
-
printFormated
Returns string describing elements in DataBush. String is formated in input-file code.- Parameters:
db
- DataBush- Returns:
- java.lang.String
-
printFormated
Prints to PrintWriter string describing elements in DataBush. String is formated in input-file code.- Parameters:
db
- DataBushp
- aPrintWriter
object
-
printFormated
Returns string describing elements in ElementList. String is formated in input-file code.- Parameters:
l
- ElementList- Returns:
- java.lang.String
-
printFormated
Prints to PrintWriter string describing elements in ElementList. String is formated in input-file code.- Parameters:
l
- ElementListp
- aPrintWriter
object
-
printMagnets
Returns String of names,positions, and other properties of elements, held in CalMagnetList.- Parameters:
list
- aCalMagnetList
object- Returns:
- java.lang.String
-
printMagnets
Prints to PrintWriter names, positions, and other properties of elements, held in CalMagnetList.- Parameters:
list
- aCalMagnetList
objectpr
- aPrintWriter
object
-
printMagnets
Returns String of names,positions, and other properties of elements, held in MagnetList.- Parameters:
list
- aMagnetList
object- Returns:
- java.lang.String
-
printMagnets
Prints to PrintWriter names,positions, and other properties of elements, held in MagnetList.- Parameters:
list
- aMagnetList
objectpr
- aPrintWriter
object
-
printMatrices
Returns String of names of elements in TransferList, their position in storage ring and their matrices.- Parameters:
list
- TransferList- Returns:
- java.lang.String
-
printMatrices
Prints to PrintWriter names of elements, their position and matrices.TransferList holds elements.- Parameters:
list
- TransferListpr
- aPrintWriter
object
-
printMatrix
printMatrix.
- Parameters:
m
- an array ofinvalid reference
double
- Returns:
- a
String
object
-
printMatrix
Prints matrix to PrintWriter.- Parameters:
m
- an array ofinvalid reference
double
pr
- aPrintWriter
object
-
printMatrix
Returns String of matrix elements.- Parameters:
m
- an array ofinvalid reference
double
- Returns:
- a
String
object
-
printMatrix
printMatrix.
- Parameters:
m
- an array ofinvalid reference
double
pr
- aPrintWriter
object
-
printMatrix
Returns String of matrix elements.- Parameters:
m
- aDoubleMatrix
matrix- Returns:
- a
String
object
-
printMatrix
Prints matrix to PrintWriter.- Parameters:
m
- aDoubleMatrix
matrixpr
- aPrintWriter
object
-
toStringBasics
toStringBasics.
- Parameters:
list
- aElementList
object- Returns:
- java.lang.String
-