Creates the checks for checking boolean values
@param chunkDefinition The chunk definition for these records.
425925
function createFunctions(chunkDefinition) {

	// all the field names used to build the key for a record and a name to store the hash
	const keyHashFields = chunkDefinition.keyHashFields;
	const keyHashName = chunkDefinition.keyHashName;

	// all the field names used to build the content hash for a record and a name to store the hash
	const contentHashFields = chunkDefinition.contentHashFields;
	const contentHashName = chunkDefinition.contentHashName;

	// all the field names used to build the content hash for a record and a name to store the hash
	const scopeHashFields = chunkDefinition.scopeHashFields;
	const scopeHashName = chunkDefinition.scopeHashName;

	if (keyHashName === undefined || keyHashName === null || keyHashFields === undefined) {
		throw ("No 'keyHashFields' and 'keyHashName' are given.");
	}

	if (contentHashFields) {
		if (contentHashName === undefined || contentHashName === null) {
			throw ("No 'contentHashName' given in the chunk definition, but the 'contentHashFields' are defined");
		}
	}

	if (scopeHashFields) {
		if (scopeHashName === undefined || scopeHashName === null) {
			throw ("No 'scopeHashName' given in the chunk definition, but the 'scopeHashFields' are defined");
		}
	}

	let functions = [];
	// create the key hash functions
	functions.push(createHashFunction(keyHashFields, keyHashName));

	// create the content hash functions
	if (contentHashFields && contentHashFields.length > 0) {
		functions.push(createHashFunction(contentHashFields, contentHashName));
	}

	// create the scope hash functions
	if (scopeHashFields && scopeHashFields.length > 0) {
		functions.push(createHashFunction(scopeHashFields, scopeHashName));
	}

	return functions;
}
271663
private boolean chunkInStorage(String spaceId, String contentId, String checksum) {
        try {
            if (contentStore.contentExists(spaceId, contentId)) { // dc file exists
                Map<String, String> props =
                    contentStore.getContentProperties(spaceId, contentId);
                String dcChecksum = props.get(ContentStore.CONTENT_CHECKSUM);
                if (null != checksum && null != dcChecksum && checksum.equals(dcChecksum)) {
                    return true; // File with matching checksum already in DuraCloud
                } else {
                    return false; // File exists in DuraCloud, but checksums don't match
                }
            } else {
                return false; // File does not exist in DuraCloud
            }
        } catch (ContentStoreException e) {
            return false; // File does not exist in DuraCloud
        }
    }
1096719
public void createChunks(String frameKey, byte[] expectedTypes, int chunkId, int totalNumRows, int[] maxVecSizes) throws IOException {
        ab.put1(ExternalFrameHandler.INIT_BYTE);
        ab.put1(ExternalFrameHandler.CREATE_FRAME);
        ab.putStr(frameKey);
        this.expectedTypes = expectedTypes;
        ab.putA1(expectedTypes);
        ab.putA4(maxVecSizes);
        ab.putInt(totalNumRows);
        ab.putInt(chunkId);
        writeToChannel(ab, channel);
    }
343988
@Override
    protected void parseColumnDefinition( DdlTokenStream tokens,
                                          AstNode tableNode,
                                          boolean isAlterTable ) throws ParsingException {
        // column-definition
        //
        // Simple-column-Name DataType
        // [ ColumnDefinition-level-constraint ]*
        // [ [ WITH ] DEFAULT { ConstantExpression | NULL } |generated-column-spec ]
        // [ ColumnDefinition-level-constraint ]*

        // generated-column-spec
        //
        // [ GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( START WITH IntegerConstant [ ,INCREMENT BY IntegerConstant] ) ] ] ]

        // EXAMPLE COLUMNS
        // (i INT GENERATED BY DEFAULT AS IDENTITY (START WITH 2, INCREMENT BY 1),
        // ch CHAR(50));

        tokens.canConsume("COLUMN"); // FOR ALTER TABLE ADD [COLUMN] case
        String columnName = parseName(tokens);
        DataType datatype = getDatatypeParser().parse(tokens);

        AstNode columnNode = nodeFactory().node(columnName, tableNode, TYPE_COLUMN_DEFINITION);

        columnNode.setProperty(StandardDdlLexicon.DATATYPE_NAME, datatype.getName());
        if (datatype.getLength() >= 0) {
            columnNode.setProperty(StandardDdlLexicon.DATATYPE_LENGTH, datatype.getLength());
        }
        if (datatype.getPrecision() >= 0) {
            columnNode.setProperty(StandardDdlLexicon.DATATYPE_PRECISION, datatype.getPrecision());
        }
        if (datatype.getScale() >= 0) {
            columnNode.setProperty(StandardDdlLexicon.DATATYPE_SCALE, datatype.getScale());
        }

        // Now clauses and constraints can be defined in any order, so we need to keep parsing until we get to a comma
        // Now clauses and constraints can be defined in any order, so we need to keep parsing until we get to a comma
        StringBuilder unusedTokensSB = new StringBuilder();

        while (tokens.hasNext() && !tokens.matches(COMMA)) {
            boolean parsedDefaultClause = parseDefaultClause(tokens, columnNode);
            if (!parsedDefaultClause) {
                boolean parsedCollate = parseCollateClause(tokens, columnNode);
                boolean parsedConstraint = parseColumnConstraint(tokens, columnNode, isAlterTable);
                boolean parsedGeneratedColumn = parseGeneratedColumnSpecClause(tokens, columnNode);
                if (!parsedCollate && !parsedConstraint && !parsedGeneratedColumn) {
                    // THIS IS AN ERROR. NOTHING FOUND.
                    // NEED TO absorb tokens
                    unusedTokensSB.append(SPACE).append(tokens.consume());
                }
            }
            tokens.canConsume(DdlTokenizer.COMMENT);
        }

        if (unusedTokensSB.length() > 0) {
            String msg = DdlSequencerI18n.unusedTokensParsingColumnDefinition.text(tableNode.getName());
            DdlParserProblem problem = new DdlParserProblem(Problems.WARNING, getCurrentMarkedPosition(), msg);
            problem.setUnusedSource(unusedTokensSB.toString());
            addProblem(problem, tableNode);
        }

    }
1254650
private void addChunkId(Document dbObject) {
        List<String> chunkIds = new ArrayList<>();
        int chunkStart = (Integer) dbObject.get("start") / MongoDBCollectionConfiguration.VARIATION_CHUNK_SIZE;
        int chunkEnd = (Integer) dbObject.get("end") / MongoDBCollectionConfiguration.VARIATION_CHUNK_SIZE;
        String chunkIdSuffix = MongoDBCollectionConfiguration.VARIATION_CHUNK_SIZE / 1000 + "k";
        for (int i = chunkStart; i <= chunkEnd; i++) {
            if (dbObject.containsKey("chromosome")) {
                chunkIds.add(dbObject.get("chromosome") + "_" + i + "_" + chunkIdSuffix);
            } else {
                chunkIds.add(dbObject.get("sequenceName") + "_" + i + "_" + chunkIdSuffix);
            }
        }
        dbObject.put("_chunkIds", chunkIds);
    }
157752
@Override
    public void beginDefinitionList(Map<String, String> parameters)
    {
        saveEvent(EventType.BEGIN_DEFINITION_LIST, parameters);
    }
408871
private void parseFragment(String fragment, boolean query) {
    ChunkTokenizer tokenizer = new ChunkTokenizer(fragment);

    while (tokenizer.hasNext()) {
      /* check to see if we have an expression or a literal */
      String chunk = tokenizer.next();

      if (chunk.startsWith("{")) {
        /* it's an expression, defer encoding until resolution */
        FragmentType type = (query) ? FragmentType.QUERY : FragmentType.PATH_SEGMENT;

        Expression expression = Expressions.create(chunk, type);
        if (expression == null) {
          this.templateChunks.add(Literal.create(encode(chunk, query)));
        } else {
          this.templateChunks.add(expression);
        }
      } else {
        /* it's a literal, pct-encode it */
        this.templateChunks.add(Literal.create(encode(chunk, query)));
      }
    }
  }
14942
public static boolean fixChunkTokenBoundaries(CoreMap docAnnotation, List<IntPair> chunkCharOffsets)
  {
    // First identify any tokens that need to be fixed
    String text = docAnnotation.get(CoreAnnotations.TextAnnotation.class);
    List<CoreLabel> tokens = docAnnotation.get(CoreAnnotations.TokensAnnotation.class);
    List<CoreLabel> output = new ArrayList<CoreLabel>(tokens.size());
    int i = 0;
    CoreLabel token = tokens.get(i);
    for (IntPair offsets:chunkCharOffsets) {
      assert(token.beginPosition() >= 0);
      assert(token.endPosition() >= 0);
      int offsetBegin = offsets.getSource();
      int offsetEnd = offsets.getTarget();
      // Find tokens where token begins after chunk starts
      // and token ends after chunk starts
      while (offsetBegin < token.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class)
              || offsetBegin >= token.get(CoreAnnotations.CharacterOffsetEndAnnotation.class)) {
        output.add(token);
        i++;
        if (i >= tokens.size()) { return false; }
        token = tokens.get(i);
      }
      // offsetBegin is now >= token begin and < token end
      // go until we find a token that starts after our chunk has ended
      while (offsetEnd > token.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class)) {
        // Check if chunk includes token
        if (offsetBegin > token.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class)) {
          // Chunk starts in the middle of the token
          if (offsetEnd < token.get(CoreAnnotations.CharacterOffsetEndAnnotation.class)) {
            output.add(tokenFactory.makeToken(text.substring(token.beginPosition(), offsetBegin),
                    token.beginPosition(), offsetBegin-token.beginPosition()));
            output.add(tokenFactory.makeToken(text.substring(offsetBegin,offsetEnd),
                    offsetBegin, offsetEnd-offsetBegin));
            output.add(tokenFactory.makeToken(text.substring(offsetEnd,token.endPosition()),
                    offsetEnd, token.endPosition()-offsetEnd));
          } else {
            output.add(tokenFactory.makeToken(text.substring(token.beginPosition(), offsetBegin),
                    token.beginPosition(), offsetBegin-token.beginPosition()));
            output.add(tokenFactory.makeToken(text.substring(offsetBegin,token.endPosition()),
                    offsetBegin, token.endPosition()-offsetBegin));
          }
        } else if (offsetEnd < token.get(CoreAnnotations.CharacterOffsetEndAnnotation.class)) {
          output.add(tokenFactory.makeToken(text.substring(token.beginPosition(),offsetEnd),
                  token.beginPosition(), offsetEnd-token.beginPosition()));
          output.add(tokenFactory.makeToken(text.substring(offsetEnd,token.endPosition()), offsetEnd,
                  token.endPosition()-offsetEnd));
        } else {
          // success!  chunk contains token
          output.add(token);
        }
        i++;
        if (i >= tokens.size()) { return false; }
        token = tokens.get(i);
      }
    }
    // Add rest of the tokens
    for (; i < tokens.size(); i++) {
      token = tokens.get(i);
      output.add(token);
    }
    docAnnotation.set(CoreAnnotations.TokensAnnotation.class, output);
    return true;
  }
1281706
public void register(final FieldDefinition definition) {
        //ensure that we can't register a mandatory definition if there are already optional ones
        boolean hasOptionalField = false;
        for (final FieldDefinition fieldDefinition : fields.values()) {
            if (fieldDefinition.isOptional()) {
                hasOptionalField = true;
                break;
            }
        }
        if (!definition.isOptional() && hasOptionalField) {
            throw new IllegalArgumentException("Can't register mandatory definition after a optional definition.");
        }
        fields.put(definition.getFieldName(), definition);
    }
146085
function(definition, client) {

  this.client = client;

  this.schema = null;

  this.ddlHelper = {
    tableName: null,
    pkAttrName: null,
    pkAutoIncrement: false,
    attrNamesToColNames: {},
    attrTypes: {},
    colNamesToAttrNames: {},
    colTypes: {},
    defaultValues: {},
    cqlCreateTable: null,
    indexes: {}
  };

  this._parseDefinition(definition);
}
1267303
public void setChunking()
    {
        checkOutput();
        if (_bufferedOut instanceof ChunkingOutputStream)
            ((ChunkingOutputStream)_bufferedOut).setChunking(true);
        else
            throw new IllegalStateException(_bufferedOut.getClass().toString());
    }
947874
@Override
    public void checkDocument(Document document) {
        document.getDefinitions().forEach(definition -> {
            if (!(definition instanceof OperationDefinition)
                && !(definition instanceof FragmentDefinition)) {

                String message = nonExecutableDefinitionMessage(definition);
                addError(ValidationErrorType.NonExecutableDefinition, definition.getSourceLocation(), message);
            }
        });
    }
268746
public void defineFrom(InputProblemReporter rep, DTDElement definedElem,
                           boolean fullyValidate)
        throws XMLStreamException
    {
        if (fullyValidate) {
            verifyUndefined();
        }
        mValidator = definedElem.mValidator;
        mAllowedContent = definedElem.mAllowedContent;
        mergeMissingAttributesFrom(rep, definedElem, fullyValidate);
    }
160328
private void checkBlockDefinitionsComplete() throws MiniTemplator.TemplateSyntaxException {
        for (int blockNo = 0; blockNo < blockTabCnt; blockNo++) {
            BlockTabRec btr = blockTab[blockNo];
            if (btr.definitionIsOpen) {
                throw new MiniTemplator.TemplateSyntaxException(
                        "Missing $EndBlock command in template for block \"" + btr.blockName + "\".");
            }
        }
        if (currentNestingLevel != 0) {
            throw new MiniTemplator.TemplateSyntaxException("Block nesting level error at end of template.");
        }
    }
503825
private void checkAnyChunk(long p) {
    if (VALIDATING) {
      if (!isAligned(chunkToMem(p)))
        throw new AssertionError("Chunk address [mem:" + p + "=>chunk:" + chunkToMem(p) + "] is incorrectly aligned");
      if (!okAddress(p))
        throw new AssertionError("Memory address " + p + " is invalid");
    }
  }
760046
public static BooleanList calculateStructOffsets(
            Field field,
            int[] fieldDefinitionLevels,
            int[] fieldRepetitionLevels)
    {
        int maxDefinitionLevel = field.getDefinitionLevel();
        int maxRepetitionLevel = field.getRepetitionLevel();
        BooleanList structIsNull = new BooleanArrayList();
        boolean required = field.isRequired();
        if (fieldDefinitionLevels == null) {
            return structIsNull;
        }
        for (int i = 0; i < fieldDefinitionLevels.length; i++) {
            if (fieldRepetitionLevels[i] <= maxRepetitionLevel) {
                if (isValueNull(required, fieldDefinitionLevels[i], maxDefinitionLevel)) {
                    // Struct is null
                    structIsNull.add(true);
                }
                else if (fieldDefinitionLevels[i] >= maxDefinitionLevel) {
                    // Struct is defined and not empty
                    structIsNull.add(false);
                }
            }
        }
        return structIsNull;
    }
914756
@Override
	public long writeBooleans(boolean value, long count) {
		if (count < 0L) throw new IllegalArgumentException("negative count");
		if (position + count > size) throw new EndOfBitStreamException();
		int boundary = BitBoundary.BYTE.bitsFrom(position);
		int bits = value ? -1 : 0;
		if (count <= boundary) return write(bits, (int) count);

		long c = write(bits, boundary);
		long d = (count - c) >> 3;
		fillBytes(bits, d);
		d <<= 3;
		position += d;
		c += d;
		c += write(bits, (int) (count - c));

		return c;
	}