Class RandomLocationTransformer<V>

  • Type Parameters:
    V - the vertex type
    All Implemented Interfaces:
    com.google.common.base.Function<V,​java.awt.geom.Point2D>, java.util.function.Function<V,​java.awt.geom.Point2D>

    public class RandomLocationTransformer<V>
    extends java.lang.Object
    implements com.google.common.base.Function<V,​java.awt.geom.Point2D>
    Provides a random vertex location within the bounds of the Dimension property. This provides a random location for unmapped vertices the first time they are accessed.

    Note: the generated values are not cached, so apply() will generate a new random location for the passed vertex every time it is called. If you want a consistent value, wrap this layout's generated values in a StaticLayout instance.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.awt.Dimension d  
      (package private) java.util.Random random  
    • Constructor Summary

      Constructors 
      Constructor Description
      RandomLocationTransformer​(java.awt.Dimension d)
      Creates an instance with the specified size which uses the current time as the random seed.
      RandomLocationTransformer​(java.awt.Dimension d, long seed)
      Creates an instance with the specified dimension and random seed.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.geom.Point2D apply​(V v)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.google.common.base.Function

        equals
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Field Detail

      • d

        java.awt.Dimension d
      • random

        java.util.Random random
    • Constructor Detail

      • RandomLocationTransformer

        public RandomLocationTransformer​(java.awt.Dimension d)
        Creates an instance with the specified size which uses the current time as the random seed.
        Parameters:
        d - the size of the layout area
      • RandomLocationTransformer

        public RandomLocationTransformer​(java.awt.Dimension d,
                                         long seed)
        Creates an instance with the specified dimension and random seed.
        Parameters:
        d - the size of the layout area
        seed - the seed for the internal random number generator
    • Method Detail

      • apply

        public java.awt.geom.Point2D apply​(V v)
        Specified by:
        apply in interface com.google.common.base.Function<V,​java.awt.geom.Point2D>
        Specified by:
        apply in interface java.util.function.Function<V,​java.awt.geom.Point2D>