Examples of IntIntProcedure


Examples of com.almworks.integers.func.IntIntProcedure

    final IntArray r = new IntArray(IntProgression.arithmetic(0, n));
    IntegersUtils.quicksort(n,
        // order
        IntFunctions.comparator(myValues),
        // swap
        new IntIntProcedure() {
          @Override
          public void invoke(int i, int j) {
            myValues.swap(i, j);
            r.swap(i, j);
          }
View Full Code Here

Examples of com.almworks.integers.func.IntIntProcedure

    // We cannot use PArray.sort(PArray... sortAlso) because types are different
    IntegersUtils.quicksort(main.size(),
        // compare
        IntFunctions.comparator(main),
        // swap
        new IntIntProcedure() {
          @Override
          public void invoke(int a, int b) {
            main.swap(a, b);
            parallel.swap(a, b);
          }
View Full Code Here

Examples of com.almworks.integers.func.IntIntProcedure

  public static int findDuplicate(LongList unsorted) {
    final LongArray sorted = new LongArray(unsorted);
    final IntArray perms = new IntArray(IntProgression.arithmetic(0, sorted.size()));
    IntegersUtils.quicksort(sorted.size(),
        LongFunctions.comparator(sorted),
        new IntIntProcedure() {
          @Override
          public void invoke(int a, int b) {
            sorted.swap(a, b);
            perms.swap(a, b);
          }
View Full Code Here

Examples of com.almworks.integers.func.IntIntProcedure

            int comp = LongCollections.compare(primary.get(i), primary.get(j));
            if (comp == 0) comp = LongCollections.compare(secondary.get(i), secondary.get(j));
            return comp;
          }
        },
        new IntIntProcedure() {
          @Override
          public void invoke(int i, int j) {
            primary.swap(i, j);
            secondary.swap(i, j);
          }
View Full Code Here

Examples of com.almworks.integers.func.IntIntProcedure

      for (WritableIntList list : sortAlso) {
        assert list.size() == size();
      }
    }
    IntegersUtils.quicksort(size(), IntFunctions.comparator(this),
        new IntIntProcedure() {
          public void invoke(int a, int b) {
            swap(a, b);
            if (sortAlso != null)
              for (WritableIntList list : sortAlso) {
                list.swap(a, b);
View Full Code Here

Examples of com.almworks.integers.func.IntIntProcedure

      for (WritableLongList list : sortAlso) {
        assert list.size() == size();
      }
    }
    IntegersUtils.quicksort(size(), LongFunctions.comparator(this),
        new IntIntProcedure() {
          public void invoke(int a, int b) {
            swap(a, b);
            if (sortAlso != null)
              for (WritableLongList list : sortAlso) {
                list.swap(a, b);
View Full Code Here

Examples of com.almworks.integers.func.IntIntProcedure

  public static int findDuplicate(IntList unsorted) {
    final IntArray sorted = new IntArray(unsorted);
    final IntArray perms = new IntArray(IntProgression.arithmetic(0, sorted.size()));
    IntegersUtils.quicksort(sorted.size(),
        IntFunctions.comparator(sorted),
        new IntIntProcedure() {
          @Override
          public void invoke(int a, int b) {
            sorted.swap(a, b);
            perms.swap(a, b);
          }
View Full Code Here

Examples of com.almworks.integers.func.IntIntProcedure

            int comp = IntCollections.compare(primary.get(i), primary.get(j));
            if (comp == 0) comp = IntCollections.compare(secondary.get(i), secondary.get(j));
            return comp;
          }
        },
        new IntIntProcedure() {
          @Override
          public void invoke(int i, int j) {
            primary.swap(i, j);
            secondary.swap(i, j);
          }
View Full Code Here

Examples of com.carrotsearch.hppc.procedures.IntIntProcedure

        final IntIntOpenHashMap map = new IntIntOpenHashMap();
        map.put(1, 2);
        map.put(2, 5);
        map.put(3, 10);

        int count = map.forEach(new IntIntProcedure()
        {
           int count;
           public void apply(int key, int value)
           {
               if (value >= 5) count++;
View Full Code Here

Examples of com.carrotsearch.hppc.procedures.IntIntProcedure

        // for each discovered phrase, do manual count and verify if tf and tfByDocument are correct.
        AllPhrases allPhrases = context.allPhrases;
        for (int index = 0; index < allPhrases.size(); index++)
        {
            IntIntOpenHashMap realTfByDocuments = countManually(context, allPhrases.wordIndices[index]);
            final int realTf = realTfByDocuments.forEach(new IntIntProcedure()
            {
                int tf;
                public void apply(int key, int value)
                {
                    tf += value;
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.