Package com.meapsoft

Examples of com.meapsoft.MaxHeap


  public abstract void draw(BufferedImage image, int width, int height);
 
  //returns a Vector of EDLChunks
  public Vector getSelectedEDLChunks()
  {
    MaxHeap v = new MaxHeap();
    for (int i = 0; i < events.size(); i++)
    {
      ChunkVisInfo cVI = (ChunkVisInfo)events.elementAt(i);
      if (cVI.selected)
      {
        EDLChunk c =
          new EDLChunk(cVI.srcFile, cVI.startTime, cVI.length,
            cVI.dstTime);
        c.comment = cVI.comment;
        v.add(c);
      }
    }
       
        // return v in increasing order of destTime.
        v.sort();
   
    return v;
  }
View Full Code Here


       
        // maintain a set of chunks sorted using dist from targetChunk
        MinHeap chunks = new MinHeap(dist);
        chunks.addAll(featFile.chunks);
       
        MaxHeap chunks2 = new MaxHeap(500);
       
        NumberFormat fmt = NumberFormat.getInstance();
        fmt.setMaximumFractionDigits(3);
       
        double currTime = 0;
        while(chunks.size() > 0)
        {
            dist.setTarget(currChunk);
            chunks.rebuildHeap();
           
            currChunk = (FeatChunk)chunks.deleteMin();
           
            // turn currChunk into an EDL chunk
            EDLChunk nc = new EDLChunk(currChunk, currTime);

            chunks2.add(nc);
        
            currTime += currChunk.length;

            progress.setValue(progress.getValue()+1)
        }
       
    double currTime2 = 0;
    Random rand = new Random();
    int pointer;
    int pointer2;
    int clumpWidth;
    int moveWidth;
   
    while(currTime2<=outFileLength)
    {
      pointer = rand.nextInt((int)chunks2.size());
      clumpWidth = rand.nextInt(maxClumpWidth)+1;
      moveWidth = rand.nextInt(13)+13;
      int pointersSize = 2+rand.nextInt(3);
      int pointers[] = new int[pointersSize];
      pointers[0]=pointer;
      for ( int pi = 1; pi<pointersSize; pi++) {
        pointers[pi] = pointers[0]+rand.nextInt(moveWidth);
      };
      for (int i = 0; i<rand.nextInt(maxClumpWidth)+1; i++) {
        pointer = pointers[rand.nextInt(pointersSize)];
        for (int i2 = 0; i2<rand.nextInt(maxClumpWidth)+1; i2++)
        {
          pointer2 = pointers[rand.nextInt(pointersSize)] + rand.nextInt(clumpWidth+1);
          if (pointer2>(chunks2.size()-1))
          {
            pointer2 = chunks2.size()-1;
          }
          EDLChunk currChunk2 = (EDLChunk)chunks2.get(pointer2);
          EDLChunk nc = new EDLChunk(currChunk2.srcFile, currChunk2.startTime, currChunk2.length, currTime2);
          outFile.chunks.add(nc);
          currTime2 += nc.length;
        }
      }
View Full Code Here

        dist.setTarget(targetChunk);
       
        // maintain a set of chunks sorted using dist from targetChunk
        Heap chunks = null;
        if(reverseSort)
            chunks = new MaxHeap(dist);
        else
            chunks = new MinHeap(dist);
        chunks.addAll(featFile.chunks);
       
        NumberFormat fmt = NumberFormat.getInstance();
View Full Code Here

TOP

Related Classes of com.meapsoft.MaxHeap

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.