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); } } }
@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); } } }
@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())); } } } }
@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); } } }
@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); } } }
@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); } } }
@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); } } }
@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); } } }
@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); } } }
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 ); }
@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); } } }
@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); } } }
@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); } } }
@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); } } }
@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); } } }
@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); } } }