// Path: wava-core/src/main/java/org/brutusin/wava/core/plug/impl/niceness/HomogeneusSpreadNicenessHandler.java
// public final class HomogeneusSpreadNicenessHandler extends NicenessHandler {
// 
//     @Override
//     public int getNiceness(int processPosition, int processCount, int groupPosition, int groupCount, int minNiceness, int maxNiceness) {
//         return distribute(processPosition, processCount, minNiceness, maxNiceness);
//     }
// 
//     public static int distribute(int i, int total, int min, int max) {
//         int s = max - min + 1;
//         int r = (total - 1) / s + 1;
//         int c = total - (s * (r - 1));
//         int l = c * r;
//         if (i + 1 <= l) {
//             return min + i / r;
//         } else {
//             return min + c + (i - l) / (r - 1);
//         }
//     }
// }


import org.brutusin.wava.core.plug.impl.niceness.HomogeneusSpreadNicenessHandler;
import org.junit.Test;

/*
 * Copyright 2016 Ignacio del Valle Alles idelvall@brutusin.org.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.brutusin.wava.core.plug.impl;


/**
 *
 * @author Ignacio del Valle Alles idelvall@brutusin.org
 */
public class HomogeneusSpreadNicenessHandlerTest {

    public HomogeneusSpreadNicenessHandlerTest() {
    }

    @Test
    public void distribute() {
        int minNiceness = -20;
        int maxNiceness = 19;
        for (int total = 0; total < 100; total++) {
            System.out.print(total + ":");

// Path: wava-core/src/main/java/org/brutusin/wava/core/plug/impl/niceness/HomogeneusSpreadNicenessHandler.java
// public final class HomogeneusSpreadNicenessHandler extends NicenessHandler {
// 
//     @Override
//     public int getNiceness(int processPosition, int processCount, int groupPosition, int groupCount, int minNiceness, int maxNiceness) {
//         return distribute(processPosition, processCount, minNiceness, maxNiceness);
//     }
// 
//     public static int distribute(int i, int total, int min, int max) {
//         int s = max - min + 1;
//         int r = (total - 1) / s + 1;
//         int c = total - (s * (r - 1));
//         int l = c * r;
//         if (i + 1 <= l) {
//             return min + i / r;
//         } else {
//             return min + c + (i - l) / (r - 1);
//         }
//     }
// }


// Path: wava-core/src/test/java/org/brutusin/wava/core/plug/impl/HomogeneusSpreadNicenessHandlerTest.java
import org.brutusin.wava.core.plug.impl.niceness.HomogeneusSpreadNicenessHandler;
import org.junit.Test;

/*
 * Copyright 2016 Ignacio del Valle Alles idelvall@brutusin.org.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.brutusin.wava.core.plug.impl;


/**
 *
 * @author Ignacio del Valle Alles idelvall@brutusin.org
 */
public class HomogeneusSpreadNicenessHandlerTest {

    public HomogeneusSpreadNicenessHandlerTest() {
    }

    @Test
    public void distribute() {
        int minNiceness = -20;
        int maxNiceness = 19;
        for (int total = 0; total < 100; total++) {
            System.out.print(total + ":");

            for (int i = 0; i < total; i++) {
