Package com.almworks.integers.func

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


    }
    IntegersUtils.quicksort(size(), new IntIntToInt() {
      public int invoke(int a, int b) {
        return IntCollections.compare(get(a), get(b));
      }
    }, 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

    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

    // 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

  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

            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

      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

      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

  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

            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

TOP

Related Classes of com.almworks.integers.func.IntIntProcedure

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.