本文整理了Java中java.util.BitSet.get()
方法的一些代码示例,展示了BitSet.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.get()
方法的具体详情如下:
包路径:java.util.BitSet
类名称:BitSet
方法名:get
[英]Returns the bit at index index. Indexes greater than the current length return false.
[中]返回索引处的位。大于当前长度的索引返回false。
代码示例来源:origin: jenkinsci/jenkins
public ArgumentListBuilder prepend(String... args) {
// left-shift the mask
BitSet nm = new BitSet(this.args.size()+args.length);
for(int i=0; i<this.args.size(); i++)
nm.set(i+args.length, mask.get(i));
mask = nm;
this.args.addAll(0, Arrays.asList(args));
return this;
}
代码示例来源:origin: apache/zookeeper
public synchronized boolean add(Integer elementBit) {
if (elementBit == null || elementBits.get(elementBit)) {
return false;
}
if (cache.size() < cacheSize) {
cache.add(elementBit);
}
elementBits.set(elementBit);
elementCount++;
return true;
}
代码示例来源:origin: spring-projects/spring-framework
private void setMonths(BitSet bits, String value) {
int max = 12;
value = replaceOrdinals(value, "FOO,JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC");
BitSet months = new BitSet(13);
// Months start with 1 in Cron and 0 in Calendar, so push the values first into a longer bit set
setNumberHits(months, value, 1, max + 1);
// ... and then rotate it to the front of the months
for (int i = 1; i <= max; i++) {
if (months.get(i)) {
bits.set(i - 1);
}
}
}
代码示例来源:origin: apache/zeppelin
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, getAllResources_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.success = new ArrayList<String>(_list29.size);
String _elem30;
for (int _i31 = 0; _i31 < _list29.size; ++_i31)
{
_elem30 = iprot.readString();
struct.success.add(_elem30);
}
}
struct.setSuccessIsSet(true);
}
}
}
代码示例来源:origin: lettuce-io/lettuce-core
public List<Integer> getSlots() {
if (slots == null || slots.isEmpty()) {
return Collections.emptyList();
}
List<Integer> slots = new ArrayList<>();
for (int i = 0; i < SlotHash.SLOT_COUNT; i++) {
if (this.slots.get(i)) {
slots.add(i);
}
}
return slots;
}
代码示例来源:origin: stanfordnlp/CoreNLP
@Override
public void process(long id, Annotation doc) {
CoreMap sentence = doc.get(CoreAnnotations.SentencesAnnotation.class).get(0);
SemanticGraph depparse = sentence.get(SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class);
log.info("| " + sentence.get(CoreAnnotations.TextAnnotation.class));
// Get all valid subject spans
BitSet consumedAsSubjects = new BitSet();
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection") List<Span> subjectSpans = new ArrayList<>();
NEXTNODE: for (IndexedWord head : depparse.topologicalSort()) {
// Check if the node is a noun/pronoun
if (head.tag().startsWith("N") || head.tag().equals("PRP")) {
// Try to get the NP chunk
Optional<List<IndexedWord>> subjectChunk = segmenter.getValidChunk(depparse, head, segmenter.VALID_SUBJECT_ARCS, Optional.empty(), true);
if (subjectChunk.isPresent()) {
// Make sure it's not already a member of a larger NP
for (IndexedWord tok : subjectChunk.get()) {
if (consumedAsSubjects.get(tok.index())) {
continue NEXTNODE; // Already considered. Continue to the next node.
}
}
// Register it as an NP
for (IndexedWord tok : subjectChunk.get()) {
consumedAsSubjects.set(tok.index());
}
// Add it as a subject
subjectSpans.add(toSpan(subjectChunk.get()));
}
}
}
}
代码示例来源:origin: apache/zeppelin
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, getStatus_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.success = iprot.readString();
struct.setSuccessIsSet(true);
}
}
}
代码示例来源:origin: apache/zeppelin
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, getProgress_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.success = iprot.readI32();
struct.setSuccessIsSet(true);
}
}
}
代码示例来源:origin: apache/hive
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, Order struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.col = iprot.readString();
struct.setColIsSet(true);
}
if (incoming.get(1)) {
struct.order = iprot.readI32();
struct.setOrderIsSet(true);
}
}
}
代码示例来源:origin: apache/zeppelin
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, resourceInvokeMethod_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.success = iprot.readBinary();
struct.setSuccessIsSet(true);
}
}
}
代码示例来源:origin: apache/zeppelin
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, resourcePoolGetAll_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list41 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.success = new ArrayList<String>(_list41.size);
String _elem42;
for (int _i43 = 0; _i43 < _list41.size; ++_i43)
{
_elem42 = iprot.readString();
struct.success.add(_elem42);
}
}
struct.setSuccessIsSet(true);
}
}
}
代码示例来源:origin: apache/storm
@Override
public void read(org.apache.storm.thrift.protocol.TProtocol prot, TopologyHistoryInfo struct) throws org.apache.storm.thrift.TException {
org.apache.storm.thrift.protocol.TTupleProtocol iprot = (org.apache.storm.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
{
org.apache.storm.thrift.protocol.TList _list867 = new org.apache.storm.thrift.protocol.TList(org.apache.storm.thrift.protocol.TType.STRING, iprot.readI32());
struct.topo_ids = new java.util.ArrayList<java.lang.String>(_list867.size);
java.lang.String _elem868;
for (int _i869 = 0; _i869 < _list867.size; ++_i869)
{
_elem868 = iprot.readString();
struct.topo_ids.add(_elem868);
}
}
struct.set_topo_ids_isSet(true);
}
}
}
代码示例来源:origin: apache/kylin
@Override
public BitSet copy(final Kryo kryo, final BitSet original) {
final BitSet result = new BitSet();
final int length = original.length();
for (int i = 0; i < length; i++) {
result.set(i, original.get(i));
}
return result;
}
代码示例来源:origin: neo4j/neo4j
private static void addToSeenList( BitSet target, long id, long lastId )
{
int index = toIntExact( id );
if ( target.get( index ) )
{
throw new IllegalStateException( id + " already seen" );
}
if ( id > lastId )
{
throw new IllegalStateException( "Unexpectedly high id " + id + " seen when last id is " + lastId );
}
target.set( index );
}
代码示例来源:origin: apache/zeppelin
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, unloadApplication_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.applicationInstanceId = iprot.readString();
struct.setApplicationInstanceIdIsSet(true);
}
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, SettableBlobMeta struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.replication_factor = iprot.readI32();
struct.set_replication_factor_isSet(true);
}
}
}
代码示例来源:origin: apache/zeppelin
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, RegisterInfo struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.host = iprot.readString();
struct.setHostIsSet(true);
}
if (incoming.get(1)) {
struct.port = iprot.readI32();
struct.setPortIsSet(true);
}
if (incoming.get(2)) {
struct.interpreterGroupId = iprot.readString();
struct.setInterpreterGroupIdIsSet(true);
}
}
}
代码示例来源:origin: apache/zeppelin
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, appendAppOutput_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.event = new AppOutputAppendEvent();
struct.event.read(iprot);
struct.setEventIsSet(true);
}
}
}
代码示例来源:origin: apache/hive
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, GetCatalogsResponse struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
{
org.apache.thrift.protocol.TList _list107 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.names = new ArrayList<String>(_list107.size);
String _elem108;
for (int _i109 = 0; _i109 < _list107.size; ++_i109)
{
_elem108 = iprot.readString();
struct.names.add(_elem108);
}
}
struct.setNamesIsSet(true);
}
}
}
代码示例来源:origin: apache/storm
@Override
public void read(org.apache.storm.thrift.protocol.TProtocol prot, HBNodes struct) throws org.apache.storm.thrift.TException {
org.apache.storm.thrift.protocol.TTupleProtocol iprot = (org.apache.storm.thrift.protocol.TTupleProtocol) prot;
java.util.BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
{
org.apache.storm.thrift.protocol.TList _list917 = new org.apache.storm.thrift.protocol.TList(org.apache.storm.thrift.protocol.TType.STRING, iprot.readI32());
struct.pulseIds = new java.util.ArrayList<java.lang.String>(_list917.size);
java.lang.String _elem918;
for (int _i919 = 0; _i919 < _list917.size; ++_i919)
{
_elem918 = iprot.readString();
struct.pulseIds.add(_elem918);
}
}
struct.set_pulseIds_isSet(true);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!