Class Utilities

java.lang.Object
org.scictrl.mp.orbitcorrect.accessories.Utilities

public final class Utilities extends Object
Class of useful methods, which are printing lists, matrices etc, that are in use in DataBush.
Author:
igor@scictrl.com
  • Method Details

    • format4E

      public static String format4E(double d)

      format4E.

      Parameters:
      d - a double
      Returns:
      a String object
    • format3E

      public static String format3E(double d)

      format3E.

      Parameters:
      d - a double
      Returns:
      a String object
    • format2E

      public static String format2E(double d)

      format2E.

      Parameters:
      d - a double
      Returns:
      a String object
    • format1E

      public static String format1E(double d)

      format1E.

      Parameters:
      d - a double
      Returns:
      a String object
    • format3D

      public static String format3D(double d)

      format3D.

      Parameters:
      d - a double
      Returns:
      a String object
    • format2D

      public static String format2D(double d)

      format2D.

      Parameters:
      d - a double
      Returns:
      a String object
    • format1D

      public static String format1D(double d)

      format1D.

      Parameters:
      d - a double
      Returns:
      a String object
    • format4D

      public static String format4D(double d)

      format4D.

      Parameters:
      d - a double
      Returns:
      a String object
    • formatdMHmsS

      public static String formatdMHmsS(Date d)

      formatdMHmsS.

      Parameters:
      d - a Date object
      Returns:
      a String object
    • formatdMHmsS

      public static String formatdMHmsS(long d)

      formatdMHmsS.

      Parameters:
      d - a long
      Returns:
      a String object
    • formatdMHmsS

      public static String formatdMHmsS()

      formatdMHmsS.

      Returns:
      a String object
    • formatHHHHmsS

      public static String formatHHHHmsS(long duration)
      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

      public static String formatHHHHms(long duration)
      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 - ElementList
      second - ElementList
      Returns:
      java.lang.String
      See Also:
      • compareValue(StringBuffer, String, AbstractDataBushElement, AbstractDataBushElement)
    • lazySearch

      public 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.
      Parameters:
      array - java.lang.Object[]
      o - java.lang.Object
      Returns:
      boolean
    • printBeamData

      public static String printBeamData(OpticsList list)
      Returns formated text of beam data.
      Parameters:
      list - DataBushInterface.ProtectedControlList
      Returns:
      java.lang.String
      See Also:
    • printBeamData

      public static void printBeamData(OpticsList list, PrintWriter st)
      Prints parameters (beam data) of OpticElements, that are in OpticsList, in PrintWriter.
      Parameters:
      list - DataBushInterface.ProtectedControlList
      st - a PrintWriter object
    • printBPMs

      public static String printBPMs(BPMonitorList list)
      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

      public static void printBPMs(BPMonitorList list, PrintWriter pr)
      Prints in PrintWriter name and position of BMPs and position of the beam at BPMs.
      Parameters:
      list - DataBushInterface.ProtectedControlList
      pr - a PrintWriter object
    • printDBInfo

      public static void printDBInfo(DataBushInfo info, PrintWriter pr)
      Returns text of information that are hold in DataBushInfo.
      Parameters:
      info - a DataBushInfo DataBushInfo holds information about energy of baem.
      pr - a PrintWriter object
    • printDBInfo

      public static String printDBInfo(DataBushInfo info)

      printDBInfo.

      Parameters:
      info - a DataBushInfo object
      Returns:
      a String object
    • printFormated

      public static String printFormated(DataBush db)
      Returns string describing elements in DataBush. String is formated in input-file code.
      Parameters:
      db - DataBush
      Returns:
      java.lang.String
    • printFormated

      public static void printFormated(DataBush db, PrintWriter p)
      Prints to PrintWriter string describing elements in DataBush. String is formated in input-file code.
      Parameters:
      db - DataBush
      p - a PrintWriter object
    • printFormated

      public static String printFormated(ElementList<AbstractDataBushElement> l)
      Returns string describing elements in ElementList. String is formated in input-file code.
      Parameters:
      l - ElementList
      Returns:
      java.lang.String
    • printFormated

      public static void printFormated(ElementList<AbstractDataBushElement> l, PrintWriter p)
      Prints to PrintWriter string describing elements in ElementList. String is formated in input-file code.
      Parameters:
      l - ElementList
      p - a PrintWriter object
    • printMagnets

      public static String printMagnets(CalMagnetList list)
      Returns String of names,positions, and other properties of elements, held in CalMagnetList.
      Parameters:
      list - a CalMagnetList object
      Returns:
      java.lang.String
    • printMagnets

      public static void printMagnets(CalMagnetList list, PrintWriter pr)
      Prints to PrintWriter names, positions, and other properties of elements, held in CalMagnetList.
      Parameters:
      list - a CalMagnetList object
      pr - a PrintWriter object
    • printMagnets

      public static String printMagnets(MagnetList list)
      Returns String of names,positions, and other properties of elements, held in MagnetList.
      Parameters:
      list - a MagnetList object
      Returns:
      java.lang.String
    • printMagnets

      public static void printMagnets(MagnetList list, PrintWriter pr)
      Prints to PrintWriter names,positions, and other properties of elements, held in MagnetList.
      Parameters:
      list - a MagnetList object
      pr - a PrintWriter object
    • printMatrices

      public static String printMatrices(TransferList list)
      Returns String of names of elements in TransferList, their position in storage ring and their matrices.
      Parameters:
      list - TransferList
      Returns:
      java.lang.String
    • printMatrices

      public static void printMatrices(TransferList list, PrintWriter pr)
      Prints to PrintWriter names of elements, their position and matrices.TransferList holds elements.
      Parameters:
      list - TransferList
      pr - a PrintWriter object
    • printMatrix

      public static String printMatrix(double[][] m)

      printMatrix.

      Parameters:
      m - an array of
      invalid reference
      double
      objects
      Returns:
      a String object
    • printMatrix

      public static void printMatrix(double[][] m, PrintWriter pr)
      Prints matrix to PrintWriter.
      Parameters:
      m - an array of
      invalid reference
      double
      matrix
      pr - a PrintWriter object
    • printMatrix

      public static String printMatrix(double[] m)
      Returns String of matrix elements.
      Parameters:
      m - an array of
      invalid reference
      double
      matrix
      Returns:
      a String object
    • printMatrix

      public static void printMatrix(double[] m, PrintWriter pr)

      printMatrix.

      Parameters:
      m - an array of
      invalid reference
      double
      objects
      pr - a PrintWriter object
    • printMatrix

      public static String printMatrix(DoubleMatrix m)
      Returns String of matrix elements.
      Parameters:
      m - a DoubleMatrix matrix
      Returns:
      a String object
    • printMatrix

      public static void printMatrix(DoubleMatrix m, PrintWriter pr)
      Prints matrix to PrintWriter.
      Parameters:
      m - a DoubleMatrix matrix
      pr - a PrintWriter object
    • toStringBasics

      public static String toStringBasics(ElementList<AbstractDataBushElement> list)

      toStringBasics.

      Parameters:
      list - a ElementList object
      Returns:
      java.lang.String