Class Util


  • public final class Util
    extends Object
    Class to hold the utility methods.
    • Method Detail

      • fetchProjectRootPath

        public static String fetchProjectRootPath()
        Finds the project root path.
        Returns:
        the project root path.
      • checkEqualityOfIntPredicates

        public static boolean checkEqualityOfIntPredicates​(IntPredicate firstPredicate,
                                                           IntPredicate secondPredicate,
                                                           int noOfTimes)
        Check the equality of two intPredicates. Check if the both the predicates either passes together or fails together for each integer in the range [0,noOfTimes]
        Parameters:
        firstPredicate - the first IntPredicate.
        secondPredicate - the second IntPredicate.
        noOfTimes - Number to check the IntPredicates from.
        Returns:
        whether or not we can say that they are equal.
      • cloneEdge

        public static IREdge cloneEdge​(IREdge edgeToClone,
                                       IRVertex newSrc,
                                       IRVertex newDst)
        Parameters:
        edgeToClone - to copy execution properties from.
        newSrc - of the new edge.
        newDst - of the new edge.
        Returns:
        the new edge.
      • cloneEdge

        public static IREdge cloneEdge​(CommunicationPatternProperty.Value commPattern,
                                       IREdge edgeToClone,
                                       IRVertex newSrc,
                                       IRVertex newDst)
        Creates a new edge with several execution properties same as the given edge. The copied execution properties include those minimally required for execution, such as encoder/decoders.
        Parameters:
        commPattern - to use.
        edgeToClone - to copy execution properties from.
        newSrc - of the new edge.
        newDst - of the new edge.
        Returns:
        the new edge.
      • createControlEdge

        public static IREdge createControlEdge​(IRVertex src,
                                               IRVertex dst)
        A control edge enforces an execution ordering between the source vertex and the destination vertex. The additional output tag property of control edges is set such that no actual data element is transferred via the edges. This minimizes the run-time overhead of executing control edges.
        Parameters:
        src - vertex.
        dst - vertex.
        Returns:
        the control edge.
      • isControlEdge

        public static boolean isControlEdge​(IREdge edge)
      • isUtilityVertex

        public static boolean isUtilityVertex​(IRVertex v)
      • stringifyIRVertexIds

        public static String stringifyIRVertexIds​(Collection<IRVertex> vertices)
        Parameters:
        vertices - to stringify ids of.
        Returns:
        the string of ids.
      • stringifyIREdgeIds

        public static String stringifyIREdgeIds​(Collection<IREdge> edges)
        Parameters:
        edges - to stringify ids of.
        Returns:
        the string of ids.
      • restoreVertexId

        public static String restoreVertexId​(Integer numericId)
        Method to restore String ID from the numeric ID.
        Parameters:
        numericId - the numeric id.
        Returns:
        the restored string ID.
      • restoreEdgeId

        public static String restoreEdgeId​(Integer numericId)
        Method to restore String ID from the numeric ID.
        Parameters:
        numericId - the numeric id.
        Returns:
        the restored string ID.
      • premain

        public static void premain​(String args,
                                   Instrumentation inst)
        Method for the instrumentation: for getting the object size.
        Parameters:
        args - arguments.
        inst - the instrumentation.
      • getObjectSize

        public static long getObjectSize​(Object o)
        Get the object byte size.
        Parameters:
        o - object to measure.
        Returns:
        the bytes of the object.