Faster than RecordType.valueof()
2748
private static RecordType typeFromChar(char recChar) {
        for (int i=0; i < numRecChars; i++) {
            if (recordChars[i] == recChar) {
                return recordTypes[i];
            }
        }
        
        throw new BitsyException(BitsyErrorCodes.INTERNAL_ERROR, "Unrecognized record type " + recChar);
    }
806679
@Override
  public double getMapRecordProcessingRate(long currentTime) {
    @SuppressWarnings("deprecation")
    long bytesProcessed = super.getCounters().findCounter
        (Task.Counter.MAP_INPUT_RECORDS).getCounter();
    return calculateRate(bytesProcessed, currentTime);
  }
1145671
function record(buffer, variable, recordDimension) {
  // variable type
  const type = types.str2num(variable.type);
  const width = variable.size ? variable.size / types.num2bytes(type) : 1;

  // size of the data
  // TODO streaming data
  var size = recordDimension.length;

  // iterates over the data
  var data = new Array(size);
  const step = recordDimension.recordStep;

  for (var i = 0; i < size; i++) {
    var currentOffset = buffer.offset;
    data[i] = types.readType(buffer, type, width);
    buffer.seek(currentOffset + step);
  }

  return data;
}
1278798
public void recordValue(final long value) throws ArrayIndexOutOfBoundsException {
        long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
        try {
            activeHistogram.recordValue(value);
        } finally {
            recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
        }
    }
131289
public List evaluate(Record record) {
    // fast path (not functionally necessary):
    if (fields.size() == 1) {
      Object first = fields.get(0);
      if (first instanceof String) {
        return Collections.singletonList(first);
      } else {
        String ref = ((Field) first).getName();
        if (ref.length() != 0) {
          List resolvedValues = record.get(ref);
          return resolvedValues;
        }
      }
    }

    // slow path:
    ArrayList<Object> results = new ArrayList<Object>(1);
    evaluate2(0, record, new StringBuilder(), results);
    return results;
  }
521625
public int doMove(int iRelPosition) throws DBException
    {
        try   {
            BaseBuffer buffer = m_pTable.move(iRelPosition, this);
            this.doSetHandle(buffer, DBConstants.DATA_SOURCE_HANDLE);
            int iRecordStatus = DBConstants.RECORD_NORMAL;
            if (buffer == null) if ((iRelPosition < 0) || (iRelPosition == DBConstants.LAST_RECORD))
                iRecordStatus |= DBConstants.RECORD_AT_BOF;
            if (buffer == null) if ((iRelPosition >= 0) || (iRelPosition == DBConstants.FIRST_RECORD))
                iRecordStatus |= DBConstants.RECORD_AT_EOF;
            return iRecordStatus;
        } catch (DBException ex)    {
            throw DatabaseException.toDatabaseException(ex);
        }
    }
586670
public int handleGetRawRecordData(Rec record)
    {
        int iErrorCode = Constant.NORMAL_RETURN;
            
        iErrorCode = super.handleGetRawRecordData(record);
        
        if (iErrorCode == Constant.NORMAL_RETURN)
        {
            if (m_messageDataDescChildren != null)
            {
                for (String strKey : m_messageDataDescChildren.keySet())
                {
                    iErrorCode = m_messageDataDescChildren.get(strKey).handleGetRawRecordData(record);
                    if (iErrorCode != Constant.NORMAL_RETURN)
                        break;
                }
            }
        }

        return iErrorCode;
    }
44760
private void populateCurrentKeyValue() throws IOException, InterruptedException {
    currentKey = delegateReader.getCurrentKey();
    currentValue = delegateReader.getCurrentValue();
    ++recordsRead;
  }
194971
function(c) {
    var rval = 0;

    // get input buffer and its length
    var b = c.input;
    var len = b.length();

    // need at least 5 bytes to initialize a record
    if(len < 5) {
      rval = 5 - len;
    } else {
      // enough bytes for header
      // initialize record
      c.record = {
        type: b.getByte(),
        version: {
          major: b.getByte(),
          minor: b.getByte()
        },
        length: b.getInt16(),
        fragment: forge.util.createBuffer(),
        ready: false
      };

      // check record version
      var compatibleVersion = (c.record.version.major === c.version.major);
      if(compatibleVersion && c.session && c.session.version) {
        // session version already set, require same minor version
        compatibleVersion = (c.record.version.minor === c.version.minor);
      }
      if(!compatibleVersion) {
        c.error(c, {
          message: 'Incompatible TLS version.',
          send: true,
          alert: {
            level: tls.Alert.Level.fatal,
            description: tls.Alert.Description.protocol_version
          }
        });
      }
    }

    return rval;
  }
808041
public int handleGetRawRecordData(Rec record)
    {
        int iErrorCode = Constant.NORMAL_RETURN;
        record = this.setNodeIndex(RESET_INDEX, record);   // Being careful
        int iNodeCount = 1;
        if (this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
            iNodeCount = this.getMessage().getNodeCount(this.getFullKey(null));
        for (int index = 1; index <= iNodeCount; index++)
        {
            if (this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
                record = this.setNodeIndex(index, record);
            
            iErrorCode = super.handleGetRawRecordData(record);
            
            if (iErrorCode != Constant.NORMAL_RETURN)
                break;
        }
        if (this.getNodeType() == MessageRecordDesc.NON_UNIQUE_NODE)
            this.setNodeIndex(END_OF_NODES, record);
        return iErrorCode;
    }
989917
function initializeWithEval() {
  var dbTest = new loki('perfInsertWithEval');

  var start, end, totalTime;
  var totalTimes = [];
  var totalMS = 0.0;

  var coll = dbTest.addCollection('samplecoll',
    {
      indices: ['customId'],
      asyncListeners: false,
      disableChangesApi: true,
      transactional: false,
      clone: false
    }
  );

  var dv = coll.addDynamicView('test');
  dv.applyFind({'customId': {'$lt': arraySize/4 }});

  for (var idx=0; idx < arraySize; idx++) {
    var v1 = genRandomVal();
    var v2 = genRandomVal();

    start = performance.now();
    coll.insert({
      customId: idx,
      val: v1,
      val2: v2,
      val3: "more data 1234567890"
    });
    end = performance.now() - start;
    totalTimes.push([0, end * 1e6]);
  }

  for(idx=0; idx < totalTimes.length; idx++) {
    totalMS += totalTimes[idx][0] * 1e3 + totalTimes[idx][1]/1e6;
  }

  totalMS = totalMS.toFixed(2);
  var rate = arraySize * 1000 / totalMS;
  rate = rate.toFixed(2);
  trace("load (insert with dynamic view registered) : " + totalMS + "ms (" + rate + ") ops/s");
}
908705
public int valueToIndex(Object value)
    {
        if (value != null)
            if (!(value instanceof String))
                value = value.toString();
        if ((m_record != null) && (m_strIndexValue != null))
        {
            try   {
                FieldTable table = m_record.getTable();
                for (int iIndex = 0; ; iIndex++)
                {
                    if (table.get(iIndex) == null)  // I use get, so the index matches the index of JComboBox
                        break;
                    FieldInfo field = m_record.getField(m_strIndexValue);
                    if (field == null)
                        field = m_record.getField(0);
                    String strValue = field.getString();
                    if ((strValue != null) && (strValue.length() > 0))
                        if (strValue.equals(value))
                            return iIndex + 1;
                }
            } catch (Exception ex)  {
                ex.printStackTrace();
            }
        }
        else
        {
            this.setSelectedItem(value);
            if (this.getSelectedIndex() != -1)
                return this.getSelectedIndex();
        }
        return 0;
    }
444362
def _record_from_json(value, field):
    """"""
    if _not_null(value, field):
        record = {}
        record_iter = zip(field.fields, value["f"])
        for subfield, cell in record_iter:
            converter = _CELLDATA_FROM_JSON[subfield.field_type]
            if subfield.mode == "REPEATED":
                value = [converter(item["v"], subfield) for item in cell["v"]]
            else:
                value = converter(cell["v"], subfield)
            record[subfield.name] = value
        return record
354211
private void populateComparableKeyRecord(GenericRecord source, GenericRecord target) {
    for (Field field : target.getSchema().getFields()) {
      if (field.schema().getType() == Schema.Type.UNION) {

        // Since a UNION has multiple types, we need to use induce() to get the actual type in the record.
        Object fieldData = source.get(field.name());
        Schema actualFieldSchema = GenericData.get().induce(fieldData);
        if (actualFieldSchema.getType() == Schema.Type.RECORD) {

          // If the actual type is RECORD (which may contain another UNION), we need to recursively
          // populate it.
          for (Schema candidateType : field.schema().getTypes()) {
            if (candidateType.getFullName().equals(actualFieldSchema.getFullName())) {
              GenericRecord record = new GenericData.Record(candidateType);
              target.put(field.name(), record);
              populateComparableKeyRecord((GenericRecord) fieldData, record);
              break;
            }
          }
        } else {
          target.put(field.name(), source.get(field.name()));
        }
      } else if (field.schema().getType() == Schema.Type.RECORD) {
        GenericRecord record = (GenericRecord) target.get(field.name());
        if (record == null) {
          record = new GenericData.Record(field.schema());
          target.put(field.name(), record);
        }
        populateComparableKeyRecord((GenericRecord) source.get(field.name()), record);
      } else {
        target.put(field.name(), source.get(field.name()));
      }
    }
  }
697014
def record(self, i=0):
        """"""
        f = self.__getFileObj(self.dbf)
        if self.numRecords is None:
            self.__dbfHeader()
        i = self.__restrictIndex(i)
        recSize = self.__recStruct.size
        f.seek(0)
        f.seek(self.__dbfHdrLength + (i * recSize))
        return self.__record(oid=i)
572546
static Map<String, Object> toRDataMap(Record record) {
    if ("MX".equals(record.type)) {
      return MXData.create(record.priority, record.data());
    } else if ("TXT".equals(record.type)) {
      return TXTData.create(record.data());
    } else if ("SRV".equals(record.type)) {
      List<String> rdata = split(' ', record.data());
      return SRVData.builder()
          .priority(record.priority)
          .weight(Integer.valueOf(rdata.get(0)))
          .port(Integer.valueOf(rdata.get(1)))
          .target(rdata.get(2)).build();
    } else if ("SOA".equals(record.type)) {
      List<String> threeParts = split(' ', record.data());
      return SOAData.builder()
          .mname(threeParts.get(0))
          .rname(threeParts.get(1))
          .serial(Integer.valueOf(threeParts.get(2)))
          .refresh(record.ttl)
          .retry(record.ttl)
          .expire(record.ttl).minimum(record.ttl).build();
    } else {
      return Util.toMap(record.type, record.data());
    }
  }
1344471
@Override
  public @Nullable V getIfPresent(Object key, boolean recordStats) {
    V value = data.get(key);

    if (recordStats) {
      if (value == null) {
        statsCounter.recordMisses(1);
      } else {
        statsCounter.recordHits(1);
      }
    }
    return value;
  }