Check the cohesion of the segments field with other fields used
        to write the record
518592
def _check_segment_cohesion(self):
        

        if self.n_seg != len(self.segments):
            raise ValueError("Length of segments must match the 'n_seg' field")

        for i in range(n_seg):
            s = self.segments[i]

            # If segment 0 is a layout specification record, check that its file names are all == '~''
            if i == 0 and self.seg_len[0] == 0:
                for file_name in s.file_name:
                    if file_name != '~':
                        raise ValueError("Layout specification records must have all file_names named '~'")

            # Sampling frequencies must all match the one in the master header
            if s.fs != self.fs:
                raise ValueError("The 'fs' in each segment must match the overall record's 'fs'")

            # Check the signal length of the segment against the corresponding seg_len field
            if s.sig_len != self.seg_len[i]:
                raise ValueError('The signal length of segment '+str(i)+' does not match the corresponding segment length')

            totalsig_len = totalsig_len + getattr(s, 'sig_len')
801927
public boolean compareToBuffer(FieldList record)
    {
        boolean bBufferEqual = true;
        this.resetPosition(); // Start at the first field
        int iFieldCount = record.getFieldCount();   // Number of fields to read in
        for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= iFieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++)
        {
            FieldInfo field = record.getField(iFieldSeq);
            if (!this.skipField(field))
                bBufferEqual = this.compareNextToField(field);
            if (!bBufferEqual)
                break;
        }
        return bBufferEqual;
    }
828178
public function isFieldInRecord()
    {
        //zażądany join
        if (strpos($this->getName(), '.')) {
            return true;
        }
        //sorawdzenie w rekordzie
        return property_exists($this->_grid->getQuery()->getRecordName(), $this->getName());
    }
569441
public void saveValue()
    {
        BaseField field = this.getOwner();
        RecordOwner recordOwner = field.getRecord().getRecordOwner();
        if (recordOwner instanceof ComponentParent)
            this.saveValue((ComponentParent)recordOwner);
    }
685373
def validate_fields
      l = Block.serialize self
      RLP.decode(RLP.encode(l)) == l
    end
300020
private boolean checkWriteConfiguration() {

        if ((m_fieldconfiguration != null) || m_fieldconfiguration.getFields().isEmpty()) {
            for (CmsSearchField field : m_fieldconfiguration.getFields()) {
                if (field.getMappings().isEmpty()) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }
643491
def _compare_records(src, sink, strict=False):
    # type: (MutableMapping[Text, Any], MutableMapping[Text, Any], bool) -> bool
    

    def _rec_fields(rec):  # type: (MutableMapping[Text, Any]) -> MutableMapping[Text, Any]
        out = {}
        for field in rec["fields"]:
            name = shortname(field["name"])
            out[name] = field["type"]
        return out

    srcfields = _rec_fields(src)
    sinkfields = _rec_fields(sink)
    for key in six.iterkeys(sinkfields):
        if (not can_assign_src_to_sink(
                srcfields.get(key, "null"), sinkfields.get(key, "null"), strict)
                and sinkfields.get(key) is not None):
            _logger.info("Record comparison failure for %s and %s\n"
                         "Did not match fields for %s: %s and %s",
                         src["name"], sink["name"], key, srcfields.get(key),
                         sinkfields.get(key))
            return False
    return True
7106
private void recordOnePair(JSField access, JSchema accSchema, JSField encoding,
      JSchema encSchema)
  {
    int acc = access.getAccessor(accSchema);
    if (acc >= indices.length)
      return;
    indices[acc] = encoding.getAccessor(encSchema);
  }
864412
def get_field_list(fields, schema):
  
  # If the fields weren't supplied get them from the schema.
  if schema:
    all_fields = [f['name'] for f in schema._bq_schema if f['type'] != 'RECORD']

  if isinstance(fields, list):
    if schema:
      # validate fields exist
      for f in fields:
        if f not in all_fields:
          raise Exception('Cannot find field %s in given schema' % f)
    return fields
  if isinstance(fields, basestring) and fields != '*':
    if schema:
      # validate fields exist
      for f in fields.split(','):
        if f not in all_fields:
          raise Exception('Cannot find field %s in given schema' % f)
      return fields.split(',')
  if not schema:
    return []
  return all_fields
657157
def _validate(self, writing=False):
        """"""
        if (((len(self.fragment_offset) != len(self.fragment_length)) or
             (len(self.fragment_length) != len(self.data_reference)))):
            msg = ("The lengths of the fragment offsets ({len_offsets}), "
                   "fragment lengths ({len_fragments}), and "
                   "data reference items ({len_drefs}) must be the same.")
            msg = msg.format(len_offsets=len(self.fragment_offset),
                             len_fragments=len(self.fragment_length),
                             len_drefs=len(self.data_reference))
            self._dispatch_validation_error(msg, writing=writing)
        if any([x <= 0 for x in self.fragment_offset]):
            msg = "Fragment offsets must all be positive."
            self._dispatch_validation_error(msg, writing=writing)
        if any([x <= 0 for x in self.fragment_length]):
            msg = "Fragment lengths must all be positive."
            self._dispatch_validation_error(msg, writing=writing)
1181610
def _validate_keyschema(self, schema, field, value):
        
        if isinstance(value, Mapping):
            validator = self._get_child_validator(
                document_crumb=field,
                schema_crumb=(field, 'keyschema'),
                schema=dict(((k, schema) for k in value.keys())))
            if not validator(dict(((k, k) for k in value.keys())),
                             normalize=False):
                self._drop_nodes_from_errorpaths(validator._errors,
                                                 [], [2, 4])
                self._error(field, errors.KEYSCHEMA, validator._errors)
374979
def check_field_cohesion(self, rec_write_fields, sig_write_fields):
        
        # If there are no signal specification fields, there is nothing to check.
        if self.n_sig>0:

            # The length of all signal specification fields must match n_sig
            # even if some of its elements are None.
            for f in sig_write_fields:
                if len(getattr(self, f)) != self.n_sig:
                    raise ValueError('The length of field: '+f+' must match field n_sig.')

            # Each file_name must correspond to only one fmt, (and only one byte offset if defined).
            datfmts = {}
            for ch in range(self.n_sig):
                if self.file_name[ch] not in datfmts:
                    datfmts[self.file_name[ch]] = self.fmt[ch]
                else:
                    if datfmts[self.file_name[ch]] != self.fmt[ch]:
                        raise ValueError('Each file_name (dat file) specified must have the same fmt')

            datoffsets = {}
            if self.byte_offset is not None:
                # At least one byte offset value exists
                for ch in range(self.n_sig):
                    if self.byte_offset[ch] is None:
                        continue
                    if self.file_name[ch] not in datoffsets:
                        datoffsets[self.file_name[ch]] = self.byte_offset[ch]
                    else:
                        if datoffsets[self.file_name[ch]] != self.byte_offset[ch]:
                            raise ValueError('Each file_name (dat file) specified must have the same byte offset')
835619
private boolean isOrdered(FieldDescriptor[] flds, String[] pkFieldNames)
    {
        if((flds.length > 1 && pkFieldNames == null) || flds.length != pkFieldNames.length)
        {
            throw new PersistenceBrokerException("pkFieldName length does not match number of defined PK fields." +
                    " Expected number of PK fields is " + flds.length + ", given number was " +
                    (pkFieldNames != null ? pkFieldNames.length : 0));
        }
        boolean result = true;
        for(int i = 0; i < flds.length; i++)
        {
            FieldDescriptor fld = flds[i];
            result = result && fld.getPersistentField().getName().equals(pkFieldNames[i]);
        }
        return result;
    }
252042
@Check
	@SuppressWarnings({"checkstyle:nestedifdepth", "checkstyle:npathcomplexity", "checkstyle:cyclomaticcomplexity"})
	public void checkUnsynchronizedField(XtendField field) {
		if (doCheckValidMemberName(field) && !isIgnored(POTENTIAL_FIELD_SYNCHRONIZATION_PROBLEM)) {
			final JvmField jvmField = this.associations.getJvmField(field);
			if (jvmField == null || jvmField.eContainer() == null || jvmField.isConstant() || jvmField.isFinal()) {
				return;
			}
			final EObject scope = getOutermostType(field);
			if ((scope instanceof SarlAgent || scope instanceof SarlBehavior
					|| scope instanceof SarlSkill) && isLocallyAssigned(jvmField, scope)) {
				final Collection<Setting> usages = XbaseUsageCrossReferencer.find(jvmField, scope);
				final Set<XtendMember> blocks = new HashSet<>();
				boolean isAccessibleFromOutside = jvmField.getVisibility() != JvmVisibility.PRIVATE;
				final Collection<Setting> pbUsages = new ArrayList<>();
				for (final Setting usage : usages) {
					final XtendMember member = EcoreUtil2.getContainerOfType(usage.getEObject(), XtendMember.class);
					if (member instanceof XtendFunction) {
						final XtendFunction fct = (XtendFunction) member;
						blocks.add(member);
						if (member.getVisibility() != JvmVisibility.PRIVATE) {
							isAccessibleFromOutside = true;
						}
						if (!fct.isSynchonized()) {
							pbUsages.add(usage);
						}
					} else if (member instanceof SarlBehaviorUnit) {
						blocks.add(member);
						isAccessibleFromOutside = true;
						pbUsages.add(usage);
					}
				}
				for (final Setting usage : pbUsages) {
					boolean synchronizationIssue = false;
					if (isAccessibleFromOutside || blocks.size() > 1) {
						synchronizationIssue = true;
					} else {
						// TODO: Refine the function call detection
						synchronizationIssue = true;
					}
					// Check if the field is already locally synchronized
					if (synchronizationIssue) {
						final XSynchronizedExpression syncExpr = EcoreUtil2.getContainerOfType(
								usage.getEObject(), XSynchronizedExpression.class);
						if (syncExpr != null) {
							synchronizationIssue = false;
						}
					}
					if (synchronizationIssue
							&& !isIgnored(POTENTIAL_FIELD_SYNCHRONIZATION_PROBLEM,
									usage.getEObject())) {
						addIssue(
								MessageFormat.format(Messages.SARLValidator_91, field.getName()),
								usage.getEObject(),
								usage.getEStructuralFeature(),
								POTENTIAL_FIELD_SYNCHRONIZATION_PROBLEM);
					}
				}
			}
		}
	}
1144856
private void compactEntries(Segment segment, Segment compactSegment) {
    for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) {
      checkEntry(i, segment, compactSegment);
    }
  }
275069
public void moveFieldToThin(FieldInfo fieldInfo, BaseField field, Record record)
    {
        if ((field == null) || (!field.getFieldName().equals(fieldInfo.getFieldName())))
        {
            field = null;
            if (record != null)
                field = record.getField(fieldInfo.getFieldName());
        }
        if (field != null)
        {
            if (field.getDataClass() == fieldInfo.getDataClass())
                fieldInfo.setData(field.getData());
            else
                fieldInfo.setString(field.toString());
        }
    }
1357873
def _clean_record(rec):
    
    if workflow.is_cwl_record(rec):
        def _clean_fields(d):
            if isinstance(d, dict):
                if "fields" in d:
                    out = []
                    for f in d["fields"]:
                        f = utils.deepish_copy(f)
                        f.pop("secondaryFiles", None)
                        out.append(f)
                    d["fields"] = out
                    return d
                else:
                    out = {}
                    for k, v in d.items():
                        out[k] = _clean_fields(v)
                    return out
            else:
                return d
        return _clean_fields(rec)
    else:
        return rec