idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,138,603 | private // ----------------------------------------------------------------------------------------------<NEW_LINE>void addVirtualBasesSpeculatively(int startOffset, List<ClassPdbMember> pdbMembers, List<VirtualLayoutBaseClass> virtualBases, TaskMonitor monitor) throws CancelledException {<NEW_LINE>String accumulatedComment = "";<NEW_LINE>int memberOffset = startOffset;<NEW_LINE>for (VirtualLayoutBaseClass virtualBase : virtualBases) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>Composite baseDataType = virtualBase.getDirectDataType();<NEW_LINE>int virtualBaseLength = getCompositeLength(baseDataType);<NEW_LINE>if (virtualBaseLength != 0) {<NEW_LINE>String comment = "((Speculative Placement) Virtual Base " + virtualBase.getDataTypePath<MASK><NEW_LINE>accumulatedComment += comment;<NEW_LINE>ClassPdbMember virtualClassPdbMember = new ClassPdbMember("", baseDataType, false, memberOffset, accumulatedComment);<NEW_LINE>pdbMembers.add(virtualClassPdbMember);<NEW_LINE>memberOffset += virtualBaseLength;<NEW_LINE>accumulatedComment = "";<NEW_LINE>} else {<NEW_LINE>String comment = "((empty) (Speculative Placement) Virtual Base " + virtualBase.getDataTypePath().getDataTypeName() + ")";<NEW_LINE>accumulatedComment += comment;<NEW_LINE>}<NEW_LINE>// If last base is empty, then its comment and any accumulated to this point<NEW_LINE>// will not be seen (not applied to a PdbMember). TODO: Consider options,<NEW_LINE>// though we know we have left it in this state and are OK with it for now.<NEW_LINE>// We have not considered fall-out from this.<NEW_LINE>}<NEW_LINE>} | ().getDataTypeName() + ")"; |
740,025 | // Stratified cross validation<NEW_LINE>public void cross_validation(DataSet x, double[] weighted_C, int nr_fold, double[] target) {<NEW_LINE>final int l = x.size();<NEW_LINE>int[] perm = new int[l], fold_start;<NEW_LINE>// stratified cv may not give leave-one-out rate<NEW_LINE>// Each class to l folds -> some folds may have zero elements<NEW_LINE>if (nr_fold < l) {<NEW_LINE>fold_start = stratifiedFolds(x, nr_fold, perm);<NEW_LINE>} else {<NEW_LINE>perm = shuffledIndex(perm, l);<NEW_LINE>fold_start = makeFolds(l, nr_fold);<NEW_LINE>}<NEW_LINE>ByteWeightedArrayDataSet newx = new ByteWeightedArrayDataSet(x, l);<NEW_LINE>for (int i = 0; i < nr_fold; i++) {<NEW_LINE>final int begin = fold_start[i], end = fold_start[i + 1];<NEW_LINE>newx.clear();<NEW_LINE>for (int j = 0; j < begin; ++j) {<NEW_LINE>newx.add(perm[j], (byte) x.classnum(perm[j]));<NEW_LINE>}<NEW_LINE>for (int j = end; j < l; ++j) {<NEW_LINE>newx.add(perm[j], (byte) x.classnum(perm[j]));<NEW_LINE>}<NEW_LINE>ClassificationModel submodel = train(newx, weighted_C);<NEW_LINE>if (submodel instanceof ProbabilisticClassificationModel) {<NEW_LINE>ProbabilisticClassificationModel pm = (ProbabilisticClassificationModel) submodel;<NEW_LINE>double[] prob_estimates <MASK><NEW_LINE>for (int j = begin; j < end; j++) {<NEW_LINE>target[perm[j]] = pm.predict_prob(x, perm[j], prob_estimates);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (int j = begin; j < end; j++) {<NEW_LINE>target[perm[j]] = submodel.predict(x, perm[j]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = new double[submodel.nr_class]; |
869,634 | public static void convolve(Kernel2D_S32 kernel, GrayS16 input, GrayI16 output, int skip) {<NEW_LINE>output.reshape(input.width / skip, input.height / skip);<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int width = input.width - input.width % skip;<NEW_LINE>final int height = input.height - input.height % skip;<NEW_LINE>for (int y = 0; y < height; y += skip) {<NEW_LINE>for (int x = 0; x < width; x += skip) {<NEW_LINE>int startX = x - radius;<NEW_LINE>int endX = x + radius;<NEW_LINE>if (startX < 0)<NEW_LINE>startX = 0;<NEW_LINE>if (endX >= input.width)<NEW_LINE>endX = input.width - 1;<NEW_LINE>int startY = y - radius;<NEW_LINE>int endY = y + radius;<NEW_LINE>if (startY < 0)<NEW_LINE>startY = 0;<NEW_LINE>if (endY >= input.height)<NEW_LINE>endY = input.height - 1;<NEW_LINE>int total = 0;<NEW_LINE>int div = 0;<NEW_LINE>for (int i = startY; i <= endY; i++) {<NEW_LINE>for (int j = startX; j <= endX; j++) {<NEW_LINE>int v = kernel.get(j - x + radius, i - y + radius);<NEW_LINE>total += input.<MASK><NEW_LINE>div += v;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>output.set(x / skip, y / skip, (total + div / 2) / div);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | get(j, i) * v; |
1,719,082 | protected void prepare() {<NEW_LINE>ProcessInfoParameter[] para = getParameter();<NEW_LINE>for (int i = 0; i < para.length; i++) {<NEW_LINE>String name = <MASK><NEW_LINE>if (para[i].getParameter() == null)<NEW_LINE>;<NEW_LINE>if (name.equals("MovementDate"))<NEW_LINE>p_MovementDate = (Timestamp) para[i].getParameter();<NEW_LINE>else if (name.equals("IgnorePrevProduction"))<NEW_LINE>ignorePrevProduction = "Y".equals(para[i].getParameter());<NEW_LINE>else<NEW_LINE>log.log(Level.SEVERE, "Unknown Parameter: " + name);<NEW_LINE>}<NEW_LINE>if (p_MovementDate == null)<NEW_LINE>p_MovementDate = Env.getContextAsDate(getCtx(), "#Date");<NEW_LINE>if (p_MovementDate == null)<NEW_LINE>p_MovementDate = new Timestamp(System.currentTimeMillis());<NEW_LINE>p_C_OrderLine_ID = getRecord_ID();<NEW_LINE>} | para[i].getParameterName(); |
640,148 | public boolean isMUL(String columnName) {<NEW_LINE>for (SQLTableElement element : this.tableElementList) {<NEW_LINE>if (element instanceof MySqlUnique) {<NEW_LINE>MySqlUnique unique = (MySqlUnique) element;<NEW_LINE>SQLExpr column = unique.getColumns().<MASK><NEW_LINE>if (column instanceof SQLIdentifierExpr && SQLUtils.nameEquals(columnName, ((SQLIdentifierExpr) column).getName())) {<NEW_LINE>return unique.getColumns().size() > 1;<NEW_LINE>} else if (column instanceof SQLMethodInvokeExpr && SQLUtils.nameEquals(((SQLMethodInvokeExpr) column).getMethodName(), columnName)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} else if (element instanceof MySqlKey) {<NEW_LINE>MySqlKey unique = (MySqlKey) element;<NEW_LINE>SQLExpr column = unique.getColumns().get(0).getExpr();<NEW_LINE>if (column instanceof SQLIdentifierExpr && SQLUtils.nameEquals(columnName, ((SQLIdentifierExpr) column).getName())) {<NEW_LINE>return true;<NEW_LINE>} else if (column instanceof SQLMethodInvokeExpr && SQLUtils.nameEquals(((SQLMethodInvokeExpr) column).getMethodName(), columnName)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | get(0).getExpr(); |
125,518 | private JsonWebTokenImpl verifyAndParseEncryptedJWT(String issuer, PublicKey publicKey, PrivateKey privateKey) throws JWTProcessingException {<NEW_LINE>if (encryptedJWT == null) {<NEW_LINE>throw new IllegalStateException("EncryptedJWT not parsed");<NEW_LINE>}<NEW_LINE>String algName = encryptedJWT.getHeader().getAlgorithm().getName();<NEW_LINE>if (!RSA_OAEP.getName().equals(algName)) {<NEW_LINE>throw new JWTProcessingException("Only RSA-OAEP algorithm is supported for JWT encryption, used " + algName);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>encryptedJWT.<MASK><NEW_LINE>} catch (JOSEException ex) {<NEW_LINE>throw new JWTProcessingException("Exception during decrypting JWT token", ex);<NEW_LINE>}<NEW_LINE>signedJWT = encryptedJWT.getPayload().toSignedJWT();<NEW_LINE>if (signedJWT == null) {<NEW_LINE>throw new JWTProcessingException("Unable to parse signed JWT.");<NEW_LINE>}<NEW_LINE>return verifyAndParseSignedJWT(issuer, publicKey);<NEW_LINE>} | decrypt(new RSADecrypter(privateKey)); |
55,038 | public static ErrorDescription implementMethods(HintContext ctx) {<NEW_LINE>ClassTree clazz = (ClassTree) ctx.getPath().getLeaf();<NEW_LINE>Element typeEl = ctx.getInfo().getTrees().getElement(ctx.getPath());<NEW_LINE>if (typeEl == null || !typeEl.getKind().isClass())<NEW_LINE>return null;<NEW_LINE>List<Tree> candidate = new ArrayList<Tree<MASK><NEW_LINE>candidate.add(clazz.getExtendsClause());<NEW_LINE>Tree found = null;<NEW_LINE>for (Tree cand : candidate) {<NEW_LINE>if (ctx.getInfo().getTrees().getSourcePositions().getStartPosition(ctx.getInfo().getCompilationUnit(), cand) <= ctx.getCaretLocation() && ctx.getCaretLocation() <= ctx.getInfo().getTrees().getSourcePositions().getEndPosition(ctx.getInfo().getCompilationUnit(), cand)) {<NEW_LINE>found = cand;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (found == null)<NEW_LINE>return null;<NEW_LINE>TreePath foundPath = new TreePath(ctx.getPath(), found);<NEW_LINE>Element supertype = ctx.getInfo().getTrees().getElement(foundPath);<NEW_LINE>if (supertype == null || (!supertype.getKind().isClass() && !supertype.getKind().isInterface()))<NEW_LINE>return null;<NEW_LINE>List<ExecutableElement> unimplemented = computeUnimplemented(ctx.getInfo(), typeEl, supertype);<NEW_LINE>if (!unimplemented.isEmpty()) {<NEW_LINE>return ErrorDescriptionFactory.forName(ctx, foundPath, Bundle.ERR_ImplementMethods(((TypeElement) supertype).getQualifiedName().toString()), new ImplementFix(ctx.getInfo(), ctx.getPath(), (TypeElement) typeEl, (TypeElement) supertype).toEditorFix());<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | >(clazz.getImplementsClause()); |
1,814,156 | public StarlarkCallable rule(StarlarkFunction implementation, Boolean test, Object attrs, Object implicitOutputs, Boolean executable, Boolean outputToGenfiles, Sequence<?> fragments, Sequence<?> hostFragments, Boolean starlarkTestable, Sequence<?> toolchains, boolean useToolchainTransition, String doc, Sequence<?> providesArg, Sequence<?> execCompatibleWith, Object analysisTest, Object buildSetting, Object cfg, Object execGroups, Object compileOneFiletype, Object name, StarlarkThread thread) throws EvalException {<NEW_LINE>ImmutableMap.Builder<String, FakeDescriptor> attrsMapBuilder = ImmutableMap.builder();<NEW_LINE>if (attrs != null && attrs != Starlark.NONE) {<NEW_LINE>attrsMapBuilder.putAll(Dict.cast(attrs, String.class, FakeDescriptor.class, "attrs"));<NEW_LINE>}<NEW_LINE>attrsMapBuilder.put("name", IMPLICIT_NAME_ATTRIBUTE_DESCRIPTOR);<NEW_LINE>List<AttributeInfo> attrInfos = attrsMapBuilder.build().entrySet().stream().filter(entry -> !entry.getKey().startsWith("_")).map(entry -> entry.getValue().asAttributeInfo(entry.getKey())).collect(Collectors.toList());<NEW_LINE>attrInfos.sort(new AttributeNameComparator());<NEW_LINE>RuleDefinitionIdentifier functionIdentifier = new RuleDefinitionIdentifier();<NEW_LINE>// Only the Builder is passed to RuleInfoWrapper as the rule name may not be available yet.<NEW_LINE>RuleInfo.Builder ruleInfo = RuleInfo.newBuilder().setDocString(doc).addAllAttribute(attrInfos);<NEW_LINE>if (name != Starlark.NONE) {<NEW_LINE>ruleInfo.setRuleName((String) name);<NEW_LINE>}<NEW_LINE>Location loc = thread.getCallerLocation();<NEW_LINE>ruleInfoList.add(new RuleInfoWrapper<MASK><NEW_LINE>return functionIdentifier;<NEW_LINE>} | (functionIdentifier, loc, ruleInfo)); |
1,397,282 | private static List<Class> findClasses(File directory, String packageName) throws ClassNotFoundException, IOException, URISyntaxException {<NEW_LINE>List<Class> <MASK><NEW_LINE>if (!directory.exists()) {<NEW_LINE>// maybe we are running from a jar file, so try that<NEW_LINE>File thisJarFile = new File(SpecificProfileFactory.class.getProtectionDomain().getCodeSource().getLocation().toURI());<NEW_LINE>if (thisJarFile.exists()) {<NEW_LINE>List<Class> classNames = new ArrayList<>();<NEW_LINE>try (ZipInputStream zip = new ZipInputStream(new FileInputStream(thisJarFile.getPath()))) {<NEW_LINE>for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry()) if (entry.getName().endsWith(".class") && !entry.isDirectory()) {<NEW_LINE>// This ZipEntry represents a class. Now, what class does it represent?<NEW_LINE>StringBuilder className = new StringBuilder();<NEW_LINE>for (String part : entry.getName().split("/")) {<NEW_LINE>if (className.length() != 0)<NEW_LINE>className.append(".");<NEW_LINE>className.append(part);<NEW_LINE>if (part.endsWith(".class"))<NEW_LINE>className.setLength(className.length() - ".class".length());<NEW_LINE>}<NEW_LINE>if (className.toString().contains(packageName)) {<NEW_LINE>classNames.add(Class.forName(className.toString()));<NEW_LINE>}<NEW_LINE>zip.closeEntry();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return classNames;<NEW_LINE>} else<NEW_LINE>return classes;<NEW_LINE>}<NEW_LINE>File[] files = directory.listFiles();<NEW_LINE>for (File file : files) {<NEW_LINE>if (file.isDirectory()) {<NEW_LINE>assert !file.getName().contains(".");<NEW_LINE>classes.addAll(findClasses(file, packageName + "." + file.getName()));<NEW_LINE>} else if (file.getName().endsWith(".class")) {<NEW_LINE>classes.add(Class.forName(packageName + '.' + file.getName().substring(0, file.getName().length() - 6)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return classes;<NEW_LINE>} | classes = new ArrayList<>(); |
26,183 | public SaveResult saveIdentity(SignalProtocolAddress address, IdentityKey identityKey, boolean nonBlockingApproval) {<NEW_LINE>synchronized (LOCK) {<NEW_LINE>IdentityStoreRecord identityRecord = cache.<MASK><NEW_LINE>RecipientId recipientId = RecipientId.fromExternalPush(address.getName());<NEW_LINE>if (identityRecord == null) {<NEW_LINE>Log.i(TAG, "Saving new identity...");<NEW_LINE>cache.save(address.getName(), recipientId, identityKey, VerifiedStatus.DEFAULT, true, System.currentTimeMillis(), nonBlockingApproval);<NEW_LINE>return SaveResult.NEW;<NEW_LINE>}<NEW_LINE>if (!identityRecord.getIdentityKey().equals(identityKey)) {<NEW_LINE>Log.i(TAG, "Replacing existing identity... Existing: " + identityRecord.getIdentityKey().hashCode() + " New: " + identityKey.hashCode());<NEW_LINE>VerifiedStatus verifiedStatus;<NEW_LINE>if (identityRecord.getVerifiedStatus() == VerifiedStatus.VERIFIED || identityRecord.getVerifiedStatus() == VerifiedStatus.UNVERIFIED) {<NEW_LINE>verifiedStatus = VerifiedStatus.UNVERIFIED;<NEW_LINE>} else {<NEW_LINE>verifiedStatus = VerifiedStatus.DEFAULT;<NEW_LINE>}<NEW_LINE>cache.save(address.getName(), recipientId, identityKey, verifiedStatus, false, System.currentTimeMillis(), nonBlockingApproval);<NEW_LINE>IdentityUtil.markIdentityUpdate(context, recipientId);<NEW_LINE>ApplicationDependencies.getProtocolStore().aci().sessions().archiveSiblingSessions(address);<NEW_LINE>SignalDatabase.senderKeyShared().deleteAllFor(recipientId);<NEW_LINE>return SaveResult.UPDATE;<NEW_LINE>}<NEW_LINE>if (isNonBlockingApprovalRequired(identityRecord)) {<NEW_LINE>Log.i(TAG, "Setting approval status...");<NEW_LINE>cache.setApproval(address.getName(), recipientId, identityRecord, nonBlockingApproval);<NEW_LINE>return SaveResult.NON_BLOCKING_APPROVAL_REQUIRED;<NEW_LINE>}<NEW_LINE>return SaveResult.NO_CHANGE;<NEW_LINE>}<NEW_LINE>} | get(address.getName()); |
1,784,270 | final AssociateMemberAccountResult executeAssociateMemberAccount(AssociateMemberAccountRequest associateMemberAccountRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(associateMemberAccountRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AssociateMemberAccountRequest> request = null;<NEW_LINE>Response<AssociateMemberAccountResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AssociateMemberAccountRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(associateMemberAccountRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Macie");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociateMemberAccount");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AssociateMemberAccountResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AssociateMemberAccountResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,121,832 | public void runScript() throws IOException {<NEW_LINE>List<String> args = new ArrayList<>();<NEW_LINE>String pythonVersion = mlContext.getProperties().getOrDefault(MLConstants.PYTHON_VERSION, "");<NEW_LINE>String pythonExec = "python" + pythonVersion;<NEW_LINE>// check if has python2 or python3 environment<NEW_LINE>if (checkPythonEnvironment("which " + pythonExec) != 0) {<NEW_LINE>throw new RuntimeException("No this python environment");<NEW_LINE>}<NEW_LINE>args.add(pythonExec);<NEW_LINE>args.add(mlContext.getScript().getAbsolutePath());<NEW_LINE>args.add("--logdir=" + mlContext.getProperties().getOrDefault(MLConstants.CHECKPOINT_DIR, mlContext.getWorkDir().getAbsolutePath()));<NEW_LINE>String port = mlContext.getProperties().getOrDefault(TFConstants.TENSORBOART_PORT, String.valueOf(IpHostUtil.getFreePort()));<NEW_LINE>args.add("--port=" + port);<NEW_LINE>args.add("--host=" + mlContext.getNodeServerIP());<NEW_LINE>ProcessBuilder builder = new ProcessBuilder(args);<NEW_LINE>String classPath = getClassPath();<NEW_LINE>if (classPath == null) {<NEW_LINE>// can happen in UT<NEW_LINE>LOG.warn("Cannot find proper classpath for the Python process.");<NEW_LINE>} else {<NEW_LINE>mlContext.putEnvProperty(MLConstants.CLASSPATH, classPath);<NEW_LINE>}<NEW_LINE>buildProcessBuilder(builder);<NEW_LINE>LOG.info("{} Python cmd: {}", mlContext.getIdentity(), Joiner.on(<MASK><NEW_LINE>runProcess(builder);<NEW_LINE>} | " ").join(args)); |
1,176,129 | public static String[][] parseFromLines(String[] lines, int minimumItemsInOneLine, int startLine, int endLine) {<NEW_LINE>String[][] labels = null;<NEW_LINE><MASK><NEW_LINE>if (startLine <= endLine) {<NEW_LINE>int i, j;<NEW_LINE>int count = 0;<NEW_LINE>for (i = startLine; i <= endLine; i++) {<NEW_LINE>String[] labelInfos = null;<NEW_LINE>if (minimumItemsInOneLine > 1) {<NEW_LINE>labelInfos = lines[i].split(" ");<NEW_LINE>} else {<NEW_LINE>labelInfos = new String[1];<NEW_LINE>labelInfos[0] = lines[i];<NEW_LINE>}<NEW_LINE>boolean isNotEmpty = false;<NEW_LINE>for (j = 0; j < labelInfos.length; j++) {<NEW_LINE>labelInfos[j] = labelInfos[j].trim();<NEW_LINE>if (labelInfos[j].length() != 0)<NEW_LINE>isNotEmpty = true;<NEW_LINE>}<NEW_LINE>if (labelInfos.length > 0 && isNotEmpty)<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>int tmpCount = 0;<NEW_LINE>if (count > 0) {<NEW_LINE>labels = new String[count][];<NEW_LINE>for (i = startLine; i <= endLine; i++) {<NEW_LINE>if (tmpCount > count - 1)<NEW_LINE>break;<NEW_LINE>String[] labelInfos = null;<NEW_LINE>if (minimumItemsInOneLine > 1) {<NEW_LINE>labelInfos = lines[i].split(" ");<NEW_LINE>} else {<NEW_LINE>labelInfos = new String[1];<NEW_LINE>labelInfos[0] = lines[i];<NEW_LINE>}<NEW_LINE>boolean isNotEmpty = false;<NEW_LINE>for (j = 0; j < labelInfos.length; j++) {<NEW_LINE>labelInfos[j] = labelInfos[j].trim();<NEW_LINE>if (labelInfos[j].length() != 0)<NEW_LINE>isNotEmpty = true;<NEW_LINE>}<NEW_LINE>if (labelInfos.length > 0 && isNotEmpty) {<NEW_LINE>labels[tmpCount] = new String[minimumItemsInOneLine];<NEW_LINE>for (j = 0; j < Math.min(labelInfos.length, minimumItemsInOneLine); j++) labels[tmpCount][j] = labelInfos[j].trim();<NEW_LINE>tmpCount++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>labelsRet = new String[tmpCount][];<NEW_LINE>for (i = 0; i < tmpCount; i++) {<NEW_LINE>labelsRet[i] = new String[minimumItemsInOneLine];<NEW_LINE>for (j = 0; j < minimumItemsInOneLine; j++) labelsRet[i][j] = labels[i][j];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return labelsRet;<NEW_LINE>} | String[][] labelsRet = null; |
1,812,162 | protected void cleanupCompensation() {<NEW_LINE>// The compensation is at the end here. Simply stop the execution.<NEW_LINE>commandContext.getHistoryManager(<MASK><NEW_LINE>commandContext.getExecutionEntityManager().deleteExecutionAndRelatedData(execution, null);<NEW_LINE>ExecutionEntity parentExecutionEntity = execution.getParent();<NEW_LINE>if (parentExecutionEntity.isScope() && !parentExecutionEntity.isProcessInstanceType()) {<NEW_LINE>if (allChildExecutionsEnded(parentExecutionEntity, null)) {<NEW_LINE>// Go up the hierarchy to check if the next scope is ended too.<NEW_LINE>// This could happen if only the compensation activity is still active, but the<NEW_LINE>// main process is already finished.<NEW_LINE>ExecutionEntity executionEntityToEnd = parentExecutionEntity;<NEW_LINE>ExecutionEntity scopeExecutionEntity = findNextParentScopeExecutionWithAllEndedChildExecutions(parentExecutionEntity, parentExecutionEntity);<NEW_LINE>while (scopeExecutionEntity != null) {<NEW_LINE>executionEntityToEnd = scopeExecutionEntity;<NEW_LINE>scopeExecutionEntity = findNextParentScopeExecutionWithAllEndedChildExecutions(scopeExecutionEntity, parentExecutionEntity);<NEW_LINE>}<NEW_LINE>if (executionEntityToEnd.isProcessInstanceType()) {<NEW_LINE>Context.getAgenda().planEndExecutionOperation(executionEntityToEnd);<NEW_LINE>} else {<NEW_LINE>Context.getAgenda().planDestroyScopeOperation(executionEntityToEnd);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).recordActivityEnd(execution, null); |
506,257 | public void doApkBuild() throws Exception {<NEW_LINE>// TODO Merge 2 zip packages<NEW_LINE>apkFile = getApkFile();<NEW_LINE>diffAPkFile = getDiffAPkFile();<NEW_LINE>Profiler.start("build tpatch apk");<NEW_LINE>Profiler.enter("prepare dir");<NEW_LINE>File tmpWorkDir = new File(diffAPkFile.getParentFile(), "tmp-apk");<NEW_LINE>if (tmpWorkDir.exists()) {<NEW_LINE>FileUtils.deleteDirectory(tmpWorkDir);<NEW_LINE>}<NEW_LINE>if (!tmpWorkDir.exists()) {<NEW_LINE>tmpWorkDir.mkdirs();<NEW_LINE>}<NEW_LINE>BetterZip.unzipDirectory(apkFile, tmpWorkDir);<NEW_LINE>// Map zipEntityMap = new HashMap();<NEW_LINE>// ZipUtils.unzip(apkFile, tmpWorkDir.getAbsolutePath(), "UTF-8", zipEntityMap, true);<NEW_LINE>FileUtils.deleteDirectory(new File(tmpWorkDir, "assets"));<NEW_LINE>FileUtils.deleteDirectory(<MASK><NEW_LINE>FileUtils.forceDelete(new File(tmpWorkDir, "resources.arsc"));<NEW_LINE>FileUtils.forceDelete(new File(tmpWorkDir, "AndroidManifest.xml"));<NEW_LINE>File resdir = new File(diffAPkFile.getParentFile(), "tmp-diffResAp");<NEW_LINE>resdir.mkdirs();<NEW_LINE>ZipUtils.unzip(getResourceFile(), resdir.getAbsolutePath(), "UTF-8", new HashMap<String, ZipEntry>(), true);<NEW_LINE>FileUtils.copyDirectory(resdir, tmpWorkDir);<NEW_LINE>Profiler.release();<NEW_LINE>Profiler.enter("rezip");<NEW_LINE>if (getProject().hasProperty("atlas.createDiffApk")) {<NEW_LINE>BetterZip.zipDirectory(tmpWorkDir, diffAPkFile);<NEW_LINE>} else {<NEW_LINE>if (diffAPkFile.exists()) {<NEW_LINE>FileUtils.deleteDirectory(diffAPkFile);<NEW_LINE>}<NEW_LINE>FileUtils.moveDirectory(tmpWorkDir, diffAPkFile);<NEW_LINE>}<NEW_LINE>// ZipUtils.rezip(diffAPkFile, tmpWorkDir, zipEntityMap);<NEW_LINE>Profiler.release();<NEW_LINE>FileUtils.deleteDirectory(tmpWorkDir);<NEW_LINE>FileUtils.deleteDirectory(resdir);<NEW_LINE>getLogger().warn(Profiler.dump());<NEW_LINE>} | new File(tmpWorkDir, "res")); |
1,228,114 | protected ECPointFormat selectPointFormat(T msg) {<NEW_LINE>ECPointFormat selectedFormat;<NEW_LINE>if (chooser.getConfig().isEnforceSettings()) {<NEW_LINE>selectedFormat = chooser<MASK><NEW_LINE>} else {<NEW_LINE>Set<ECPointFormat> serverSet = new HashSet<>(chooser.getConfig().getDefaultServerSupportedPointFormats());<NEW_LINE>Set<ECPointFormat> clientSet = new HashSet<>(chooser.getClientSupportedPointFormats());<NEW_LINE>serverSet.retainAll(clientSet);<NEW_LINE>if (serverSet.isEmpty()) {<NEW_LINE>LOGGER.warn("No common ECPointFormat - falling back to default");<NEW_LINE>selectedFormat = chooser.getConfig().getDefaultSelectedPointFormat();<NEW_LINE>} else {<NEW_LINE>if (serverSet.contains(chooser.getConfig().getDefaultSelectedPointFormat())) {<NEW_LINE>selectedFormat = chooser.getConfig().getDefaultSelectedPointFormat();<NEW_LINE>} else {<NEW_LINE>selectedFormat = (ECPointFormat) serverSet.toArray()[0];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return selectedFormat;<NEW_LINE>} | .getConfig().getDefaultSelectedPointFormat(); |
1,116,410 | public static RandomForest fit(Formula formula, DataFrame data, Properties params) {<NEW_LINE>int ntrees = Integer.parseInt(params<MASK><NEW_LINE>int mtry = Integer.parseInt(params.getProperty("smile.random_forest.mtry", "0"));<NEW_LINE>SplitRule rule = SplitRule.valueOf(params.getProperty("smile.random_forest.split_rule", "GINI"));<NEW_LINE>int maxDepth = Integer.parseInt(params.getProperty("smile.random_forest.max_depth", "20"));<NEW_LINE>int maxNodes = Integer.parseInt(params.getProperty("smile.random_forest.max_nodes", String.valueOf(data.size() / 5)));<NEW_LINE>int nodeSize = Integer.parseInt(params.getProperty("smile.random_forest.node_size", "5"));<NEW_LINE>double subsample = Double.parseDouble(params.getProperty("smile.random_forest.sampling_rate", "1.0"));<NEW_LINE>int[] classWeight = Strings.parseIntArray(params.getProperty("smile.random_forest.class_weight"));<NEW_LINE>return fit(formula, data, ntrees, mtry, rule, maxDepth, maxNodes, nodeSize, subsample, classWeight, null);<NEW_LINE>} | .getProperty("smile.random_forest.trees", "500")); |
613,813 | public void heartbeat() {<NEW_LINE>LinkedMultiValueMap<String, ElasticAgentMetadata> elasticAgentsOfMissingPlugins = agentService.allElasticAgents();<NEW_LINE>// pingMessage TTL is set lesser than elasticPluginHeartBeatInterval to ensure there aren't multiple ping request for the same plugin<NEW_LINE>long pingMessageTimeToLive = elasticPluginHeartBeatInterval - 10000L;<NEW_LINE>for (PluginDescriptor descriptor : elasticAgentPluginRegistry.getPlugins()) {<NEW_LINE>elasticAgentsOfMissingPlugins.remove(descriptor.id());<NEW_LINE>List<ClusterProfile> clusterProfiles = clusterProfilesService.getPluginProfiles().findByPluginId(descriptor.id());<NEW_LINE>boolean secretsResolved = resolveSecrets(descriptor.id(), clusterProfiles);<NEW_LINE>if (!secretsResolved)<NEW_LINE>continue;<NEW_LINE>serverPingQueue.post(new ServerPingMessage(descriptor.id<MASK><NEW_LINE>serverHealthService.removeByScope(scope(descriptor.id()));<NEW_LINE>}<NEW_LINE>if (!elasticAgentsOfMissingPlugins.isEmpty()) {<NEW_LINE>for (String pluginId : elasticAgentsOfMissingPlugins.keySet()) {<NEW_LINE>Collection<String> uuids = elasticAgentsOfMissingPlugins.get(pluginId).stream().map(ElasticAgentMetadata::uuid).collect(toList());<NEW_LINE>String description = format("Elastic agent plugin with identifier %s has gone missing, but left behind %s agent(s) with UUIDs %s.", pluginId, elasticAgentsOfMissingPlugins.get(pluginId).size(), uuids);<NEW_LINE>serverHealthService.update(ServerHealthState.warning("Elastic agents with no matching plugins", description, general(scope(pluginId))));<NEW_LINE>LOGGER.warn(description);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (), clusterProfiles), pingMessageTimeToLive); |
824,917 | public DashEncryption unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DashEncryption dashEncryption = new DashEncryption();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("spekeKeyProvider", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>dashEncryption.setSpekeKeyProvider(SpekeKeyProviderJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return dashEncryption;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
444,304 | public static DescribeAffectedMaliciousFileImagesResponse unmarshall(DescribeAffectedMaliciousFileImagesResponse describeAffectedMaliciousFileImagesResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeAffectedMaliciousFileImagesResponse.setRequestId(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.RequestId"));<NEW_LINE>PageInfo pageInfo = new PageInfo();<NEW_LINE>pageInfo.setCount(_ctx.integerValue("DescribeAffectedMaliciousFileImagesResponse.PageInfo.Count"));<NEW_LINE>pageInfo.setPageSize(_ctx.integerValue("DescribeAffectedMaliciousFileImagesResponse.PageInfo.PageSize"));<NEW_LINE>pageInfo.setTotalCount(_ctx.integerValue("DescribeAffectedMaliciousFileImagesResponse.PageInfo.TotalCount"));<NEW_LINE>pageInfo.setCurrentPage(_ctx.integerValue("DescribeAffectedMaliciousFileImagesResponse.PageInfo.CurrentPage"));<NEW_LINE>describeAffectedMaliciousFileImagesResponse.setPageInfo(pageInfo);<NEW_LINE>List<AffectedMaliciousFileImage> affectedMaliciousFileImagesResponse = new ArrayList<AffectedMaliciousFileImage>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse.Length"); i++) {<NEW_LINE>AffectedMaliciousFileImage affectedMaliciousFileImage = new AffectedMaliciousFileImage();<NEW_LINE>affectedMaliciousFileImage.setLayer(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Layer"));<NEW_LINE>affectedMaliciousFileImage.setFirstScanTimestamp(_ctx.longValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].FirstScanTimestamp"));<NEW_LINE>affectedMaliciousFileImage.setLatestScanTimestamp(_ctx.longValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].LatestScanTimestamp"));<NEW_LINE>affectedMaliciousFileImage.setLatestVerifyTimestamp(_ctx.longValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].LatestVerifyTimestamp"));<NEW_LINE>affectedMaliciousFileImage.setMaliciousMd5(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].MaliciousMd5"));<NEW_LINE>affectedMaliciousFileImage.setStatus(_ctx.integerValue<MASK><NEW_LINE>affectedMaliciousFileImage.setLevel(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Level"));<NEW_LINE>affectedMaliciousFileImage.setImageUuid(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].ImageUuid"));<NEW_LINE>affectedMaliciousFileImage.setFilePath(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].FilePath"));<NEW_LINE>affectedMaliciousFileImage.setDigest(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Digest"));<NEW_LINE>affectedMaliciousFileImage.setRepoRegionId(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].RepoRegionId"));<NEW_LINE>affectedMaliciousFileImage.setRepoInstanceId(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].RepoInstanceId"));<NEW_LINE>affectedMaliciousFileImage.setRepoId(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].RepoId"));<NEW_LINE>affectedMaliciousFileImage.setRepoName(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].RepoName"));<NEW_LINE>affectedMaliciousFileImage.setNamespace(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Namespace"));<NEW_LINE>affectedMaliciousFileImage.setTag(_ctx.stringValue("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Tag"));<NEW_LINE>affectedMaliciousFileImagesResponse.add(affectedMaliciousFileImage);<NEW_LINE>}<NEW_LINE>describeAffectedMaliciousFileImagesResponse.setAffectedMaliciousFileImagesResponse(affectedMaliciousFileImagesResponse);<NEW_LINE>return describeAffectedMaliciousFileImagesResponse;<NEW_LINE>} | ("DescribeAffectedMaliciousFileImagesResponse.AffectedMaliciousFileImagesResponse[" + i + "].Status")); |
558,497 | EncodedParameter encodeParameterValue(Object value, @Nullable PostgresTypeIdentifier dataType, @Nullable Object parameterValue) {<NEW_LINE>if (dataType == null) {<NEW_LINE>if (parameterValue == null) {<NEW_LINE>throw new IllegalArgumentException(String<MASK><NEW_LINE>}<NEW_LINE>Codec<?> codec = this.codecLookup.findEncodeCodec(parameterValue);<NEW_LINE>if (codec != null) {<NEW_LINE>return codec.encode(parameterValue);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (parameterValue == null) {<NEW_LINE>return new EncodedParameter(Format.FORMAT_BINARY, dataType.getObjectId(), NULL_VALUE);<NEW_LINE>}<NEW_LINE>Codec<?> codec = this.codecLookup.findEncodeCodec(parameterValue);<NEW_LINE>if (codec != null) {<NEW_LINE>return codec.encode(parameterValue, dataType.getObjectId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException(String.format("Cannot encode parameter of type %s (%s)", value.getClass().getName(), parameterValue));<NEW_LINE>} | .format("Cannot encode null value %s using type inference", value)); |
533,392 | public void onEnterStage(MySQLResponseService service) {<NEW_LINE>RouteResultsetNode rrn = (RouteResultsetNode) service.getAttachment();<NEW_LINE>if (!service.getConnection().isClosed() && service.getXaStatus() != TxState.TX_COMMIT_FAILED_STATE) {<NEW_LINE>session.releaseConnection(rrn, false);<NEW_LINE>xaHandler.fakedResponse(rrn);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MySQLResponseService newService = session.freshConn(service.getConnection(), xaHandler);<NEW_LINE>xaOldThreadIds.putIfAbsent(service.getAttachment(), service.getConnection().getThreadId());<NEW_LINE>if (newService.equals(service)) {<NEW_LINE>xaHandler.fakedResponse(service, "fail to fresh connection to commit failed xa transaction");<NEW_LINE>} else {<NEW_LINE>String xaTxId = service.getConnXID(session.getSessionXaID(), rrn);<NEW_LINE>XaDelayProvider.delayBeforeXaCommit(rrn.getName(), xaTxId);<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("XA COMMIT " + xaTxId + " to " + service);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | newService.execCmd("XA COMMIT " + xaTxId); |
1,637,111 | public void stop() {<NEW_LINE>if (tomcatReference != null && Thread.currentThread() == main.getMainThread()) {<NEW_LINE>Tomcat tomcat = tomcatReference.getTomcat();<NEW_LINE>if (tomcat.getServer() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Logging.info(main, "Stopping webserver...");<NEW_LINE>if (tomcat.getServer().getState() != LifecycleState.DESTROYED) {<NEW_LINE>if (tomcat.getServer().getState() != LifecycleState.STOPPED) {<NEW_LINE>try {<NEW_LINE>// this stops all new requests and waits for all requests to finish. The wait<NEW_LINE>// amount is defined by unloadDelay<NEW_LINE>tomcat.stop();<NEW_LINE>} catch (LifecycleException e) {<NEW_LINE>Logging.error(main, "Stop tomcat error.", false, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>tomcat.destroy();<NEW_LINE>} catch (LifecycleException e) {<NEW_LINE>Logging.error(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// delete BASEDIR folder created by tomcat<NEW_LINE>try {<NEW_LINE>// we want to clear just this process' folder and not all since other processes<NEW_LINE>// might still be running.<NEW_LINE>FileUtils.deleteDirectory(new File(CLIOptions.get(main).getInstallationPath() + TEMP_FOLDER));<NEW_LINE>} catch (Exception ignored) {<NEW_LINE>}<NEW_LINE>tomcatReference = null;<NEW_LINE>} | main, "Destroy tomcat error.", false, e); |
511,100 | private static HttpURLConnection connect(String url, String method, Map<String, String> requestProperty, boolean doOutput, /* for post/puts */<NEW_LINE>boolean useCaches) throws MalformedURLException, URISyntaxException, IOException {<NEW_LINE>// Decode the url since the url in the card may already be encoded<NEW_LINE>URL netURL = new URL(URLDecoder.decode(url, "UTF-8"));<NEW_LINE>URI uri = new URI(netURL.getProtocol(), netURL.getUserInfo(), netURL.getHost(), netURL.getPort(), netURL.getPath(), netURL.getQuery(), netURL.getRef());<NEW_LINE>netURL = uri.toURL();<NEW_LINE>HttpURLConnection conn = (HttpURLConnection) netURL.openConnection();<NEW_LINE>conn.setRequestMethod(method);<NEW_LINE>conn.setInstanceFollowRedirects(true);<NEW_LINE>conn.setDoOutput(doOutput);<NEW_LINE>conn.setUseCaches(useCaches);<NEW_LINE>if (requestProperty != null) {<NEW_LINE>// Set HTTP header<NEW_LINE>for (Map.Entry<String, String> entry : requestProperty.entrySet()) {<NEW_LINE>conn.setRequestProperty(entry.getKey(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return conn;<NEW_LINE>} | ), entry.getValue()); |
1,673,489 | public Optional<Long> launchInstalledBundleInSimulator(String simulatorUdid, String bundleID, LaunchBehavior launchBehavior, List<String> args) throws IOException, InterruptedException {<NEW_LINE>ImmutableList.Builder<String> commandBuilder = ImmutableList.builder();<NEW_LINE>commandBuilder.add(<MASK><NEW_LINE>if (launchBehavior == LaunchBehavior.WAIT_FOR_DEBUGGER) {<NEW_LINE>commandBuilder.add("-w");<NEW_LINE>}<NEW_LINE>commandBuilder.add(simulatorUdid, bundleID);<NEW_LINE>commandBuilder.addAll(args);<NEW_LINE>ImmutableList<String> command = commandBuilder.build();<NEW_LINE>ProcessExecutorParams processExecutorParams = ProcessExecutorParams.builder().setCommand(command).build();<NEW_LINE>Set<ProcessExecutor.Option> options = EnumSet.of(ProcessExecutor.Option.EXPECTING_STD_OUT);<NEW_LINE>String message = String.format("Launching bundle ID %s in simulator %s via command %s", bundleID, simulatorUdid, command);<NEW_LINE>LOG.debug(message);<NEW_LINE>ProcessExecutor.Result result = processExecutor.launchAndExecute(processExecutorParams, options, /* stdin */<NEW_LINE>Optional.empty(), /* timeOutMs */<NEW_LINE>Optional.empty(), /* timeOutHandler */<NEW_LINE>Optional.empty());<NEW_LINE>if (result.getExitCode() != 0) {<NEW_LINE>LOG.error(result.getMessageForResult(message));<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>Preconditions.checkState(result.getStdout().isPresent());<NEW_LINE>String trimmedStdout = result.getStdout().get().trim();<NEW_LINE>Matcher stdoutMatcher = SIMCTL_LAUNCH_OUTPUT_PATTERN.matcher(trimmedStdout);<NEW_LINE>if (!stdoutMatcher.find()) {<NEW_LINE>LOG.error("Could not parse output from %s: %s", command, trimmedStdout);<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>return Optional.of(Long.parseLong(stdoutMatcher.group(1), 10));<NEW_LINE>} | simctlPath.toString(), "launch"); |
96,613 | public void doTask() {<NEW_LINE>for (String type : config.getOuterClusterTypes()) {<NEW_LINE>try {<NEW_LINE>ClusterType clusterType = ClusterType.lookup(type);<NEW_LINE>SentinelBindTask <MASK><NEW_LINE>if (bindTask != null) {<NEW_LINE>if (!bindTask.future().isDone()) {<NEW_LINE>logger.debug("sentinels of cluster type: {} task running", clusterType);<NEW_LINE>bindTask.future().cancel(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>DcMeta dcMeta = metaCache.getXpipeMeta().getDcs().get(currentDcId);<NEW_LINE>if (dcMeta == null)<NEW_LINE>continue;<NEW_LINE>SentinelBindTask task = new DefaultSentinelBindTask(sentinelManager, dcMeta, clusterType, checkerConsoleService, config);<NEW_LINE>bindTasks.put(clusterType, task);<NEW_LINE>task.execute(executors);<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("bind sentinel of type: {}", type, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | bindTask = bindTasks.get(clusterType); |
648,702 | protected void configure() {<NEW_LINE>Config config = ConfigLoader.loadYmlConfigFromResource("configuration.yml", Config.class);<NEW_LINE>ToDoApi toDoApi = Feign.builder().decoder(new GsonDecoder()).logger(new Slf4jLogger()).logLevel(FULL).requestInterceptor(new BasicAuthRequestInterceptor(config.getToDoCredentials().getUsername(), config.getToDoCredentials().getPassword())).target(ToDoApi.class, config.getToDoEndpoint());<NEW_LINE>PostApi postApi = Feign.builder().encoder(new GsonEncoder()).logger(new Slf4jLogger()).logLevel(FULL).requestInterceptor(new BasicAuthRequestInterceptor(config.getPostCredentials().getUsername(), config.getPostCredentials().getPassword())).target(PostApi.<MASK><NEW_LINE>bind(Config.class).toInstance(config);<NEW_LINE>bind(ToDoApi.class).toInstance(toDoApi);<NEW_LINE>bind(PostApi.class).toInstance(postApi);<NEW_LINE>} | class, config.getPostEndpoint()); |
480,629 | public static IntDeltaCompressor newInstance(@Nonnull IntList deltaList) {<NEW_LINE>if (deltaList.size() < 0)<NEW_LINE>throw new NegativeArraySizeException(<MASK><NEW_LINE>int bytesAfterCompression = ByteArrayUtils.countBytesAfterCompression(deltaList);<NEW_LINE>Flags startedDeltaIndex = new BitSetFlags(bytesAfterCompression);<NEW_LINE>byte[] compressedDeltas = new byte[bytesAfterCompression];<NEW_LINE>int currentStartIndex = 0;<NEW_LINE>for (int i = 0; i < deltaList.size(); i++) {<NEW_LINE>startedDeltaIndex.set(currentStartIndex, true);<NEW_LINE>int value = deltaList.get(i);<NEW_LINE>int sizeOf = ByteArrayUtils.sizeOf(value);<NEW_LINE>ByteArrayUtils.writeDelta(currentStartIndex, value, sizeOf, compressedDeltas);<NEW_LINE>currentStartIndex += sizeOf;<NEW_LINE>}<NEW_LINE>return new IntDeltaCompressor(compressedDeltas, startedDeltaIndex, deltaList.size());<NEW_LINE>} | "size < 0: " + deltaList.size()); |
1,499,026 | public Map<JCTree, JCTree> resolveMethodMember(JavacNode node) {<NEW_LINE>ArrayDeque<JCTree> stack = new ArrayDeque<JCTree>();<NEW_LINE>{<NEW_LINE>JavacNode n = node;<NEW_LINE>while (n != null) {<NEW_LINE>stack.push(n.get());<NEW_LINE>n = n.up();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>messageSuppressor.disableLoggers();<NEW_LINE>try {<NEW_LINE>EnvFinder finder = new EnvFinder(node.getContext());<NEW_LINE>while (!stack.isEmpty()) stack.pop().accept(finder);<NEW_LINE>TreeMirrorMaker mirrorMaker = new TreeMirrorMaker(node.getTreeMaker(), node.getContext());<NEW_LINE>JCTree copy = mirrorMaker.copy(finder.copyAt());<NEW_LINE>Log log = Log.instance(node.getContext());<NEW_LINE>JavaFileObject oldFileObject = log.useSource(((JCCompilationUnit) node.top().get()).getSourceFile());<NEW_LINE>try {<NEW_LINE>memberEnterAndAttribute(copy, finder.get(<MASK><NEW_LINE>return mirrorMaker.getOriginalToCopyMap();<NEW_LINE>} finally {<NEW_LINE>log.useSource(oldFileObject);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>messageSuppressor.enableLoggers();<NEW_LINE>}<NEW_LINE>} | ), node.getContext()); |
915,526 | public static <T> Queue<T> createQueue(int queueType, final int queueCapacity) {<NEW_LINE>switch(queueType) {<NEW_LINE>case -99:<NEW_LINE>return new ArrayDeque<T>(queueCapacity);<NEW_LINE>case -3:<NEW_LINE>return new ArrayBlockingQueue<T>(queueCapacity);<NEW_LINE>case -2:<NEW_LINE>return new LinkedTransferQueue<T>();<NEW_LINE>case -1:<NEW_LINE>return new ConcurrentLinkedQueue<T>();<NEW_LINE>case 0:<NEW_LINE>return new InlinedCountersSpscConcurrentArrayQueue<T>(queueCapacity);<NEW_LINE>case 10:<NEW_LINE>return new BQueue<T>(queueCapacity);<NEW_LINE>case 20:<NEW_LINE>return new FFBuffer<T>(queueCapacity);<NEW_LINE>case 3:<NEW_LINE>return new SpscArrayQueue<T>(queueCapacity);<NEW_LINE>case 308:<NEW_LINE>return BlockingQueueFactory.newBlockingQueue(ConcurrentQueueSpec.createBoundedSpsc(queueCapacity));<NEW_LINE>case 31:<NEW_LINE>return new SpscLinkedQueue<T>();<NEW_LINE>case 32:<NEW_LINE>return new SpscGrowableArrayQueue<T>(queueCapacity);<NEW_LINE>case 40:<NEW_LINE>return new FloatingCountersSpscConcurrentArrayQueue<T>(queueCapacity);<NEW_LINE>case 5:<NEW_LINE>return new SpmcArrayQueue<T>(queueCapacity);<NEW_LINE>case 508:<NEW_LINE>return BlockingQueueFactory.newBlockingQueue(ConcurrentQueueSpec.createBoundedSpmc(queueCapacity));<NEW_LINE>case 6:<NEW_LINE>return new MpscArrayQueue<T>(queueCapacity);<NEW_LINE>case 608:<NEW_LINE>return BlockingQueueFactory.newBlockingQueue(ConcurrentQueueSpec.createBoundedMpsc(queueCapacity));<NEW_LINE>case 61:<NEW_LINE>return new MpscCompoundQueue<T>(queueCapacity);<NEW_LINE>case 62:<NEW_LINE>return new MpscOnSpscQueue<T>(queueCapacity);<NEW_LINE>case 63:<NEW_LINE>return new MpscLinkedQueue<T>();<NEW_LINE>case 7:<NEW_LINE>return new MpmcArrayQueue<T>(queueCapacity);<NEW_LINE>case 708:<NEW_LINE>return BlockingQueueFactory.newBlockingQueue(ConcurrentQueueSpec.createBoundedMpmc(queueCapacity));<NEW_LINE>case 71:<NEW_LINE>return new MpmcConcurrentQueueStateMarkers<T>(queueCapacity);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | throw new IllegalArgumentException("Type: " + queueType); |
732,220 | private TreeNode buildTree(int[] preorder, int preStart, int preEnd, Map<Integer, Integer> inorderMap, int inStart, int inEnd) {<NEW_LINE>if (preStart > preEnd || inStart > inEnd) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TreeNode root = <MASK><NEW_LINE>int inRoot = inorderMap.get(preorder[preStart]);<NEW_LINE>// This line is the key to figure out how many nodes should be on the left subtree<NEW_LINE>int numsLeft = inRoot - inStart;<NEW_LINE>root.left = buildTree(preorder, preStart + 1, preStart + numsLeft, inorderMap, inStart, inRoot - 1);<NEW_LINE>root.right = buildTree(preorder, preStart + numsLeft + 1, preEnd, inorderMap, inRoot + 1, inEnd);<NEW_LINE>return root;<NEW_LINE>} | new TreeNode(preorder[preStart]); |
1,682,825 | private static void testDateTime() {<NEW_LINE>{<NEW_LINE>final Date now = Foo.now();<NEW_LINE>final Date nowChrono = Foo.chrono_now();<NEW_LINE>final DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");<NEW_LINE>System.out.println("now: " + df.format(now));<NEW_LINE>final Date today = Calendar.getInstance().getTime();<NEW_LINE>System.out.println("now: " + now);<NEW_LINE>System.out.println("today: " + today);<NEW_LINE>assert Math.abs(today.getTime() - now.getTime()) < 2000;<NEW_LINE>assert Math.abs(nowChrono.getTime() - today.getTime()) < 2000;<NEW_LINE>}<NEW_LINE>{<NEW_LINE>assert !Foo.chrono_now_opt(false).isPresent();<NEW_LINE>assert Foo.<MASK><NEW_LINE>final Date today = Calendar.getInstance().getTime();<NEW_LINE>final Date nowChrono = Foo.chrono_now_opt(true).get();<NEW_LINE>assert Math.abs(nowChrono.getTime() - today.getTime()) < 2000;<NEW_LINE>}<NEW_LINE>} | chrono_now_opt(true).isPresent(); |
1,027,709 | protected boolean streamFromRepo(HttpServletRequest request, HttpServletResponse response, Repository repository, RevCommit commit, String requestedPath) throws IOException {<NEW_LINE>boolean served = false;<NEW_LINE>RevWalk rw = new RevWalk(repository);<NEW_LINE>TreeWalk tw = new TreeWalk(repository);<NEW_LINE>try {<NEW_LINE>tw.reset();<NEW_LINE>tw.addTree(commit.getTree());<NEW_LINE>PathFilter f = PathFilter.create(requestedPath);<NEW_LINE>tw.setFilter(f);<NEW_LINE>tw.setRecursive(true);<NEW_LINE>MutableObjectId id = new MutableObjectId();<NEW_LINE>ObjectReader reader = tw.getObjectReader();<NEW_LINE>while (tw.next()) {<NEW_LINE>FileMode mode = tw.getFileMode(0);<NEW_LINE>if (mode == FileMode.GITLINK || mode == FileMode.TREE) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>tw.getObjectId(id, 0);<NEW_LINE>String filename = StringUtils.getLastPathElement(requestedPath);<NEW_LINE>try {<NEW_LINE>String userAgent = request.getHeader("User-Agent");<NEW_LINE>if (userAgent != null && userAgent.indexOf("MSIE 5.5") > -1) {<NEW_LINE>response.setHeader("Content-Disposition", "filename=\"" + URLEncoder.encode(filename, Constants.ENCODING) + "\"");<NEW_LINE>} else if (userAgent != null && userAgent.indexOf("MSIE") > -1) {<NEW_LINE>response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(filename, Constants.ENCODING) + "\"");<NEW_LINE>} else {<NEW_LINE>response.setHeader("Content-Disposition", "attachment; filename=\"" + new String(filename.getBytes(Constants.ENCODING), "latin1") + "\"");<NEW_LINE>}<NEW_LINE>} catch (UnsupportedEncodingException e) {<NEW_LINE>response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");<NEW_LINE>}<NEW_LINE>long len = reader.getObjectSize(id, org.eclipse.jgit.lib.Constants.OBJ_BLOB);<NEW_LINE>setContentType(response, "application/octet-stream");<NEW_LINE>response.setIntHeader("Content-Length", (int) len);<NEW_LINE>ObjectLoader ldr = repository.open(id);<NEW_LINE>ldr.<MASK><NEW_LINE>served = true;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>tw.close();<NEW_LINE>rw.dispose();<NEW_LINE>}<NEW_LINE>response.flushBuffer();<NEW_LINE>return served;<NEW_LINE>} | copyTo(response.getOutputStream()); |
1,676,108 | public void close() {<NEW_LINE>// Make sure we are not restoring more then once<NEW_LINE>if (restored) {<NEW_LINE>slogger.warn("currentInstance: Skip restoring current instance because we already did that: {}", this);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>restored = true;<NEW_LINE>// Actually restore it<NEW_LINE>final Object currentInstanceFound = currentInstanceHolder.get();<NEW_LINE>currentInstanceHolder.set(previousInstance);<NEW_LINE>slogger.debug("currentInstance: Restored previous instance: {} (from={})", previousInstance, instance);<NEW_LINE>// Warn if the current instance expected it's not the one the we temporary set. Shall not happen.<NEW_LINE>if (!Objects.equal(currentInstanceFound, instance)) {<NEW_LINE>slogger.warn("Invalid current process instance found while restoring the current instance" + "\n Current instance found: {}" + "\n Current instance expected: {}" + "\n => Current instance restored: {}", currentInstanceFound, <MASK><NEW_LINE>}<NEW_LINE>} | instance, currentInstanceHolder.get()); |
723,634 | private static Set<ProxyClassLoader> coalesceAppend(ClassLoader root, Set<ProxyClassLoader> existing, ClassLoader[] appended, ClassLoader[] systemCL) throws IllegalArgumentException {<NEW_LINE>int likelySize = existing.size() + appended.length;<NEW_LINE>LinkedHashSet<ClassLoader> uniq = new LinkedHashSet<ClassLoader>(likelySize);<NEW_LINE>uniq.addAll(existing);<NEW_LINE>if (uniq.containsAll(Arrays.asList(appended))) {<NEW_LINE>return existing;<NEW_LINE>}<NEW_LINE>// No change required.<NEW_LINE>for (ClassLoader l : appended) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// add all loaders (maybe recursively)<NEW_LINE>// validate the configuration<NEW_LINE>// it is valid if all heading non-ProxyClassLoaders are parents of the last one<NEW_LINE>boolean head = true;<NEW_LINE>Set<ProxyClassLoader> pcls = new LinkedHashSet<ProxyClassLoader>(uniq.size());<NEW_LINE>for (ClassLoader l : uniq) {<NEW_LINE>if (head) {<NEW_LINE>if (l instanceof ProxyClassLoader) {<NEW_LINE>// only PCLs after this point<NEW_LINE>head = false;<NEW_LINE>pcls.add((ProxyClassLoader) l);<NEW_LINE>} else {<NEW_LINE>if (isParentOf(systemCL[0], l)) {<NEW_LINE>systemCL[0] = l;<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Bad ClassLoader ordering: " + Arrays.asList(appended));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (l instanceof ProxyClassLoader) {<NEW_LINE>pcls.add((ProxyClassLoader) l);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Bad ClassLoader ordering: " + Arrays.asList(appended));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return pcls;<NEW_LINE>} | addRec(root, uniq, l); |
484,513 | public static void createAndRegister() {<NEW_LINE>SubstrateTargetDescription target = ConfigurationValues.getTarget();<NEW_LINE>SubstrateRegisterConfig registerConfig = new SubstrateAArch64RegisterConfig(SubstrateRegisterConfig.ConfigKind.NORMAL, null, target, SubstrateOptions.PreserveFramePointer.getValue());<NEW_LINE>Register frameRegister = registerConfig.getFrameRegister();<NEW_LINE>List<Register> calleeSavedRegisters = new ArrayList<>(registerConfig.getAllocatableRegisters().asList());<NEW_LINE><MASK><NEW_LINE>Collections.reverse(calleeSavedRegisters);<NEW_LINE>int offset = 0;<NEW_LINE>Map<Register, Integer> calleeSavedRegisterOffsets = new HashMap<>();<NEW_LINE>for (Register register : calleeSavedRegisters) {<NEW_LINE>int regByteSize = register.getRegisterCategory().equals(CPU) ? 8 : 16;<NEW_LINE>offset += offset % regByteSize;<NEW_LINE>calleeSavedRegisterOffsets.put(register, offset);<NEW_LINE>offset += regByteSize;<NEW_LINE>}<NEW_LINE>int calleeSavedRegistersSizeInBytes = offset;<NEW_LINE>int saveAreaOffsetInFrame = -(// slot is always reserved for frame pointer<NEW_LINE>FrameAccess.returnAddressSize() + FrameAccess.wordSize() + calleeSavedRegistersSizeInBytes);<NEW_LINE>ImageSingletons.add(CalleeSavedRegisters.class, new AArch64CalleeSavedRegisters(frameRegister, calleeSavedRegisters, calleeSavedRegisterOffsets, calleeSavedRegistersSizeInBytes, saveAreaOffsetInFrame));<NEW_LINE>} | calleeSavedRegisters.remove(AArch64.lr); |
590,539 | public void replace(final StringBuilder target, final String piece) {<NEW_LINE>// Compile the regex to match something like <img ... /> or<NEW_LINE>// <IMG ... />. This regex is case sensitive and keeps the style,<NEW_LINE>// src or other attributes of the <img> tag.<NEW_LINE>final Pattern p = Pattern.compile("<\\s*[iI][mM][gG](.*?)(/\\s*>)");<NEW_LINE>final Matcher m = p.matcher(piece);<NEW_LINE>int slashIndex;<NEW_LINE>int start = 0;<NEW_LINE>// while we find some <img /> self-closing tags with a slash inside.<NEW_LINE>while (m.find()) {<NEW_LINE>// First, we have to copy all the message preceding the <img><NEW_LINE>// tag.<NEW_LINE>target.append(piece.substring(start, m.start()));<NEW_LINE>// Then, we find the position of the slash inside the tag.<NEW_LINE>slashIndex = m.group().lastIndexOf("/");<NEW_LINE>// We copy the <img> tag till the slash exclude.<NEW_LINE>target.append(m.group().substring(0, slashIndex));<NEW_LINE>// We copy all the end of the tag following the slash exclude.<NEW_LINE>target.append(m.group().substring(slashIndex + 1));<NEW_LINE>// We close the tag with a separate closing tag.<NEW_LINE>target.append("</img>");<NEW_LINE>start = m.end();<NEW_LINE>}<NEW_LINE>// Finally, we have to add the end of the message following the last<NEW_LINE>// <img> tag, or the whole message if there is no <img> tag.<NEW_LINE>target.append<MASK><NEW_LINE>} | (piece.substring(start)); |
213,546 | public void schedule(TransportContext transportContext, EventInternal event, TransportScheduleCallback callback) {<NEW_LINE>executor.execute(() -> {<NEW_LINE>try {<NEW_LINE>TransportBackend transportBackend = backendRegistry.get(transportContext.getBackendName());<NEW_LINE>if (transportBackend == null) {<NEW_LINE>String errorMsg = String.format("Transport backend '%s' is not registered", transportContext.getBackendName());<NEW_LINE>LOGGER.warning(errorMsg);<NEW_LINE>callback.onSchedule(new IllegalArgumentException(errorMsg));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>EventInternal decoratedEvent = transportBackend.decorate(event);<NEW_LINE>guard.runCriticalSection(() -> {<NEW_LINE>eventStore.persist(transportContext, decoratedEvent);<NEW_LINE>workScheduler.schedule(transportContext, 1);<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>callback.onSchedule(null);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.warning(<MASK><NEW_LINE>callback.onSchedule(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | "Error scheduling event " + e.getMessage()); |
700,715 | public static QCommitPanel createRefreshPanel(final File[] roots, final File repository, String commitMessage, final QPatch patch, final HgRevision parentRevision, final String helpCtxId) {<NEW_LINE>final Preferences preferences = HgModuleConfig.getDefault().getPreferences();<NEW_LINE>List<<MASK><NEW_LINE>final DefaultCommitParameters parameters = new QCreatePatchParameters(preferences, commitMessage, patch, recentUsers);<NEW_LINE>final Collection<HgQueueHook> hooks = VCSHooks.getInstance().getHooks(HgQueueHook.class);<NEW_LINE>return Mutex.EVENT.readAccess(new Mutex.Action<QCommitPanel>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public QCommitPanel run() {<NEW_LINE>// own diff provider, displays qdiff instead of regular diff<NEW_LINE>DiffProvider diffProvider = new QDiffProvider(parentRevision);<NEW_LINE>// NOI18N<NEW_LINE>VCSCommitPanelModifier msgProvider = RefreshPanelModifier.getDefault("refresh");<NEW_LINE>HgQueueHookContext hooksCtx = new HgQueueHookContext(roots, null, patch.getId());<NEW_LINE>// own node computer, displays files not modified in cache but files returned by qdiff<NEW_LINE>return new QCommitPanel(new QCommitTable(msgProvider), roots, repository, parameters, preferences, hooks, hooksCtx, diffProvider, new QRefreshNodesProvider(parentRevision), new HelpCtx(helpCtxId));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | String> recentUsers = getRecentUsers(repository); |
580,129 | public PointSensitivityBuilder presentValueSensitivityRates(ResolvedSwaption swaption, RatesProvider ratesProvider, HullWhiteOneFactorPiecewiseConstantParametersProvider hwProvider) {<NEW_LINE>validate(swaption, ratesProvider, hwProvider);<NEW_LINE>ResolvedSwap swap = swaption.getUnderlying();<NEW_LINE>LocalDate expiryDate = swaption.getExpiryDate();<NEW_LINE>if (expiryDate.isBefore(ratesProvider.getValuationDate())) {<NEW_LINE>// Option has expired already<NEW_LINE>return PointSensitivityBuilder.none();<NEW_LINE>}<NEW_LINE>ImmutableMap<Payment, PointSensitivityBuilder> cashFlowEquivSensi = CashFlowEquivalentCalculator.cashFlowEquivalentAndSensitivitySwap(swap, ratesProvider);<NEW_LINE>ImmutableList<Payment> list = cashFlowEquivSensi.keySet().asList();<NEW_LINE>ImmutableList<PointSensitivityBuilder> listSensi = cashFlowEquivSensi.values().asList();<NEW_LINE>int nPayments = list.size();<NEW_LINE>double[] alpha = new double[nPayments];<NEW_LINE>double[] discountedCashFlow = new double[nPayments];<NEW_LINE>for (int loopcf = 0; loopcf < nPayments; loopcf++) {<NEW_LINE>Payment payment = list.get(loopcf);<NEW_LINE>alpha[loopcf] = hwProvider.alpha(ratesProvider.getValuationDate(), expiryDate, expiryDate, payment.getDate());<NEW_LINE>discountedCashFlow[loopcf] = paymentPricer.presentValueAmount(payment, ratesProvider);<NEW_LINE>}<NEW_LINE>double omega = (swap.getLegs(SwapLegType.FIXED).get(0).getPayReceive().isPay() ? -1d : 1d);<NEW_LINE>double kappa = computeKappa(hwProvider, discountedCashFlow, alpha, omega);<NEW_LINE><MASK><NEW_LINE>for (int loopcf = 0; loopcf < nPayments; loopcf++) {<NEW_LINE>Payment payment = list.get(loopcf);<NEW_LINE>double cdf = NORMAL.getCDF(omega * (kappa + alpha[loopcf]));<NEW_LINE>point = point.combinedWith(paymentPricer.presentValueSensitivity(payment, ratesProvider).multipliedBy(cdf));<NEW_LINE>if (!listSensi.get(loopcf).equals(PointSensitivityBuilder.none())) {<NEW_LINE>point = point.combinedWith(listSensi.get(loopcf).multipliedBy(cdf * ratesProvider.discountFactor(payment.getCurrency(), payment.getDate())));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return swaption.getLongShort().isLong() ? point : point.multipliedBy(-1d);<NEW_LINE>} | PointSensitivityBuilder point = PointSensitivityBuilder.none(); |
370,087 | private PackageData parseDataFromClassFile(InputFile file) throws IOException {<NEW_LINE>PackageDataBuilder builder = new PackageDataBuilder();<NEW_LINE>ClassFile <MASK><NEW_LINE>TypeDeclaration typeDecl = classFile.getType();<NEW_LINE>for (Annotation annotation : typeDecl.getAnnotations()) {<NEW_LINE>String signature = annotation.getType().toTypeReference().getErasedSignature();<NEW_LINE>if (signature.equals("Lcom/google/j2objc/annotations/ObjectiveCName;")) {<NEW_LINE>for (Expression expr : annotation.getArguments()) {<NEW_LINE>if (expr instanceof MemberReferenceExpression) {<NEW_LINE>String value = ((MemberReferenceExpression) expr).getMemberName();<NEW_LINE>builder.setObjectiveCName(value);<NEW_LINE>} else if (expr instanceof PrimitiveExpression) {<NEW_LINE>Object value = ((PrimitiveExpression) expr).getValue();<NEW_LINE>builder.setObjectiveCName((String) value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (signature.equals("Ljavax/annotation/ParametersAreNonnullByDefault;")) {<NEW_LINE>builder.setParametersAreNonnullByDefault();<NEW_LINE>} else if (signature.equals("Lcom/google/j2objc/annotations/ReflectionSupport;")) {<NEW_LINE>for (Expression expr : annotation.getArguments()) {<NEW_LINE>if (expr instanceof MemberReferenceExpression) {<NEW_LINE>String value = ((MemberReferenceExpression) expr).getMemberName();<NEW_LINE>builder.setReflectionSupportLevel(ReflectionSupport.Level.valueOf(value));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | classFile = ClassFile.create(file); |
537,526 | public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {<NEW_LINE>LogHelper.<MASK><NEW_LINE>if (isUriNotValid(uri)) {<NEW_LINE>return new MatrixCursor(new String[0], 1);<NEW_LINE>}<NEW_LINE>ensureCacheReady();<NEW_LINE>String[] queryKeys;<NEW_LINE>if (projection == null) {<NEW_LINE>Set<String> keySet = mCachePreferences.keySet();<NEW_LINE>queryKeys = new String[keySet.size()];<NEW_LINE>int i = 0;<NEW_LINE>for (String key : keySet) {<NEW_LINE>queryKeys[i++] = key;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>queryKeys = projection;<NEW_LINE>}<NEW_LINE>MatrixCursor cursor = new MatrixCursor(queryKeys, 1);<NEW_LINE>Object[] values = new Object[queryKeys.length];<NEW_LINE>for (int i = 0; i < queryKeys.length; i++) {<NEW_LINE>values[i] = mCachePreferences.get(queryKeys[i]);<NEW_LINE>}<NEW_LINE>cursor.addRow(values);<NEW_LINE>return cursor;<NEW_LINE>} | i(TAG, "query values with: " + this); |
21,716 | public int[] queryFanSpeeds() {<NEW_LINE>if (!IS_PI) {<NEW_LINE>String fanStr = this.sensorsMap.get(FAN);<NEW_LINE>if (fanStr != null) {<NEW_LINE>List<Integer> speeds = new ArrayList<>();<NEW_LINE>int fan = 1;<NEW_LINE>for (; ; ) {<NEW_LINE>String fanPath = String.format("%s%d_input", fanStr, fan);<NEW_LINE>if (!new File(fanPath).exists()) {<NEW_LINE>// No file found, we've reached max fans<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// Should return a single line of RPM<NEW_LINE>speeds.add(FileUtil.getIntFromFile(fanPath));<NEW_LINE>// Done reading data for current fan, read next fan<NEW_LINE>fan++;<NEW_LINE>}<NEW_LINE>int[] fanSpeeds = new int[speeds.size()];<NEW_LINE>for (int i = 0; i < speeds.size(); i++) {<NEW_LINE>fanSpeeds[i<MASK><NEW_LINE>}<NEW_LINE>return fanSpeeds;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new int[0];<NEW_LINE>} | ] = speeds.get(i); |
195,702 | private void visitGeneratedElements(RoundEnvironment roundEnv, TypeElement generatedElement) {<NEW_LINE>for (Element ae : roundEnv.getElementsAnnotatedWith(generatedElement)) {<NEW_LINE>String comments = getGeneratedComments(ae, generatedElement);<NEW_LINE>if (comments == null || !comments.startsWith(Metadata.ANNOTATION_COMMENT_PREFIX)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String annotationFile = comments.substring(<MASK><NEW_LINE>if (ae instanceof ClassSymbol) {<NEW_LINE>ClassSymbol cs = (ClassSymbol) ae;<NEW_LINE>try {<NEW_LINE>String annotationPath = cs.sourcefile.toUri().resolve(annotationFile).getPath();<NEW_LINE>for (JavaFileObject file : fileManager.getJavaFileForSources(Arrays.asList(annotationPath))) {<NEW_LINE>((UsageAsInputReportingJavaFileObject) file).markUsed();<NEW_LINE>}<NEW_LINE>} catch (IllegalArgumentException ex) {<NEW_LINE>logger.atWarning().withCause(ex).log("Bad annotationFile: %s", annotationFile);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Metadata.ANNOTATION_COMMENT_PREFIX.length()); |
218,193 | public void printTag(String name, HashMap parameters, boolean insertTab, boolean insertNewLine, boolean closeTag) {<NEW_LINE>if (insertTab) {<NEW_LINE>printTabulation();<NEW_LINE>}<NEW_LINE>this.print('<');<NEW_LINE>this.print(name);<NEW_LINE>if (parameters != null) {<NEW_LINE>int length = parameters.size();<NEW_LINE>Map.Entry[] entries = new Map.Entry[length];<NEW_LINE>parameters.entrySet().toArray(entries);<NEW_LINE>Arrays.sort(entries, new Comparator() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int compare(Object o1, Object o2) {<NEW_LINE>Map.Entry entry1 = (Map.Entry) o1;<NEW_LINE>Map.Entry entry2 = (Map.Entry) o2;<NEW_LINE>return ((String) entry1.getKey()).compareTo((String) entry2.getKey());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>this.print(' ');<NEW_LINE>this.print(entries<MASK><NEW_LINE>// $NON-NLS-1$<NEW_LINE>this.print("=\"");<NEW_LINE>this.print(getEscaped(String.valueOf(entries[i].getValue())));<NEW_LINE>this.print('\"');<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (closeTag) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>this.print("/>");<NEW_LINE>} else {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>this.print(">");<NEW_LINE>}<NEW_LINE>if (insertNewLine) {<NEW_LINE>print(this.lineSeparator);<NEW_LINE>}<NEW_LINE>if (parameters != null && !closeTag)<NEW_LINE>this.tab++;<NEW_LINE>} | [i].getKey()); |
1,674,558 | private void displayBox(BoxNode box) {<NEW_LINE>rightPane.removeAll();<NEW_LINE>rightPane.revalidate();<NEW_LINE>rightPane.repaint();<NEW_LINE>if (box.box != null) {<NEW_LINE>HashMap<Integer, Tuple._2<String, Object>> map = new HashMap<Integer, Tuple._2<String, Object>>();<NEW_LINE>Method[] methods = box.box.getClass().getMethods();<NEW_LINE>for (Method method : methods) {<NEW_LINE>if (!isDefined(method)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>AtomField annotation = method.getAnnotation(Box.AtomField.class);<NEW_LINE>try {<NEW_LINE>Object value = method.invoke(box.box);<NEW_LINE>map.put(annotation.idx(), new Tuple._2<String, Object>(toName(method), value));<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 0; i < 1000; i++) {<NEW_LINE>if (map.containsKey(i)) {<NEW_LINE>_2<String, Object> field = map.get(i);<NEW_LINE>rightPane.add(new JLabel(field.v0));<NEW_LINE>rightPane.add(renderValue<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (box.atom != null) {<NEW_LINE>rightPane.add(new JLabel("Offset"));<NEW_LINE>rightPane.add(new JTextField(String.valueOf(box.atom.getOffset()), 20), "wrap");<NEW_LINE>rightPane.add(new JLabel("Size"));<NEW_LINE>rightPane.add(new JTextField(String.valueOf(box.atom.getHeader().getSize()), 20), "wrap");<NEW_LINE>}<NEW_LINE>rightPane.revalidate();<NEW_LINE>rightPane.repaint();<NEW_LINE>} | (field.v1), "wrap"); |
206,626 | private void resize(int newSize) {<NEW_LINE>// find out what the delta is<NEW_LINE>int currentSize = 0;<NEW_LINE>for (int i = 0; i < getCellCount(); i++) {<NEW_LINE>currentSize += cellAt(i).getRequiredSize();<NEW_LINE>}<NEW_LINE>int totalDividerSize = getDividerSize() * (getCellCount() - 1);<NEW_LINE>int newNetSize = newSize - totalDividerSize;<NEW_LINE>int delta = newNetSize - currentSize;<NEW_LINE>if (delta > 0) {<NEW_LINE>// the child cells will grow<NEW_LINE>grow(delta);<NEW_LINE>} else if (delta < 0) {<NEW_LINE>delta = shrink(delta);<NEW_LINE>if (delta > 0) {<NEW_LINE>// the complete delta couldn't be distributed because of minimum sizes constraints<NEW_LINE>newNetSize -= delta;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// check for rounding errors and add 'missing' pixel(s) to the last cell<NEW_LINE>int totalSize = 0;<NEW_LINE>for (int i = 0; i < getCellCount(); i++) {<NEW_LINE>MultiSplitCell cell = cellAt(i);<NEW_LINE>totalSize += cell.getRequiredSize();<NEW_LINE>}<NEW_LINE>if (totalSize < newNetSize) {<NEW_LINE>MultiSplitCell lastCell = <MASK><NEW_LINE>lastCell.setRequiredSize(lastCell.getRequiredSize() + (newNetSize - totalSize));<NEW_LINE>}<NEW_LINE>} | cellAt(getCellCount() - 1); |
140,591 | public List<User> executeList(CommandContext commandContext) {<NEW_LINE>// GET /{realm}/users<NEW_LINE>// Query parameters: username, email, firstName, lastName, search(email, first, last or username)<NEW_LINE>// paging first, max<NEW_LINE>UriComponentsBuilder builder = prepareQuery("/users");<NEW_LINE>if (getMaxResults() >= 0) {<NEW_LINE>builder.queryParam("max", getMaxResults());<NEW_LINE>}<NEW_LINE>if (getFirstResult() >= 0) {<NEW_LINE>builder.queryParam("first", getFirstResult());<NEW_LINE>}<NEW_LINE>URI uri = builder.buildAndExpand(keycloakConfiguration.getRealm()).toUri();<NEW_LINE>ResponseEntity<List<KeycloakUserRepresentation>> response = keycloakConfiguration.getRestTemplate().exchange(uri, HttpMethod.GET, null, KEYCLOAK_LIST_OF_USERS);<NEW_LINE><MASK><NEW_LINE>if (statusCode.is2xxSuccessful()) {<NEW_LINE>LOGGER.debug("Successful response from keycloak");<NEW_LINE>List<KeycloakUserRepresentation> keycloakUsers = response.getBody();<NEW_LINE>if (keycloakUsers != null) {<NEW_LINE>List<User> users = new ArrayList<>(keycloakUsers.size());<NEW_LINE>for (KeycloakUserRepresentation keycloakUser : keycloakUsers) {<NEW_LINE>User user = new UserEntityImpl();<NEW_LINE>user.setId(keycloakUser.getUsername());<NEW_LINE>user.setFirstName(keycloakUser.getFirstName());<NEW_LINE>user.setLastName(keycloakUser.getLastName());<NEW_LINE>user.setEmail(keycloakUser.getEmail());<NEW_LINE>users.add(user);<NEW_LINE>}<NEW_LINE>return users;<NEW_LINE>} else {<NEW_LINE>LOGGER.warn("Keycloak didn't return any body when querying users");<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new FlowableException("Keycloak returned status code: " + statusCode);<NEW_LINE>}<NEW_LINE>} | HttpStatus statusCode = response.getStatusCode(); |
806,308 | static Authority fromString(String authority) {<NEW_LINE>if (authority == null || authority.length() == 0) {<NEW_LINE>return NoAuthority.INSTANCE;<NEW_LINE>}<NEW_LINE>Matcher matcher = ZOOKEEPER_AUTH.matcher(authority);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new ZookeeperAuthority(matcher.group(1).replaceAll("[;+]", ","));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new SingleMasterAuthority(matcher.group(1), Integer.parseInt(matcher.group(2)));<NEW_LINE>}<NEW_LINE>matcher = MULTI_MASTERS_AUTH.matcher(authority);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new MultiMasterAuthority(authority.replaceAll("[;+]", ","));<NEW_LINE>}<NEW_LINE>matcher = LOGICAL_ZOOKEEPER_AUTH.matcher(authority);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new ZookeeperLogicalAuthority(matcher.group(1));<NEW_LINE>}<NEW_LINE>matcher = LOGICAL_MASTER_AUTH.matcher(authority);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new EmbeddedLogicalAuthority(matcher.group(1));<NEW_LINE>}<NEW_LINE>return new UnknownAuthority(authority);<NEW_LINE>} | matcher = SINGLE_MASTER_AUTH.matcher(authority); |
1,706,374 | void merge(@NotNull final SentryOptions options) {<NEW_LINE>if (options.getDsn() != null) {<NEW_LINE>setDsn(options.getDsn());<NEW_LINE>}<NEW_LINE>if (options.getEnvironment() != null) {<NEW_LINE>setEnvironment(options.getEnvironment());<NEW_LINE>}<NEW_LINE>if (options.getRelease() != null) {<NEW_LINE>setRelease(options.getRelease());<NEW_LINE>}<NEW_LINE>if (options.getDist() != null) {<NEW_LINE>setDist(options.getDist());<NEW_LINE>}<NEW_LINE>if (options.getServerName() != null) {<NEW_LINE>setServerName(options.getServerName());<NEW_LINE>}<NEW_LINE>if (options.getProxy() != null) {<NEW_LINE>setProxy(options.getProxy());<NEW_LINE>}<NEW_LINE>if (options.getEnableUncaughtExceptionHandler() != null) {<NEW_LINE>setEnableUncaughtExceptionHandler(options.getEnableUncaughtExceptionHandler());<NEW_LINE>}<NEW_LINE>if (options.getPrintUncaughtStackTrace() != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (options.getTracesSampleRate() != null) {<NEW_LINE>setTracesSampleRate(options.getTracesSampleRate());<NEW_LINE>}<NEW_LINE>if (options.getDebug() != null) {<NEW_LINE>setDebug(options.getDebug());<NEW_LINE>}<NEW_LINE>if (options.getEnableDeduplication() != null) {<NEW_LINE>setEnableDeduplication(options.getEnableDeduplication());<NEW_LINE>}<NEW_LINE>final Map<String, String> tags = new HashMap<>(options.getTags());<NEW_LINE>for (final Map.Entry<String, String> tag : tags.entrySet()) {<NEW_LINE>this.tags.put(tag.getKey(), tag.getValue());<NEW_LINE>}<NEW_LINE>final List<String> inAppIncludes = new ArrayList<>(options.getInAppIncludes());<NEW_LINE>for (final String inAppInclude : inAppIncludes) {<NEW_LINE>addInAppInclude(inAppInclude);<NEW_LINE>}<NEW_LINE>final List<String> inAppExcludes = new ArrayList<>(options.getInAppExcludes());<NEW_LINE>for (final String inAppExclude : inAppExcludes) {<NEW_LINE>addInAppExclude(inAppExclude);<NEW_LINE>}<NEW_LINE>for (final Class<? extends Throwable> exceptionType : new HashSet<>(options.getIgnoredExceptionsForType())) {<NEW_LINE>addIgnoredExceptionForType(exceptionType);<NEW_LINE>}<NEW_LINE>final List<String> tracingOrigins = new ArrayList<>(options.getTracingOrigins());<NEW_LINE>for (final String tracingOrigin : tracingOrigins) {<NEW_LINE>addTracingOrigin(tracingOrigin);<NEW_LINE>}<NEW_LINE>if (options.getProguardUuid() != null) {<NEW_LINE>setProguardUuid(options.getProguardUuid());<NEW_LINE>}<NEW_LINE>} | setPrintUncaughtStackTrace(options.getPrintUncaughtStackTrace()); |
368,853 | static String extractCN(final String subjectPrincipal) throws SSLException {<NEW_LINE>if (subjectPrincipal == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final LdapName subjectDN = new LdapName(subjectPrincipal);<NEW_LINE>final List<Rdn> rdns = subjectDN.getRdns();<NEW_LINE>for (int i = rdns.size() - 1; i >= 0; i--) {<NEW_LINE>final Rdn rds = rdns.get(i);<NEW_LINE>final <MASK><NEW_LINE>final Attribute cn = attributes.get("cn");<NEW_LINE>if (cn != null) {<NEW_LINE>try {<NEW_LINE>final Object value = cn.get();<NEW_LINE>if (value != null) {<NEW_LINE>return value.toString();<NEW_LINE>}<NEW_LINE>} catch (final NoSuchElementException ignore) {<NEW_LINE>// ignore exception<NEW_LINE>} catch (final NamingException ignore) {<NEW_LINE>// ignore exception<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} catch (final InvalidNameException e) {<NEW_LINE>throw new SSLException(subjectPrincipal + " is not a valid X500 distinguished name");<NEW_LINE>}<NEW_LINE>} | Attributes attributes = rds.toAttributes(); |
155,255 | private String findModelPackageName(EntityGraph graph) {<NEW_LINE>String packageName = "";<NEW_LINE>Set<String> packageNames = graph.entities().stream().map(entity -> entity.typeName().packageName()).collect(Collectors.toCollection(TreeSet::new));<NEW_LINE>if (packageNames.size() == 1) {<NEW_LINE>// all the types are in the same package...<NEW_LINE>packageName = packageNames.iterator().next();<NEW_LINE>} else {<NEW_LINE>String target = packageNames<MASK><NEW_LINE>while (target.indexOf(".") != target.lastIndexOf(".")) {<NEW_LINE>target = target.substring(0, target.lastIndexOf("."));<NEW_LINE>boolean allTypesInPackage = true;<NEW_LINE>for (EntityDescriptor entity : graph.entities()) {<NEW_LINE>if (!entity.typeName().packageName().startsWith(target)) {<NEW_LINE>allTypesInPackage = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (allTypesInPackage) {<NEW_LINE>packageName = target;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// no common package...<NEW_LINE>if ("".equals(packageName)) {<NEW_LINE>packageName = target;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return packageName;<NEW_LINE>} | .iterator().next(); |
1,570,306 | public static QueryAvailableInstancesResponse unmarshall(QueryAvailableInstancesResponse queryAvailableInstancesResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryAvailableInstancesResponse.setRequestId(_ctx.stringValue("QueryAvailableInstancesResponse.RequestId"));<NEW_LINE>queryAvailableInstancesResponse.setCode(_ctx.stringValue("QueryAvailableInstancesResponse.Code"));<NEW_LINE>queryAvailableInstancesResponse.setMessage(_ctx.stringValue("QueryAvailableInstancesResponse.Message"));<NEW_LINE>queryAvailableInstancesResponse.setSuccess(_ctx.booleanValue("QueryAvailableInstancesResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageNum(_ctx.integerValue("QueryAvailableInstancesResponse.Data.PageNum"));<NEW_LINE>data.setPageSize(_ctx.integerValue("QueryAvailableInstancesResponse.Data.PageSize"));<NEW_LINE>data.setTotalCount(_ctx.integerValue("QueryAvailableInstancesResponse.Data.TotalCount"));<NEW_LINE>List<Instance> instanceList = new ArrayList<Instance>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryAvailableInstancesResponse.Data.InstanceList.Length"); i++) {<NEW_LINE>Instance instance = new Instance();<NEW_LINE>instance.setSubStatus(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].SubStatus"));<NEW_LINE>instance.setStatus(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].Status"));<NEW_LINE>instance.setExpectedReleaseTime(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].ExpectedReleaseTime"));<NEW_LINE>instance.setRenewStatus(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].RenewStatus"));<NEW_LINE>instance.setCreateTime(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].CreateTime"));<NEW_LINE>instance.setSellerId(_ctx.longValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].SellerId"));<NEW_LINE>instance.setInstanceID(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].InstanceID"));<NEW_LINE>instance.setSeller(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].Seller"));<NEW_LINE>instance.setStopTime(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].StopTime"));<NEW_LINE>instance.setRenewalDurationUnit(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].RenewalDurationUnit"));<NEW_LINE>instance.setSubscriptionType(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].SubscriptionType"));<NEW_LINE>instance.setOwnerId(_ctx.longValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].OwnerId"));<NEW_LINE>instance.setEndTime(_ctx.stringValue<MASK><NEW_LINE>instance.setProductType(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].ProductType"));<NEW_LINE>instance.setRegion(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].Region"));<NEW_LINE>instance.setReleaseTime(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].ReleaseTime"));<NEW_LINE>instance.setRenewalDuration(_ctx.integerValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].RenewalDuration"));<NEW_LINE>instance.setProductCode(_ctx.stringValue("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].ProductCode"));<NEW_LINE>instanceList.add(instance);<NEW_LINE>}<NEW_LINE>data.setInstanceList(instanceList);<NEW_LINE>queryAvailableInstancesResponse.setData(data);<NEW_LINE>return queryAvailableInstancesResponse;<NEW_LINE>} | ("QueryAvailableInstancesResponse.Data.InstanceList[" + i + "].EndTime")); |
1,369,663 | private String nameForType(TypeMirror type) {<NEW_LINE>return type.accept(new SimpleTypeVisitor8<String, Void>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String visitDeclared(DeclaredType type, Void v) {<NEW_LINE>String simpleName = simpleNameForType(type);<NEW_LINE>if (type.getTypeArguments().isEmpty()) {<NEW_LINE>return simpleName;<NEW_LINE>}<NEW_LINE>ImmutableList<String> typeArgumentNames = type.getTypeArguments().stream().map(t -> simpleNameForType(t)<MASK><NEW_LINE>if (isMapOrMultimap(type) && typeArgumentNames.size() == 2) {<NEW_LINE>return String.format("%sOf%sTo%s", simpleName, typeArgumentNames.get(0), typeArgumentNames.get(1));<NEW_LINE>}<NEW_LINE>List<String> parts = new ArrayList<>();<NEW_LINE>parts.add(simpleName);<NEW_LINE>parts.add("Of");<NEW_LINE>parts.addAll(typeArgumentNames.subList(0, typeArgumentNames.size() - 1));<NEW_LINE>if (typeArgumentNames.size() > 1) {<NEW_LINE>parts.add("And");<NEW_LINE>}<NEW_LINE>parts.add(getLast(typeArgumentNames));<NEW_LINE>return String.join("", parts);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected String defaultAction(TypeMirror type, Void v) {<NEW_LINE>return simpleNameForType(type);<NEW_LINE>}<NEW_LINE>}, null);<NEW_LINE>} | ).collect(toImmutableList()); |
466,245 | public static ServerIdentity deserialize(byte[] input) throws IllegalArgumentException, IOException {<NEW_LINE>DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(input));<NEW_LINE>byte header = inputStream.readByte();<NEW_LINE>if (header != SERVER_IDENTITY_HEADER) {<NEW_LINE>throw new IllegalArgumentException("Incorrect server identity message header");<NEW_LINE>}<NEW_LINE>byte version = inputStream.readByte();<NEW_LINE>if (version != PROTOCOL_VERSION) {<NEW_LINE>throw new IllegalArgumentException("Incorrect remote attestation protocol version");<NEW_LINE>}<NEW_LINE>byte[] ephemeralPublicKey = readFixedSizeArray(inputStream, EPHEMERAL_PUBLIC_KEY_LENGTH, "ephemeral public key");<NEW_LINE>byte[] random = readFixedSizeArray(inputStream, REPLAY_PROTECTION_ARRAY_LENGTH, "random value");<NEW_LINE>byte[] transcriptSignature = readFixedSizeArray(inputStream, TRANSCRIPT_SIGNATURE_LENGTH, "transcript signature");<NEW_LINE>byte[] signingPublicKey = readFixedSizeArray(inputStream, SIGNING_PUBLIC_KEY_LENGTH, "signing key");<NEW_LINE>byte[] attestationInfo = readVariableSizeArray(inputStream, "attestation info");<NEW_LINE>byte[] additionalInfo = readVariableSizeArray(inputStream, "additional info");<NEW_LINE>ServerIdentity serverIdentity = new ServerIdentity(ephemeralPublicKey, <MASK><NEW_LINE>serverIdentity.setTranscriptSignature(transcriptSignature);<NEW_LINE>return serverIdentity;<NEW_LINE>} | random, signingPublicKey, attestationInfo, additionalInfo); |
1,242,408 | public static void addToString(SourceBuilder code, Datatype datatype, Map<Property, PropertyCodeGenerator> generatorsByProperty, boolean forPartial) {<NEW_LINE>// This code is to ensure entry order is preserved.<NEW_LINE>// Specifically this code is boiler plate from Collectors.toMap.<NEW_LINE>// Except with a LinkedHashMap supplier.<NEW_LINE>generatorsByProperty = generatorsByProperty.entrySet().stream().filter(e -> e.getKey().isInToString()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (u, v) -> {<NEW_LINE>throw new IllegalStateException(String.format("Duplicate key %s", u));<NEW_LINE>}, LinkedHashMap::new));<NEW_LINE>String typename = (forPartial ? "partial " : "") + datatype.getType().getSimpleName();<NEW_LINE>Predicate<PropertyCodeGenerator> isOptional = generator -> {<NEW_LINE>Initially initially = generator.initialState();<NEW_LINE>return (initially == Initially.OPTIONAL || (initially == Initially.REQUIRED && forPartial));<NEW_LINE>};<NEW_LINE>boolean anyOptional = generatorsByProperty.values().<MASK><NEW_LINE>boolean allOptional = generatorsByProperty.values().stream().allMatch(isOptional) && !generatorsByProperty.isEmpty();<NEW_LINE>code.addLine("").addLine("@%s", Override.class).addLine("public %s toString() {", String.class);<NEW_LINE>if (allOptional) {<NEW_LINE>bodyWithBuilderAndSeparator(code, datatype, generatorsByProperty, typename);<NEW_LINE>} else if (anyOptional) {<NEW_LINE>bodyWithBuilder(code, datatype, generatorsByProperty, typename, isOptional);<NEW_LINE>} else {<NEW_LINE>bodyWithConcatenation(code, generatorsByProperty, typename);<NEW_LINE>}<NEW_LINE>code.addLine("}");<NEW_LINE>} | stream().anyMatch(isOptional); |
1,319,142 | public void removeSpectator(final User user) {<NEW_LINE>logger.info(String.format("Removing spectator %s from game %d.", user.toString(), id));<NEW_LINE>synchronized (spectators) {<NEW_LINE>if (!spectators.remove(user)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// not actually spectating<NEW_LINE>user.leaveGame(this);<NEW_LINE>}<NEW_LINE>// do this down here so the person that left doesn't get the notice too<NEW_LINE>final HashMap<ReturnableData, Object> data = getEventMap();<NEW_LINE>data.put(LongPollResponse.EVENT, <MASK><NEW_LINE>data.put(LongPollResponse.NICKNAME, user.getNickname());<NEW_LINE>broadcastToPlayers(MessageType.GAME_PLAYER_EVENT, data);<NEW_LINE>// Don't do this anymore, it was driving up a crazy amount of traffic.<NEW_LINE>// gameManager.broadcastGameListRefresh();<NEW_LINE>} | LongPollEvent.GAME_SPECTATOR_LEAVE.toString()); |
785,092 | public static void deserializeToField(final Object containingObject, final String fieldName, final String json, final ClassFieldCache classFieldCache) throws IllegalArgumentException {<NEW_LINE>if (containingObject == null) {<NEW_LINE>throw new IllegalArgumentException("Cannot deserialize to a field of a null object");<NEW_LINE>}<NEW_LINE>// Parse the JSON<NEW_LINE>Object parsedJSON;<NEW_LINE>try {<NEW_LINE>parsedJSON = JSONParser.parseJSON(json);<NEW_LINE>} catch (final ParseException e) {<NEW_LINE>throw new IllegalArgumentException("Could not parse JSON", e);<NEW_LINE>}<NEW_LINE>// Create a JSONObject with one field of the requested name, and deserialize that into the requested object<NEW_LINE>final <MASK><NEW_LINE>wrapperJsonObj.items.add(new SimpleEntry<>(fieldName, parsedJSON));<NEW_LINE>// Populate the object field<NEW_LINE>// (no need to call getInitialIdToObjectMap(), since toplevel object is a wrapper, which doesn't have an id)<NEW_LINE>final List<Runnable> collectionElementAdders = new ArrayList<>();<NEW_LINE>populateObjectFromJsonObject(containingObject, containingObject.getClass(), wrapperJsonObj, classFieldCache, new HashMap<CharSequence, Object>(), collectionElementAdders);<NEW_LINE>for (final Runnable runnable : collectionElementAdders) {<NEW_LINE>runnable.run();<NEW_LINE>}<NEW_LINE>} | JSONObject wrapperJsonObj = new JSONObject(1); |
1,055,671 | public void run() {<NEW_LINE>var viewer = qupath.getViewer();<NEW_LINE>var imageData = viewer.getImageData();<NEW_LINE>if (imageData == null) {<NEW_LINE>Dialogs.showNoImageError(title);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>var builder = new SvgTools.SvgBuilder(viewer);<NEW_LINE>var server = imageData.getServer();<NEW_LINE>String description = "SVG image";<NEW_LINE>String ext = ".svg";<NEW_LINE>String name = null;<NEW_LINE>// Prompt for more options if we are exporting a selected region<NEW_LINE>if (type == SvgExportType.SELECTED_REGION) {<NEW_LINE>var selected = viewer.getSelectedObject();<NEW_LINE>var params = new ParameterList().addDoubleParameter("downsample", "Downsample factor", downsample, null, "Downsample factor for export resolution (default: current viewer downsample)").addChoiceParameter("includeImage", "Raster image", imageType, Arrays.asList(ImageIncludeType.values()), "Export associated raster image").addBooleanParameter("highlightSelected", "Highlight selected objects", highlightSelected, "Highlight selected objects to distinguish these from unselected objects, as they are shown in the viewer").addBooleanParameter("compress", "Compress SVGZ", compress, "Write compressed SVGZ file, rather than standard SVG (default: no compression, for improved compatibility with other software)");<NEW_LINE>if (!Dialogs.showParameterDialog(title, params))<NEW_LINE>return;<NEW_LINE>downsample = params.getDoubleParameterValue("downsample");<NEW_LINE>imageType = (ImageIncludeType) params.getChoiceParameterValue("includeImage");<NEW_LINE>highlightSelected = params.getBooleanParameterValue("highlightSelected");<NEW_LINE><MASK><NEW_LINE>if (downsample <= 0) {<NEW_LINE>Dialogs.showErrorMessage(title, "Downsample factor must be > 0!");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>RegionRequest request;<NEW_LINE>if (selected != null && selected.hasROI()) {<NEW_LINE>request = RegionRequest.createInstance(server.getPath(), downsample, selected.getROI());<NEW_LINE>} else {<NEW_LINE>request = RegionRequest.createInstance(server, downsample);<NEW_LINE>}<NEW_LINE>int width = (int) (request.getWidth() / downsample);<NEW_LINE>int height = (int) (request.getHeight() / downsample);<NEW_LINE>if ((width > 8192 || height > 8192)) {<NEW_LINE>if (!Dialogs.showYesNoDialog(title, String.format("The requested image size (approx. %d x %d pixels) is very big -\n" + "are you sure you want to try to export at this resolution?", width, height)))<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>builder.images(imageType).region(request).downsample(request.getDownsample()).showSelection(highlightSelected);<NEW_LINE>if (compress) {<NEW_LINE>description = "SVGZ image";<NEW_LINE>ext = ".svgz";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>var file = Dialogs.promptToSaveFile(title, null, name, description, ext);<NEW_LINE>if (file == null)<NEW_LINE>return;<NEW_LINE>try {<NEW_LINE>builder.writeSVG(file);<NEW_LINE>} catch (IOException e) {<NEW_LINE>Dialogs.showErrorMessage(title, e);<NEW_LINE>}<NEW_LINE>} | compress = params.getBooleanParameterValue("compress"); |
772,065 | private CompletableFuture<Optional<EthPeer>> confirmPivotBlockHeader(final EthPeer bestPeer) {<NEW_LINE>final BlockHeader pivotBlockHeader = fastSyncState.getPivotBlockHeader().get();<NEW_LINE>final RetryingGetHeaderFromPeerByNumberTask task = RetryingGetHeaderFromPeerByNumberTask.forSingleNumber(protocolSchedule, ethContext, metricsSystem, pivotBlockHeader.getNumber(), MAX_QUERY_RETRIES_PER_PEER);<NEW_LINE>task.assignPeer(bestPeer);<NEW_LINE>return ethContext.getScheduler().timeout(task).thenApply(result -> {<NEW_LINE>if (peerHasDifferentPivotBlock(result)) {<NEW_LINE>LOG.warn("Best peer has wrong pivot block (#{}) expecting {} but received {}. Disconnect: {}", pivotBlockHeader.getNumber(), pivotBlockHeader.getHash(), result.size() == 1 ? result.get(0).getHash() : "invalid response", bestPeer);<NEW_LINE><MASK><NEW_LINE>return Optional.<EthPeer>empty();<NEW_LINE>} else {<NEW_LINE>return Optional.of(bestPeer);<NEW_LINE>}<NEW_LINE>}).exceptionally(error -> {<NEW_LINE>LOG.debug("Could not confirm best peer had pivot block", error);<NEW_LINE>return Optional.empty();<NEW_LINE>});<NEW_LINE>} | bestPeer.disconnect(DisconnectReason.USELESS_PEER); |
398,659 | public static Date pascoa(int ano) {<NEW_LINE>int a = ano % 19;<NEW_LINE>int b = ano / 100;<NEW_LINE>int c = ano % 100;<NEW_LINE>int d = b / 4;<NEW_LINE>int e = b % 4;<NEW_LINE>int f = (b + 8) / 25;<NEW_LINE>int g = (b - f + 1) / 3;<NEW_LINE>int h = (19 * a + b - d - g + 15) % 30;<NEW_LINE>int i = c / 4;<NEW_LINE>int k = c % 4;<NEW_LINE>int L = (32 + 2 * e + 2 * i - h - k) % 7;<NEW_LINE>int m = (a + 11 * h + 22 * L) / 451;<NEW_LINE>int mes = (h + L - <MASK><NEW_LINE>int dia = ((h + L - 7 * m + 114) % 31) + 1;<NEW_LINE>Calendar calendar = DateUtil.hoje();<NEW_LINE>calendar.set(ano, mes - 1, dia, 0, 0, 0);<NEW_LINE>return calendar.getTime();<NEW_LINE>} | 7 * m + 114) / 31; |
766,597 | protected void prepareHandshakeMessageContents() {<NEW_LINE>LOGGER.debug("Prepare SSL2ClientHello");<NEW_LINE>preparePaddingLength(message);<NEW_LINE>prepareType(message);<NEW_LINE>prepareProtocolVersion(message);<NEW_LINE>// By Default we just set a fixed value with ssl2 cipher suites<NEW_LINE>prepareCipherSuites(message);<NEW_LINE>byte[] challenge = new byte[16];<NEW_LINE>chooser.getContext().getRandom().nextBytes(challenge);<NEW_LINE>prepareChallenge(message, challenge);<NEW_LINE>prepareSessionID(message);<NEW_LINE>prepareSessionIDLength(message);<NEW_LINE>prepareChallengeLength(message);<NEW_LINE>prepareCipherSuiteLength(message);<NEW_LINE>int length = SSL2ByteLength.CHALLENGE_LENGTH + SSL2ByteLength.CIPHERSUITE_LENGTH + SSL2ByteLength.MESSAGE_TYPE + SSL2ByteLength.SESSIONID_LENGTH;<NEW_LINE>length += message.getChallenge().getValue().length;<NEW_LINE>length += message.getCipherSuites().getValue().length;<NEW_LINE>length += message.getSessionId().getValue().length;<NEW_LINE>length += message.getProtocolVersion<MASK><NEW_LINE>prepareMessageLength(message, length);<NEW_LINE>} | ().getValue().length; |
476,553 | public static void main(String[] args) throws Exception {<NEW_LINE>int port = 8282;<NEW_LINE>try {<NEW_LINE>port = Integer.parseInt<MASK><NEW_LINE>} catch (Exception ex) {<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerBootstrap.ConsumerConfiguration.class);<NEW_LINE>context.start();<NEW_LINE>RestApiService.applicationContext = context;<NEW_LINE>Server server = new Server(port);<NEW_LINE>ServletHolder servlet = new ServletHolder(ServletContainer.class);<NEW_LINE>servlet.setInitParameter("com.sun.jersey.config.property.packages", "org.apache.dubbo.admin.impl.consumer");<NEW_LINE>servlet.setInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true");<NEW_LINE>ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);<NEW_LINE>handler.setContextPath("/");<NEW_LINE>handler.addServlet(servlet, "/*");<NEW_LINE>server.setHandler(handler);<NEW_LINE>server.start();<NEW_LINE>System.out.println("dubbo service init finish");<NEW_LINE>} | (System.getenv("rest.api.port")); |
102,709 | public <T> ClusterInvoker<T> buildClusterInvokerChain(final ClusterInvoker<T> originalInvoker, String key, String group) {<NEW_LINE>ClusterInvoker<T> last = originalInvoker;<NEW_LINE>URL url = originalInvoker.getUrl();<NEW_LINE>List<ModuleModel> moduleModels = getModuleModelsFromUrl(url);<NEW_LINE>List<ClusterFilter> filters;<NEW_LINE>if (moduleModels != null && moduleModels.size() == 1) {<NEW_LINE>filters = ScopeModelUtil.getExtensionLoader(ClusterFilter.class, moduleModels.get(0)).<MASK><NEW_LINE>} else if (moduleModels != null && moduleModels.size() > 1) {<NEW_LINE>filters = new ArrayList<>();<NEW_LINE>List<ExtensionDirector> directors = new ArrayList<>();<NEW_LINE>for (ModuleModel moduleModel : moduleModels) {<NEW_LINE>List<ClusterFilter> tempFilters = ScopeModelUtil.getExtensionLoader(ClusterFilter.class, moduleModel).getActivateExtension(url, key, group);<NEW_LINE>filters.addAll(tempFilters);<NEW_LINE>directors.add(moduleModel.getExtensionDirector());<NEW_LINE>}<NEW_LINE>filters = sortingAndDeduplication(filters, directors);<NEW_LINE>} else {<NEW_LINE>filters = ScopeModelUtil.getExtensionLoader(ClusterFilter.class, null).getActivateExtension(url, key, group);<NEW_LINE>}<NEW_LINE>if (!CollectionUtils.isEmpty(filters)) {<NEW_LINE>for (int i = filters.size() - 1; i >= 0; i--) {<NEW_LINE>final ClusterFilter filter = filters.get(i);<NEW_LINE>final Invoker<T> next = last;<NEW_LINE>last = new CopyOfClusterFilterChainNode<>(originalInvoker, next, filter);<NEW_LINE>}<NEW_LINE>return new ClusterCallbackRegistrationInvoker<>(originalInvoker, last, filters);<NEW_LINE>}<NEW_LINE>return last;<NEW_LINE>} | getActivateExtension(url, key, group); |
1,267,475 | public void paint(Graphics g) {<NEW_LINE>Rectangle newBounds = new Rectangle(newViewPort.getBounds());<NEW_LINE>Rectangle currentBounds = new Rectangle(currentViewPort.getBounds());<NEW_LINE>double nW = newBounds.getWidth();<NEW_LINE>double nH = newBounds.getHeight();<NEW_LINE>double cW = currentBounds.getWidth();<NEW_LINE>double cH = currentBounds.getHeight();<NEW_LINE>double scale = cW / nW;<NEW_LINE>if (nH * scale > cH) {<NEW_LINE>scale = cH / nH;<NEW_LINE>}<NEW_LINE>Point newCenter = new Point(newBounds.getX() + newBounds.getWidth() / 2, newBounds.getY() + newBounds.getHeight() / 2);<NEW_LINE>Point currentCenter = new Point(currentBounds.getX() + currentBounds.getWidth() / 2, currentBounds.getY() + currentBounds.getHeight() / 2);<NEW_LINE>double motionVal = motion.getValue();<NEW_LINE>double tx = ((double) newCenter.getX() - currentCenter.<MASK><NEW_LINE>double ty = ((double) newCenter.getY() - currentCenter.getY()) * motionVal / 100.0;<NEW_LINE>scale = 1.0 + (scale - 1f) * motionVal / 100.0;<NEW_LINE>Transform t = Transform.makeIdentity();<NEW_LINE>t.setTransform(origTransform);<NEW_LINE>int cX = (int) (currentCenter.getX() + tx);<NEW_LINE>int cY = (int) (currentCenter.getY() + ty);<NEW_LINE>t.translate(currentCenter.getX(), currentCenter.getY());<NEW_LINE>t.scale((float) scale, (float) scale);<NEW_LINE>t.translate(-cX, -cY);<NEW_LINE>setTransform(t);<NEW_LINE>ChartComponent.this.repaint();<NEW_LINE>} | getX()) * motionVal / 100.0; |
487,283 | public void marshall(ApiDestination apiDestination, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (apiDestination == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(apiDestination.getApiDestinationArn(), APIDESTINATIONARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(apiDestination.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(apiDestination.getConnectionArn(), CONNECTIONARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(apiDestination.getInvocationEndpoint(), INVOCATIONENDPOINT_BINDING);<NEW_LINE>protocolMarshaller.marshall(apiDestination.getHttpMethod(), HTTPMETHOD_BINDING);<NEW_LINE>protocolMarshaller.marshall(apiDestination.getInvocationRateLimitPerSecond(), INVOCATIONRATELIMITPERSECOND_BINDING);<NEW_LINE>protocolMarshaller.marshall(apiDestination.getCreationTime(), CREATIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(apiDestination.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | apiDestination.getApiDestinationState(), APIDESTINATIONSTATE_BINDING); |
1,425,061 | private static Object mergeDictText(Object object, Map<String, List<SysDictItemEntity>> mapDictItems) throws Exception {<NEW_LINE>// Map<Field->Value><NEW_LINE>HashMap<String, Object> mapFieldValues = new HashMap<>();<NEW_LINE>// Map<Field->FieldType><NEW_LINE>HashMap<String, Object> mapFieldAndType = new HashMap<>();<NEW_LINE>Class<? extends Object<MASK><NEW_LINE>BeanInfo beanInfo = Introspector.getBeanInfo(objectClass);<NEW_LINE>PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();<NEW_LINE>// Get data that already exists in the object<NEW_LINE>for (PropertyDescriptor descriptor : propertyDescriptors) {<NEW_LINE>String propertyName = descriptor.getName();<NEW_LINE>if (!propertyName.equals("class")) {<NEW_LINE>Method readMethod = descriptor.getReadMethod();<NEW_LINE>if (null == readMethod) {<NEW_LINE>throw new Exception("Can not found " + propertyName + " ReadMethod(), All fields in " + objectClass.getName() + " need add set and set methods.");<NEW_LINE>}<NEW_LINE>Object result = readMethod.invoke(object, new Object[0]);<NEW_LINE>mapFieldValues.put(propertyName, result);<NEW_LINE>mapFieldAndType.put(propertyName, descriptor.getPropertyType());<NEW_LINE>if (mapDictItems.containsKey(propertyName)) {<NEW_LINE>// add new dict text field to object<NEW_LINE>mapFieldAndType.put(propertyName + DICT_SUFFIX, String.class);<NEW_LINE>List<SysDictItemEntity> dictItems = mapDictItems.get(propertyName);<NEW_LINE>for (SysDictItemEntity dictItem : dictItems) {<NEW_LINE>if (StringUtils.equals(String.valueOf(result), dictItem.getItemCode())) {<NEW_LINE>mapFieldValues.put(propertyName + DICT_SUFFIX, dictItem.getItemName());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Map to entity object<NEW_LINE>DictAnnotation bean = new DictAnnotation(mapFieldAndType);<NEW_LINE>Set<String> keys = mapFieldAndType.keySet();<NEW_LINE>for (String key : keys) {<NEW_LINE>bean.setValue(key, mapFieldValues.get(key));<NEW_LINE>}<NEW_LINE>return bean.getObject();<NEW_LINE>} | > objectClass = object.getClass(); |
1,626,180 | public void generateCode(ClassFile classFile) {<NEW_LINE>classFile.generateMethodInfoHeader(this.binding);<NEW_LINE>int methodAttributeOffset = classFile.contentsOffset;<NEW_LINE>int attributeNumber = classFile.generateMethodInfoAttributes(this.binding);<NEW_LINE>if ((!this.binding.isNative()) && (!this.binding.isAbstract())) {<NEW_LINE>int codeAttributeOffset = classFile.contentsOffset;<NEW_LINE>classFile.generateCodeAttributeHeader();<NEW_LINE>CodeStream codeStream = classFile.codeStream;<NEW_LINE>codeStream.reset(this, classFile);<NEW_LINE>// initialize local positions<NEW_LINE>this.scope.computeLocalVariablePositions(this.binding.isStatic() ? 0 : 1, codeStream);<NEW_LINE>// arguments initialization for local variable debug attributes<NEW_LINE>if (this.arguments != null) {<NEW_LINE>for (int i = 0, max = this.arguments.length; i < max; i++) {<NEW_LINE>LocalVariableBinding argBinding;<NEW_LINE>codeStream.addVisibleLocalVariable(argBinding = this.arguments[i].binding);<NEW_LINE>argBinding.recordInitializationStartPC(0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (this.statements != null) {<NEW_LINE>for (int i = 0, max = this.statements.length; i < max; i++) this.statements[i].generateCode(this.scope, codeStream);<NEW_LINE>}<NEW_LINE>// if a problem got reported during code gen, then trigger problem method creation<NEW_LINE>if (this.ignoreFurtherInvestigation) {<NEW_LINE>throw new AbortMethod(this.scope.referenceCompilationUnit().compilationResult, null);<NEW_LINE>}<NEW_LINE>if ((this.bits & ASTNode.NeedFreeReturn) != 0) {<NEW_LINE>codeStream.return_();<NEW_LINE>}<NEW_LINE>// local variable attributes<NEW_LINE>codeStream.exitUserScope(this.scope);<NEW_LINE>codeStream.recordPositionsFrom(0, this.declarationSourceEnd);<NEW_LINE>try {<NEW_LINE>classFile.completeCodeAttribute(codeAttributeOffset);<NEW_LINE>} catch (NegativeArraySizeException e) {<NEW_LINE>throw new AbortMethod(this.scope.<MASK><NEW_LINE>}<NEW_LINE>attributeNumber++;<NEW_LINE>} else {<NEW_LINE>checkArgumentsSize();<NEW_LINE>}<NEW_LINE>classFile.completeMethodInfo(this.binding, methodAttributeOffset, attributeNumber);<NEW_LINE>} | referenceCompilationUnit().compilationResult, null); |
1,518,857 | public Request<GetCelebrityInfoRequest> marshall(GetCelebrityInfoRequest getCelebrityInfoRequest) {<NEW_LINE>if (getCelebrityInfoRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(GetCelebrityInfoRequest)");<NEW_LINE>}<NEW_LINE>Request<GetCelebrityInfoRequest> request = new DefaultRequest<GetCelebrityInfoRequest>(getCelebrityInfoRequest, "AmazonRekognition");<NEW_LINE>String target = "RekognitionService.GetCelebrityInfo";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (getCelebrityInfoRequest.getId() != null) {<NEW_LINE>String id = getCelebrityInfoRequest.getId();<NEW_LINE>jsonWriter.name("Id");<NEW_LINE>jsonWriter.value(id);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.<MASK><NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | setContent(new StringInputStream(snippet)); |
123,085 | final ListRecipeVersionsResult executeListRecipeVersions(ListRecipeVersionsRequest listRecipeVersionsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listRecipeVersionsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListRecipeVersionsRequest> request = null;<NEW_LINE>Response<ListRecipeVersionsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListRecipeVersionsRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "DataBrew");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListRecipeVersions");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListRecipeVersionsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListRecipeVersionsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(listRecipeVersionsRequest)); |
742,658 | public void run() {<NEW_LINE>final ClassLoader clBackup <MASK><NEW_LINE>final Tasklet t = tracker.tasklet;<NEW_LINE>currentThread().setContextClassLoader(tracker.jobClassLoader);<NEW_LINE>IdleStrategy idlerLocal = idlerNonCooperative;<NEW_LINE>MetricsImpl.Container userMetricsContextContainer = MetricsImpl.container();<NEW_LINE>try {<NEW_LINE>blockingWorkerCount.inc();<NEW_LINE>userMetricsContextContainer.setContext(t.getMetricsContext());<NEW_LINE>startedLatch.countDown();<NEW_LINE>t.init();<NEW_LINE>long idleCount = 0;<NEW_LINE>ProgressState result;<NEW_LINE>do {<NEW_LINE>result = t.call();<NEW_LINE>if (result.isMadeProgress()) {<NEW_LINE>idleCount = 0;<NEW_LINE>} else {<NEW_LINE>idlerLocal.idle(++idleCount);<NEW_LINE>}<NEW_LINE>} while (!result.isDone() && !tracker.executionTracker.executionCompletedExceptionally() && !isShutdown);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>logger.warning("Exception in " + t, e);<NEW_LINE>tracker.executionTracker.exception(new JetException("Exception in " + t + ": " + e, e));<NEW_LINE>} finally {<NEW_LINE>blockingWorkerCount.inc(-1L);<NEW_LINE>userMetricsContextContainer.setContext(null);<NEW_LINE>currentThread().setContextClassLoader(clBackup);<NEW_LINE>tracker.executionTracker.taskletDone();<NEW_LINE>}<NEW_LINE>} | = currentThread().getContextClassLoader(); |
72,198 | public void write(LogoutRequestType logOutRequest) throws ProcessingException {<NEW_LINE>StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.LOGOUT_REQUEST.get(), PROTOCOL_NSURI.get());<NEW_LINE>StaxUtil.writeNameSpace(writer, PROTOCOL_PREFIX, PROTOCOL_NSURI.get());<NEW_LINE>StaxUtil.writeNameSpace(writer, ASSERTION_PREFIX, ASSERTION_NSURI.get());<NEW_LINE>StaxUtil.writeDefaultNameSpace(writer, ASSERTION_NSURI.get());<NEW_LINE>// Attributes<NEW_LINE>StaxUtil.writeAttribute(writer, JBossSAMLConstants.ID.get(), logOutRequest.getID());<NEW_LINE>StaxUtil.writeAttribute(writer, JBossSAMLConstants.VERSION.get(), logOutRequest.getVersion());<NEW_LINE>StaxUtil.writeAttribute(writer, JBossSAMLConstants.ISSUE_INSTANT.get(), logOutRequest.getIssueInstant().toString());<NEW_LINE>URI destination = logOutRequest.getDestination();<NEW_LINE>if (destination != null) {<NEW_LINE>StaxUtil.writeAttribute(writer, JBossSAMLConstants.DESTINATION.get(), destination.toASCIIString());<NEW_LINE>}<NEW_LINE>String consent = logOutRequest.getConsent();<NEW_LINE>if (StringUtil.isNotNull(consent))<NEW_LINE>StaxUtil.writeAttribute(writer, JBossSAMLConstants.CONSENT.get(), consent);<NEW_LINE>NameIDType issuer = logOutRequest.getIssuer();<NEW_LINE>write(issuer, new QName(ASSERTION_NSURI.get(), JBossSAMLConstants.ISSUER.get(), ASSERTION_PREFIX));<NEW_LINE>Element signature = logOutRequest.getSignature();<NEW_LINE>if (signature != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>ExtensionsType extensions = logOutRequest.getExtensions();<NEW_LINE>if (extensions != null && !extensions.getAny().isEmpty()) {<NEW_LINE>write(extensions);<NEW_LINE>}<NEW_LINE>NameIDType nameID = logOutRequest.getNameID();<NEW_LINE>if (nameID != null) {<NEW_LINE>write(nameID, new QName(ASSERTION_NSURI.get(), JBossSAMLConstants.NAMEID.get(), ASSERTION_PREFIX));<NEW_LINE>}<NEW_LINE>List<String> sessionIndexes = logOutRequest.getSessionIndex();<NEW_LINE>for (String sessionIndex : sessionIndexes) {<NEW_LINE>StaxUtil.writeStartElement(writer, PROTOCOL_PREFIX, JBossSAMLConstants.SESSION_INDEX.get(), PROTOCOL_NSURI.get());<NEW_LINE>StaxUtil.writeCharacters(writer, sessionIndex);<NEW_LINE>StaxUtil.writeEndElement(writer);<NEW_LINE>StaxUtil.flush(writer);<NEW_LINE>}<NEW_LINE>StaxUtil.writeEndElement(writer);<NEW_LINE>StaxUtil.flush(writer);<NEW_LINE>} | StaxUtil.writeDOMElement(writer, signature); |
496,800 | public <U> Optional<U> createMetadata(BuildTarget buildTarget, ActionGraphBuilder graphBuilder, CellPathResolver cellRoots, CgoLibraryDescriptionArg args, Optional<ImmutableMap<BuildTarget, Version>> selectedVersions, Class<U> metadataClass) {<NEW_LINE>Optional<GoPlatform> platform = getGoToolchain(buildTarget.getTargetConfiguration()).<MASK><NEW_LINE>if (metadataClass.isAssignableFrom(GoLinkable.class)) {<NEW_LINE>Preconditions.checkState(platform.isPresent());<NEW_LINE>SourcePath output = graphBuilder.requireRule(buildTarget).getSourcePathToOutput();<NEW_LINE>return Optional.of(metadataClass.cast(GoLinkable.of(ImmutableMap.of(args.getPackageName().map(Paths::get).orElse(goBuckConfig.getDefaultPackageName(buildTarget)), output), args.getExportedDeps())));<NEW_LINE>} else if (buildTarget.getFlavors().contains(GoDescriptors.TRANSITIVE_LINKABLES_FLAVOR)) {<NEW_LINE>Preconditions.checkState(platform.isPresent());<NEW_LINE>ImmutableList<BuildTarget> nonCxxDeps = args.getDeps().stream().filter(target -> !(graphBuilder.requireRule(target) instanceof NativeLinkableGroup)).collect(ImmutableList.toImmutableList());<NEW_LINE>return Optional.of(metadataClass.cast(GoDescriptors.requireTransitiveGoLinkables(buildTarget, graphBuilder, platform.get(), Iterables.concat(nonCxxDeps, args.getExportedDeps()), /* includeSelf */<NEW_LINE>true)));<NEW_LINE>} else {<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>} | getPlatformFlavorDomain().getValue(buildTarget); |
1,621,065 | private boolean buildDefaultActivator(Path bindir, String activatorClassName, Writer writer) throws IOException {<NEW_LINE>Path activatorSourceFileName = bindir.resolve(activatorClassName + ".java");<NEW_LINE>try (PrintWriter activatorWriter = new PrintWriter(Files.newBufferedWriter(activatorSourceFileName, Charset.forName("UTF-8")))) {<NEW_LINE>activatorWriter.println("import " + GhidraBundleActivator.class.getName() + ";");<NEW_LINE>activatorWriter.println("import org.osgi.framework.BundleActivator;");<NEW_LINE>activatorWriter.println("import org.osgi.framework.BundleContext;");<NEW_LINE>activatorWriter.println("public class " + GENERATED_ACTIVATOR_CLASSNAME + " extends GhidraBundleActivator {");<NEW_LINE>activatorWriter.println(" protected void start(BundleContext bc, Object api) {");<NEW_LINE>activatorWriter.println(" // TODO: stuff to do on bundle start");<NEW_LINE>activatorWriter.println(" }");<NEW_LINE>activatorWriter.println(" protected void stop(BundleContext bc, Object api) {");<NEW_LINE>activatorWriter.println(" // TODO: stuff to do on bundle stop");<NEW_LINE>activatorWriter.println(" }");<NEW_LINE>activatorWriter.println();<NEW_LINE>activatorWriter.println("}");<NEW_LINE>}<NEW_LINE>List<String> options = new ArrayList<>();<NEW_LINE>options.add("-g");<NEW_LINE>options.add("-d");<NEW_LINE>options.add(bindir.toString());<NEW_LINE>options.add("-sourcepath");<NEW_LINE>options.add(bindir.toString());<NEW_LINE>options.add("-classpath");<NEW_LINE>options.add(System.getProperty("java.class.path"));<NEW_LINE>options.add("-proc:none");<NEW_LINE>try (StandardJavaFileManager javaFileManager = compiler.getStandardFileManager(null, null, null);<NEW_LINE>BundleJavaManager bundleManager = new MyBundleJavaManager(bundleHost.getHostFramework(), javaFileManager, options)) {<NEW_LINE>Iterable<? extends JavaFileObject> sourceFiles = javaFileManager.getJavaFileObjectsFromPaths(List.of(activatorSourceFileName));<NEW_LINE>DiagnosticCollector<JavaFileObject> <MASK><NEW_LINE>JavaCompiler.CompilationTask task = compiler.getTask(writer, bundleManager, diagnostics, options, null, sourceFiles);<NEW_LINE>if (task.call()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {<NEW_LINE>writer.write(diagnostic.getSource().toString() + ": " + diagnostic.getMessage(null) + "\n");<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | diagnostics = new DiagnosticCollector<>(); |
1,548,031 | public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState state) {<NEW_LINE>ImmutableChecker immutableChecker = new ImmutableChecker(ImmutableSet.of(javax.annotation.concurrent.Immutable.class.getName(), com.google.errorprone.annotations.Immutable.class.getName()));<NEW_LINE>Optional<? extends ImportTree> immutableImport = tree.getImports().stream().filter(i -> {<NEW_LINE>Symbol s = ASTHelpers.<MASK><NEW_LINE>return s != null && s.getQualifiedName().contentEquals(javax.annotation.concurrent.Immutable.class.getName());<NEW_LINE>}).findFirst();<NEW_LINE>if (!immutableImport.isPresent()) {<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>boolean[] ok = { true };<NEW_LINE>new TreePathScanner<Void, Void>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Void visitClass(ClassTree node, Void unused) {<NEW_LINE>if (immutableChecker.matchClass(node, createVisitorState().withPath(getCurrentPath())) != Description.NO_MATCH) {<NEW_LINE>ok[0] = false;<NEW_LINE>}<NEW_LINE>return super.visitClass(node, null);<NEW_LINE>}<NEW_LINE><NEW_LINE>private VisitorState createVisitorState() {<NEW_LINE>return VisitorState.createConfiguredForCompilation(state.context, description -> ok[0] = false, ImmutableMap.of(), state.errorProneOptions());<NEW_LINE>}<NEW_LINE>}.scan(state.getPath(), null);<NEW_LINE>if (!ok[0]) {<NEW_LINE>// TODO(cushon): replace non-compliant @Immutable annotations with javadoc<NEW_LINE>return Description.NO_MATCH;<NEW_LINE>}<NEW_LINE>return describeMatch(immutableImport.get(), SuggestedFix.builder().removeImport(javax.annotation.concurrent.Immutable.class.getName()).addImport(com.google.errorprone.annotations.Immutable.class.getName()).build());<NEW_LINE>} | getSymbol(i.getQualifiedIdentifier()); |
1,115,791 | private void moveOrDeleteSentMessage(Account account, LocalStore localStore, LocalMessage message) throws MessagingException {<NEW_LINE>if (!account.hasSentFolder() || !account.isUploadSentMessages()) {<NEW_LINE>Timber.i("Not uploading sent message; deleting local message");<NEW_LINE>message.destroy();<NEW_LINE>} else {<NEW_LINE>long sentFolderId = account.getSentFolderId();<NEW_LINE>LocalFolder sentFolder = localStore.getFolder(sentFolderId);<NEW_LINE>sentFolder.open();<NEW_LINE><MASK><NEW_LINE>Timber.i("Moving sent message to folder '%s' (%d)", sentFolderServerId, sentFolderId);<NEW_LINE>MessageStore messageStore = messageStoreManager.getMessageStore(account);<NEW_LINE>long destinationMessageId = messageStore.moveMessage(message.getDatabaseId(), sentFolderId);<NEW_LINE>Timber.i("Moved sent message to folder '%s' (%d)", sentFolderServerId, sentFolderId);<NEW_LINE>if (!sentFolder.isLocalOnly()) {<NEW_LINE>String destinationUid = messageStore.getMessageServerId(destinationMessageId);<NEW_LINE>PendingCommand command = PendingAppend.create(sentFolderId, destinationUid);<NEW_LINE>queuePendingCommand(account, command);<NEW_LINE>processPendingCommands(account);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (MessagingListener listener : getListeners()) {<NEW_LINE>listener.folderStatusChanged(account, account.getOutboxFolderId());<NEW_LINE>}<NEW_LINE>} | String sentFolderServerId = sentFolder.getServerId(); |
1,286,811 | private static LookupResult buildResult(Message answer, List<Name> aliases, Record query) {<NEW_LINE>int rcode = answer.getRcode();<NEW_LINE>List<Record> answerRecords = answer.getSection(Section.ANSWER);<NEW_LINE>if (answerRecords.isEmpty() && rcode != Rcode.NOERROR) {<NEW_LINE>switch(rcode) {<NEW_LINE>case Rcode.NXDOMAIN:<NEW_LINE>throw new NoSuchDomainException(query.getName(<MASK><NEW_LINE>case Rcode.NXRRSET:<NEW_LINE>throw new NoSuchRRSetException(query.getName(), query.getType());<NEW_LINE>case Rcode.SERVFAIL:<NEW_LINE>throw new ServerFailedException();<NEW_LINE>default:<NEW_LINE>throw new LookupFailedException(String.format("Unknown non-success error code %s", Rcode.string(rcode)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new LookupResult(answerRecords, aliases);<NEW_LINE>} | ), query.getType()); |
58,131 | public GeneratorEntity compile() {<NEW_LINE>GeneratorEntity entity = new GeneratorEntity(getCompiler().getContext());<NEW_LINE>entity.setReturnReference(statement.isReturnReference());<NEW_LINE>entity.setInternalName(compiler.getModule().getInternalName() + "_generator" + statement.getGeneratorId());<NEW_LINE>entity.setId(statement.getGeneratorId());<NEW_LINE>entity.setTrace(statement.toTraceInfo(compiler.getContext()));<NEW_LINE>ClassStmtToken classStmtToken = new ClassStmtToken(statement.getMeta());<NEW_LINE>classStmtToken.setNamespace(NamespaceStmtToken.getDefault());<NEW_LINE>classStmtToken.setName(NameToken.valueOf(entity.getInternalName()));<NEW_LINE>classStmtToken.setExtend(ExtendsStmtToken.valueOf(Generator.class.getSimpleName()));<NEW_LINE>MethodStmtToken methodToken = new MethodStmtToken(statement);<NEW_LINE>methodToken.setClazz(classStmtToken);<NEW_LINE>methodToken.setGenerator(false);<NEW_LINE>methodToken.setReturnReference(statement.isReturnReference());<NEW_LINE>if (statement.isReturnReference()) {<NEW_LINE>methodToken.setDynamicLocal(true);<NEW_LINE>}<NEW_LINE>methodToken.setModifier(Modifier.PROTECTED);<NEW_LINE>methodToken.setName(NameToken.valueOf("_run"));<NEW_LINE>methodToken.setUses(statement.getArguments());<NEW_LINE>methodToken.setArguments(Collections.<ArgumentStmtToken>emptyList());<NEW_LINE>classStmtToken.setMethods(Arrays.asList(methodToken));<NEW_LINE>ClassStmtCompiler classStmtCompiler = new ClassStmtCompiler(this.compiler, classStmtToken);<NEW_LINE>classStmtCompiler.setSystem(true);<NEW_LINE>classStmtCompiler.setInterfaceCheck(false);<NEW_LINE>classStmtCompiler.setGeneratorEntity(entity);<NEW_LINE>classStmtCompiler.setFunctionName(statement.getFulledName());<NEW_LINE>ClassEntity clazzEntity = classStmtCompiler.compile();<NEW_LINE>entity.getMethods().putAll(clazzEntity.getMethods());<NEW_LINE>if (clazzEntity.getParent() != null)<NEW_LINE>entity.setParent(clazzEntity.getParent());<NEW_LINE>entity.<MASK><NEW_LINE>entity.setType(ClassEntity.Type.GENERATOR);<NEW_LINE>entity.doneDeclare();<NEW_LINE>return entity;<NEW_LINE>} | setData(clazzEntity.getData()); |
967,489 | private Filter deserializeArray(final JsonParser p, final DeserializationContext c) throws IOException {<NEW_LINE>if (p.nextToken() != JsonToken.VALUE_STRING) {<NEW_LINE>throw c.mappingException("Expected operator (string)");<NEW_LINE>}<NEW_LINE>final String operator = p.readValueAs(String.class);<NEW_LINE>final FilterEncoding<? extends Filter> deserializer = deserializers.get(operator);<NEW_LINE>if (deserializer == null) {<NEW_LINE>throw c.mappingException("No such operator: " + operator);<NEW_LINE>}<NEW_LINE>p.nextToken();<NEW_LINE>final FilterEncoding.Decoder d = new Decoder(p, c);<NEW_LINE>final Filter filter;<NEW_LINE>try {<NEW_LINE>filter = deserializer.deserialize(d);<NEW_LINE>if (p.getCurrentToken() != JsonToken.END_ARRAY) {<NEW_LINE>throw c.mappingException("Expected end of array from '" + deserializer + "'");<NEW_LINE>}<NEW_LINE>if (filter instanceof RawFilter) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return filter.optimize();<NEW_LINE>} catch (final Exception e) {<NEW_LINE>// use special {operator} syntax to indicate filter.<NEW_LINE>throw JsonMappingException.wrapWithPath(e, this, "{" + operator + "}");<NEW_LINE>}<NEW_LINE>} | return parseRawFilter((RawFilter) filter); |
130,310 | public boolean transform(MutableQuadView quad) {<NEW_LINE>if (identityMatrix) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < 4; i++) {<NEW_LINE>quad.copyPos(i, storage3);<NEW_LINE>storage.set(storage3.x(), storage3.y(), storage3.z(), 1);<NEW_LINE>storage.transform(matrix);<NEW_LINE>quad.pos(i, storage.x(), storage.y(), storage.z());<NEW_LINE>if (quad.hasNormal(i)) {<NEW_LINE>quad.copyNormal(i, storage3);<NEW_LINE>storage.set(storage3.x(), storage3.y(), <MASK><NEW_LINE>storage.transform(matrix);<NEW_LINE>storage.normalize();<NEW_LINE>quad.normal(i, storage.x(), storage.y(), storage.z());<NEW_LINE>if (i == 0) {<NEW_LINE>Direction face = Direction.getNearest(storage.x(), storage.y(), storage.z());<NEW_LINE>quad.nominalFace(face);<NEW_LINE>quad.cullFace(face);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | storage3.z(), 0); |
1,851,938 | private static void randomize(Context context) {<NEW_LINE>int first = 0;<NEW_LINE>String format = context.getString(R.string.msg_randomizing);<NEW_LINE>List<ApplicationInfo> listApp = context.getPackageManager().getInstalledApplications(0);<NEW_LINE>// Randomize global<NEW_LINE>int userId = Util.<MASK><NEW_LINE>PrivacyManager.setSettingList(getRandomizeWork(context, userId));<NEW_LINE>// Randomize applications<NEW_LINE>for (int i = 1; i <= listApp.size(); i++) {<NEW_LINE>int uid = listApp.get(i - 1).uid;<NEW_LINE>List<PSetting> listSetting = getRandomizeWork(context, uid);<NEW_LINE>PrivacyManager.setSettingList(listSetting);<NEW_LINE>if (first == 0)<NEW_LINE>if (listSetting.size() > 0)<NEW_LINE>first = i;<NEW_LINE>if (first > 0 && first < listApp.size())<NEW_LINE>notifyProgress(context, Util.NOTIFY_RANDOMIZE, format, 100 * (i - first) / (listApp.size() - first));<NEW_LINE>}<NEW_LINE>if (first == 0)<NEW_LINE>Util.log(null, Log.WARN, "Nothing to randomize");<NEW_LINE>} | getUserId(Process.myUid()); |
653,635 | public List<String> resolve(Context context, List<String> expressions) {<NEW_LINE><MASK><NEW_LINE>Metadata metadata = context.getState().metadata();<NEW_LINE>if (options.expandWildcardsClosed() == false && options.expandWildcardsOpen() == false) {<NEW_LINE>return expressions;<NEW_LINE>}<NEW_LINE>if (isEmptyOrTrivialWildcard(expressions)) {<NEW_LINE>return resolveEmptyOrTrivialWildcard(options, metadata);<NEW_LINE>}<NEW_LINE>Set<String> result = innerResolve(context, expressions, options, metadata);<NEW_LINE>if (result == null) {<NEW_LINE>return expressions;<NEW_LINE>}<NEW_LINE>if (result.isEmpty() && !options.allowNoIndices()) {<NEW_LINE>IndexNotFoundException infe = new IndexNotFoundException((String) null);<NEW_LINE>infe.setResources("index_or_alias", expressions.toArray(new String[0]));<NEW_LINE>throw infe;<NEW_LINE>}<NEW_LINE>return new ArrayList<>(result);<NEW_LINE>} | IndicesOptions options = context.getOptions(); |
658,949 | public <T> T parseObject(Type type, Object fieldName) {<NEW_LINE>int token = lexer.token();<NEW_LINE>if (token == JSONToken.NULL) {<NEW_LINE>lexer.nextToken();<NEW_LINE>return (T) TypeUtils.optionalEmpty(type);<NEW_LINE>}<NEW_LINE>if (token == JSONToken.LITERAL_STRING) {<NEW_LINE>if (type == byte[].class) {<NEW_LINE>byte[] bytes = lexer.bytesValue();<NEW_LINE>lexer.nextToken();<NEW_LINE>return (T) bytes;<NEW_LINE>}<NEW_LINE>if (type == char[].class) {<NEW_LINE>String strVal = lexer.stringVal();<NEW_LINE>lexer.nextToken();<NEW_LINE>return (T) strVal.toCharArray();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ObjectDeserializer deserializer = config.getDeserializer(type);<NEW_LINE>try {<NEW_LINE>if (deserializer.getClass() == JavaBeanDeserializer.class) {<NEW_LINE>if (lexer.token() != JSONToken.LBRACE && lexer.token() != JSONToken.LBRACKET) {<NEW_LINE>throw new JSONException("syntax error,expect start with { or [,but actually start with " + lexer.tokenName());<NEW_LINE>}<NEW_LINE>return (T) ((JavaBeanDeserializer) deserializer).deserialze(this, type, fieldName, 0);<NEW_LINE>} else {<NEW_LINE>return (T) deserializer.<MASK><NEW_LINE>}<NEW_LINE>} catch (JSONException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw new JSONException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | deserialze(this, type, fieldName); |
552,595 | public void announce() throws AnnounceException {<NEW_LINE>Mail mail = context.getModel().getAnnounce().getMail();<NEW_LINE>String message = "";<NEW_LINE>if (isNotBlank(mail.getMessage())) {<NEW_LINE>message = mail.getResolvedMessage(context);<NEW_LINE>} else {<NEW_LINE>Map<String, Object> <MASK><NEW_LINE>props.put(Constants.KEY_CHANGELOG, MustacheUtils.passThrough(context.getChangelog()));<NEW_LINE>context.getModel().getRelease().getGitService().fillProps(props, context.getModel());<NEW_LINE>message = mail.getResolvedMessageTemplate(context, props);<NEW_LINE>}<NEW_LINE>String subject = mail.getResolvedSubject(context);<NEW_LINE>context.getLogger().info("subject: {}", subject);<NEW_LINE>context.getLogger().debug("message: {}", message);<NEW_LINE>try {<NEW_LINE>MessageMailCommand.builder(context.getLogger()).dryrun(context.isDryrun()).transport(mail.getTransport()).host(mail.getHost()).port(mail.getPort()).auth(mail.isAuth()).username(mail.getUsername()).password(context.isDryrun() ? "**UNDEFINED**" : mail.getResolvedPassword()).from(mail.getFrom()).to(mail.getTo()).cc(mail.getCc()).bcc(mail.getBcc()).subject(subject).message(message).mimeType(mail.getMimeType()).build().execute();<NEW_LINE>} catch (MailException e) {<NEW_LINE>context.getLogger().trace(e);<NEW_LINE>throw new AnnounceException(e);<NEW_LINE>}<NEW_LINE>} | props = new LinkedHashMap<>(); |
302,472 | private void initLayout() {<NEW_LINE>this.getStyleClass().add("searchBox");<NEW_LINE>searchField = new JFXTextField();<NEW_LINE>searchField.setOnKeyReleased(e -> {<NEW_LINE>if (e.getCode() == KeyCode.ESCAPE) {<NEW_LINE>if (closeHandler != null) {<NEW_LINE>closeHandler.run();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>searchField.setPromptText("Search");<NEW_LINE>searchField.setOnKeyPressed(e -> {<NEW_LINE>if (e.getCode() == KeyCode.ENTER) {<NEW_LINE>triggerSearch(e.isShiftDown());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>var searchUp = new JFXButton();<NEW_LINE>searchUp.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.ANGLE_UP));<NEW_LINE>searchUp.setOnAction(e -> triggerSearch(true));<NEW_LINE>var searchDown = new JFXButton();<NEW_LINE>searchDown.setGraphic(new FontAwesomeIconView(FontAwesomeIcon.ANGLE_DOWN));<NEW_LINE>searchDown.setOnAction(e -> triggerSearch(false));<NEW_LINE>this.add(searchField);<NEW_LINE>this.add(searchUp);<NEW_LINE>this.add(searchDown);<NEW_LINE>this.setMaxWidth(200);<NEW_LINE>this.setMaxHeight(40);<NEW_LINE>this.setVisible(false);<NEW_LINE>ChangeListener<Boolean> focusListener = (obs, o, n) -> {<NEW_LINE>if (n != null && n == false) {<NEW_LINE>var focusedNode = this.getScene().getFocusOwner();<NEW_LINE>if (!JavaFxUtils.isParent(this, focusedNode)) {<NEW_LINE>if (closeHandler != null) {<NEW_LINE>closeHandler.run();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>searchField.focusedProperty().addListener(focusListener);<NEW_LINE>searchUp.focusedProperty().addListener(focusListener);<NEW_LINE>searchDown.<MASK><NEW_LINE>} | focusedProperty().addListener(focusListener); |
1,818,345 | protected void checkFile(@NotNull ErlangFile file, @NotNull ProblemsHolder problemsHolder) {<NEW_LINE>Set<String> exported = new HashSet<>();<NEW_LINE>for (ErlangAttribute attribute : file.getAttributes()) {<NEW_LINE>ErlangExport export = attribute.getExport();<NEW_LINE>ErlangExportFunctions exportFunctions = export != null <MASK><NEW_LINE>if (exportFunctions == null)<NEW_LINE>continue;<NEW_LINE>List<ErlangExportFunction> list = exportFunctions.getExportFunctionList();<NEW_LINE>for (ErlangExportFunction exportFunction : list) {<NEW_LINE>PsiElement integer = exportFunction.getInteger();<NEW_LINE>if (integer == null)<NEW_LINE>continue;<NEW_LINE>String s = ErlangPsiImplUtil.getExportFunctionName(exportFunction) + "/" + integer.getText();<NEW_LINE>if (exported.contains(s)) {<NEW_LINE>problemsHolder.registerProblem(exportFunction, "Function " + "'" + s + "' has been already exported.", new ErlangRemoveDuplicateFunctionExportFix());<NEW_LINE>} else {<NEW_LINE>exported.add(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ? export.getExportFunctions() : null; |
645,451 | final DisassociateBotResult executeDisassociateBot(DisassociateBotRequest disassociateBotRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateBotRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisassociateBotRequest> request = null;<NEW_LINE>Response<DisassociateBotResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateBotRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disassociateBotRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Connect");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateBot");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateBotResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new DisassociateBotResultJsonUnmarshaller()); |
1,063,351 | public void invokeAfterGroupsConfigurations(GroupConfigMethodArguments arguments) {<NEW_LINE>// Skip this if the current method doesn't belong to any group<NEW_LINE>// (only a method that belongs to a group can trigger the invocation<NEW_LINE>// of afterGroups methods)<NEW_LINE>if (arguments.getTestMethod().getGroups().length == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// See if the currentMethod is the last method in any of the groups<NEW_LINE>// it belongs to<NEW_LINE>Map<String, String> filteredGroups = Maps.newHashMap();<NEW_LINE>String[] groups = arguments.getTestMethod().getGroups();<NEW_LINE>for (String group : groups) {<NEW_LINE>if (arguments.getGroupMethods().isLastMethodForGroup(group, arguments.getTestMethod())) {<NEW_LINE>filteredGroups.put(group, group);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (filteredGroups.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// The list of afterMethods to run<NEW_LINE>Map<ITestNGMethod, ITestNGMethod> afterMethods = Maps.newHashMap();<NEW_LINE>// Now filteredGroups contains all the groups for which we need to run the afterGroups<NEW_LINE>// method. Find all the methods that correspond to these groups and invoke them.<NEW_LINE>for (String g : filteredGroups.values()) {<NEW_LINE>List<ITestNGMethod> methods = arguments.<MASK><NEW_LINE>// Note: should put them in a map if we want to make sure the same afterGroups<NEW_LINE>// doesn't get run twice<NEW_LINE>if (methods != null) {<NEW_LINE>for (ITestNGMethod m : methods) {<NEW_LINE>afterMethods.put(m, m);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Got our afterMethods, invoke them<NEW_LINE>ITestNGMethod[] filteredConfigurations = afterMethods.keySet().stream().filter(ConfigInvoker::isGroupLevelConfigurationMethod).toArray(ITestNGMethod[]::new);<NEW_LINE>if (filteredConfigurations.length == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// don't pass the IClass or the instance as the method may be external<NEW_LINE>// the invocation must be similar to @BeforeTest/@BeforeSuite<NEW_LINE>ConfigMethodArguments configMethodArguments = new Builder().usingConfigMethodsAs(filteredConfigurations).forSuite(arguments.getSuite()).usingParameters(arguments.getParameters()).usingInstance(arguments.getInstance()).forTestMethod(arguments.getTestMethod()).build();<NEW_LINE>invokeConfigurations(configMethodArguments);<NEW_LINE>// Remove the groups so they don't get run again<NEW_LINE>arguments.getGroupMethods().removeAfterGroups(filteredGroups.keySet());<NEW_LINE>} | getGroupMethods().getAfterGroupMethodsForGroup(g); |
869,203 | protected boolean afterSave(boolean newRecord, boolean success) {<NEW_LINE>if (!success)<NEW_LINE>return success;<NEW_LINE>if (newRecord) {<NEW_LINE>StringBuffer sb = new StringBuffer("INSERT INTO AD_TreeNodeCMT " + "(AD_Client_ID,AD_Org_ID, IsActive,Created,CreatedBy,Updated,UpdatedBy, " + "AD_Tree_ID, Node_ID, Parent_ID, SeqNo) " + "VALUES (").append(getAD_Client_ID()).append(",0, 'Y', SysDate, 0, SysDate, 0,").append(getAD_Tree_ID()).append(",").append(get_ID()).append(", 0, 999)");<NEW_LINE>int no = DB.executeUpdate(sb.<MASK><NEW_LINE>if (no > 0)<NEW_LINE>log.fine("#" + no + " - TreeType=CMT");<NEW_LINE>else<NEW_LINE>log.warning("#" + no + " - TreeType=CMT");<NEW_LINE>return no > 0;<NEW_LINE>}<NEW_LINE>if (!newRecord) {<NEW_LINE>org.compiere.cm.CacheHandler thisHandler = new org.compiere.cm.CacheHandler(org.compiere.cm.CacheHandler.convertJNPURLToCacheURL(getCtx().getProperty("java.naming.provider.url")), log, getCtx(), get_TrxName());<NEW_LINE>if (!isInclude()) {<NEW_LINE>// Clean Main Templates on a single level.<NEW_LINE>thisHandler.cleanTemplate(this.get_ID());<NEW_LINE>} else {<NEW_LINE>// Since we not know which main templates we will clean up all!<NEW_LINE>thisHandler.emptyTemplate();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return success;<NEW_LINE>} | toString(), get_TrxName()); |
565,656 | public static void main(String[] args) {<NEW_LINE>Scanner sc = new Scanner(System.in);<NEW_LINE>System.out.println("Enter the number of rows of the first matrix");<NEW_LINE>int n1 = sc.nextInt();<NEW_LINE>System.out.println("Enter the number of columns of the first matrix");<NEW_LINE>int m1 = sc.nextInt();<NEW_LINE>System.out.println("Enter the elements of the first matrix");<NEW_LINE>int[][] arr_1 = new int[n1][m1];<NEW_LINE>for (int i = 0; i < n1; i++) {<NEW_LINE>for (int j = 0; j < m1; j++) {<NEW_LINE>arr_1[i][j] = sc.nextInt();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("Enter the number of rows of the second matrix");<NEW_LINE>int n2 = sc.nextInt();<NEW_LINE><MASK><NEW_LINE>int m2 = sc.nextInt();<NEW_LINE>System.out.println("Enter the elements of the second matrix");<NEW_LINE>int[][] arr_2 = new int[n2][m2];<NEW_LINE>for (int i = 0; i < n2; i++) {<NEW_LINE>for (int j = 0; j < m2; j++) {<NEW_LINE>arr_2[i][j] = sc.nextInt();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int[][] res = new int[n1][m1];<NEW_LINE>for (int i = 0; i < n1; i++) {<NEW_LINE>for (int j = 0; j < m1; j++) {<NEW_LINE>res[i][j] = arr_1[i][j] + arr_2[i][j];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("The result of matrix addition is :");<NEW_LINE>for (int i = 0; i < n1; i++) {<NEW_LINE>for (int j = 0; j < m1; j++) {<NEW_LINE>System.out.print(res[i][j] + " ");<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>sc.close();<NEW_LINE>} | System.out.println("Enter the number of columns of the second matrix"); |
1,644,027 | final StartSupportDataExportResult executeStartSupportDataExport(StartSupportDataExportRequest startSupportDataExportRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(startSupportDataExportRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StartSupportDataExportRequest> request = null;<NEW_LINE>Response<StartSupportDataExportResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StartSupportDataExportRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Marketplace Commerce Analytics");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartSupportDataExport");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StartSupportDataExportResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartSupportDataExportResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(startSupportDataExportRequest)); |
436,622 | final public SemgrexPattern SubNode(GraphRelation r) throws ParseException {<NEW_LINE>SemgrexPattern result = null;<NEW_LINE>SemgrexPattern child = null;<NEW_LINE>switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {<NEW_LINE>case 11:<NEW_LINE>{<NEW_LINE>jj_consume_token(11);<NEW_LINE>result = SubNode(r);<NEW_LINE>jj_consume_token(12);<NEW_LINE>switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {<NEW_LINE>case RELATION:<NEW_LINE>case ALIGNRELN:<NEW_LINE>case IDENTIFIER:<NEW_LINE>case 15:<NEW_LINE>case 16:<NEW_LINE>case 17:<NEW_LINE>{<NEW_LINE>child = RelationDisj();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>jj_la1[2] = jj_gen;<NEW_LINE>;<NEW_LINE>}<NEW_LINE>if (child != null) {<NEW_LINE>List<SemgrexPattern> newChildren = new ArrayList<SemgrexPattern>();<NEW_LINE>newChildren.<MASK><NEW_LINE>newChildren.add(child);<NEW_LINE>result.setChild(new CoordinationPattern(false, newChildren, true, false));<NEW_LINE>}<NEW_LINE>{<NEW_LINE>if ("" != null)<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case 15:<NEW_LINE>case 17:<NEW_LINE>case 21:<NEW_LINE>{<NEW_LINE>result = ModNode(r);<NEW_LINE>switch((jj_ntk == -1) ? jj_ntk_f() : jj_ntk) {<NEW_LINE>case RELATION:<NEW_LINE>case ALIGNRELN:<NEW_LINE>case IDENTIFIER:<NEW_LINE>case 15:<NEW_LINE>case 16:<NEW_LINE>case 17:<NEW_LINE>{<NEW_LINE>child = RelationDisj();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>jj_la1[3] = jj_gen;<NEW_LINE>;<NEW_LINE>}<NEW_LINE>if (child != null)<NEW_LINE>result.setChild(child);<NEW_LINE>{<NEW_LINE>if ("" != null)<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>jj_la1[4] = jj_gen;<NEW_LINE>jj_consume_token(-1);<NEW_LINE>throw new ParseException();<NEW_LINE>}<NEW_LINE>throw new Error("Missing return statement in function");<NEW_LINE>} | addAll(result.getChildren()); |
1,265,112 | private Map<String, Object> createOnlineActivityJSONMap(SessionsMutator sessionsMutator) {<NEW_LINE>long now = System.currentTimeMillis();<NEW_LINE>long monthAgo = now - TimeUnit.DAYS.toMillis(30L);<NEW_LINE>long weekAgo = now - TimeUnit.DAYS.toMillis(7L);<NEW_LINE>SessionsMutator sessions30d = sessionsMutator.filterSessionsBetween(monthAgo, now);<NEW_LINE>SessionsMutator sessions7d = sessions30d.filterSessionsBetween(weekAgo, now);<NEW_LINE>Map<String, Object> onlineActivity = new HashMap<>();<NEW_LINE>onlineActivity.put("playtime_30d", timeAmount.apply<MASK><NEW_LINE>onlineActivity.put("active_playtime_30d", timeAmount.apply(sessions30d.toActivePlaytime()));<NEW_LINE>onlineActivity.put("afk_time_30d", timeAmount.apply(sessions30d.toAfkTime()));<NEW_LINE>onlineActivity.put("average_session_length_30d", timeAmount.apply(sessions30d.toAverageSessionLength()));<NEW_LINE>onlineActivity.put("median_session_length_30d", timeAmount.apply(sessions30d.toMedianSessionLength()));<NEW_LINE>onlineActivity.put("session_count_30d", sessions30d.count());<NEW_LINE>onlineActivity.put("player_kill_count_30d", sessions30d.toPlayerKillCount());<NEW_LINE>onlineActivity.put("mob_kill_count_30d", sessions30d.toMobKillCount());<NEW_LINE>onlineActivity.put("death_count_30d", sessions30d.toDeathCount());<NEW_LINE>onlineActivity.put("playtime_7d", timeAmount.apply(sessions7d.toPlaytime()));<NEW_LINE>onlineActivity.put("active_playtime_7d", timeAmount.apply(sessions7d.toActivePlaytime()));<NEW_LINE>onlineActivity.put("afk_time_7d", timeAmount.apply(sessions7d.toAfkTime()));<NEW_LINE>onlineActivity.put("average_session_length_7d", timeAmount.apply(sessions7d.toAverageSessionLength()));<NEW_LINE>onlineActivity.put("median_session_length_7d", timeAmount.apply(sessions7d.toMedianSessionLength()));<NEW_LINE>onlineActivity.put("session_count_7d", sessions7d.count());<NEW_LINE>onlineActivity.put("player_kill_count_7d", sessions7d.toPlayerKillCount());<NEW_LINE>onlineActivity.put("mob_kill_count_7d", sessions7d.toMobKillCount());<NEW_LINE>onlineActivity.put("death_count_7d", sessions7d.toDeathCount());<NEW_LINE>return onlineActivity;<NEW_LINE>} | (sessions30d.toPlaytime())); |
1,048,035 | public void init(Map<String, Object> params) {<NEW_LINE>super.init(params);<NEW_LINE>diffTable.setStyleProvider(new DiffStyleProvider());<NEW_LINE>diffTable.setIconProvider(new DiffIconProvider());<NEW_LINE>diffDs.addItemChangeListener(e -> {<NEW_LINE>boolean valuesVisible = (e.getItem() != null) && (e.getItem().hasStateValues());<NEW_LINE>boolean stateVisible = (e.getItem() != null) && (e.getItem().hasStateValues() && e.getItem().itemStateVisible());<NEW_LINE>valuesHeader.setVisible(stateVisible || valuesVisible);<NEW_LINE>itemStateField.setVisible(stateVisible);<NEW_LINE>diffValuesField.setVisible(valuesVisible);<NEW_LINE>if (e.getItem() != null) {<NEW_LINE>EntityPropertyDiff.ItemState itemState = e.getItem().getItemState();<NEW_LINE>if (itemState != EntityPropertyDiff.ItemState.Normal) {<NEW_LINE>String messageCode <MASK><NEW_LINE>itemStateLabel.setValue(getMessage(messageCode));<NEW_LINE>itemStateLabel.setVisible(true);<NEW_LINE>} else {<NEW_LINE>itemStateField.setVisible(false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | = "ItemState." + itemState.toString(); |
354,338 | public boolean isConvertible(MAcctSchema acctSchema) {<NEW_LINE>// No Currency in document<NEW_LINE>if (getC_Currency_ID() == NO_CURRENCY) {<NEW_LINE>log.fine("(none) - " + toString());<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Journal from a different acct schema<NEW_LINE>if (this instanceof Doc_GLJournal) {<NEW_LINE>int glj_as = ((Integer) p_po.get_Value("C_AcctSchema_ID")).intValue();<NEW_LINE>if (acctSchema.getC_AcctSchema_ID() != glj_as)<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Get All Currencies<NEW_LINE>HashSet<Integer> set = new HashSet<Integer>();<NEW_LINE>set.add(new Integer(getC_Currency_ID()));<NEW_LINE>for (int i = 0; p_lines != null && i < p_lines.length; i++) {<NEW_LINE>int C_Currency_ID = p_lines[i].getC_Currency_ID();<NEW_LINE>if (C_Currency_ID != NO_CURRENCY)<NEW_LINE>set.add(new Integer(C_Currency_ID));<NEW_LINE>}<NEW_LINE>// just one and the same<NEW_LINE>if (set.size() == 1 && acctSchema.getC_Currency_ID() == getC_Currency_ID()) {<NEW_LINE>log.fine("(same) Cur=" + getC_Currency_ID() + " - " + toString());<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>boolean convertible = true;<NEW_LINE>Iterator<Integer<MASK><NEW_LINE>while (it.hasNext() && convertible) {<NEW_LINE>int C_Currency_ID = it.next().intValue();<NEW_LINE>if (C_Currency_ID != acctSchema.getC_Currency_ID()) {<NEW_LINE>BigDecimal amt = MConversionRate.getRate(C_Currency_ID, acctSchema.getC_Currency_ID(), getDateAcct(), getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID());<NEW_LINE>if (amt == null) {<NEW_LINE>convertible = false;<NEW_LINE>log.warning("NOT from C_Currency_ID=" + C_Currency_ID + " to " + acctSchema.getC_Currency_ID() + " - " + toString());<NEW_LINE>} else<NEW_LINE>log.fine("From C_Currency_ID=" + C_Currency_ID);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.fine("Convertible=" + convertible + ", AcctSchema C_Currency_ID=" + acctSchema.getC_Currency_ID() + " - " + toString());<NEW_LINE>return convertible;<NEW_LINE>} | > it = set.iterator(); |
702,746 | final DetectLabelsResult executeDetectLabels(DetectLabelsRequest detectLabelsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(detectLabelsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DetectLabelsRequest> request = null;<NEW_LINE>Response<DetectLabelsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DetectLabelsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(detectLabelsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Rekognition");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DetectLabels");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DetectLabelsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DetectLabelsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,502,668 | public void init() {<NEW_LINE>List<String> fileList = getFilesList();<NEW_LINE>if (fileList.size() > 0) {<NEW_LINE>try {<NEW_LINE>List<String> paths <MASK><NEW_LINE>for (String s : fileList) {<NEW_LINE>if (!paths.contains(s)) {<NEW_LINE>paths.add(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Collections.sort(paths, Collections.reverseOrder());<NEW_LINE>File listFile = createTempFileWithFilesList();<NEW_LINE>writeCleaningFileList(listFile, paths);<NEW_LINE>File cleanerFile = getCleanerFile();<NEW_LINE>writeCleaner(cleanerFile);<NEW_LINE>SystemUtils.correctFilesPermissions(cleanerFile);<NEW_LINE>runningCommand = new ArrayList<String>();<NEW_LINE>runningCommand.add(cleanerFile.getCanonicalPath());<NEW_LINE>runningCommand.add(listFile.getCanonicalPath());<NEW_LINE>} catch (IOException e) {<NEW_LINE>// do nothing then..<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = new ArrayList<String>(); |
449,166 | private PrivacyController createPrivacyController() {<NEW_LINE>final Optional<BigInteger> chainId = protocolSchedule.getChainId();<NEW_LINE>if (privacyParameters.isPrivacyPluginEnabled()) {<NEW_LINE>return new PluginPrivacyController(blockchainQueries.getBlockchain(), privacyParameters, chainId, createPrivateTransactionSimulator(), createPrivateNonceProvider(), privacyParameters.getPrivateWorldStateReader());<NEW_LINE>} else {<NEW_LINE>final PrivacyController restrictedPrivacyController;<NEW_LINE>if (privacyParameters.isFlexiblePrivacyGroupsEnabled()) {<NEW_LINE>restrictedPrivacyController = new FlexiblePrivacyController(blockchainQueries.getBlockchain(), privacyParameters, chainId, createPrivateTransactionSimulator(), createPrivateNonceProvider(<MASK><NEW_LINE>} else {<NEW_LINE>restrictedPrivacyController = new RestrictedDefaultPrivacyController(blockchainQueries.getBlockchain(), privacyParameters, chainId, createPrivateTransactionSimulator(), createPrivateNonceProvider(), privacyParameters.getPrivateWorldStateReader());<NEW_LINE>}<NEW_LINE>return privacyParameters.isMultiTenancyEnabled() ? new MultiTenancyPrivacyController(restrictedPrivacyController) : restrictedPrivacyController;<NEW_LINE>}<NEW_LINE>} | ), privacyParameters.getPrivateWorldStateReader()); |
732,449 | public void notifyAppearStateChange(int firstVisible, int lastVisible, int directionX, int directionY) {<NEW_LINE>if (mAppearChangeRunnable != null) {<NEW_LINE>getHostView().removeCallbacks(mAppearChangeRunnable);<NEW_LINE>mAppearChangeRunnable = null;<NEW_LINE>}<NEW_LINE>// notify appear state<NEW_LINE>Iterator<AppearanceHelper> it = mAppearComponents.values().iterator();<NEW_LINE>String direction = directionY > 0 ? Constants.Value.DIRECTION_UP : directionY < 0 ? Constants.Value.DIRECTION_DOWN : null;<NEW_LINE>if (getOrientation() == Constants.Orientation.HORIZONTAL && directionX != 0) {<NEW_LINE>direction = directionX > 0 ? Constants.Value.DIRECTION_LEFT : Constants.Value.DIRECTION_RIGHT;<NEW_LINE>}<NEW_LINE>while (it.hasNext()) {<NEW_LINE>AppearanceHelper item = it.next();<NEW_LINE>WXComponent component = item.getAwareChild();<NEW_LINE>if (!item.isWatch()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>View view = component.getHostView();<NEW_LINE>if (view == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>boolean outOfVisibleRange = !ViewCompat.isAttachedToWindow(view);<NEW_LINE>boolean visible = (!outOfVisibleRange) && item.isViewVisible(true);<NEW_LINE>int <MASK><NEW_LINE>if (result == AppearanceHelper.RESULT_NO_CHANGE) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (WXEnvironment.isApkDebugable()) {<NEW_LINE>WXLogUtils.d("appear", "item " + item.getCellPositionINScollable() + " result " + result);<NEW_LINE>}<NEW_LINE>component.notifyAppearStateChange(result == AppearanceHelper.RESULT_APPEAR ? Constants.Event.APPEAR : Constants.Event.DISAPPEAR, direction);<NEW_LINE>}<NEW_LINE>} | result = item.setAppearStatus(visible); |
1,486,393 | public GraphQLInterfaceType toGraphQLType(String typeName, AnnotatedType javaType, TypeMappingEnvironment env) {<NEW_LINE>BuildContext buildContext = env.buildContext;<NEW_LINE>GraphQLInterfaceType.Builder typeBuilder = newInterface().name(typeName).description(buildContext.typeInfoGenerator.generateTypeDescription(javaType, buildContext.messageBundle));<NEW_LINE>List<GraphQLFieldDefinition> fields = objectTypeMapper.getFields(typeName, javaType, env);<NEW_LINE>fields.forEach(typeBuilder::field);<NEW_LINE>typeBuilder.withDirective(Directives.mappedType(javaType));<NEW_LINE>buildContext.directiveBuilder.buildInterfaceTypeDirectives(javaType, buildContext.directiveBuilderParams()).forEach(directive -> typeBuilder.withDirective(env.operationMapper.toGraphQLDirective(directive, buildContext)));<NEW_LINE>typeBuilder.comparatorRegistry(buildContext.comparatorRegistry(javaType));<NEW_LINE>GraphQLInterfaceType type = typeBuilder.build();<NEW_LINE>buildContext.codeRegistry.<MASK><NEW_LINE>registerImplementations(javaType, type, env);<NEW_LINE>return type;<NEW_LINE>} | typeResolver(type, buildContext.typeResolver); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.