Class SmallDefaultContext<T>

    • Constructor Detail

      • SmallDefaultContext

        public SmallDefaultContext()
      • SmallDefaultContext

        public SmallDefaultContext​(Object id)
      • SmallDefaultContext

        public SmallDefaultContext​(Object name,
                                   Object typeID)
    • Method Detail

      • getObjects

        public IndexedIterable<T> getObjects​(Class<?> clazz)
        Gets a IndexedIterable over all the objects in this context (and thus in the sub contexts) that are of the specified type.
        Parameters:
        clazz - the type of objects to return
        Returns:
        a IndexedIterable over all the objects in this context (and thus in the sub contexts) that are of the specified type.
      • getObjectsAsStream

        public Stream<T> getObjectsAsStream​(Class<?> clazz)
        Gets a sequential Stream over all the objects in this context (and thus in the sub contexts) that are of the specified type.
        Parameters:
        clazz - the type of objects to return
        Returns:
        a Stream over all the objects in this context (and thus in the sub contexts) that are of the specified type. The Stream is sequential.
      • getRandomObjectsAsStream

        public Stream<T> getRandomObjectsAsStream​(Class<? extends T> clazz,
                                                  long count)
        Gets a sequential Stream over a collection of objects chosen at random. The number of objects is determined by the specified count and the type of objects by the specified class. If the context contains fewer objects than the specified count, all the appropriate objects in the context will be returned.

        If this is repeatedly called with a count equal to the number of objects in the context, the iteration order will be shuffled each time.

        Parameters:
        clazz - the class of the objects to return
        count - the number of random objects to return
        Returns:
        a sequential Stream over a collection of random objects
      • getRandomObjects

        public Iterable<T> getRandomObjects​(Class<? extends T> clazz,
                                            long count)
        Gets an iterable over a collection of objects chosen at random. The number of objects is determined by the specified count and the type of objects by the specified class. If the context contains fewer objects than the specified count, all the appropriate objects in the context will be returned.

        If this is repeatedly called with a count equal to the number of objects in the context, the iteration order will be shuffled each time.

        Parameters:
        clazz - the class of the objects to return
        count - the number of random objects to return
        Returns:
        an iterable over a collection of random objects
      • getRandomObject

        public T getRandomObject()
        Gets an object in this context chosen at random from a uniform distribution.
        Returns:
        an object in this context chosen at random from a uniform distribution.