RISC JKU
at.jku.risc.stout.tgau.util

Class DataStructureFactory



  • public class DataStructureFactory
    extends java.lang.Object
    This factory class defines which data structures to use. The complexity of the algorithm will depend on the used data structures. Hash based structures (HashMap, HashSet) have better average case complexity and tree based structures (TreeMap, TreeSet) have better worst case complexity in Java's standard implementation. Of course you are free to provide your own data structures with better computational behavior here ;)
    You can simply change the public static instance field which is called $ to your own implementation of DataStructureFactory (override some of the methods). The data structures which are used by default are ArrayList, LinkedList, HashSet and HashMap.
    Author:
    Alexander Baumgartner
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static DataStructureFactory $
      You can customize the collection implementations that are used by this software package in the following way:
      DataStructureFactory.$ = new DataStructureFactory(){OVERRIDE METHODS};
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      <T> java.util.List<T> newConcatList(java.util.List<? extends T> l1, java.util.List<? extends T> l2)
      Returns a list that is not modifiable.
      <T> java.util.Deque<T> newDeque() 
      <T> java.util.Deque<T> newDeque(java.util.Collection<T> toCopy) 
      <T> java.util.Deque<T> newDeque(int size) 
      <T> java.util.List<T> newList() 
      <T> java.util.List<T> newList(java.util.Collection<T> toCopy) 
      <T> java.util.List<T> newList(int size) 
      <K,V> java.util.Map<K,V> newMap() 
      <K,V> java.util.Map<K,V> newMap(int size) 
      <K,V> java.util.Map<K,V> newMap(java.util.Map<K,V> toCopy) 
      <T> java.util.Set<T> newSet() 
      <T> java.util.Set<T> newSet(java.util.Collection<T> toCopy) 
      <T> java.util.Set<T> newSet(int size) 
      void printCollection(java.util.Collection<? extends Printable> vars, boolean commutative, java.io.Writer out) 
      void printPlainCollection(java.util.Collection<? extends Printable> vars, java.io.Writer out) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • $

        public static DataStructureFactory $
        You can customize the collection implementations that are used by this software package in the following way:
        DataStructureFactory.$ = new DataStructureFactory(){OVERRIDE METHODS};
    • Constructor Detail

      • DataStructureFactory

        public DataStructureFactory()
    • Method Detail

      • newConcatList

        public final <T> java.util.List<T> newConcatList(java.util.List<? extends T> l1,
                                                         java.util.List<? extends T> l2)
        Returns a list that is not modifiable. It reflects any modification of the original lists, since it's just a hull around the two of them.
      • newDeque

        public <T> java.util.Deque<T> newDeque()
      • newDeque

        public <T> java.util.Deque<T> newDeque(java.util.Collection<T> toCopy)
      • newDeque

        public <T> java.util.Deque<T> newDeque(int size)
      • newList

        public <T> java.util.List<T> newList()
      • newList

        public <T> java.util.List<T> newList(java.util.Collection<T> toCopy)
      • newList

        public <T> java.util.List<T> newList(int size)
      • newMap

        public <K,V> java.util.Map<K,V> newMap()
      • newMap

        public <K,V> java.util.Map<K,V> newMap(int size)
      • newMap

        public <K,V> java.util.Map<K,V> newMap(java.util.Map<K,V> toCopy)
      • newSet

        public <T> java.util.Set<T> newSet()
      • newSet

        public <T> java.util.Set<T> newSet(java.util.Collection<T> toCopy)
      • newSet

        public <T> java.util.Set<T> newSet(int size)
      • printCollection

        public void printCollection(java.util.Collection<? extends Printable> vars,
                                    boolean commutative,
                                    java.io.Writer out)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • printPlainCollection

        public void printPlainCollection(java.util.Collection<? extends Printable> vars,
                                         java.io.Writer out)
                                  throws java.io.IOException
        Throws:
        java.io.IOException