本文整理汇总了Java中org.apache.commons.lang.mutable.MutableInt.intValue方法的典型用法代码示例。如果您正苦于以下问题:Java MutableInt.intValue方法的具体用法?Java MutableInt.intValue怎么用?Java MutableInt.intValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.mutable.MutableInt
的用法示例。
在下文中一共展示了MutableInt.intValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWord
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private static String getWord(String line, MutableInt pos) {
String word = "";
boolean marker = false;
boolean start = false;
char ch;
word = "";
if (line.length() > 0) {
do {
ch = line.charAt(pos.intValue());
start |= ((ch != ' ') || (ch != '\t'));
if (ch == '"') marker = !marker;
if ((marker && start) || (start && (ch != ' ' && ch != '\t'))) {
word += ch;
}
pos.increment();
} while ((pos.intValue() < line.length()) && (marker || !start || (ch != ' ' && ch != '\t')));
}
if (word.length() == 0) word = null;
return word;
}
示例2: getAllFromPos
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private String getAllFromPos(String line, MutableInt pos) {
String word = "";
boolean start = false;
char ch;
word = "";
if (line.length() > 0) {
do {
ch = line.charAt(pos.intValue());
start |= ((ch != ' ') && (ch != '\t'));
if (start || (ch != ' ' && ch != '\t')) {
if (startValue == 0) startValue = pos.intValue();
word += ch;
}
pos.increment();
} while (pos.intValue() < line.length());
endValue = pos.intValue();
}
if (word.length() == 0) word = null;
return word;
}
示例3: getNumFactTableInExpressions
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
/**
* Get number of fact columns used in the an expression
*
* @param node
* @param count
* @return Number of fact columns used in expression
*/
protected int getNumFactTableInExpressions(ASTNode node, MutableInt count) {
if (node == null) {
log.debug("ASTNode is null ");
return 0;
}
if (node.getToken().getType() == HiveParser.TOK_TABLE_OR_COL) {
String factAlias = getFactAlias();
String table = node.getChild(0).getText();
if (table.equals(factAlias)) {
count.add(1);
}
}
for (int i = 0; i < node.getChildCount(); i++) {
ASTNode child = (ASTNode) node.getChild(i);
getNumFactTableInExpressions(child, count);
}
return count.intValue();
}
示例4: traverseFilterQueryAndPopulateMap
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private static FilterQuery traverseFilterQueryAndPopulateMap(FilterQueryTree tree,
Map<Integer, FilterQuery> filterQueryMap, MutableInt currentId) {
int currentNodeId = currentId.intValue();
currentId.increment();
final List<Integer> f = new ArrayList<Integer>();
if (null != tree.getChildren()) {
for (final FilterQueryTree c : tree.getChildren()) {
int childNodeId = currentId.intValue();
currentId.increment();
f.add(childNodeId);
final FilterQuery q = traverseFilterQueryAndPopulateMap(c, filterQueryMap, currentId);
filterQueryMap.put(childNodeId, q);
}
}
FilterQuery query = new FilterQuery();
query.setColumn(tree.getColumn());
query.setId(currentNodeId);
query.setNestedFilterQueryIds(f);
query.setOperator(tree.getOperator());
query.setValue(tree.getValue());
return query;
}
示例5: traverseHavingFilterQueryAndPopulateMap
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private static HavingFilterQuery traverseHavingFilterQueryAndPopulateMap(HavingQueryTree tree,
Map<Integer, HavingFilterQuery> filterQueryMap, MutableInt currentId) {
int currentNodeId = currentId.intValue();
currentId.increment();
final List<Integer> filterIds = new ArrayList<Integer>();
if (null != tree.getChildren()) {
for (final HavingQueryTree child : tree.getChildren()) {
int childNodeId = currentId.intValue();
currentId.increment();
filterIds.add(childNodeId);
final HavingFilterQuery filterQuery = traverseHavingFilterQueryAndPopulateMap(child, filterQueryMap, currentId);
filterQueryMap.put(childNodeId, filterQuery);
}
}
HavingFilterQuery havingFilterQuery = new HavingFilterQuery();
havingFilterQuery.setAggregationInfo(tree.getAggregationInfo());
havingFilterQuery.setId(currentNodeId);
havingFilterQuery.setNestedFilterQueryIds(filterIds);
havingFilterQuery.setOperator(tree.getOperator());
havingFilterQuery.setValue(tree.getValue());
return havingFilterQuery;
}
示例6: run
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
@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();
}
}
示例7: enableBehaviour
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public void enableBehaviour(NodeRef nodeRef)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
if (logger.isDebugEnabled())
{
logger.debug("Behaviour: ENABLE (" + AlfrescoTransactionSupport.getTransactionId() + "): " + nodeRef + "/ALL");
}
TransactionalResourceHelper.decrementCount(KEY_FILTER_COUNT, false);
if (!TransactionalResourceHelper.isResourcePresent(KEY_INSTANCE_FILTERS))
{
// Nothing was disabled
return;
}
nodeRef = tenantService.getName(nodeRef);
Map<NodeRef, MutableInt> instanceFilters = TransactionalResourceHelper.getMap(KEY_INSTANCE_FILTERS);
MutableInt filter = instanceFilters.get(nodeRef);
if (filter == null)
{
// Instance was not disabled
return;
}
else if (filter.intValue() <= 0)
{
// Can't go below zero for this
}
else
{
filter.decrement();
}
if (logger.isDebugEnabled())
{
logger.debug(" Now:" + filter);
}
}
示例8: getClassFilter
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private ClassFilter getClassFilter(QName className)
{
ParameterCheck.mandatory("className", className);
// Check the global, first
if (!isEnabled())
{
return null;
}
if (!TransactionalResourceHelper.isResourcePresent(KEY_CLASS_FILTERS))
{
// Nothing was disabled
return null;
}
Map<ClassFilter, MutableInt> classFilters = TransactionalResourceHelper.getMap(KEY_CLASS_FILTERS);
for (ClassFilter classFilter : classFilters.keySet())
{
if (classFilter.getClassName().equals(className))
{
MutableInt filterNumber = classFilters.get(classFilter);
if (filterNumber != null && filterNumber.intValue() > 0 )
{
return classFilter;
}
break;
}
}
return null;
}
示例9: isEnabled
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public boolean isEnabled(NodeRef nodeRef)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
// Check the class (includes global) and instance, first
if (!isEnabled())
{
return false;
}
if (!TransactionalResourceHelper.isResourcePresent(KEY_INSTANCE_FILTERS))
{
// Nothing was disabled
return true;
}
nodeRef = tenantService.getName(nodeRef);
Map<NodeRef, MutableInt> instanceFilters = TransactionalResourceHelper.getMap(KEY_INSTANCE_FILTERS);
MutableInt filter = instanceFilters.get(nodeRef);
if (filter != null && filter.intValue() > 0)
{
// Instance was disabled
return false;
}
return true;
}
示例10: loadData
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void loadData(final int maxCount)
{
final MutableInt doneCount = new MutableInt(0);
// Batches of 1000 objects
RetryingTransactionCallback<Integer> makeNodesCallback = new RetryingTransactionCallback<Integer>()
{
public Integer execute() throws Throwable
{
for (int i = 0; i < 1000; i++)
{
// We don't need to write anything
String contentUrl = FileContentStore.createNewFileStoreUrl();
ContentData contentData = new ContentData(contentUrl, MimetypeMap.MIMETYPE_TEXT_PLAIN, 10, "UTF-8");
nodeHelper.makeNode(contentData);
int count = doneCount.intValue();
count++;
doneCount.setValue(count);
// Do some reporting
if (count % 1000 == 0)
{
System.out.println(String.format(" " + (new Date()) + "Total created: %6d", count));
}
// Double check for shutdown
if (vmShutdownListener.isVmShuttingDown())
{
break;
}
}
return maxCount;
}
};
int repetitions = (int) Math.floor((double)maxCount / 1000.0);
for (int i = 0; i < repetitions; i++)
{
transactionService.getRetryingTransactionHelper().doInTransaction(makeNodesCallback);
}
}
示例11: processException
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private void processException(Exception e, MethodInvocation invocation, MutableInt attempt) {
StringBuilder message = new StringBuilder("When invoking method \"").append(invocation.getMethod().getName())
.append("\" caught \"").append(e.getMessage()).append("\". Attempt #").append(attempt);
attempt.increment();
if (attempt.intValue() <= TransactionRetryInterceptor.MAX_ATTEMPTS) {
message.append(". Retrying.");
} else {
message.append(". Giving up.");
}
TransactionRetryInterceptor.log.warn(message);
}
示例12: parseType
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
private Synonym.Type parseType(String value, MutableInt fromIndex) {
Synonym.Type type = Synonym.Type.RELATED;
while(fromIndex.intValue() < value.length()
&& Character.isWhitespace(value.charAt(fromIndex.intValue()))) {
fromIndex.increment();
}
int start = fromIndex.intValue();
while(fromIndex.intValue() < value.length()
&& Character.isLetter(value.charAt(fromIndex.intValue()))) {
fromIndex.increment();
}
if(start < fromIndex.intValue()) {
String scope = value.substring(start, fromIndex.intValue());
try {
type = Synonym.Type.valueOf(scope.toUpperCase());
} catch(IllegalArgumentException e) {
type = Synonym.Type.RELATED;
fromIndex.setValue(start);
}
}
return type;
}
示例13: getCount
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
public int getCount(T key)
{
int ret = -1;
MutableInt val = map.get(key);
if (val != null) {
ret = val.intValue();
}
return ret;
}
示例14: getUnreadMessages
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
public int getUnreadMessages(Channel channel) {
MutableInt result = unreadChannels.get(channel);
if (result == null) {
return -1;
}
return result.intValue();
}
示例15: prepareCharge
import org.apache.commons.lang.mutable.MutableInt; //导入方法依赖的package包/类
@Override
public int prepareCharge(final AccountFeeLog log) {
final Long[] groupIds = EntityHelper.toIds(log.getAccountFee().getGroups());
if (ArrayUtils.isEmpty(groupIds)) {
// No groups to charge
return 0;
}
final MutableInt result = new MutableInt();
runNative(new JDBCCallback() {
@Override
public void execute(final JDBCWrapper jdbc) throws SQLException {
String[] placeHolders = new String[groupIds.length];
Arrays.fill(placeHolders, "?");
StringBuilder sql = new StringBuilder();
sql.append(" insert into members_pending_charge");
sql.append(" (account_fee_log_id, member_id)");
sql.append(" select ?, id");
sql.append(" from members m");
sql.append(" where m.subclass = ?");
sql.append(" and m.group_id in (").append(StringUtils.join(placeHolders, ",")).append(')');
List<Object> args = new ArrayList<Object>(groupIds.length + 2);
args.add(log.getId());
args.add("M");
CollectionUtils.addAll(args, groupIds);
int totalMembers = jdbc.execute(sql.toString(), args.toArray());
result.setValue(totalMembers);
}
});
return result.intValue();
}