CHECKSTYLE IGNORE LINE: ExecutableStatementCount|CyclomaticComplexity|NPathComplexity
770619
private CollisionResult computeCollision(CollisionCategory category,
                                             double sh,
                                             double sv,
                                             double sx,
                                             double sy,
                                             int max)
    {
        double x = sh;
        double y = sv;
        double ox = x;
        double oy = y;

        boolean collX = false;
        boolean collY = false;

        CollisionResult last = null;
        for (int cur = 0; cur < max; cur++)
        {
            CollisionResult current = computeCollision(category, ox, oy, x, y);
            if (current != null)
            {
                last = current;
                if (current.getX() != null)
                {
                    x = current.getX().doubleValue();
                    collX = true;
                }
                else
                {
                    collX = false;
                }
                if (current.getY() != null)
                {
                    y = current.getY().doubleValue();
                    oy = y;
                }
            }
            else
            {
                collX = false;
            }

            if (!collX)
            {
                ox = x;
                x += sx;
            }

            current = computeCollision(category, ox, oy, x, y);
            if (current != null)
            {
                last = current;
                if (current.getX() != null)
                {
                    x = current.getX().doubleValue();
                }
                if (current.getY() != null)
                {
                    y = current.getY().doubleValue();
                    collY = true;
                }
                else
                {
                    collY = false;
                }
            }
            else
            {
                collY = false;
            }

            if (!collY)
            {
                oy = y;
                y += sy;
            }
        }
        if (category.isGlue())
        {
            if (last == null)
            {
                last = computeCollision(category, ox, oy, x, y - 1);
            }
            if (last == null)
            {
                last = computeCollision(category, ox, oy, x, y - 2);
            }
        }
        return last;
    }
1290254
function setChecksum(fs, path, checksum, callback) {
  fs.setxattr(path, constants.attributes.checksum, checksum, callback);
}
562955
@Override
    protected AstNode parseCustomStatement( DdlTokenStream tokens,
                                            AstNode parentNode ) throws ParsingException {
        assert tokens != null;
        assert parentNode != null;

        AstNode result = null;

        if (tokens.matches(STMT_COMMENT_ON)) {
            result = parseCommentStatement(tokens, parentNode);
        } else if (tokens.matches(STMT_ANALYZE)) {
            return parseStatement(tokens, STMT_ANALYZE, parentNode, TYPE_ANALYZE_STATEMENT);
        } else if (tokens.matches(STMT_ASSOCIATE_STATISTICS)) {
            return parseStatement(tokens, STMT_ASSOCIATE_STATISTICS, parentNode, TYPE_ASSOCIATE_STATISTICS_STATEMENT);
        } else if (tokens.matches(STMT_AUDIT)) {
            return parseStatement(tokens, STMT_AUDIT, parentNode, TYPE_AUDIT_STATEMENT);
        } else if (tokens.matches(STMT_COMMIT_FORCE) || tokens.matches(STMT_COMMIT_WORK) || tokens.matches(STMT_COMMIT_WRITE)) {
            return parseStatement(tokens, STMT_COMMIT, parentNode, TYPE_COMMIT_STATEMENT);
        } else if (tokens.matches(STMT_DISASSOCIATE_STATISTICS)) {
            return parseStatement(tokens, STMT_DISASSOCIATE_STATISTICS, parentNode, TYPE_DISASSOCIATE_STATISTICS_STATEMENT);
        } else if (tokens.matches(STMT_EXPLAIN_PLAN)) {
            return parseStatement(tokens, STMT_EXPLAIN_PLAN, parentNode, TYPE_EXPLAIN_PLAN_STATEMENT);
        } else if (tokens.matches(STMT_FLASHBACK)) {
            return parseStatement(tokens, STMT_FLASHBACK, parentNode, TYPE_FLASHBACK_STATEMENT);
        } else if (tokens.matches(STMT_LOCK_TABLE)) {
            return parseStatement(tokens, STMT_LOCK_TABLE, parentNode, TYPE_LOCK_TABLE_STATEMENT);
        } else if (tokens.matches(STMT_MERGE)) {
            return parseStatement(tokens, STMT_MERGE, parentNode, TYPE_MERGE_STATEMENT);
        } else if (tokens.matches(STMT_NOAUDIT)) {
            return parseStatement(tokens, STMT_NOAUDIT, parentNode, TYPE_NOAUDIT_STATEMENT);
        } else if (tokens.matches(STMT_PURGE)) {
            return parseStatement(tokens, STMT_PURGE, parentNode, TYPE_PURGE_STATEMENT);
        } else if (tokens.matches(STMT_RENAME)) {
            return parseStatement(tokens, STMT_RENAME, parentNode, TYPE_RENAME_STATEMENT);
        } else if (tokens.matches(STMT_ROLLBACK)) {
            return parseStatement(tokens, STMT_ROLLBACK, parentNode, TYPE_ROLLBACK_STATEMENT);
        } else if (tokens.matches(STMT_ROLLBACK_WORK)) {
            return parseStatement(tokens, STMT_ROLLBACK_WORK, parentNode, TYPE_ROLLBACK_STATEMENT);
        } else if (tokens.matches(STMT_ROLLBACK_TO_SAVEPOINT)) {
            return parseStatement(tokens, STMT_ROLLBACK_TO_SAVEPOINT, parentNode, TYPE_ROLLBACK_STATEMENT);
        } else if (tokens.matches(STMT_SAVEPOINT)) {
            return parseStatement(tokens, STMT_SAVEPOINT, parentNode, TYPE_SAVEPOINT_STATEMENT);
        } else if (tokens.matches(STMT_TRUNCATE)) {
            return parseStatement(tokens, STMT_TRUNCATE, parentNode, TYPE_TRUNCATE_STATEMENT);
        }

        if (result == null) {
            result = super.parseCustomStatement(tokens, parentNode);
        }
        return result;
    }
340220
def _checksum(cls, line):
        
        tr_table = str.maketrans({c: None for c in ascii_uppercase + "+ ."})
        no_letters = line[:68].translate(tr_table).replace("-", "1")
        return sum([int(l) for l in no_letters]) % 10
547306
def line_is_executable(line: str) -> bool:
    """"""

    if line_is_comment(line):
        return False

    if re.match(RE_TYPE_NAMES, line):
        return False

    for exp in EXECUTABLE_CODE_START:
        if re.match(exp, line) != None:
            return True

    return False
114038
function processLine (line, callback) {
	var trigger = line[0];

	// Required to drop the args to callback so async doesn't think we're throwing an error.
	function cb () {
		callback();
	}

	if (trigger === 'alias') {
		bot.db.schemas.factTrigger.saveAlias(line[1], line[2]).then(cb);
	} else {
		bot.db.schemas.factTrigger.saveFactoid(trigger, line[1], line[2]).then(cb);
	}
}
462864
void checkColumnInCheckConstraint(int colIndex) {

        for (int i = 0, size = constraintList.length; i < size; i++) {
            Constraint c = constraintList[i];

            if (c.constType == Constraint.CHECK && !c.isNotNull()
                    && c.hasColumn(colIndex)) {
                HsqlName name = c.getName();

                throw Error.error(ErrorCode.X_42502,
                                  name.getSchemaQualifiedStatementName());
            }
        }
    }
29106
private void maybeRunValidityCheck(String passName, Node externs, Node root) {
    if (validityCheck == null) {
      return;
    }
    try {
      validityCheck.create(compiler).process(externs, root);
      changeVerifier.checkRecordedChanges(passName, jsRoot);
    } catch (Exception e) {
      throw new IllegalStateException("Validity checks failed for pass: " + passName, e);
    }
  }
155575
public void registerExistingChecksums(File featureDir, String symbolicName, String fileName) {
        ChecksumData checksums = checksumsMap.get(featureDir);
        if (checksums == null) {
            checksums = new ChecksumData();
            checksumsMap.put(featureDir, checksums);
        }
        checksums.registerExistingChecksums(symbolicName, fileName);
    }
36692
public static void checkReflectionParameters(SqlFragmentContainer statement, MethodDeclaration methodDecl) {

        ArrayList<ParameterDeclaration> params =
                new ArrayList<ParameterDeclaration>(methodDecl.getParameters());
        HashMap<String, ParameterDeclaration> paramMap = new HashMap<String, ParameterDeclaration>();

        // don't run these checks if this is a compiled class file (method names replaced with arg0, arg1, etc)
        if (params.size() > 0 && params.get(0).getSimpleName().equals("arg0")) {
            return;
        }

        for (int i = 0; i < params.size(); i++) {
            paramMap.put(params.get(i).getSimpleName(), params.get(i));
        }

        doCheck(statement, paramMap, methodDecl);
    }
1235622
Enumeration pollForInvalidSessionsWithListeners(Connection nukerCon) throws SQLException {
        //create local variable - JIT performance improvement
        final boolean isTraceOn = com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS]);
        }
        String appName = getIStore().getId(); // bhSessionContext.getAppName();
        Hashtable ret = new Hashtable();
        String id = null;
        PreparedStatement selectNukerStatement = null;
        ResultSet rs = null;
        boolean statementClose = false;
        try {
            long now = System.currentTimeMillis();

            String selNukerString = this.selNukerString;

            if (usingDB2 || usingDerby)
                selNukerString = selNukerString + " for read only";

            int oldIsolationLevel = 0;
            // to reduce shared locks on select, set auto commit on

            //To reduce the shared locks happening on select, temporarily change isolation level
            if (usingDB2 || usingDerby) {
                oldIsolationLevel = nukerCon.getTransactionIsolation();
                nukerCon.setTransactionIsolation(java.sql.Connection.TRANSACTION_READ_UNCOMMITTED);
            }

            selectNukerStatement = nukerCon.prepareStatement(selNukerString);
            selectNukerStatement.setString(1, appName);
            setPSLong(selectNukerStatement, 2, now);

            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "exec query for " + appName);
            }

            rs = selectNukerStatement.executeQuery();

            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "after query for " + appName
                                                                                                                                        + " processing results");
            }

            while (rs.next()) {

                id = rs.getString(1);
                if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "processing " + id);
                }
                BackedSession s = new DatabaseSession(this, id, _iStore.getStoreCallback()); //(DatabaseSession)getSessionWrapper(id);

                s.initSession(_iStore);
                s.setIsValid(true);
                s.setIsNew(false);
                s.updateLastAccessTime(rs.getLong(2));
                s.setCreationTime(rs.getLong(3));
                s.internalSetMaxInactive(rs.getInt(4));
                s.internalSetUser(rs.getString(5));
                s.setListenerFlag(rs.getShort(6));

                ret.put(id, s);
            }

            rs.close();
            selectNukerStatement.close();
            statementClose = true;

            if (usingDB2) {
                nukerCon.setTransactionIsolation(oldIsolationLevel);
            }

            if (isTraceOn && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
                LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "close/commit ");
            }
        } catch (SQLException se) {
            //            if (isStaleConnectionException(se)) {
            //                com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.pollForInvalids", id, nukerCon);
            //                if (isTraceOn&&LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            //                    LoggingUtil.SESSION_LOGGER_WAS.logp(Level.FINE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "StaleConnectionException");
            //                }
            //                throw se;
            //            } else {
            com.ibm.ws.ffdc.FFDCFilter.processException(se, "com.ibm.ws.session.store.db.DatabaseHashMap.pollForInvalids", id, nukerCon);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "DatabaseHashMap.pollForInvalidsError");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "CommonMessage.sessionid", id);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "CommonMessage.exception", se);
            throw se;
            //            }
        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.session.store.db.DatabaseHashMap.pollForInvalids", id, nukerCon);
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "DatabaseHashMap.pollForInvalidsError");
            LoggingUtil.SESSION_LOGGER_WAS.logp(Level.SEVERE, methodClassName, methodNames[POLL_FOR_INVALID_SESSIONS_WITH_LISTENERS], "CommonMessage.exception", e);
        } finally {
            if (!statementClose && selectNukerStatement != null) {
                closeResultSet(rs);
                closeStatement(selectNukerStatement);
            }
        }

        return ret.elements();
    }
1357445
synchronized Statement compile(Session session,
                                   Result cmd) throws Throwable {

        String    sql  = cmd.getMainString();
        long      csid = getStatementID(session.currentSchema, sql);
        Statement cs   = (Statement) csidMap.get(csid);

        if (cs == null || !cs.isValid() || !session.isAdmin()) {
            Session sys = database.sessionManager.getSysSession(
                session.currentSchema.name, session.getUser());

            cs   = sys.compileStatement(sql);
            csid = registerStatement(csid, cs);
        }

        linkSession(csid, session.getId());

        return cs;
    }
447040
def _py_code_clean(lines, tab, executable):
    
    count = 0
    allparams = executable.ordered_parameters
    if type(executable).__name__ == "Function":
        allparams = allparams + [executable]
        
    for p in allparams:
        value = _py_clean(p, tab)
        if value is not None:
            count += 1
            lines.append(value)
            
    return count
684204
def action_verify_checksum(self, ids):
        """"""
        try:
            count = 0
            for file_id in ids:
                f = FileInstance.query.filter_by(
                    id=uuid.UUID(file_id)).one_or_none()
                if f is None:
                    raise ValueError(_("Cannot find file instance."))
                verify_checksum.delay(file_id)
                count += 1
            if count > 0:
                flash(_('Fixity check(s) sent to queue.'), 'success')
        except Exception as exc:
            if not self.handle_view_exception(exc):
                raise
            current_app.logger.exception(str(exc))  # pragma: no cover
            flash(_('Failed to run fixity checks.'),
                  'error')
1194190
private Properties initChecksumProps(Map<String, Set<String>> useOldChecksums) {
        Properties checksumProps = new Properties();
        for (Set<String> set : useOldChecksums.values()) {
            for (String s : set) {
                checksumProps.put(s, "");
            }
        }
        return checksumProps;
    }
598565
def update kwargs={}
      ignore_cksum = kwargs.arg :ignore_cksum, false
      ignore_sigs = kwargs.arg :ignore_sigs, false

      cmd = 'aptly mirror update'
      cmd += ' -ignore-checksums' if ignore_cksum
      cmd += ' -ignore-signatures' if ignore_sigs
      cmd += " #{@name.quote}"

      Aptly::runcmd cmd
    end
1221860
private String maybeTrim(String line) {
    return sqlLine.getOpts().getTrimScripts() ? line.trim() : line;
  }