Java Code Examples for org.apache.commons.lang.mutable.MutableInt#setValue()

The following examples show how to use org.apache.commons.lang.mutable.MutableInt#setValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReaderTextLIBSVM.java    From systemds with Apache License 2.0 6 votes vote down vote up
private static long readLIBSVMMatrixFromInputStream( InputStream is, String srcInfo, MatrixBlock dest, MutableInt rowPos, 
		long rlen, long clen, int blen )
	throws IOException
{
	SparseRowVector vect = new SparseRowVector(1024);
	String value = null;
	int row = rowPos.intValue();
	long lnnz = 0;
	
	// Read the data
	try( BufferedReader br = new BufferedReader(new InputStreamReader(is)) ) {
		while( (value=br.readLine())!=null ) { //for each line
			String rowStr = value.toString().trim();
			lnnz += ReaderTextLIBSVM.parseLibsvmRow(rowStr, vect, (int)clen);
			dest.appendRow(row, vect);
			row++;
		}
	}
	
	rowPos.setValue(row);
	return lnnz;
}
 
Example 2
Source File: RefreshTask.java    From ScoreboardStats with MIT License 6 votes vote down vote up
@Override
public void run() {
    //let the players update smoother
    int remainingUpdates = getNextUpdates();
    for (Map.Entry<Player, MutableInt> entry : queue.entrySet()) {
        Player player = entry.getKey();
        MutableInt remainingTicks = entry.getValue();
        if (remainingTicks.intValue() == 0) {
            if (remainingUpdates != 0) {
                //Smoother refreshing; limit the updates
                plugin.getScoreboardManager().onUpdate(player);
                remainingTicks.setValue(20 * Settings.getInterval());
                remainingUpdates--;
            }
        } else {
            remainingTicks.decrement();
        }
    }

    nextGlobalUpdate--;
    if (nextGlobalUpdate == 0) {
        nextGlobalUpdate = 20 * Settings.getInterval();
        //update globals
        plugin.getReplaceManager().updateGlobals();
    }
}
 
Example 3
Source File: ReaderTextLIBSVM.java    From systemds with Apache License 2.0 6 votes vote down vote up
private static long readLIBSVMMatrixFromInputStream( InputStream is, String srcInfo, MatrixBlock dest, MutableInt rowPos, 
		long rlen, long clen, int blen )
	throws IOException
{
	SparseRowVector vect = new SparseRowVector(1024);
	String value = null;
	int row = rowPos.intValue();
	long lnnz = 0;
	
	// Read the data
	try( BufferedReader br = new BufferedReader(new InputStreamReader(is)) ) {
		while( (value=br.readLine())!=null ) { //for each line
			String rowStr = value.toString().trim();
			lnnz += ReaderTextLIBSVM.parseLibsvmRow(rowStr, vect, (int)clen);
			dest.appendRow(row, vect);
			row++;
		}
	}
	
	rowPos.setValue(row);
	return lnnz;
}
 
Example 4
Source File: AccumuloConnectionPool.java    From datawave with Apache License 2.0 6 votes vote down vote up
public List<Map<String,String>> getConnectionPoolStats(MutableInt maxTotal, MutableInt numActive, MutableInt maxIdle, MutableInt numIdle,
                MutableInt numWaiting) {
    
    ArrayList<Map<String,String>> t = new ArrayList<>();
    // no changes to underlying values while collecting metrics
    synchronized (connectorToTrackingMapMap) {
        // no changes to underlying values while collecting metrics
        synchronized (threadToTrackingMapMap) {
            // synchronize this last to prevent race condition for this lock underlying super type
            synchronized (this) {
                if (!threadToTrackingMapMap.isEmpty()) {
                    t.addAll(Collections.unmodifiableCollection(threadToTrackingMapMap.values()));
                }
                if (!connectorToTrackingMapMap.isEmpty()) {
                    t.addAll(Collections.unmodifiableCollection(connectorToTrackingMapMap.values()));
                }
                maxTotal.setValue(getMaxTotal());
                numActive.setValue(getNumActive());
                maxIdle.setValue(getMaxIdle());
                numIdle.setValue(getNumIdle());
                numWaiting.setValue(getNumWaiters());
            }
        }
    }
    return Collections.unmodifiableList(t);
}
 
Example 5
Source File: NeviwindCanyonReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPvpKillsByRace(Race race, int points) {
    MutableInt pvpKillsByRace = getPvpKillsByRace(race);
    pvpKillsByRace.add(points);
    if (pvpKillsByRace.intValue() < 0) {
        pvpKillsByRace.setValue(0);
    }
}
 
Example 6
Source File: JormungandReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPvpKillsByRace(Race race, int points) {
	MutableInt racePoints = getPvpKillsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 7
Source File: JormungandReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 8
Source File: DredgionReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 9
Source File: KamarBattlefieldReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 10
Source File: KamarBattlefieldReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPvpKillsByRace(Race race, int points) {
	MutableInt racePoints = getPvpKillsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 11
Source File: BalaurMarchingRouteReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPvpKillsByRace(Race race, int points) {
	MutableInt racePoints = getPvpKillsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 12
Source File: BalaurMarchingRouteReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 13
Source File: SteelWallBastionBattlefieldReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 14
Source File: SteelWallBastionBattlefieldReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPvpKillsByRace(Race race, int points) {
	MutableInt racePoints = getPvpKillsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 15
Source File: RunatoriumRuinsReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 16
Source File: RunatoriumRuinsReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPvpKillsByRace(Race race, int points) {
	MutableInt racePoints = getPvpKillsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 17
Source File: RunatoriumReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPointsByRace(Race race, int points) {
	MutableInt racePoints = getPointsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 18
Source File: RunatoriumReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPvpKillsByRace(Race race, int points) {
	MutableInt racePoints = getPvpKillsByRace(race);
	racePoints.add(points);
	if (racePoints.intValue() < 0) {
		racePoints.setValue(0);
	}
}
 
Example 19
Source File: NeviwindCanyonReward.java    From aion-germany with GNU General Public License v3.0 5 votes vote down vote up
public void addPointsByRace(Race race, int points) {
    MutableInt pointsByRace = getPointsByRace(race);
    pointsByRace.add(points);
    if (pointsByRace.intValue() < 0) {
        pointsByRace.setValue(0);
    }
}