Package elki.result

Class ResultUtil


  • public final class ResultUtil
    extends java.lang.Object
    Utilities for handling result objects
    Since:
    0.2
    Author:
    Erich Schubert
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ResultUtil()
      Private constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addChildResult​(java.lang.Object parent, java.lang.Object child)
      Add a child result.
      static <C> java.util.ArrayList<C> filterResults​(java.lang.Object r, java.lang.Class<? super C> restrictionClass)
      Return only results of the given restriction class
      static Database findDatabase​(java.lang.Object result)
      Find the first database result in the tree.
      static java.util.List<CollectionResult<?>> getCollectionResults​(java.lang.Object r)
      Collect all collection results from a Result
      static java.util.List<IterableResult<?>> getIterableResults​(java.lang.Object r)
      Return all Iterable results
      static java.util.List<OrderingResult> getOrderingResults​(java.lang.Object r)
      Collect all ordering results from a Result
      static java.util.List<Relation<?>> getRelations​(java.lang.Object r)
      Collect all Annotation results from a Result
      static void removeRecursive​(java.lang.Object child)
      Recursively remove a result and its children.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResultUtil

        private ResultUtil()
        Private constructor. Static methods only.
    • Method Detail

      • getRelations

        public static java.util.List<Relation<?>> getRelations​(java.lang.Object r)
        Collect all Annotation results from a Result
        Parameters:
        r - Result
        Returns:
        List of all annotation results
      • getOrderingResults

        public static java.util.List<OrderingResult> getOrderingResults​(java.lang.Object r)
        Collect all ordering results from a Result
        Parameters:
        r - Result
        Returns:
        List of ordering results
      • getCollectionResults

        public static java.util.List<CollectionResult<?>> getCollectionResults​(java.lang.Object r)
        Collect all collection results from a Result
        Parameters:
        r - Result
        Returns:
        List of collection results
      • getIterableResults

        public static java.util.List<IterableResult<?>> getIterableResults​(java.lang.Object r)
        Return all Iterable results
        Parameters:
        r - Result
        Returns:
        List of iterable results
      • filterResults

        public static <C> java.util.ArrayList<C> filterResults​(java.lang.Object r,
                                                               java.lang.Class<? super C> restrictionClass)
        Return only results of the given restriction class
        Type Parameters:
        C - Class type
        Parameters:
        r - Starting position
        restrictionClass - Class restriction
        Returns:
        filtered results list
      • addChildResult

        public static void addChildResult​(java.lang.Object parent,
                                          java.lang.Object child)
        Add a child result.
        Parameters:
        parent - Parent
        child - Child
      • findDatabase

        public static Database findDatabase​(java.lang.Object result)
        Find the first database result in the tree.
        Parameters:
        result - Result hierarchy.
        Returns:
        Database
      • removeRecursive

        public static void removeRecursive​(java.lang.Object child)
        Recursively remove a result and its children.
        Parameters:
        child - Result to remove