Examples of Sorter


Examples of com.jdkcn.myblog.util.Sorter

    assertEquals(sorter.decorate(hql), orderedHql);
  }
 
  @Test
  public void testSorterWithExistOrderBy() throws Exception {
    Sorter sorter = new Sorter().desc("name").asc("property").desc("createDate");
    String hql = "from Entry entry order by entry.title desc";
    String orderedHql = "from Entry entry order by entry.title desc,name desc,property asc,createDate desc";
    assertEquals(sorter.decorate(hql), orderedHql);
  }
View Full Code Here

Examples of com.nexirius.util.Sorter

            model.setFlag(flag, filter.filter(model));
        }
    }

    public void sortByAttribute(String childName) {
        Sorter sorter = new AttributeSorter(childName);

        sort(sorter);
    }
View Full Code Here

Examples of com.nexirius.util.Sorter

        sort(sorter);
    }

    public void sortInsertByAttribute(DataModel model, String childName) {
        Sorter sorter = new AttributeSorter(childName);

        sortInsert(model, sorter);
    }
View Full Code Here

Examples of com.nexirius.util.Sorter

        sortInsert(model, sorter);
    }

    public void sortByAttributeDesc(String childName) {
        Sorter sorter = new AttributeSorter(childName, true);

        sort(sorter);
    }
View Full Code Here

Examples of com.psddev.dari.db.Sorter

    public Query<?> toPreviousQuery(State state) {
        String sortFieldName = getSortFieldName();
        Query<?> query = toQuery().and(sortFieldName + " <= ? and _id != ?", state.get(sortFieldName), state.getId());

        for (ListIterator<Sorter> i = query.getSorters().listIterator(); i.hasNext();) {
            Sorter sorter = i.next();
            if (Sorter.ASCENDING_OPERATOR.equals(sorter.getOperator())) {
                List<Object> options = sorter.getOptions();
                if (options != null &&
                        options.size() > 0 &&
                        sortFieldName.equals(options.get(0))) {
                    i.set(new Sorter(Sorter.DESCENDING_OPERATOR, options));
                }
            }
        }

        return query;
View Full Code Here

Examples of lupos.datastructures.sort.sorter.Sorter

    SORTER sorter = SORTER.valueOf(args[0]);
    if(sorter==null){
      System.out.println(Sort.getHelpText());
      return;
    }
    Sorter algo = sorter.createInstance(args, 4);
    if(algo==null){
      System.out.println(Sort.getHelpText());
      return;
    }

    final int times = Integer.parseInt(args[3]);

    // just to use for deleting temporary files...
    // final File file = new File("");
    // final String absolutePath = file.getAbsolutePath() + File.separator;

    System.out.println("\nParameters:\n-----------\nMain Strategy:" + sorter.name() + "\n" + algo.parametersToString() + "\n");

    final long[] execution_times = new long[times];
    long total_time = 0;
    for(int t=0; t<times; t++){
      sorter = SORTER.valueOf(args[0]);
      if(sorter==null){
        System.out.println(Sort.getHelpText());
        return;
      }
      algo = sorter.createInstance(args, 4);
      if(algo==null){
        System.out.println(Sort.getHelpText());
        return;
      }

      final Date start = new Date();
      System.out.println("\n"+t+": Start processing:"+start+"\n");

      final Run result = algo.sort(new BufferedInputStream(new FileInputStream(args[1])), args[2]);

      // just access all elements in the bag by iterating one time through
      final Iterator<String> it = result.iterator();
      long i=0;
      while(it.hasNext()){
        it.next();
        i++;
        // System.out.println((++i)+":"+it.next());
      }
      result.release();
      final Date end = new Date();

      System.out.println("\n"+t+": End processing:"+end);
      System.out.println("\nNumber of sorted RDF terms/Strings:"+i);
      System.out.println("Number of runs swapped to disk:" + algo.getNumberOfRunsOnDisk());

      execution_times[t] = end.getTime()-start.getTime();
      total_time += execution_times[t];

      DiskCollection.removeCollectionsFromDisk();
View Full Code Here

Examples of net.sf.jmp3renamer.datamanager.sort.Sorter

        comboSort = new JComboBox();
        for (Class<?> strategyClass : sortStrategies) {
            try {
                DataSetSortStrategy dsss = (DataSetSortStrategy) strategyClass.newInstance();
                comboSort.addItem(new Sorter(dsss));
                if(dsss.supportsReversing()) {
                    comboSort.addItem(new Sorter(dsss, false));
                }
            } catch (Exception e) {
                logger.warn("Couldn't instantiate sort strategy {}", strategyClass.getName());
            }
        }
View Full Code Here

Examples of org.apache.drill.exec.physical.impl.sort.Sorter

  VectorContainer sortedSamples = new VectorContainer();
    builder.build(context, sortedSamples);

    // Sort the records according the orderings given in the configuration

    Sorter sorter = SortBatch.createNewSorter(context, popConfig.getOrderings(), sortedSamples);
    SelectionVector4 sv4 = builder.getSv4();
    sorter.setup(context, sv4, sortedSamples);
    sorter.sort(sv4, sortedSamples);

    // Project every Nth record to a new vector container, where N = recordsSampled/(samplingFactor * partitions).
    // Uses the
    // the expressions from the Orderings to populate each column. There is one column for each Ordering in
    // popConfig.orderings.
View Full Code Here

Examples of org.apache.hadoop.io.SequenceFile.Sorter

        return;
      }
      {
        //create a sorter object as we need access to the SegmentDescriptor
        //class and merge methods
        Sorter sorter = new Sorter(localFs, job.getOutputKeyComparator(), valClass, job);
        sorter.setProgressable(reporter);
       
        for (int parts = 0; parts < partitions; parts++){
          List<SegmentDescriptor> segmentList =
            new ArrayList<SegmentDescriptor>(numSpills);
          for(int i = 0; i < numSpills; i++) {
            FSDataInputStream indexIn = localFs.open(indexFileName[i]);
            indexIn.seek(parts * 16);
            long segmentOffset = indexIn.readLong();
            long segmentLength = indexIn.readLong();
            indexIn.close();
            SegmentDescriptor s = sorter.new SegmentDescriptor(segmentOffset,
                                                               segmentLength, filename[i]);
            s.preserveInput(true);
            s.doSync();
            segmentList.add(i, s);
          }
          segmentStart = finalOut.getPos();
          RawKeyValueIterator kvIter = sorter.merge(segmentList, new Path(getTaskId()));
          SequenceFile.Writer writer = SequenceFile.createWriter(job, finalOut,
                                                                 job.getMapOutputKeyClass(), job.getMapOutputValueClass(),
                                                                 compressionType, codec);
          sorter.writeFile(kvIter, writer);
          //close the file - required esp. for block compression to ensure
          //partition data don't span partition boundaries
          writer.close();
          //when we write the offset/length to the final index file, we write
          //longs for both. This helps us to reliably seek directly to the
View Full Code Here

Examples of org.apache.hadoop.io.SequenceFile.Sorter

   *          output <code>Path</code>
   * @param evaluations
   *          List of evaluations
   */
  public static void importEvaluations(FileSystem fs, JobConf conf, Path outpath, List<Double> evaluations) throws IOException {
    Sorter sorter = new Sorter(fs, LongWritable.class, DoubleWritable.class, conf);
   
    // merge and sort the outputs
    Path[] outfiles = listOutputFiles(fs, outpath);
    Path output = new Path(outpath, "output.sorted");
    sorter.merge(outfiles, output);
   
    // import the evaluations
    LongWritable key = new LongWritable();
    DoubleWritable value = new DoubleWritable();
    Reader reader = new Reader(fs, output, conf);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.