Package programming5.code

Examples of programming5.code.ReplicableObject


  /**
         *Creates an empty set
         */
        public MathSet() {
    super();
    sampleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    singleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    viewRand = new Random(System.currentTimeMillis());
  }
View Full Code Here


        public <T extends E> MathSet(T[] array) {
    super();
    for (T elem : array) {
      this.add(elem);
    }
    sampleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    singleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    viewRand = new Random(System.currentTimeMillis());
  }
View Full Code Here

  /**
         *Creates a new set out of the collection elements. Any repeated elements in the collection will only be inserted once.
         */
        public MathSet(Collection<? extends E> c) {
    super(c);
    sampleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    singleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    viewRand = new Random(System.currentTimeMillis());
  }
View Full Code Here

  /**
         *Creates an empty set initialized to the given size
         */
        public MathSet(int size) {
    super(size);
    sampleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    singleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    viewRand = new Random(System.currentTimeMillis());
  }
View Full Code Here

  /**
         *Creates an empty set initialized to the given size with the given growth percentage
         */
        public MathSet(int size, float pctGrowth) {
    super(size, pctGrowth);
    sampleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    singleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    viewRand = new Random(System.currentTimeMillis());
  }
View Full Code Here

  /**
   *Seeds the random objects used to generate random samples to the given value. If this method is not called, the
   *seed used is the current system time.
   */
  public void seedRandom(long seed) {
    sampleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    singleOrderGen = new RandomOrderGenerator(System.currentTimeMillis());
    viewRand = new Random(System.currentTimeMillis());
  }
View Full Code Here

    /**
     *Creates an iterator object to randomly traverse the given collection (can be traversed cyclically, in a new order each time)
     */
    public RandomOrderIterator(Collection<T> myCollection) {
        array = myCollection.toArray();
        rog = new RandomOrderGenerator();
        rog.generate(array.length);
    }
View Full Code Here

    /**
     *Creates an iterator object to randomly traverse the given collection (can be traversed cyclically, in a new order each time) using the given seed for the random order generator
     */
    public RandomOrderIterator(Collection<T> myCollection, long seed) {
        array = myCollection.toArray();
        rog = new RandomOrderGenerator(seed);
        rog.generate(array.length);
    }
View Full Code Here

   *@return the set of all subsets of this set, except for the empty set
   */
  public MathSet<Set<E>> parts() {
    MathSet<Set<E>> result = new MathSet<Set<E>>();
    E[] elements = (E[])this.toArray();
    SubsetGenerator subsetGen = new SubsetGenerator(this.size());
    int[] subsetIndices;
    while ((subsetIndices = subsetGen.nextSet()) != null) {
      MathSet<E> subset = new MathSet<E>();
      for (int index : subsetIndices) {
        subset.add(elements[index]);
      }
      result.add(subset);
View Full Code Here

   *@return the set of all subsets of the given set, except for the empty set
   */
  public static <T> Set<Set<T>> parts(Set<T> set) {
    MathSet<Set<T>> result = new MathSet<Set<T>>();
    T[] elements = (T[])set.toArray();
    SubsetGenerator subsetGen = new SubsetGenerator(set.size());
    int[] subsetIndices;
    while ((subsetIndices = subsetGen.nextSet()) != null) {
      MathSet<T> subset = new MathSet<T>();
      for (int index : subsetIndices) {
        subset.add(elements[index]);
      }
      result.add(subset);
View Full Code Here

TOP

Related Classes of programming5.code.ReplicableObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.