当前位置: 首页>>代码示例>>Java>>正文


Java TObjectProcedure类代码示例

本文整理汇总了Java中gnu.trove.TObjectProcedure的典型用法代码示例。如果您正苦于以下问题:Java TObjectProcedure类的具体用法?Java TObjectProcedure怎么用?Java TObjectProcedure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TObjectProcedure类属于gnu.trove包,在下文中一共展示了TObjectProcedure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWidth

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
public int getWidth() {
  class MyProcecure implements TObjectProcedure<PsiType> {
    int width = 0;
    public boolean execute(PsiType type) {
      if (substitute(type)  != null) width++;
      return true;
    }

    public int getWidth() {
      return width;
    }
  }

  MyProcecure procedure = new MyProcecure();
  myBindings.forEachValue(procedure);
  return procedure.getWidth();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:BindingFactory.java

示例2: doImport

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
@Override
public void doImport(final PsiJavaFile javaFile) {
  final PsiClass containingClass = myMethod.getContainingClass();
  if (containingClass != null) {
    if (javaFile.findImportReferenceTo(containingClass) == null) {
      javaFile.importClass(containingClass);
    }
  }
  if (myReplaceElements != null) {
    myReplaceElements.forEachValue(new TObjectProcedure<SubLookupElement>() {
      @Override
      public boolean execute(final SubLookupElement subLookupElement) {
        subLookupElement.doImport(javaFile);
        return false;
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:StaticMethodSubLookupElement.java

示例3: ClientManager

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
public ClientManager(@Nullable WebSocketServerOptions options, @NotNull ExceptionHandler exceptionHandler, @Nullable ClientListener listener) {
  this.exceptionHandler = exceptionHandler;
  this.listener = listener;

  heartbeatTimer = SimpleTimer.getInstance().setUp(new Runnable() {
    @Override
    public void run() {
      synchronized (clients) {
        if (clients.isEmpty()) {
          return;
        }

        clients.forEach(new TObjectProcedure<Client>() {
          @Override
          public boolean execute(Client client) {
            if (client.channel.isActive()) {
              client.sendHeartbeat();
            }
            return true;
          }
        });
      }
    }
  }, (options == null ? new WebSocketServerOptions() : options).heartbeatDelay);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ClientManager.java

示例4: send

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
public <T> void send(final int messageId, @NotNull final ByteBuf message, @Nullable final List<AsyncPromise<Pair<Client, T>>> results) {
  forEachClient(new TObjectProcedure<Client>() {
    private boolean first;

    @Override
    public boolean execute(final Client client) {
      try {
        AsyncPromise<Pair<Client, T>> result = client.send(messageId, first ? message : message.duplicate());
        first = false;
        if (results != null) {
          results.add(result);
        }
      }
      catch (Throwable e) {
        exceptionHandler.exceptionCaught(e);
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ClientManager.java

示例5: getFoldingData

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
@Nullable
public FoldingData getFoldingData(@NotNull final FoldRegion region) {
  FoldingData candidate = myFoldingData.get(region.getStartOffset());
  if (candidate != null) {
    return candidate;
  }
  
  // Folding implementation is known to postpone actual fold region offsets update on document change, i.e. it performs
  // fold data caching with its further replace by up-to-date info. Hence, there is a possible case that soft wraps processing
  // advances fold region offset but folding model still provides old cached values. Hence, we're trying to match exact given
  // fold region against the cached data here.
  final Ref<FoldingData> result = new Ref<FoldingData>();
  myFoldingData.forEachValue(new TObjectProcedure<FoldingData>() {
    @Override
    public boolean execute(FoldingData data) {
      if (data.getFoldRegion().equals(region)) {
        result.set(data);
        return false;
      }
      return true;
    }
  });
  return result.get();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:CacheEntry.java

示例6: scheduleTimeoutCheck

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
private void scheduleTimeoutCheck() {
  final Ref<Long> nextTime = Ref.create(Long.MAX_VALUE);
  synchronized (myLock) {
    if (myTimeoutHandlers.isEmpty()) return;
    myTimeoutHandlers.forEachValue(new TObjectProcedure<TimeoutHandler>() {
      public boolean execute(TimeoutHandler handler) {
        nextTime.set(Math.min(nextTime.get(), handler.myLastTime));
        return true;
      }
    });
  }
  final int delay = (int)(nextTime.get() - System.currentTimeMillis() + 100);
  LOG.debug("schedule timeout check in " + delay + "ms");
  if (delay > 10) {
    myTimeoutAlarm.cancelAllRequests();
    myTimeoutAlarm.addRequest(new Runnable() {
      public void run() {
        checkTimeout();
      }
    }, delay);
  }
  else {
    checkTimeout();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ResponseProcessor.java

示例7: size

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
public int size ()
{
  final int[] N = new int[]{0};
  backing.forEachValue (new TObjectProcedure() {
    public boolean execute (Object object)
    {
      TIntObjectHashMap inner = (TIntObjectHashMap) object;
      N[0] += inner.size ();
      return true;
    }
  });
  return N[0];
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:14,代码来源:CSIntInt2ObjectMultiMap.java

示例8: any

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
/**
 *  Returns true if the procedure proc returns true for any
 *   element of the array v.
 */
public static boolean any (TObjectProcedure proc, Object[][] v)
{
	for (int i = 0; i < v.length; i++) {
		for (int j = 0; j < v[i].length; j++) {
			if (proc.execute (v[i][j])) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:16,代码来源:ArrayUtils.java

示例9: forEach

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
public static void forEach (TObjectProcedure proc, Object[][] v) 
{
	for (int i = 0; i < v.length; i++) {
		for (int j = 0; j < v[i].length; j++) {
			proc.execute (v[i][j]);
		}
	}
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:9,代码来源:ArrayUtils.java

示例10: forEachClient

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
public void forEachClient(@NotNull TObjectProcedure<Client> procedure) {
  synchronized (clients) {
    if (clients.isEmpty()) {
      return;
    }

    clients.forEach(procedure);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ClientManager.java

示例11: forEach

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
@Override
public boolean forEach(@NotNull TObjectProcedure<T> procedure) {
  T theElement = this.theElement;
  if (theElement != null) {
    return procedure.execute(theElement);
  }
  return super.forEach(procedure);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:SmartHashSet.java

示例12: getNontrivialFileIndexedStates

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
@NotNull
public static List<ID<?,?>> getNontrivialFileIndexedStates(int fileId) {
  if (fileId != INVALID_FILE_ID) {
    Lock readLock = getStripedLock(fileId).readLock();
    readLock.lock();
    try {
      Timestamps stamp = createOrGetTimeStamp(fileId);
      if (stamp != null && stamp.myIndexStamps != null && !stamp.myIndexStamps.isEmpty()) {
        final SmartList<ID<?, ?>> retained = new SmartList<ID<?, ?>>();
        stamp.myIndexStamps.forEach(new TObjectProcedure<ID<?, ?>>() {
          @Override
          public boolean execute(ID<?, ?> object) {
            retained.add(object);
            return true;
          }
        });
        return retained;
      }
    }
    catch (InvalidVirtualFileAccessException ignored /*ok to ignore it here*/) {
    }
    finally {
      readLock.unlock();
    }
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:IndexingStamp.java

示例13: getInstances

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
@NonNull
public Collection<Instance> getInstances() {
    final ArrayList<Instance> result = new ArrayList<Instance>(mInstances.size());
    mInstances.forEachValue(new TObjectProcedure<Instance>() {
        @Override
        public boolean execute(Instance instance) {
            result.add(instance);
            return true;
        }
    });
    return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:Heap.java

示例14: containsFile

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
@Override
public boolean containsFile(@NotNull TObjectIntHashMap<VirtualFile> roots, @NotNull final VirtualFile virtualFile)
{
	return !roots.forEachKey(new TObjectProcedure<VirtualFile>()
	{
		@Override
		public boolean execute(VirtualFile object)
		{
			return !VfsUtil.isAncestor(object, virtualFile, false);
		}
	});
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:13,代码来源:DotNetModuleRootsProcessor.java

示例15: containsFile

import gnu.trove.TObjectProcedure; //导入依赖的package包/类
@Override
public boolean containsFile(@Nonnull TObjectIntHashMap<VirtualFile> roots, @Nonnull final VirtualFile virtualFile) {
  return !roots.forEachKey(new TObjectProcedure<VirtualFile>() {
    @Override
    public boolean execute(VirtualFile object) {
      return !VfsUtilCore.isAncestor(object, virtualFile, false);
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ModuleRootsProcessorFromModuleDir.java


注:本文中的gnu.trove.TObjectProcedure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。