idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,642,643 | private static List<Entry> calculateElevationArray(GPXTrackAnalysis analysis, GPXDataSetAxisType axisType, float divX, float convEle, boolean useGeneralTrackPoints, boolean calcWithoutGaps) {<NEW_LINE>List<Entry> values = new ArrayList<>();<NEW_LINE>List<Elevation> elevationData = analysis.elevationData;<NEW_LINE>float nextX = 0;<NEW_LINE>float nextY;<NEW_LINE>float elev;<NEW_LINE>float prevElevOrig = -80000;<NEW_LINE>float prevElev = 0;<NEW_LINE>int i = -1;<NEW_LINE>int lastIndex = elevationData.size() - 1;<NEW_LINE>Entry lastEntry = null;<NEW_LINE>float lastXSameY = -1;<NEW_LINE>boolean hasSameY = false;<NEW_LINE>float x = 0f;<NEW_LINE>for (Elevation e : elevationData) {<NEW_LINE>i++;<NEW_LINE>if (axisType == GPXDataSetAxisType.TIME || axisType == GPXDataSetAxisType.TIMEOFDAY) {<NEW_LINE>x = e.time;<NEW_LINE>} else {<NEW_LINE>x = e.distance;<NEW_LINE>}<NEW_LINE>if (x >= 0) {<NEW_LINE>if (!(calcWithoutGaps && e.firstPoint && lastEntry != null)) {<NEW_LINE>nextX += x / divX;<NEW_LINE>}<NEW_LINE>if (!Float.isNaN(e.elevation)) {<NEW_LINE>elev = e.elevation;<NEW_LINE>if (prevElevOrig != -80000) {<NEW_LINE>if (elev > prevElevOrig) {<NEW_LINE>// elev -= 1f;<NEW_LINE>} else if (prevElevOrig == elev && i < lastIndex) {<NEW_LINE>hasSameY = true;<NEW_LINE>lastXSameY = nextX;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (prevElev == elev && i < lastIndex) {<NEW_LINE>hasSameY = true;<NEW_LINE>lastXSameY = nextX;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (hasSameY) {<NEW_LINE>values.add(new Entry(lastXSameY<MASK><NEW_LINE>}<NEW_LINE>hasSameY = false;<NEW_LINE>}<NEW_LINE>if (useGeneralTrackPoints && e.firstPoint && lastEntry != null) {<NEW_LINE>values.add(new Entry(nextX, lastEntry.getY()));<NEW_LINE>}<NEW_LINE>prevElevOrig = e.elevation;<NEW_LINE>prevElev = elev;<NEW_LINE>nextY = elev * convEle;<NEW_LINE>lastEntry = new Entry(nextX, nextY);<NEW_LINE>values.add(lastEntry);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return values;<NEW_LINE>} | , lastEntry.getY())); |
428,261 | protected final <R extends AbstractPutObjectRequest> R wrapWithCipher(final R request, ContentCryptoMaterial cekMaterial) {<NEW_LINE>// Create a new metadata object if there is no metadata already.<NEW_LINE>ObjectMetadata metadata = request.getMetadata();<NEW_LINE>if (metadata == null) {<NEW_LINE>metadata = new ObjectMetadata();<NEW_LINE>}<NEW_LINE>// Removes the original content MD5 if present from the meta data.<NEW_LINE>metadata.setContentMD5(null);<NEW_LINE>// Record the original, unencrypted content-length so it can be accessed<NEW_LINE>// later<NEW_LINE>final long plaintextLength = plaintextLength(request, metadata);<NEW_LINE>if (plaintextLength >= 0) {<NEW_LINE>metadata.addUserMetadata(Headers.UNENCRYPTED_CONTENT_LENGTH, Long.toString(plaintextLength));<NEW_LINE>// Put the ciphertext length in the metadata<NEW_LINE>metadata.setContentLength(ciphertextLength(plaintextLength));<NEW_LINE>}<NEW_LINE>request.setMetadata(metadata);<NEW_LINE>request.setInputStream(newS3CipherLiteInputStream<MASK><NEW_LINE>// Treat all encryption requests as input stream upload requests, not as<NEW_LINE>// file upload requests.<NEW_LINE>request.setFile(null);<NEW_LINE>return request;<NEW_LINE>} | (request, cekMaterial, plaintextLength)); |
1,840,839 | protected void dswap(long N, INDArray X, int incX, INDArray Y, int incY) {<NEW_LINE>Nd4j.getExecutioner().push();<NEW_LINE>CudaContext ctx = allocator.getFlowController().prepareAction(Y, X);<NEW_LINE>CublasPointer xCPointer = new CublasPointer(X, ctx);<NEW_LINE>CublasPointer yCPointer = new CublasPointer(Y, ctx);<NEW_LINE>cublasHandle_t handle = ctx.getCublasHandle();<NEW_LINE>synchronized (handle) {<NEW_LINE>cublasSetStream_v2(new cublasContext(handle), new CUstream_st(ctx.getCublasStream()));<NEW_LINE>cublasDswap_v2(new cublasContext(handle), (int) N, (DoublePointer) xCPointer.getDevicePointer(), incX, (DoublePointer) <MASK><NEW_LINE>}<NEW_LINE>allocator.registerAction(ctx, Y, X);<NEW_LINE>OpExecutionerUtil.checkForAny(Y);<NEW_LINE>} | yCPointer.getDevicePointer(), incY); |
1,502,003 | private JPanel optionalSettings() {<NEW_LINE>JPanel panel = <MASK><NEW_LINE>panel.setOpaque(false);<NEW_LINE>JPanel description = new JPanel();<NEW_LINE>description.setLayout(new BoxLayout(description, BoxLayout.Y_AXIS));<NEW_LINE>description.setOpaque(false);<NEW_LINE>JPanel name = new JPanel(new FlowLayout(FlowLayout.LEADING));<NEW_LINE>name.setOpaque(false);<NEW_LINE>JLabel nameLbl = new JLabel(MessageUtils.getLocalizedMessage("createindex.label.option"));<NEW_LINE>name.add(nameLbl);<NEW_LINE>description.add(name);<NEW_LINE>JTextArea descTA1 = new JTextArea(MessageUtils.getLocalizedMessage("createindex.textarea.data_help1"));<NEW_LINE>descTA1.setPreferredSize(new Dimension(550, 20));<NEW_LINE>descTA1.setBorder(BorderFactory.createEmptyBorder(2, 10, 10, 5));<NEW_LINE>descTA1.setOpaque(false);<NEW_LINE>descTA1.setLineWrap(true);<NEW_LINE>descTA1.setEditable(false);<NEW_LINE>description.add(descTA1);<NEW_LINE>JPanel link = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 1));<NEW_LINE>link.setOpaque(false);<NEW_LINE>JLabel linkLbl = FontUtils.toLinkText(new URLLabel(MessageUtils.getLocalizedMessage("createindex.label.data_link")));<NEW_LINE>link.add(linkLbl);<NEW_LINE>description.add(link);<NEW_LINE>JTextArea descTA2 = new JTextArea(MessageUtils.getLocalizedMessage("createindex.textarea.data_help2"));<NEW_LINE>descTA2.setPreferredSize(new Dimension(550, 50));<NEW_LINE>descTA2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 5));<NEW_LINE>descTA2.setOpaque(false);<NEW_LINE>descTA2.setLineWrap(true);<NEW_LINE>descTA2.setEditable(false);<NEW_LINE>description.add(descTA2);<NEW_LINE>panel.add(description, BorderLayout.PAGE_START);<NEW_LINE>JPanel dataDirPath = new JPanel(new FlowLayout(FlowLayout.LEADING));<NEW_LINE>dataDirPath.setOpaque(false);<NEW_LINE>dataDirPath.add(new JLabel(MessageUtils.getLocalizedMessage("createindex.label.datadir")));<NEW_LINE>dataDirPath.add(dataDirTF);<NEW_LINE>dataDirPath.add(dataBrowseBtn);<NEW_LINE>dataDirPath.add(clearBtn);<NEW_LINE>panel.add(dataDirPath, BorderLayout.CENTER);<NEW_LINE>return panel;<NEW_LINE>} | new JPanel(new BorderLayout()); |
973,377 | private void reorderNode(ProgramNode destNode, int dropAction, int relativeMousePos, ProgramNode parentNode, ProgramNode dropNode) throws NotFoundException, CircularDependencyException, DuplicateGroupException {<NEW_LINE>if (!reorderChildren(destNode, dropNode, relativeMousePos)) {<NEW_LINE>int index;<NEW_LINE>// this is the case where destNode and dropNode have different parents...<NEW_LINE>if (relativeMousePos < 0) {<NEW_LINE>if (parentNode == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>index = parentNode.getIndex(destNode);<NEW_LINE>} else {<NEW_LINE>// if destNode is a module and if it is expanded,<NEW_LINE>// then dropNode will go inside the module<NEW_LINE>if (destNode.isModule() && tree.isExpanded(destNode.getTreePath())) {<NEW_LINE>index = 0;<NEW_LINE>destNode = (ProgramNode) destNode.getChildAt(0);<NEW_LINE>} else {<NEW_LINE>// destNode is a module or a fragment, but place<NEW_LINE>// destNode after it<NEW_LINE>index = parentNode.getIndex(destNode);<NEW_LINE>++index;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>addGroup(<MASK><NEW_LINE>ProgramNode child = (ProgramNode) parentNode.getChildAt(index);<NEW_LINE>selectNode(dropNode, child);<NEW_LINE>}<NEW_LINE>} | destNode, dropNode, index, dropAction); |
850,852 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {<NEW_LINE>super.onActivityResult(requestCode, resultCode, data);<NEW_LINE>if (requestCode == Constants.INTENT_SETTINGS_AUTHENTICATE) {<NEW_LINE>if (resultCode == RESULT_OK) {<NEW_LINE>byte[] authKey = data.getByteArrayExtra(Constants.EXTRA_AUTH_PASSWORD_KEY);<NEW_LINE>String newEnc = data.getStringExtra(Constants.EXTRA_AUTH_NEW_ENCRYPTION);<NEW_LINE>if (authKey != null && authKey.length > 0 && newEnc != null && !newEnc.isEmpty()) {<NEW_LINE>EncryptionType newEncType = EncryptionType.valueOf(newEnc);<NEW_LINE>startEncryptionChangeTask(newEncType, authKey);<NEW_LINE>} else {<NEW_LINE>Snackbar.make(fragment.getView(), R.string.settings_toast_encryption_no_key, BaseTransientBottomBar.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Snackbar.make(fragment.getView(), R.string.settings_toast_encryption_auth_failed, BaseTransientBottomBar.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>} else if (requestCode == Constants.INTENT_SETTINGS_BACKUP_LOCATION && resultCode == RESULT_OK) {<NEW_LINE>Uri treeUri = data.getData();<NEW_LINE>if (treeUri != null) {<NEW_LINE>final int takeFlags = data.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);<NEW_LINE>getContentResolver().takePersistableUriPermission(treeUri, takeFlags);<NEW_LINE>settings.setBackupLocation(treeUri);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Handled in OpenPgpKeyPreference<NEW_LINE>fragment.pgpSigningKey.<MASK><NEW_LINE>}<NEW_LINE>} | handleOnActivityResult(requestCode, resultCode, data); |
1,260,667 | public Request<UpdateApplicationSettingsRequest> marshall(UpdateApplicationSettingsRequest updateApplicationSettingsRequest) {<NEW_LINE>if (updateApplicationSettingsRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(UpdateApplicationSettingsRequest)");<NEW_LINE>}<NEW_LINE>Request<UpdateApplicationSettingsRequest> request = new DefaultRequest<UpdateApplicationSettingsRequest>(updateApplicationSettingsRequest, "AmazonPinpoint");<NEW_LINE>request.setHttpMethod(HttpMethodName.PUT);<NEW_LINE>String uriResourcePath = "/v1/apps/{application-id}/settings";<NEW_LINE>uriResourcePath = uriResourcePath.replace("{application-id}", (updateApplicationSettingsRequest.getApplicationId() == null) ? "" : StringUtils.fromString(updateApplicationSettingsRequest.getApplicationId()));<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>if (updateApplicationSettingsRequest.getWriteApplicationSettingsRequest() != null) {<NEW_LINE>WriteApplicationSettingsRequest writeApplicationSettingsRequest = updateApplicationSettingsRequest.getWriteApplicationSettingsRequest();<NEW_LINE>WriteApplicationSettingsRequestJsonMarshaller.getInstance().marshall(writeApplicationSettingsRequest, jsonWriter);<NEW_LINE>}<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer<MASK><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>} | .toString(content.length)); |
693,306 | public void processImage(int sourceID, long frameID, BufferedImage buffered, ImageBase input) {<NEW_LINE>GIntegralImageOps.transform((T) input, integral);<NEW_LINE>intensity.reshape(integral.width, input.height);<NEW_LINE>List<BufferedImage> layers = new ArrayList<>();<NEW_LINE>List<String> labels = new ArrayList<>();<NEW_LINE>int skip = 0;<NEW_LINE>for (int octave = 0; octave < 4; octave++) {<NEW_LINE>if (skip == 0)<NEW_LINE>skip = 1;<NEW_LINE>else<NEW_LINE>skip = skip + skip;<NEW_LINE>for (int sizeIndex = 0; sizeIndex < 4; sizeIndex++) {<NEW_LINE>int block = 1 + skip * 2 * (sizeIndex + 1);<NEW_LINE>int size = 3 * block;<NEW_LINE>GIntegralImageFeatureIntensity.hessian(integral, 1, size, intensity, null, null, null);<NEW_LINE>float maxAbs = ImageStatistics.maxAbs(intensity);<NEW_LINE>BufferedImage b = VisualizeImageData.colorizeSign(intensity, null, maxAbs);<NEW_LINE>labels.add(String.format("Oct = %2d size %3d"<MASK><NEW_LINE>layers.add(b);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>SwingUtilities.invokeLater(() -> {<NEW_LINE>guiIntensity.reset();<NEW_LINE>guiIntensity.addImage(buffered, "Original");<NEW_LINE>guiIntensity.addImage(input, "Gray");<NEW_LINE>for (int i = 0; i < layers.size(); i++) {<NEW_LINE>guiIntensity.addImage(layers.get(i), labels.get(i), ScaleOptions.DOWN);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | , octave + 1, size)); |
732,267 | private void maybeUpdateExportDeclaration(NodeTraversal t, Node n) {<NEW_LINE>if (!currentScript.isModule || !n.getString().equals("exports") || !isAssignTarget(n)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Node assignNode = n.getParent();<NEW_LINE>Node rhs = assignNode.getLastChild();<NEW_LINE>if (rhs != currentScript.defaultExport.rhs) {<NEW_LINE>// This script has duplicate 'exports = ' assignments. Preserve the rhs as an expression but<NEW_LINE>// don't declare it as a global variable.<NEW_LINE>assignNode.replaceWith(rhs.detach());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!currentScript.declareLegacyNamespace && currentScript.defaultExportLocalName != null) {<NEW_LINE>assignNode<MASK><NEW_LINE>Node binaryNamespaceName = astFactory.createName(currentScript.getBinaryNamespace(), type(n));<NEW_LINE>this.declareGlobalVariable(binaryNamespaceName, t);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Rewrite "exports = ..." as "var module$exports$foo$Bar = ..."<NEW_LINE>Node jsdocNode;<NEW_LINE>if (currentScript.declareLegacyNamespace) {<NEW_LINE>Node legacyQname = this.astFactory.createQName(this.globalTypedScope, currentScript.namespaceId).srcrefTree(n);<NEW_LINE>legacyQname.setJSType(n.getJSType());<NEW_LINE>n.replaceWith(legacyQname);<NEW_LINE>jsdocNode = assignNode;<NEW_LINE>} else {<NEW_LINE>rhs.detach();<NEW_LINE>Node exprResultNode = assignNode.getParent();<NEW_LINE>Node binaryNamespaceName = astFactory.createName(currentScript.getBinaryNamespace(), type(n));<NEW_LINE>binaryNamespaceName.setOriginalName("exports");<NEW_LINE>this.declareGlobalVariable(binaryNamespaceName, t);<NEW_LINE>Node exportsObjectCreationNode = IR.var(binaryNamespaceName, rhs);<NEW_LINE>exportsObjectCreationNode.srcrefTreeIfMissing(exprResultNode);<NEW_LINE>exportsObjectCreationNode.putBooleanProp(Node.IS_NAMESPACE, true);<NEW_LINE>exprResultNode.replaceWith(exportsObjectCreationNode);<NEW_LINE>jsdocNode = exportsObjectCreationNode;<NEW_LINE>currentScript.hasCreatedExportObject = true;<NEW_LINE>}<NEW_LINE>markConstAndCopyJsDoc(assignNode, jsdocNode);<NEW_LINE>compiler.reportChangeToEnclosingScope(jsdocNode);<NEW_LINE>maybeUpdateExportObjectLiteral(t, rhs);<NEW_LINE>return;<NEW_LINE>} | .getParent().detach(); |
1,079,003 | public ConstraintDefinition createPropertyExistenceConstraint(String name, RelationshipType type, String propertyKey) {<NEW_LINE>try {<NEW_LINE>TokenWrite tokenWrite = transaction.tokenWrite();<NEW_LINE>int typeId = tokenWrite.<MASK><NEW_LINE>int[] propertyKeyId = getOrCreatePropertyKeyIds(tokenWrite, propertyKey);<NEW_LINE>RelationTypeSchemaDescriptor schema = forRelType(typeId, propertyKeyId);<NEW_LINE>ConstraintDescriptor constraint = transaction.schemaWrite().relationshipPropertyExistenceConstraintCreate(schema, name);<NEW_LINE>return new RelationshipPropertyExistenceConstraintDefinition(this, constraint, type, propertyKey);<NEW_LINE>} catch (AlreadyConstrainedException | CreateConstraintFailureException | RepeatedSchemaComponentException e) {<NEW_LINE>throw new ConstraintViolationException(e.getUserMessage(transaction.tokenRead()), e);<NEW_LINE>} catch (IllegalTokenNameException e) {<NEW_LINE>throw new IllegalArgumentException(e);<NEW_LINE>} catch (InvalidTransactionTypeKernelException | SchemaKernelException e) {<NEW_LINE>throw new ConstraintViolationException(e.getMessage(), e);<NEW_LINE>} catch (KernelException e) {<NEW_LINE>throw new TransactionFailureException("Unknown error trying to create token ids", e);<NEW_LINE>}<NEW_LINE>} | relationshipTypeGetOrCreateForName(type.name()); |
463,713 | public final AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {<NEW_LINE>if ((!session.isSingleSite() && directory.isRoot()) || (session.isSingleSite() && session.isHome(directory))) {<NEW_LINE>return getRoot(directory, listener);<NEW_LINE>}<NEW_LINE>final AttributedList<Path> result = processList(directory, listener);<NEW_LINE>if (result != AttributedList.<Path>emptyList()) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>final GraphSession.ContainerItem container = session.getContainer(directory);<NEW_LINE>if (container.getCollectionPath().map(p -> container.isContainerInCollection() && SITES_CONTAINER.equals(p.getName())).orElse(false)) {<NEW_LINE>return addSiteItems(directory, listener);<NEW_LINE>}<NEW_LINE>final Optional<ListService> collectionListService = container.getCollectionPath().map(p -> {<NEW_LINE>if (SITES_CONTAINER.equals(p.getName())) {<NEW_LINE>return new SitesListService(session, fileid);<NEW_LINE>} else if (DRIVES_CONTAINER.equals(p.getName())) {<NEW_LINE>return new SiteDrivesListService(session, fileid);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>});<NEW_LINE>if (collectionListService.isPresent() && (!container.isDefined() || container.isCollectionInContainer())) {<NEW_LINE>return collectionListService.get().list(directory, listener);<NEW_LINE>}<NEW_LINE>return new GraphItemListService(session, fileid<MASK><NEW_LINE>} | ).list(directory, listener); |
1,628,315 | private void writeSummary() {<NEW_LINE>final File summaryFile = new File(dir, STRTableFile.SUMMARY_FILE_NAME);<NEW_LINE>try (final PrintWriter writer = new PrintWriter(new FileWriter(summaryFile))) {<NEW_LINE>writer.println("##########################################################################################");<NEW_LINE>writer.println("# STRTableSummary");<NEW_LINE>writer.println("# ---------------------------------------");<NEW_LINE>writer.println("# maxPeriod = " + maxPeriod);<NEW_LINE>writer.println("# maxRepeatLength = " + maxRepeatLength);<NEW_LINE>for (final String name : annotations.keySet()) {<NEW_LINE>writer.println("# " + name + " = " + annotations.get(name));<NEW_LINE>}<NEW_LINE>writer.println("##########################################################################################");<NEW_LINE>writer.println(String.join("\t", "period", "repeatLength", "totalCounts", "emittedCounts", "intendedDecimation", "actualDecimation"));<NEW_LINE>for (int period = 1; period <= maxPeriod; period++) {<NEW_LINE>for (int repeatLength = period == 1 ? 1 : 2; repeatLength <= maxRepeatLength; repeatLength++) {<NEW_LINE>final long total = totalCounts[period][repeatLength];<NEW_LINE>final long emitted = emittedCounts[period][repeatLength];<NEW_LINE>final int decimation = decimationTable.decimationBit(period, repeatLength);<NEW_LINE>final double actualDecimation = total > 0 ? (MathUtils.INV_LOG_2 * (Math.log(total) - Math.log(emitted))) : 0;<NEW_LINE>writer.println(Utils.join("\t", period, repeatLength, total, emitted, decimation, Math.round(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new GATKException("unexpected issues writing summary file in " + dir);<NEW_LINE>}<NEW_LINE>} | actualDecimation * 100) / 100.0)); |
1,417,763 | protected void mapAnnotation(IRI n, Map<IRI, Collection<OWLAnnotation>> anns, Set<OWLAnnotation> nodeAnns, IRI p) {<NEW_LINE>OWLAnnotationProperty ap = df.getOWLAnnotationProperty(p);<NEW_LINE>IRI resVal = getResourceObject(n, p, true);<NEW_LINE>while (resVal != null) {<NEW_LINE>IRI annotation = getSubjectForAnnotatedPropertyAndObject(n, p, resVal);<NEW_LINE>OWLAnnotationValue val = getAnnotationValue(resVal);<NEW_LINE>Collection<OWLAnnotation> nestedAnns = anns.getOrDefault(annotation, Collections.emptyList());<NEW_LINE>OWLAnnotation apVal = df.getOWLAnnotation(ap, val, nestedAnns);<NEW_LINE>nodeAnns.add(apVal);<NEW_LINE>consumeTriple(n, p, resVal);<NEW_LINE>resVal = getResourceObject(n, p, true);<NEW_LINE>}<NEW_LINE>OWLLiteral litVal = getLiteralObject(n, p, true);<NEW_LINE>while (litVal != null) {<NEW_LINE>IRI annotation = <MASK><NEW_LINE>Collection<OWLAnnotation> nestedAnns = anns.getOrDefault(annotation, Collections.emptyList());<NEW_LINE>OWLAnnotation apLitVal = df.getOWLAnnotation(ap, litVal, nestedAnns);<NEW_LINE>nodeAnns.add(apLitVal);<NEW_LINE>consumeTriple(n, p, litVal);<NEW_LINE>litVal = getLiteralObject(n, p, true);<NEW_LINE>}<NEW_LINE>} | getSubjectForAnnotatedPropertyAndObject(n, p, litVal); |
131,718 | public final <X> P8<A, B, X, D, E, F, G, H> map3(final fj.F<C, X> f) {<NEW_LINE>return new P8<A, B, X, D, E, F, G, H>() {<NEW_LINE><NEW_LINE>public A _1() {<NEW_LINE>return P8.this._1();<NEW_LINE>}<NEW_LINE><NEW_LINE>public B _2() {<NEW_LINE>return P8.this._2();<NEW_LINE>}<NEW_LINE><NEW_LINE>public X _3() {<NEW_LINE>return f.f(P8.this._3());<NEW_LINE>}<NEW_LINE><NEW_LINE>public D _4() {<NEW_LINE>return P8.this._4();<NEW_LINE>}<NEW_LINE><NEW_LINE>public E _5() {<NEW_LINE>return P8.this._5();<NEW_LINE>}<NEW_LINE><NEW_LINE>public F _6() {<NEW_LINE>return P8.this._6();<NEW_LINE>}<NEW_LINE><NEW_LINE>public G _7() {<NEW_LINE>return P8.this._7();<NEW_LINE>}<NEW_LINE><NEW_LINE>public H _8() {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | return P8.this._8(); |
1,761,018 | public JsonResult execute() throws InvalidHttpRequestBodyException, InvalidOperationException {<NEW_LINE>CourseCreateRequest courseCreateRequest = getAndValidateRequestBody(CourseCreateRequest.class);<NEW_LINE>String newCourseTimeZone = courseCreateRequest.getTimeZone();<NEW_LINE>String timeZoneErrorMessage = FieldValidator.getInvalidityInfoForTimeZone(newCourseTimeZone);<NEW_LINE>if (!timeZoneErrorMessage.isEmpty()) {<NEW_LINE>throw new InvalidHttpRequestBodyException(timeZoneErrorMessage);<NEW_LINE>}<NEW_LINE>String newCourseId = courseCreateRequest.getCourseId();<NEW_LINE>String newCourseName = courseCreateRequest.getCourseName();<NEW_LINE>String institute = Const.UNKNOWN_INSTITUTION;<NEW_LINE>AccountAttributes account = logic.getAccount(userInfo.getId());<NEW_LINE>if (account != null && !StringHelper.isEmpty(account.getInstitute())) {<NEW_LINE>institute = account.getInstitute();<NEW_LINE>}<NEW_LINE>CourseAttributes courseAttributes = CourseAttributes.builder(newCourseId).withName(newCourseName).withTimezone(newCourseTimeZone).withInstitute(institute).build();<NEW_LINE>try {<NEW_LINE>logic.createCourseAndInstructor(userInfo.getId(), courseAttributes);<NEW_LINE>InstructorAttributes instructorCreatedForCourse = logic.getInstructorForGoogleId(<MASK><NEW_LINE>taskQueuer.scheduleInstructorForSearchIndexing(instructorCreatedForCourse.getCourseId(), instructorCreatedForCourse.getEmail());<NEW_LINE>} catch (EntityAlreadyExistsException e) {<NEW_LINE>throw new InvalidOperationException("The course ID " + courseAttributes.getId() + " has been used by another course, possibly by some other user." + " Please try again with a different course ID.", e);<NEW_LINE>} catch (InvalidParametersException e) {<NEW_LINE>throw new InvalidHttpRequestBodyException(e);<NEW_LINE>}<NEW_LINE>return new JsonResult(new CourseData(logic.getCourse(newCourseId)));<NEW_LINE>} | newCourseId, userInfo.getId()); |
167,842 | protected byte[] createKeyWithService(UUID universeUUID, UUID configUUID, EncryptionAtRestConfig config) {<NEW_LINE>final String algorithm = "AES";<NEW_LINE>final int keySize = 256;<NEW_LINE>final ObjectNode validateResult = validateEncryptionKeyParams(algorithm, keySize);<NEW_LINE>if (!validateResult.get("result").asBoolean()) {<NEW_LINE>final String errMsg = String.format("Invalid encryption key parameters detected for create operation in " + "universe %s: %s", universeUUID, validateResult.get("errors").asText());<NEW_LINE>LOG.error(errMsg);<NEW_LINE>throw new IllegalArgumentException(errMsg);<NEW_LINE>}<NEW_LINE>final String endpoint = "/crypto/v1/keys";<NEW_LINE>final ArrayNode keyOps = Json.newArray().add("EXPORT").add("APPMANAGEABLE");<NEW_LINE>ObjectNode payload = Json.newObject().put("name", universeUUID.toString()).put("obj_type", algorithm).put("key_size", keySize);<NEW_LINE>payload.set("key_ops", keyOps);<NEW_LINE>final ObjectNode authConfig = getAuthConfig(configUUID);<NEW_LINE>final String sessionToken = retrieveSessionAuthorization(authConfig);<NEW_LINE>final Map<String, String> headers = ImmutableMap.of("Authorization", sessionToken, "Content-Type", "application/json");<NEW_LINE>final String baseUrl = authConfig.get("base_url").asText();<NEW_LINE>final String url = <MASK><NEW_LINE>final JsonNode response = this.apiHelper.postRequest(url, payload, headers);<NEW_LINE>final JsonNode errors = response.get("error");<NEW_LINE>if (errors != null)<NEW_LINE>throw new RuntimeException(errors.toString());<NEW_LINE>final String kId = response.get("kid").asText();<NEW_LINE>return kId.getBytes();<NEW_LINE>} | Util.buildURL(baseUrl, endpoint); |
1,354,310 | public void mouseDragged(final MouseEvent e) {<NEW_LINE>final NodeView nodeV = getNodeView(e);<NEW_LINE>if (!isDragActive()) {<NEW_LINE>if (!nodeV.isSelected())<NEW_LINE>super.mouseDragged(e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if ((e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK) == (InputEvent.BUTTON1_DOWN_MASK)) {<NEW_LINE>final MainView mainView = (MainView) e.getSource();<NEW_LINE>final MapView mapView = nodeV.getMap();<NEW_LINE>final Point point = e.getPoint();<NEW_LINE>UITools.convertPointToAncestor(nodeV, point, JScrollPane.class);<NEW_LINE>findGridPoint(point);<NEW_LINE>ModeController c = Controller.getCurrentController().getModeController();<NEW_LINE>final Point dragNextPoint = point;<NEW_LINE>boolean shouldMoveSingleNode = !Compat.isCtrlEvent(e);<NEW_LINE>if (shouldMoveSingleNode) {<NEW_LINE>final <MASK><NEW_LINE>final LocationModel locationModel = LocationModel.createLocationModel(node);<NEW_LINE>final int hGapChange = getHGapChange(dragNextPoint, node);<NEW_LINE>if (hGapChange != 0) {<NEW_LINE>locationModel.setHGap(originalHGap.add(hGapChange, LengthUnit.px));<NEW_LINE>}<NEW_LINE>final int shiftYChange = getNodeShiftYChange(dragNextPoint, node);<NEW_LINE>if (shiftYChange != 0) {<NEW_LINE>locationModel.setShiftY(originalShiftY.add(shiftYChange, LengthUnit.px));<NEW_LINE>}<NEW_LINE>if (hGapChange != 0 || shiftYChange != 0)<NEW_LINE>c.getMapController().nodeRefresh(node);<NEW_LINE>else<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>final NodeModel childDistanceContainer = nodeV.getParentView().getChildDistanceContainer().getModel();<NEW_LINE>final int vGapChange = getVGapChange(dragNextPoint, childDistanceContainer);<NEW_LINE>int newVGap = Math.max(0, minimalDistanceBetweenChildren.toBaseUnitsRounded() - vGapChange);<NEW_LINE>LocationModel locationModel = LocationModel.createLocationModel(childDistanceContainer);<NEW_LINE>if (locationModel.getVGap().toBaseUnitsRounded() == newVGap)<NEW_LINE>return;<NEW_LINE>locationModel.setVGap(new Quantity<LengthUnit>(newVGap, LengthUnit.px).in(LengthUnit.pt));<NEW_LINE>final MapController mapController = c.getMapController();<NEW_LINE>mapController.nodeRefresh(childDistanceContainer);<NEW_LINE>mapController.nodeRefresh(nodeV.getModel());<NEW_LINE>}<NEW_LINE>EventQueue.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (!mainView.isShowing())<NEW_LINE>return;<NEW_LINE>final Rectangle r = mainView.getBounds();<NEW_LINE>UITools.convertRectangleToAncestor(mainView.getParent(), r, mapView);<NEW_LINE>final boolean isEventPointVisible = mapView.getVisibleRect().contains(r);<NEW_LINE>if (!isEventPointVisible) {<NEW_LINE>mapView.scrollRectToVisible(r);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | NodeModel node = nodeV.getModel(); |
1,184,498 | final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TagResourceRequest> request = null;<NEW_LINE>Response<TagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TagResourceRequestProtocolMarshaller(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, "Chime SDK Identity");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());<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(tagResourceRequest)); |
207,419 | private void checkThisAndSuperAsPropertyAccess(PropertyExpression expression) {<NEW_LINE>if (expression.isImplicitThis())<NEW_LINE>return;<NEW_LINE><MASK><NEW_LINE>if (prop == null)<NEW_LINE>return;<NEW_LINE>if (!prop.equals("this") && !prop.equals("super"))<NEW_LINE>return;<NEW_LINE>ClassNode type = expression.getObjectExpression().getType();<NEW_LINE>if (expression.getObjectExpression() instanceof ClassExpression) {<NEW_LINE>if (!(currentClass instanceof InnerClassNode) && !Traits.isTrait(type)) {<NEW_LINE>addError("The usage of 'Class.this' and 'Class.super' is only allowed in nested/inner classes.", expression);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (currentScope != null && !currentScope.isInStaticContext() && Traits.isTrait(type) && "super".equals(prop) && directlyImplementsTrait(type)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ClassNode iterType = currentClass;<NEW_LINE>while (iterType != null) {<NEW_LINE>if (iterType.equals(type))<NEW_LINE>break;<NEW_LINE>iterType = iterType.getOuterClass();<NEW_LINE>}<NEW_LINE>if (iterType == null) {<NEW_LINE>addError("The class '" + type.getName() + "' needs to be an outer class of '" + currentClass.getName() + "' when using '.this' or '.super'.", expression);<NEW_LINE>}<NEW_LINE>if ((currentClass.getModifiers() & Opcodes.ACC_STATIC) == 0)<NEW_LINE>return;<NEW_LINE>if (currentScope != null && !currentScope.isInStaticContext())<NEW_LINE>return;<NEW_LINE>addError("The usage of 'Class.this' and 'Class.super' within static nested class '" + currentClass.getName() + "' is not allowed in a static context.", expression);<NEW_LINE>}<NEW_LINE>} | String prop = expression.getPropertyAsString(); |
268,082 | private STNode parseAnnotationDeclWithOptionalType(STNode metadata, STNode qualifier, STNode constKeyword, STNode annotationKeyword) {<NEW_LINE>// We come here if the type name also and identifier.<NEW_LINE>// However, if it is a qualified identifier, then it has to be the type-desc.<NEW_LINE>STNode typeDescOrAnnotTag = parseQualifiedIdentifier(ParserRuleContext.ANNOT_DECL_OPTIONAL_TYPE);<NEW_LINE>if (typeDescOrAnnotTag.kind == SyntaxKind.QUALIFIED_NAME_REFERENCE) {<NEW_LINE>STNode annotTag = parseAnnotationTag();<NEW_LINE>return parseAnnotationDeclAttachPoints(metadata, qualifier, constKeyword, annotationKeyword, typeDescOrAnnotTag, annotTag);<NEW_LINE>}<NEW_LINE>// an simple identifier<NEW_LINE>STToken nextToken = peek();<NEW_LINE>if (nextToken.kind == SyntaxKind.IDENTIFIER_TOKEN || isValidTypeContinuationToken(nextToken)) {<NEW_LINE>STNode typeDesc = parseComplexTypeDescriptor(typeDescOrAnnotTag, ParserRuleContext.TYPE_DESC_IN_ANNOTATION_DECL, false);<NEW_LINE>STNode annotTag = parseAnnotationTag();<NEW_LINE>return parseAnnotationDeclAttachPoints(metadata, qualifier, <MASK><NEW_LINE>}<NEW_LINE>STNode annotTag = ((STSimpleNameReferenceNode) typeDescOrAnnotTag).name;<NEW_LINE>return parseAnnotationDeclRhs(metadata, qualifier, constKeyword, annotationKeyword, annotTag);<NEW_LINE>} | constKeyword, annotationKeyword, typeDesc, annotTag); |
1,777,290 | protected Map<Object, Object> createInstance() {<NEW_LINE>if (this.sourceMap == null) {<NEW_LINE>throw new IllegalArgumentException("'sourceMap' is required");<NEW_LINE>}<NEW_LINE>Map<Object, Object> result = null;<NEW_LINE>if (this.targetMapClass != null) {<NEW_LINE>result = BeanUtils.instantiateClass(this.targetMapClass);<NEW_LINE>} else {<NEW_LINE>result = CollectionUtils.newLinkedHashMap(this.sourceMap.size());<NEW_LINE>}<NEW_LINE>Class<?> keyType = null;<NEW_LINE>Class<?> valueType = null;<NEW_LINE>if (this.targetMapClass != null) {<NEW_LINE>ResolvableType mapType = ResolvableType.forClass(this.targetMapClass).asMap();<NEW_LINE>keyType = mapType.resolveGeneric(0);<NEW_LINE>valueType = mapType.resolveGeneric(1);<NEW_LINE>}<NEW_LINE>if (keyType != null || valueType != null) {<NEW_LINE>TypeConverter converter = getBeanTypeConverter();<NEW_LINE>for (Map.Entry<?, ?> entry : this.sourceMap.entrySet()) {<NEW_LINE>Object convertedKey = converter.convertIfNecessary(entry.getKey(), keyType);<NEW_LINE>Object convertedValue = converter.convertIfNecessary(entry.getValue(), valueType);<NEW_LINE>result.put(convertedKey, convertedValue);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | result.putAll(this.sourceMap); |
473,974 | protected List<Select> query2Select(String table, Query query) {<NEW_LINE>// Build query<NEW_LINE>Selection selection = QueryBuilder.select();<NEW_LINE>// Set aggregate<NEW_LINE>Aggregate aggregate = query.aggregate();<NEW_LINE>if (aggregate != null) {<NEW_LINE>if (aggregate.countAll()) {<NEW_LINE>selection.countAll();<NEW_LINE>} else {<NEW_LINE>selection.fcall(aggregate.func().string(), aggregate.column());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Set table<NEW_LINE>Select select = selection.from(table);<NEW_LINE>// NOTE: Cassandra does not support query.offset()<NEW_LINE>if (query.offset() != 0) {<NEW_LINE>LOG.debug("Query offset is not supported on Cassandra store " + "currently, it will be replaced by [0, offset + limit)");<NEW_LINE>}<NEW_LINE>// Set order-by<NEW_LINE>for (Map.Entry<HugeKeys, Order> order : query.orders().entrySet()) {<NEW_LINE>String name = formatKey(order.getKey());<NEW_LINE>if (order.getValue() == Order.ASC) {<NEW_LINE>select.orderBy(QueryBuilder.asc(name));<NEW_LINE>} else {<NEW_LINE>assert order.getValue() == Order.DESC;<NEW_LINE>select.orderBy(QueryBuilder.desc(name));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Is query by id?<NEW_LINE>List<Select> ids = this.queryId2Select(query, select);<NEW_LINE>if (query.conditionsSize() == 0) {<NEW_LINE>// Query only by id<NEW_LINE>this.setPageState(query, ids);<NEW_LINE><MASK><NEW_LINE>return ids;<NEW_LINE>} else {<NEW_LINE>List<Select> conds = new ArrayList<>(ids.size());<NEW_LINE>for (Select id : ids) {<NEW_LINE>// Query by condition<NEW_LINE>conds.addAll(this.queryCondition2Select(query, id));<NEW_LINE>}<NEW_LINE>this.setPageState(query, conds);<NEW_LINE>LOG.debug("Query by conditions: {}", conds);<NEW_LINE>return conds;<NEW_LINE>}<NEW_LINE>} | LOG.debug("Query only by id(s): {}", ids); |
875,897 | static public void copyDir(File sourceDir, File targetDir) throws IOException {<NEW_LINE>if (sourceDir.equals(targetDir)) {<NEW_LINE>final String urDum = "source and target directories are identical";<NEW_LINE>throw new IllegalArgumentException(urDum);<NEW_LINE>}<NEW_LINE>targetDir.mkdirs();<NEW_LINE>String[] files = sourceDir.list();<NEW_LINE>for (int i = 0; i < files.length; i++) {<NEW_LINE>// Ignore dot files (.DS_Store), dot folders (.svn) while copying<NEW_LINE>if (files[i].charAt(0) == '.')<NEW_LINE>continue;<NEW_LINE>// if (files[i].equals(".") || files[i].equals("..")) continue;<NEW_LINE>File source = new File<MASK><NEW_LINE>File target = new File(targetDir, files[i]);<NEW_LINE>if (source.isDirectory()) {<NEW_LINE>// target.mkdirs();<NEW_LINE>copyDir(source, target);<NEW_LINE>target.setLastModified(source.lastModified());<NEW_LINE>} else {<NEW_LINE>copyFile(source, target);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (sourceDir, files[i]); |
603,490 | public SrcClass makeSrcClassStub(String fqn, JavaFileManager.Location location, DiagnosticListener<JavaFileObject> errorHandler) {<NEW_LINE>BasicJavacTask javacTask = /*location != null && JavacPlugin.instance() != null ? JavacPlugin.instance().getJavacTask() :*/<NEW_LINE>getJavacTask_PlainFileMgr();<NEW_LINE>Pair<Symbol.ClassSymbol, JCTree.JCCompilationUnit> pair = getClassSymbol(javacTask, (JavaFileManager.Location) null, /*location*/<NEW_LINE>fqn);<NEW_LINE>if (pair == null) {<NEW_LINE>// ## todo: revisit this, but for now we need to return null to handle inner class extensions<NEW_LINE>return null;<NEW_LINE>// throw new IllegalStateException( "Failed to find class, '" + fqn + "'" );<NEW_LINE>}<NEW_LINE>Symbol.<MASK><NEW_LINE>if (classSymbol == null) {<NEW_LINE>// For the case where the class is generated from a type manifold esp. from a IExtensionClassProducer<NEW_LINE>return makeSrcClassStubFromProducedClass(fqn, location, errorHandler);<NEW_LINE>}<NEW_LINE>return SrcClassUtil.instance().makeStub(fqn, classSymbol, pair.getSecond(), getJavacTask_PlainFileMgr(), _module, location, errorHandler);<NEW_LINE>} | ClassSymbol classSymbol = pair.getFirst(); |
1,423,300 | public static DataHighLevelShaderLanguageSymbolInternals parse32(AbstractPdb pdb, PdbByteReader reader) throws PdbException {<NEW_LINE>DataHighLevelShaderLanguageSymbolInternals32 result = new DataHighLevelShaderLanguageSymbolInternals32(pdb);<NEW_LINE>result.typeRecordNumber = RecordNumber.parse(pdb, <MASK><NEW_LINE>result.dataSlot = reader.parseUnsignedIntVal();<NEW_LINE>result.dataOffset = reader.parseUnsignedIntVal();<NEW_LINE>result.textureSlotStart = reader.parseUnsignedIntVal();<NEW_LINE>result.samplerSlotStart = reader.parseUnsignedIntVal();<NEW_LINE>result.uavSlotStart = reader.parseUnsignedIntVal();<NEW_LINE>result.registerType = HLSLRegisterType.fromValue(reader.parseUnsignedShortVal());<NEW_LINE>result.name = reader.parseString(pdb, StringParseType.StringUtf8Nt);<NEW_LINE>return result;<NEW_LINE>} | reader, RecordCategory.TYPE, 32); |
1,178,392 | public static List<?> repeat(Iterable<?> iterable, long amount, boolean perItem) {<NEW_LINE>if (iterable == null)<NEW_LINE>return ImmutableList.of();<NEW_LINE>if (amount < 1)<NEW_LINE>return ImmutableList.of();<NEW_LINE>if (amount == 1)<NEW_LINE>return ImmutableList.copyOf(iterable);<NEW_LINE>if (perItem) {<NEW_LINE><MASK><NEW_LINE>ImmutableList.Builder<Object> builder = ImmutableList.builder();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>Object o = iterator.next();<NEW_LINE>for (int i = 0; i < amount; i++) builder.add(o);<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} else {<NEW_LINE>Iterable<?>[] iterables = new Iterable<?>[(int) amount];<NEW_LINE>for (int i = 0; i < amount; i++) {<NEW_LINE>iterables[i] = iterable;<NEW_LINE>}<NEW_LINE>return ImmutableList.copyOf(Iterables.concat(iterables));<NEW_LINE>}<NEW_LINE>} | Iterator iterator = iterable.iterator(); |
545,940 | private void jTextField1KeyReleased(java.awt.event.KeyEvent evt, int index) {<NEW_LINE>ResourceConfigData data = this.helper.getData();<NEW_LINE>String item = (String) ((JTextField) jFields[index]).getText();<NEW_LINE>String fieldName = fields[index].getName();<NEW_LINE>String val = data.getString(fieldName);<NEW_LINE>if (FieldHelper.isInt(fields[index])) {<NEW_LINE>try {<NEW_LINE>Integer.parseInt(item);<NEW_LINE>} catch (NumberFormatException ex) {<NEW_LINE>// NOI18N<NEW_LINE>JOptionPane.showMessageDialog(this, bundle.getString("MSG_NotNumber"));<NEW_LINE>if (val == null || val.length() == 0)<NEW_LINE>val = FieldHelper.getDefaultValue(fields[index]);<NEW_LINE>((JTextField) jFields[index]).setText(val);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String jLabel = (String) this.jLabels[index].getText();<NEW_LINE>// if (!item.equals(val) && !jLabel.equals(bundle.getString("LBL_" + __JndiName)) ) { // don't save jndi name here or it will break 'duplicate jndi name validation' in edit mode<NEW_LINE>if (!item.equals(val) && jLabel.equals(bundle.getString("LBL_" + __JndiName))) {<NEW_LINE>// item = item + data.getTargetFile();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (!item.equals(val)) {<NEW_LINE>data.setString(fieldName, item);<NEW_LINE>// panel.fireChangeEvent();<NEW_LINE>}<NEW_LINE>panel.fireChange(evt.getSource());<NEW_LINE>} | data.setString(fieldName, item); |
244,903 | private static String createCaseDataBaseName(String candidateDbName) {<NEW_LINE>String dbName;<NEW_LINE>if (!candidateDbName.isEmpty()) {<NEW_LINE>// NON-NLS<NEW_LINE>dbName = candidateDbName.replaceAll("[^\\p{ASCII}]", "_");<NEW_LINE>// NON-NLS<NEW_LINE>dbName = <MASK><NEW_LINE>// NON-NLS<NEW_LINE>dbName = dbName.replaceAll("[ /?:'\"\\\\]", "_");<NEW_LINE>dbName = dbName.toLowerCase();<NEW_LINE>if ((dbName.length() > 0 && !(Character.isLetter(dbName.codePointAt(0))) && !(dbName.codePointAt(0) == '_'))) {<NEW_LINE>dbName = "_" + dbName;<NEW_LINE>}<NEW_LINE>if (dbName.length() > MAX_DB_NAME_LEN_BEFORE_TIMESTAMP) {<NEW_LINE>dbName = dbName.substring(0, MAX_DB_NAME_LEN_BEFORE_TIMESTAMP);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>dbName = "_";<NEW_LINE>}<NEW_LINE>SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");<NEW_LINE>Date date = new Date();<NEW_LINE>dbName = dbName + "_" + dateFormat.format(date);<NEW_LINE>return dbName;<NEW_LINE>} | dbName.replaceAll("[\\p{Cntrl}]", "_"); |
1,642,528 | protected final InputOutput createInputOutput() {<NEW_LINE>if (GradleSettings.getDefault().isReuseOutputTabs()) {<NEW_LINE>synchronized (FREE_TABS) {<NEW_LINE>for (Map.Entry<InputOutput, AllContext<?>> entry : FREE_TABS.entrySet()) {<NEW_LINE>InputOutput free = entry.getKey();<NEW_LINE>AllContext<?> allContext = entry.getValue();<NEW_LINE>if (io == null && allContext.name.equals(name) && allContext.tabContextType == tabContextType()) {<NEW_LINE>// Reuse it.<NEW_LINE>io = free;<NEW_LINE>reassignAdditionalContext(tabContextType().cast(allContext.tabContext));<NEW_LINE>try {<NEW_LINE>io.getOut().reset();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>// useless: io.flushReader();<NEW_LINE>} else {<NEW_LINE>// Discard it.<NEW_LINE>free.closeInputOutput();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>FREE_TABS.clear();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// }<NEW_LINE>if (io == null) {<NEW_LINE>io = IOProvider.getDefault().<MASK><NEW_LINE>io.setInputVisible(true);<NEW_LINE>}<NEW_LINE>return io;<NEW_LINE>} | getIO(name, createNewTabActions()); |
484,255 | protected void installStrings(JFileChooser fc) {<NEW_LINE>super.installStrings(fc);<NEW_LINE>Locale l = fc.getLocale();<NEW_LINE>lookInLabelMnemonic = UIManager.getInt("FileChooser.lookInLabelMnemonic");<NEW_LINE>lookInLabelText = UIManager.getString("FileChooser.lookInLabelText", l);<NEW_LINE>saveInLabelText = UIManager.getString("FileChooser.saveInLabelText", l);<NEW_LINE>fileNameLabelMnemonic = UIManager.getInt("FileChooser.fileNameLabelMnemonic");<NEW_LINE>fileNameLabelText = UIManager.getString("FileChooser.fileNameLabelText", l);<NEW_LINE>filesOfTypeLabelMnemonic = UIManager.getInt("FileChooser.filesOfTypeLabelMnemonic");<NEW_LINE>filesOfTypeLabelText = UIManager.getString("FileChooser.filesOfTypeLabelText", l);<NEW_LINE>upFolderToolTipText = UIManager.getString("FileChooser.upFolderToolTipText", l);<NEW_LINE>if (null == upFolderToolTipText)<NEW_LINE>// NOI18N<NEW_LINE>upFolderToolTipText = NbBundle.<MASK><NEW_LINE>upFolderAccessibleName = UIManager.getString("FileChooser.upFolderAccessibleName", l);<NEW_LINE>if (null == upFolderAccessibleName)<NEW_LINE>// NOI18N<NEW_LINE>upFolderAccessibleName = NbBundle.getMessage(DirectoryChooserUI.class, "ACN_UpFolder");<NEW_LINE>newFolderToolTipText = UIManager.getString("FileChooser.newFolderToolTipText", l);<NEW_LINE>if (null == newFolderToolTipText)<NEW_LINE>// NOI18N<NEW_LINE>newFolderToolTipText = NbBundle.getMessage(DirectoryChooserUI.class, "TLTP_NewFolder");<NEW_LINE>// NOI18N<NEW_LINE>newFolderAccessibleName = NbBundle.getMessage(DirectoryChooserUI.class, "ACN_NewFolder");<NEW_LINE>homeFolderTooltipText = UIManager.getString("FileChooser.homeFolderToolTipText", l);<NEW_LINE>if (null == homeFolderTooltipText)<NEW_LINE>// NOI18N<NEW_LINE>homeFolderTooltipText = NbBundle.getMessage(DirectoryChooserUI.class, "TLTP_HomeFolder");<NEW_LINE>// NOI18N<NEW_LINE>homeFolderAccessibleName = NbBundle.getMessage(DirectoryChooserUI.class, "ACN_HomeFolder");<NEW_LINE>} | getMessage(DirectoryChooserUI.class, "TLTP_UpFolder"); |
1,455,816 | public void initialize() throws IOException {<NEW_LINE>if (this.compliance == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.releaseInHex = Integer.toHexString(Integer.parseInt(this.compliance)).toUpperCase();<NEW_LINE>// $NON-NLS-1$ //$NON-NLS-2$<NEW_LINE>Path filePath = this.jdkHome.toPath().resolve("lib").resolve("ct.sym");<NEW_LINE>URI t = filePath.toUri();<NEW_LINE>if (!Files.exists(filePath)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// $NON-NLS-1$<NEW_LINE>URI uri = URI.create("jar:file:" + t.getRawPath());<NEW_LINE>try {<NEW_LINE>this.fs = FileSystems.getFileSystem(uri);<NEW_LINE>} catch (FileSystemNotFoundException fne) {<NEW_LINE>// Ignore and move on<NEW_LINE>}<NEW_LINE>if (this.fs == null) {<NEW_LINE>HashMap<String, ?> env = new HashMap<>();<NEW_LINE>try {<NEW_LINE>this.fs = <MASK><NEW_LINE>} catch (FileSystemAlreadyExistsException e) {<NEW_LINE>this.fs = FileSystems.getFileSystem(uri);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// $NON-NLS-1$<NEW_LINE>this.releasePath = this.fs.getPath("/");<NEW_LINE>if (!Files.exists(this.fs.getPath(this.releaseInHex))) {<NEW_LINE>// $NON-NLS-1$//$NON-NLS-2$<NEW_LINE>throw new IllegalArgumentException("release " + this.compliance + " is not found in the system");<NEW_LINE>}<NEW_LINE>super.initialize();<NEW_LINE>} | FileSystems.newFileSystem(uri, env); |
553,126 | protected static Mat createMat(BufferedImage img) {<NEW_LINE>if (img != null) {<NEW_LINE>Debug timer = Debug.startTimer("Mat create\t (%d x %d) from \n%s", img.getWidth(), img.getHeight(), img);<NEW_LINE>Mat mat_ref = new Mat(img.getHeight(), img.getWidth(), CvType.CV_8UC4);<NEW_LINE>timer.lap("init");<NEW_LINE>byte[] data;<NEW_LINE>BufferedImage cvImg;<NEW_LINE>ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);<NEW_LINE>int[] nBits = { 8, 8, 8, 8 };<NEW_LINE>ColorModel cm = new ComponentColorModel(cs, nBits, true, false, Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);<NEW_LINE>SampleModel sm = cm.createCompatibleSampleModel(img.getWidth(), img.getHeight());<NEW_LINE>DataBufferByte db = new DataBufferByte(img.getWidth() * img.getHeight() * 4);<NEW_LINE>WritableRaster r = WritableRaster.createWritableRaster(sm, db, new Point(0, 0));<NEW_LINE>cvImg = new BufferedImage(cm, r, false, null);<NEW_LINE>timer.lap("empty");<NEW_LINE>Graphics2D g = cvImg.createGraphics();<NEW_LINE>g.drawImage(img, 0, 0, null);<NEW_LINE>g.dispose();<NEW_LINE>timer.lap("created");<NEW_LINE>data = ((DataBufferByte) cvImg.getRaster().getDataBuffer()).getData();<NEW_LINE>mat_ref.put(0, 0, data);<NEW_LINE>Mat mat = new Mat();<NEW_LINE>timer.lap("filled");<NEW_LINE>Imgproc.cvtColor(mat_ref, <MASK><NEW_LINE>timer.end();<NEW_LINE>return mat;<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | mat, Imgproc.COLOR_RGBA2BGR, 3); |
1,625,799 | void predict(RatingPredictor pred, DataAccessObject dao, long user, List<Long> items, TableWriter outW) throws IOException {<NEW_LINE>logger.info("predicting {} items", items.size());<NEW_LINE>Stopwatch timer = Stopwatch.createStarted();<NEW_LINE>Map<Long, Double> preds = pred.predict(user, items);<NEW_LINE>System.<MASK><NEW_LINE>for (Map.Entry<Long, Double> e : preds.entrySet()) {<NEW_LINE>if (outW != null) {<NEW_LINE>outW.writeRow(user, e.getKey(), e.getValue());<NEW_LINE>}<NEW_LINE>System.out.format(" %d", e.getKey());<NEW_LINE>Entity item = dao.lookupEntity(CommonTypes.ITEM, e.getKey());<NEW_LINE>String name = item == null ? null : item.maybeGet(CommonAttributes.NAME);<NEW_LINE>if (name != null) {<NEW_LINE>System.out.format(" (%s)", name);<NEW_LINE>}<NEW_LINE>System.out.format(": %.3f", e.getValue());<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>timer.stop();<NEW_LINE>logger.info("predicted for {} items in {}", items.size(), timer);<NEW_LINE>} | out.format("predictions for user %d:%n", user); |
420,610 | public PullSchemaResp queryTimeSeriesSchema(PullSchemaRequest request) throws CheckConsistencyException, MetadataException {<NEW_LINE>// try to synchronize with the leader first in case that some schema logs are accepted but<NEW_LINE>// not committed yet<NEW_LINE>dataGroupMember.syncLeaderWithConsistencyCheck(false);<NEW_LINE>// collect local timeseries schemas and send to the requester<NEW_LINE>// the measurements in them are the full paths.<NEW_LINE>List<String> prefixPaths = request.getPrefixPaths();<NEW_LINE>List<TimeseriesSchema> timeseriesSchemas = new ArrayList<>();<NEW_LINE>collectTimeseriesSchema(prefixPaths, timeseriesSchemas);<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("{}: Collected {} schemas for {} and other {} paths", name, timeseriesSchemas.size(), prefixPaths.get(0), prefixPaths.size() - 1);<NEW_LINE>}<NEW_LINE>PullSchemaResp resp = new PullSchemaResp();<NEW_LINE>// serialize the schemas<NEW_LINE>ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>dataOutputStream.writeInt(timeseriesSchemas.size());<NEW_LINE>for (TimeseriesSchema timeseriesSchema : timeseriesSchemas) {<NEW_LINE>timeseriesSchema.serializeTo(dataOutputStream);<NEW_LINE>}<NEW_LINE>} catch (IOException ignored) {<NEW_LINE>// unreachable for we are using a ByteArrayOutputStream<NEW_LINE>}<NEW_LINE>resp.setSchemaBytes(byteArrayOutputStream.toByteArray());<NEW_LINE>return resp;<NEW_LINE>} | DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); |
715,763 | public static QueryPlanIndexItemForge validateCompileExplicitIndex(String indexName, boolean unique, List<CreateIndexItem> columns, EventType eventType, StatementRawInfo statementRawInfo, StatementCompileTimeServices services) throws ExprValidationException {<NEW_LINE>List<IndexedPropDesc> hashProps = new ArrayList<IndexedPropDesc>();<NEW_LINE>List<IndexedPropDesc> btreeProps = new ArrayList<>();<NEW_LINE>Set<String> indexedColumns <MASK><NEW_LINE>EventAdvancedIndexProvisionCompileTime advancedIndexProvisionDesc = null;<NEW_LINE>for (CreateIndexItem columnDesc : columns) {<NEW_LINE>String indexType = columnDesc.getType().toLowerCase(Locale.ENGLISH).trim();<NEW_LINE>if (indexType.equals(CreateIndexType.HASH.getNameLower()) || indexType.equals(CreateIndexType.BTREE.getNameLower())) {<NEW_LINE>validateBuiltin(columnDesc, eventType, hashProps, btreeProps, indexedColumns);<NEW_LINE>} else {<NEW_LINE>if (advancedIndexProvisionDesc != null) {<NEW_LINE>throw new ExprValidationException("Nested advanced-type indexes are not supported");<NEW_LINE>}<NEW_LINE>advancedIndexProvisionDesc = validateAdvanced(indexName, indexType, columnDesc, eventType, statementRawInfo, services);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (unique && !btreeProps.isEmpty()) {<NEW_LINE>throw new ExprValidationException("Combination of unique index with btree (range) is not supported");<NEW_LINE>}<NEW_LINE>if ((!btreeProps.isEmpty() || !hashProps.isEmpty()) && advancedIndexProvisionDesc != null) {<NEW_LINE>throw new ExprValidationException("Combination of hash/btree columns an advanced-type indexes is not supported");<NEW_LINE>}<NEW_LINE>return new QueryPlanIndexItemForge(hashProps, btreeProps, unique, advancedIndexProvisionDesc, eventType);<NEW_LINE>} | = new HashSet<String>(); |
191,562 | private void initParametersAndDoExperiment() {<NEW_LINE>int[] numberOfSizesAndQueries = { 100000, 1000000, 10000000, 100000000 };<NEW_LINE>int maxSize = numberOfSizesAndQueries[numberOfSizesAndQueries.length - 1];<NEW_LINE>int[] randomIntKeys = new int[maxSize];<NEW_LINE>double[<MASK><NEW_LINE>int[] queriesInt = new int[maxSize];<NEW_LINE>double[] queriesDouble = new double[maxSize];<NEW_LINE>// Generate random keys<NEW_LINE>for (int i = 0; i < maxSize; i++) {<NEW_LINE>int randomKey = StdRandom.uniform(Integer.MAX_VALUE);<NEW_LINE>randomIntKeys[i] = randomKey;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < maxSize; i++) {<NEW_LINE>double randomKey = StdRandom.uniform();<NEW_LINE>randomDoubleKeys[i] = randomKey;<NEW_LINE>}<NEW_LINE>// Generate queries<NEW_LINE>for (int i = 0; i < maxSize; i++) {<NEW_LINE>// Randomly chooses if this will be a key hit or a key miss query<NEW_LINE>int keyHit = StdRandom.uniform(2);<NEW_LINE>boolean isKeyHit = keyHit == 1;<NEW_LINE>if (!isKeyHit) {<NEW_LINE>int randomKey = StdRandom.uniform(Integer.MAX_VALUE);<NEW_LINE>queriesInt[i] = randomKey;<NEW_LINE>} else {<NEW_LINE>int existentKeyIndex = StdRandom.uniform(maxSize);<NEW_LINE>queriesInt[i] = randomIntKeys[existentKeyIndex];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 0; i < maxSize; i++) {<NEW_LINE>// Randomly chooses if this will be a key hit or a key miss query<NEW_LINE>int keyHit = StdRandom.uniform(2);<NEW_LINE>boolean isKeyHit = keyHit == 1;<NEW_LINE>if (!isKeyHit) {<NEW_LINE>double randomKey = StdRandom.uniform();<NEW_LINE>queriesDouble[i] = randomKey;<NEW_LINE>} else {<NEW_LINE>int existentKeyIndex = StdRandom.uniform(maxSize);<NEW_LINE>queriesDouble[i] = randomDoubleKeys[existentKeyIndex];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>doExperiment(numberOfSizesAndQueries, randomIntKeys, randomDoubleKeys, queriesInt, queriesDouble);<NEW_LINE>} | ] randomDoubleKeys = new double[maxSize]; |
459,274 | private void saveVisualComponent(RADVisualComponent component, StringBuffer buf, String indent) {<NEW_LINE><MASK><NEW_LINE>if (component.isInLayeredPane()) {<NEW_LINE>formModel.raiseVersionLevel(FormModel.FormVersion.NB74, FormModel.FormVersion.NB74);<NEW_LINE>formModel.setMaxVersionLevel(FormModel.LATEST_VERSION);<NEW_LINE>}<NEW_LINE>RADVisualContainer container = component.getParentContainer();<NEW_LINE>if (container == null || container.getLayoutSupport() == null)<NEW_LINE>return;<NEW_LINE>int componentIndex = container.getIndexOf(component);<NEW_LINE>LayoutConstraints constr = container.getLayoutSupport().getConstraints(componentIndex);<NEW_LINE>if (constr == null)<NEW_LINE>// no constraints<NEW_LINE>return;<NEW_LINE>// [might be not used at all]<NEW_LINE>StringBuffer buf2 = new StringBuffer();<NEW_LINE>int convIndex = saveConstraints(constr, buf2, indent + ONE_INDENT + ONE_INDENT);<NEW_LINE>if (convIndex >= 0) {<NEW_LINE>// standard constraints (saved in buf2)<NEW_LINE>buf.append(indent);<NEW_LINE>addElementOpen(buf, XML_CONSTRAINTS);<NEW_LINE>buf.append(indent).append(ONE_INDENT);<NEW_LINE>addElementOpenAttr(buf, XML_CONSTRAINT, new String[] { ATTR_CONSTRAINT_LAYOUT, ATTR_CONSTRAINT_VALUE }, new String[] { PersistenceObjectRegistry.getPrimaryName(layout31Names[convIndex]), PersistenceObjectRegistry.getPrimaryName(layout31ConstraintsNames[convIndex]) });<NEW_LINE>buf.append(buf2);<NEW_LINE>buf.append(indent).append(ONE_INDENT);<NEW_LINE>addElementClose(buf, XML_CONSTRAINT);<NEW_LINE>buf.append(indent);<NEW_LINE>addElementClose(buf, XML_CONSTRAINTS);<NEW_LINE>}<NEW_LINE>} | saveComponent(component, buf, indent); |
175,442 | public String run(String[] args) throws Exception {<NEW_LINE>parseParameters(args);<NEW_LINE>// if the benchmark execute multiple tasks<NEW_LINE>if (mParameters.mWriteType.equals("ALL")) {<NEW_LINE>List<String> writeTypes = ImmutableList.of("MUST_CACHE", "CACHE_THROUGH", "ASYNC_THROUGH", "THROUGH");<NEW_LINE>System.out.format("Now executing %s with all possible write " + "types %s %n", getClass().toString(), writeTypes);<NEW_LINE>for (int i = 0; i < args.length; i++) {<NEW_LINE>if (args[i].equals("--write-type")) {<NEW_LINE>for (String type : writeTypes) {<NEW_LINE>// change write type argument<NEW_LINE>args[i + 1] = type;<NEW_LINE>mParameters.mWriteType = type;<NEW_LINE>System.out.println("-----------------------------------------------------");<NEW_LINE>System.<MASK><NEW_LINE>try {<NEW_LINE>String result = runSingleTask(args);<NEW_LINE>System.out.println(result);<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.out.format("Exception occurred when executing parameter" + " --write-type %s %n", type);<NEW_LINE>System.out.println(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("-----------------------------------------------------");<NEW_LINE>return "All tasks finished. You can find the test results in the outputs above.";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// if this is a single task, just execute the task<NEW_LINE>return runSingleTask(args);<NEW_LINE>} | out.format("Now executing write type %s... %n", type); |
789,378 | public static double[] nextMVNormalWithCholesky(double[] mean, double[] precisionLowerTriangular, Randoms random) {<NEW_LINE>int n = mean.length;<NEW_LINE>// Initialize vector z to standard normals<NEW_LINE>// [NB: using the same array for z and x]<NEW_LINE>double[] result = new double[n];<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>result[i] = random.nextGaussian();<NEW_LINE>}<NEW_LINE>// Now solve trans(L) x = z using back substitution<NEW_LINE>@Var<NEW_LINE>double innerProduct;<NEW_LINE>for (int i = n - 1; i >= 0; i--) {<NEW_LINE>innerProduct = 0.0;<NEW_LINE>for (int j = i + 1; j < n; j++) {<NEW_LINE>// the cholesky decomp got us the precisionLowerTriangular triangular<NEW_LINE>// matrix, but we really want the transpose.<NEW_LINE>innerProduct += result[j] * precisionLowerTriangular[<MASK><NEW_LINE>}<NEW_LINE>result[i] = (result[i] - innerProduct) / precisionLowerTriangular[(n * i) + i];<NEW_LINE>}<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>result[i] += mean[i];<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (n * j) + i]; |
812,570 | private static ImmutableMap<Artifact, Artifact> generateTranslatedIdlArtifacts(RuleContext ruleContext, Collection<Artifact> idls) {<NEW_LINE>ImmutableMap.Builder<Artifact, Artifact<MASK><NEW_LINE>String ruleName = ruleContext.getRule().getName();<NEW_LINE>// for each aidl file use aggregated preprocessed files to generate Java code<NEW_LINE>for (Artifact idl : idls) {<NEW_LINE>// Reconstruct the package tree under <rule>_aidl to avoid a name conflict<NEW_LINE>// if the same AIDL files are used in multiple targets.<NEW_LINE>PathFragment javaOutputPath = FileSystemUtils.replaceExtension(PathFragment.create(ruleName + "_aidl").getRelative(idl.getRootRelativePath()), ".java");<NEW_LINE>Artifact output = ruleContext.getGenfilesArtifact(javaOutputPath.getPathString());<NEW_LINE>outputJavaSources.put(idl, output);<NEW_LINE>}<NEW_LINE>return outputJavaSources.buildOrThrow();<NEW_LINE>} | > outputJavaSources = ImmutableMap.builder(); |
1,620,867 | public void updateE(ClusterFeature cf, double wei) {<NEW_LINE>assert cf.getDimensionality() == mean.length;<NEW_LINE>assert wei >= 0 && wei < Double.POSITIVE_INFINITY : wei;<NEW_LINE>if (wei < Double.MIN_NORMAL) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final int dim = mean.length;<NEW_LINE>final double nwsum = wsum + wei;<NEW_LINE>// Do division only once<NEW_LINE>final double f = wei / nwsum;<NEW_LINE>final double[][] cfcov = timesEquals(<MASK><NEW_LINE>// Compute new means and covariance<NEW_LINE>for (int i = 0; i < dim; i++) {<NEW_LINE>final double delta = cf.centroid(i) - mean[i];<NEW_LINE>nmea[i] = mean[i] + delta * f;<NEW_LINE>for (int j = 0; j <= i; j++) {<NEW_LINE>covariance[i][j] += cfcov[i][j] + wei * (delta * (cf.centroid(j) - nmea[j]));<NEW_LINE>}<NEW_LINE>// Other half is NOT updated here, but in finalizeEStep!<NEW_LINE>}<NEW_LINE>// Use new Values<NEW_LINE>wsum = nwsum;<NEW_LINE>System.arraycopy(nmea, 0, mean, 0, nmea.length);<NEW_LINE>} | cf.covariance(), wei); |
109,607 | private static Layer3VniConfig create(@Nullable @JsonProperty(PROP_VNI) Integer vni, @Nullable @JsonProperty(PROP_VRF) String vrf, @Nullable @JsonProperty(PROP_ROUTE_DISTINGUISHER) RouteDistinguisher rd, @Nullable @JsonProperty(PROP_ROUTE_TARGET) ExtendedCommunity routeTarget, @Nullable @JsonProperty(PROP_IMPORT_ROUTE_TARGET) String importRouteTarget, @Nullable @JsonProperty(PROP_ADVERTISE_V4_UNICAST) Boolean advertiseV4Unicast) {<NEW_LINE>checkArgument(vni != null, "Missing %s", PROP_VNI);<NEW_LINE>checkArgument(vrf != null, "Missing %s", PROP_VRF);<NEW_LINE>checkArgument(rd != null, "Missing %s", PROP_ROUTE_DISTINGUISHER);<NEW_LINE>checkArgument(routeTarget != null, "Missing %s", PROP_ROUTE_TARGET);<NEW_LINE>checkArgument(<MASK><NEW_LINE>return new Builder().setVni(vni).setVrf(vrf).setRouteDistinguisher(rd).setRouteTarget(routeTarget).setImportRouteTarget(importRouteTarget).setAdvertiseV4Unicast(firstNonNull(advertiseV4Unicast, Boolean.FALSE)).build();<NEW_LINE>} | importRouteTarget != null, "Missing %s", PROP_ROUTE_TARGET); |
759,450 | public void handleMessage(final Message msg) {<NEW_LINE>final LatinIME latinIme = getOwnerInstance();<NEW_LINE>if (latinIme == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final KeyboardSwitcher switcher = latinIme.mKeyboardSwitcher;<NEW_LINE>switch(msg.what) {<NEW_LINE>case MSG_UPDATE_SHIFT_STATE:<NEW_LINE>switcher.requestUpdatingShiftState(latinIme.getCurrentAutoCapsState(), latinIme.getCurrentRecapitalizeState());<NEW_LINE>break;<NEW_LINE>case MSG_RESET_CACHES:<NEW_LINE>final SettingsValues settingsValues = latinIme.mSettings.getCurrent();<NEW_LINE>if (latinIme.mInputLogic.retryResetCachesAndReturnSuccess(msg.arg1 == ARG1_TRUE, /* tryResumeSuggestions */<NEW_LINE>msg.arg2, /* remainingTries */<NEW_LINE>this)) {<NEW_LINE>// If we were able to reset the caches, then we can reload the keyboard.<NEW_LINE>// Otherwise, we'll do it when we can.<NEW_LINE>latinIme.mKeyboardSwitcher.loadKeyboard(latinIme.getCurrentInputEditorInfo(), settingsValues, latinIme.getCurrentAutoCapsState(), latinIme.getCurrentRecapitalizeState());<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case MSG_WAIT_FOR_DICTIONARY_LOAD:<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>case MSG_DEALLOCATE_MEMORY:<NEW_LINE>latinIme.deallocateMemory();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | Log.i(TAG, "Timeout waiting for dictionary load"); |
41,994 | public void actionPerformed(ActionEvent e) {<NEW_LINE>log.info(Markers.USER_MARKER, "Splitting " + component.getComponentName() + " into separate fins, fin count=" + ((FinSet) component).getFinCount());<NEW_LINE>// Do change in future for overall safety<NEW_LINE>SwingUtilities.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>RocketComponent parent = component.getParent();<NEW_LINE>int <MASK><NEW_LINE>int count = ((FinSet) component).getFinCount();<NEW_LINE>double base = ((FinSet) component).getBaseRotation();<NEW_LINE>if (count <= 1)<NEW_LINE>return;<NEW_LINE>document.addUndoPosition("Split fin set");<NEW_LINE>parent.removeChild(index);<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>FinSet copy = (FinSet) component.copy();<NEW_LINE>copy.setFinCount(1);<NEW_LINE>copy.setBaseRotation(base + i * 2 * Math.PI / count);<NEW_LINE>copy.setName(copy.getName() + " #" + (i + 1));<NEW_LINE>parent.addChild(copy, index + i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>ComponentConfigDialog.disposeDialog();<NEW_LINE>} | index = parent.getChildPosition(component); |
1,729,101 | public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc) throws IOException, ServletException {<NEW_LINE>HttpServletRequest request = (HttpServletRequest) req;<NEW_LINE>// Get the IP address of client machine.<NEW_LINE><MASK><NEW_LINE>// Log the IP address and current timestamp.<NEW_LINE>LOG.info("ReadListenerFilter In filter IP " + ipAddress + ", Time " + new Date().toString());<NEW_LINE>// set up ReadListener to read data for processing<NEW_LINE>// start async<NEW_LINE>AsyncContext ac = req.startAsync();<NEW_LINE>// set up async listener<NEW_LINE>ac.addListener(new AsyncListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onComplete(AsyncEvent event) throws IOException {<NEW_LINE>LOG.info("ReadListenerFilter Filter Complete");<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(AsyncEvent event) {<NEW_LINE>LOG.info("ReadListenerFilter" + event.getThrowable().toString());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onStartAsync(AsyncEvent event) {<NEW_LINE>LOG.info(" ReadListenerFilter my asyncListener.onStartAsync");<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onTimeout(AsyncEvent event) {<NEW_LINE>LOG.info("ReadListenerFilter Filter my asyncListener.onTimeout");<NEW_LINE>}<NEW_LINE>}, req, res);<NEW_LINE>ServletInputStream input = req.getInputStream();<NEW_LINE>ReadListener readListener = new TestAsyncFilterReadListener(input, (HttpServletResponse) res, ac);<NEW_LINE>input.setReadListener(readListener);<NEW_LINE>fc.doFilter(req, res);<NEW_LINE>} | String ipAddress = request.getRemoteAddr(); |
1,128,950 | private boolean visitRule(RenderingRule rule, boolean loadOutput) {<NEW_LINE>boolean input = checkInputProperties(rule);<NEW_LINE>if (!input) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!loadOutput && !rule.isGroup()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// accept it<NEW_LINE>if (!rule.isGroup()) {<NEW_LINE>loadOutputProperties(rule, true);<NEW_LINE>}<NEW_LINE>boolean match = false;<NEW_LINE>for (RenderingRule rr : rule.getIfElseChildren()) {<NEW_LINE>match = visitRule(rr, loadOutput);<NEW_LINE>if (match) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean fit = (match <MASK><NEW_LINE>if (fit && loadOutput) {<NEW_LINE>if (rule.isGroup()) {<NEW_LINE>loadOutputProperties(rule, false);<NEW_LINE>}<NEW_LINE>for (RenderingRule rr : rule.getIfChildren()) {<NEW_LINE>visitRule(rr, loadOutput);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return fit;<NEW_LINE>} | || !rule.isGroup()); |
614,855 | final DeleteRouteResult executeDeleteRoute(DeleteRouteRequest deleteRouteRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteRouteRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DeleteRouteRequest> request = null;<NEW_LINE>Response<DeleteRouteResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteRouteRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteRouteRequest));<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, "ApiGatewayV2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteRoute");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteRouteResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteRouteResultJsonUnmarshaller());<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>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,440,969 | public void gotData(String k, int flags, byte[] data) {<NEW_LINE>if (isWrongKeyReturned(key, k))<NEW_LINE>return;<NEW_LINE>if (log.isDebugEnabled() && client.getPool().getEVCacheClientPoolManager().shouldLog(appName))<NEW_LINE>log.debug("Read data : key " + key + "; flags : " + flags + "; data : " + data);<NEW_LINE>if (data != null) {<NEW_LINE>if (log.isDebugEnabled() && client.getPool().getEVCacheClientPoolManager().shouldLog(appName))<NEW_LINE>log.debug("Key : " + key + "; val size : " + data.length);<NEW_LINE>getDataSizeDistributionSummary(EVCacheMetricsFactory.GET_OPERATION, EVCacheMetricsFactory.READ, EVCacheMetricsFactory.IPC_SIZE_INBOUND).record(data.length);<NEW_LINE>if (tc == null) {<NEW_LINE>if (tcService == null) {<NEW_LINE>log.error("tcService is null, will not be able to decode");<NEW_LINE>throw new RuntimeException("TranscoderSevice is null. Not able to decode");<NEW_LINE>} else {<NEW_LINE>final Transcoder<T> t = (Transcoder<T>) getTranscoder();<NEW_LINE>val = tcService.decode(t, new CachedData(flags, data, t.getMaxSize()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (tcService == null) {<NEW_LINE>log.error("tcService is null, will not be able to decode");<NEW_LINE>throw new RuntimeException("TranscoderSevice is null. Not able to decode");<NEW_LINE>} else {<NEW_LINE>val = tcService.decode(tc, new CachedData(flags, data, tc.getMaxSize()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (log.isDebugEnabled() && client.getPool().getEVCacheClientPoolManager().shouldLog(appName))<NEW_LINE>log.<MASK><NEW_LINE>}<NEW_LINE>} | debug("Key : " + key + "; val is null"); |
1,252,533 | public void startup() {<NEW_LINE>if (!enabled)<NEW_LINE>return;<NEW_LINE>if (serverInstance.getDatabases() instanceof OrientDBDistributed)<NEW_LINE>((OrientDBDistributed) serverInstance.getDatabases()).setPlugin(this);<NEW_LINE>OGlobalConfiguration.STORAGE_TRACK_CHANGED_RECORDS_IN_WAL.setValue(true);<NEW_LINE>// REGISTER TEMPORARY USER FOR REPLICATION PURPOSE<NEW_LINE>serverInstance.addTemporaryUser(REPLICATOR_USER, "" + new SecureRandom().nextLong(), "*");<NEW_LINE>Orient.instance().addDbLifecycleListener(this);<NEW_LINE>// CLOSE ALL CONNECTIONS TO THE SERVERS<NEW_LINE>remoteServerManager.closeAll();<NEW_LINE>messageService = new ODistributedMessageServiceImpl(this);<NEW_LINE>try {<NEW_LINE>clusterManager.startupHazelcastPlugin();<NEW_LINE>final long statsDelay = OGlobalConfiguration.DISTRIBUTED_DUMP_STATS_EVERY.getValueAsLong();<NEW_LINE>if (statsDelay > 0) {<NEW_LINE>haStatsTask = Orient.instance().scheduleTask(<MASK><NEW_LINE>}<NEW_LINE>final long healthChecker = OGlobalConfiguration.DISTRIBUTED_CHECK_HEALTH_EVERY.getValueAsLong();<NEW_LINE>if (healthChecker > 0) {<NEW_LINE>healthCheckerTask = Orient.instance().scheduleTask(new OClusterHealthChecker(this, healthChecker), healthChecker, healthChecker);<NEW_LINE>}<NEW_LINE>signalListener = new OSignalHandler.OSignalListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSignal(final Signal signal) {<NEW_LINE>if (signal.toString().trim().equalsIgnoreCase("SIGTRAP"))<NEW_LINE>dumpStats();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Orient.instance().getSignalHandler().registerListener(signalListener);<NEW_LINE>} catch (Exception e) {<NEW_LINE>ODistributedServerLog.error(this, nodeName, null, DIRECTION.NONE, "Error on starting distributed plugin", e);<NEW_LINE>throw OException.wrapException(new ODistributedStartupException("Error on starting distributed plugin"), e);<NEW_LINE>}<NEW_LINE>dumpServersStatus();<NEW_LINE>} | this::dumpStats, statsDelay, statsDelay); |
565,907 | private static void addPipeUpgradeRecipe(ItemPipeHolder from, ItemPipeHolder to, Object additional) {<NEW_LINE>if (from == null || to == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (additional == null) {<NEW_LINE>throw new NullPointerException("additional");<NEW_LINE>}<NEW_LINE>IRecipe returnRecipe = new ShapelessOreRecipe(to.getRegistryName(), new ItemStack(from), new ItemStack(to)).setRegistryName(new ResourceLocation(to.getRegistryName() + "_undo"));<NEW_LINE>ForgeRegistries.RECIPES.register(returnRecipe);<NEW_LINE>NonNullList<Ingredient<MASK><NEW_LINE>list.add(Ingredient.fromItem(from));<NEW_LINE>list.add(CraftingHelper.getIngredient(additional));<NEW_LINE>IRecipe upgradeRecipe = new ShapelessRecipes(to.getRegistryName().getResourcePath(), new ItemStack(to), list).setRegistryName(new ResourceLocation(to.getRegistryName() + "_colorless"));<NEW_LINE>ForgeRegistries.RECIPES.register(upgradeRecipe);<NEW_LINE>for (EnumDyeColor colour : ColourUtil.COLOURS) {<NEW_LINE>ItemStack f = new ItemStack(from, 1, colour.getMetadata() + 1);<NEW_LINE>ItemStack t = new ItemStack(to, 1, colour.getMetadata() + 1);<NEW_LINE>IRecipe returnRecipeColored = new ShapelessOreRecipe(to.getRegistryName(), f, t).setRegistryName(new ResourceLocation(to.getRegistryName() + "_" + colour.getName() + "_undo"));<NEW_LINE>ForgeRegistries.RECIPES.register(returnRecipeColored);<NEW_LINE>NonNullList<Ingredient> colorList = NonNullList.create();<NEW_LINE>colorList.add(Ingredient.fromStacks(f));<NEW_LINE>colorList.add(CraftingHelper.getIngredient(additional));<NEW_LINE>IRecipe upgradeRecipeColored = new ShapelessOreRecipe(to.getRegistryName(), colorList, t).setRegistryName(new ResourceLocation(to.getRegistryName() + "_" + colour.getName()));<NEW_LINE>ForgeRegistries.RECIPES.register(upgradeRecipeColored);<NEW_LINE>}<NEW_LINE>} | > list = NonNullList.create(); |
413,134 | public void actionPerformed(ActionEvent e) {<NEW_LINE>JMenuItem tt = (JMenuItem) e.getSource();<NEW_LINE>try {<NEW_LINE>GV.appFrame.openSheetFile(tt.getText());<NEW_LINE>} catch (Throwable t) {<NEW_LINE>GM.showException(t);<NEW_LINE>if (StringUtils.isValidString(tt.getText())) {<NEW_LINE>File f = new File(tt.getText());<NEW_LINE>if (!f.exists()) {<NEW_LINE>if (fileItem != null) {<NEW_LINE>int len = fileItem.length;<NEW_LINE>int index = -1;<NEW_LINE>for (int i = 0; i < len; i++) {<NEW_LINE>if (tt.getText().equalsIgnoreCase(fileItem[i].getText())) {<NEW_LINE>index = i;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (index == -1)<NEW_LINE>return;<NEW_LINE>JMenuItem[] newFileItem = new JMenuItem[GC.RECENT_MENU_COUNT];<NEW_LINE>if (index > 0) {<NEW_LINE>System.arraycopy(fileItem, 0, newFileItem, 0, index);<NEW_LINE>}<NEW_LINE>if (index < len - 1) {<NEW_LINE>System.arraycopy(fileItem, index + 1, newFileItem, index, len - index - 1);<NEW_LINE>}<NEW_LINE>newFileItem[len - 1] = new JMenuItem("");<NEW_LINE>newFileItem[len - 1].setVisible(false);<NEW_LINE>newFileItem[len <MASK><NEW_LINE>fileItem = newFileItem;<NEW_LINE>try {<NEW_LINE>ConfigFile.getConfigFile().storeRecentFiles(ConfigFile.APP_DM, fileItem);<NEW_LINE>} catch (Throwable e1) {<NEW_LINE>e1.printStackTrace();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>loadRecentFiles(menu, this);<NEW_LINE>} catch (Throwable e1) {<NEW_LINE>e1.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | - 1].addActionListener(this); |
1,069,073 | public static void rotateCW(GrayF64 image) {<NEW_LINE>if (image.width != image.height)<NEW_LINE>throw new IllegalArgumentException("Image must be square");<NEW_LINE>int w = image.height / 2 + image.height % 2;<NEW_LINE>int h = image.height / 2;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, h, y0->{<NEW_LINE>for (int y0 = 0; y0 < h; y0++) {<NEW_LINE>int y1 = image.height - y0 - 1;<NEW_LINE>for (int x0 = 0; x0 < w; x0++) {<NEW_LINE>int x1 = image.width - x0 - 1;<NEW_LINE>int index0 = image.startIndex + y0 * image.stride + x0;<NEW_LINE>int index1 = image.startIndex + x0 * image.stride + y1;<NEW_LINE>int index2 = image.startIndex + y1 * image.stride + x1;<NEW_LINE>int index3 = image.startIndex + x1 * image.stride + y0;<NEW_LINE>double tmp3 = image.data[index3];<NEW_LINE>image.data[index3] = image.data[index2];<NEW_LINE>image.data[index2] = image.data[index1];<NEW_LINE>image.data[index1] = image.data[index0];<NEW_LINE>image.data<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | [index0] = (double) tmp3; |
420,175 | public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {<NEW_LINE>if (args.length == 1) {<NEW_LINE>final McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);<NEW_LINE>if (mcMMOPlayer == null) {<NEW_LINE>sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>final Party playerParty = mcMMOPlayer.getParty();<NEW_LINE>final <MASK><NEW_LINE>for (Player member : playerParty.getOnlineMembers()) {<NEW_LINE>if (!PartyManager.handlePartyChangeEvent(member, partyName, null, EventReason.KICKED_FROM_PARTY)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>member.sendMessage(LocaleLoader.getString("Party.Disband"));<NEW_LINE>}<NEW_LINE>PartyManager.disbandParty(mcMMOPlayer, playerParty);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>sender.sendMessage(LocaleLoader.getString("Commands.Usage.1", "party", "disband"));<NEW_LINE>return true;<NEW_LINE>} | String partyName = playerParty.getName(); |
1,804,099 | public DataRecord deserialize(final DataInput source, @NonNegative final long recordID, final SirixDeweyID deweyID, final PageReadOnlyTrx pageReadTrx) throws IOException {<NEW_LINE>final BigInteger <MASK><NEW_LINE>// Node delegate.<NEW_LINE>final NodeDelegate nodeDel = deserializeNodeDelegate(source, recordID, deweyID, pageReadTrx);<NEW_LINE>// Struct delegate.<NEW_LINE>final StructNodeDelegate structDel = deserializeStructDel(this, nodeDel, source, pageReadTrx.getResourceManager().getResourceConfig());<NEW_LINE>// Name delegate.<NEW_LINE>final NameNodeDelegate nameDel = deserializeNameDelegate(nodeDel, source);<NEW_LINE>// Val delegate.<NEW_LINE>final boolean isCompressed = source.readByte() == (byte) 1;<NEW_LINE>final byte[] vals = new byte[source.readInt()];<NEW_LINE>source.readFully(vals, 0, vals.length);<NEW_LINE>final ValueNodeDelegate valDel = new ValueNodeDelegate(nodeDel, vals, isCompressed);<NEW_LINE>// Returning an instance.<NEW_LINE>return new PINode(hashCode, structDel, nameDel, valDel, pageReadTrx);<NEW_LINE>} | hashCode = getHash(source, pageReadTrx); |
1,837,902 | protected int addToSlot(IInvSlot slot, ItemStack stack, int injected, boolean doAdd) {<NEW_LINE><MASK><NEW_LINE>int max = Math.min(stack.getMaxStackSize(), inventory.getInventoryStackLimit());<NEW_LINE>ItemStack stackInSlot = slot.getStackInSlot();<NEW_LINE>if (stackInSlot == null) {<NEW_LINE>int wanted = Math.min(available, max);<NEW_LINE>if (doAdd) {<NEW_LINE>stackInSlot = stack.copy();<NEW_LINE>stackInSlot.stackSize = wanted;<NEW_LINE>slot.setStackInSlot(stackInSlot);<NEW_LINE>}<NEW_LINE>return wanted;<NEW_LINE>}<NEW_LINE>if (!StackUtil.canMerge(stack, stackInSlot)) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>int wanted = max - stackInSlot.stackSize;<NEW_LINE>if (wanted <= 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>if (wanted > available) {<NEW_LINE>wanted = available;<NEW_LINE>}<NEW_LINE>if (doAdd) {<NEW_LINE>stackInSlot.stackSize += wanted;<NEW_LINE>slot.setStackInSlot(stackInSlot);<NEW_LINE>}<NEW_LINE>return wanted;<NEW_LINE>} | int available = stack.stackSize - injected; |
1,285,854 | private void writeToFile(StringBuffer sb, String fileName) {<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>// not created if it exists<NEW_LINE>if (out.exists())<NEW_LINE>return;<NEW_LINE>Writer fw = new OutputStreamWriter(new FileOutputStream(out, false), "UTF-8");<NEW_LINE>for (int i = 0; i < sb.length(); i++) {<NEW_LINE>char c = sb.charAt(i);<NEW_LINE>// after<NEW_LINE>if (c == ';' || c == '}') {<NEW_LINE>fw.write(c);<NEW_LINE>} else // before & after<NEW_LINE>if (c == '{') {<NEW_LINE>fw.write(c);<NEW_LINE>} else<NEW_LINE>fw.write(c);<NEW_LINE>}<NEW_LINE>fw.flush();<NEW_LINE>fw.close();<NEW_LINE>float size = out.length();<NEW_LINE>size /= 1024;<NEW_LINE>log.info(out.getAbsolutePath() + " - " + size + " kB");<NEW_LINE>} catch (Exception ex) {<NEW_LINE>log.log(Level.SEVERE, fileName, ex);<NEW_LINE>throw new RuntimeException(ex);<NEW_LINE>}<NEW_LINE>} | File out = new File(fileName); |
1,367,050 | @Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@ApiOperation(value = "Creates a new policy condition", response = PolicyCondition.class, code = 201)<NEW_LINE>@ApiResponses(value = { @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 404, message = "The UUID of the policy could not be found") })<NEW_LINE>@PermissionRequired(Permissions.Constants.POLICY_MANAGEMENT)<NEW_LINE>public Response createPolicyCondition(@ApiParam(value = "The UUID of the policy", required = true) @PathParam("uuid") String uuid, PolicyCondition jsonPolicyCondition) {<NEW_LINE>final Validator validator = super.getValidator();<NEW_LINE>failOnValidationError(validator.validateProperty(jsonPolicyCondition, "value"));<NEW_LINE>try (QueryManager qm = new QueryManager()) {<NEW_LINE>Policy policy = qm.getObjectByUuid(Policy.class, uuid);<NEW_LINE>if (policy != null) {<NEW_LINE>final PolicyCondition pc = qm.createPolicyCondition(policy, jsonPolicyCondition.getSubject(), jsonPolicyCondition.getOperator(), StringUtils.trimToNull(jsonPolicyCondition.getValue()));<NEW_LINE>return Response.status(Response.Status.CREATED).<MASK><NEW_LINE>} else {<NEW_LINE>return Response.status(Response.Status.NOT_FOUND).entity("The UUID of the policy could not be found.").build();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | entity(pc).build(); |
1,685,439 | public boolean addRequiredModules(String originalPathType, FileObject projectArtifact, Collection<URL> moduleNames) throws IOException {<NEW_LINE>assert projectArtifact != null;<NEW_LINE>assert originalPathType != null;<NEW_LINE>Project p = FileOwnerQuery.getOwner(projectArtifact);<NEW_LINE>if (p == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>FileObject modInfo = findModuleInfo(projectArtifact);<NEW_LINE>if (modInfo == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>ProjectModulesModifier delegate = p.getLookup().lookup(ProjectModulesModifier.class);<NEW_LINE>if (delegate != null) {<NEW_LINE>return delegate.<MASK><NEW_LINE>}<NEW_LINE>switch(originalPathType) {<NEW_LINE>case ClassPath.COMPILE:<NEW_LINE>case ClassPath.EXECUTE:<NEW_LINE>case JavaClassPathConstants.MODULE_COMPILE_PATH:<NEW_LINE>case JavaClassPathConstants.MODULE_EXECUTE_PATH:<NEW_LINE>return extendModuleInfo(modInfo, moduleNames);<NEW_LINE>default:<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | addRequiredModules(originalPathType, projectArtifact, moduleNames); |
1,286,533 | public Mono<TopicDTO> recreateTopic(KafkaCluster cluster, String topicName) {<NEW_LINE>return loadTopic(cluster, topicName).flatMap(t -> deleteTopic(cluster, topicName).thenReturn(t).delayElement(Duration.ofSeconds(recreateDelayInSeconds)).flatMap(topic -> adminClientService.get(cluster).flatMap(ac -> ac.createTopic(topic.getName(), topic.getPartitionCount(), (short) topic.getReplicationFactor(), topic.getTopicConfigs().stream().collect(Collectors.toMap(InternalTopicConfig::getName, InternalTopicConfig::getValue))).thenReturn(topicName)).retryWhen(Retry.fixedDelay(recreateMaxRetries, Duration.ofSeconds(recreateDelayInSeconds)).filter(TopicExistsException.class::isInstance).onRetryExhaustedThrow((a, b) -> new TopicRecreationException(topicName, recreateMaxRetries * recreateDelayInSeconds))).flatMap(a -> loadTopicAfterCreation(cluster, topicName)).<MASK><NEW_LINE>} | map(clusterMapper::toTopic))); |
1,258,104 | public ListenerResult listen(WorkflowContext context) throws Exception {<NEW_LINE>StreamResourceProcessForm form = (StreamResourceProcessForm) context.getProcessForm();<NEW_LINE>InlongStreamInfo streamInfo = form.getStreamInfo();<NEW_LINE>final String operator = context.getOperator();<NEW_LINE>final GroupOperateType operateType = form.getGroupOperateType();<NEW_LINE>final String groupId = streamInfo.getInlongGroupId();<NEW_LINE>final String streamId = streamInfo.getInlongStreamId();<NEW_LINE>switch(operateType) {<NEW_LINE>case SUSPEND:<NEW_LINE>streamService.updateStatus(groupId, streamId, StreamStatus.SUSPENDING.getCode(), operator);<NEW_LINE>break;<NEW_LINE>case RESTART:<NEW_LINE>streamService.updateStatus(groupId, streamId, StreamStatus.<MASK><NEW_LINE>break;<NEW_LINE>case DELETE:<NEW_LINE>streamService.updateStatus(groupId, streamId, StreamStatus.DELETING.getCode(), operator);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return ListenerResult.success();<NEW_LINE>} | RESTARTING.getCode(), operator); |
1,493,147 | public void fileDataCreated(final FileEvent fe) {<NEW_LINE>RP.post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>FileObject fo = fe.getFile();<NEW_LINE>boolean accepted = acceptEvent(fo);<NEW_LINE>if (!accepted) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (DEBUG) {<NEW_LINE>Debug.log(ModuleChangeHandler.class, "-- fileDataCreated fo: " + fo + " isFolder:" + fo.isFolder() + " ACCEPTED" + " th:" + Thread.currentThread().getName());<NEW_LINE>if (accepted && fo.isFolder()) {<NEW_LINE>FileObject[] files = fo.getChildren();<NEW_LINE>for (int i = 0; i < files.length; i++) {<NEW_LINE>Debug.log(ModuleChangeHandler.class, "fo[" + i <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>processDataOrFolderCreated(fo);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | + "]: " + files[i]); |
279,265 | final ListReportsForReportGroupResult executeListReportsForReportGroup(ListReportsForReportGroupRequest listReportsForReportGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listReportsForReportGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListReportsForReportGroupRequest> request = null;<NEW_LINE>Response<ListReportsForReportGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListReportsForReportGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listReportsForReportGroupRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListReportsForReportGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListReportsForReportGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListReportsForReportGroupResultJsonUnmarshaller());<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>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeBuild"); |
778,372 | private void configure() {<NEW_LINE>final LogManager manager = LogManager.getLogManager();<NEW_LINE>final String className = this.getClass().getName();<NEW_LINE>final String level = <MASK><NEW_LINE>this.setLevel((level == null) ? Level.INFO : Level.parse(level));<NEW_LINE>final Level levelStdOut = this.parseLevel(manager.getProperty(className + ".levelStdOut"));<NEW_LINE>final Level levelSplit = this.parseLevel(manager.getProperty(className + ".levelSplit"));<NEW_LINE>final Level levelStdErr = this.parseLevel(manager.getProperty(className + ".levelStdErr"));<NEW_LINE>this.setLevels(levelStdOut, levelSplit, levelStdErr);<NEW_LINE>final String filter = manager.getProperty(className + ".filter");<NEW_LINE>this.setFilter(this.makeFilter(filter));<NEW_LINE>final String formatter = manager.getProperty(className + ".formatter");<NEW_LINE>this.setFormatter(this.makeFormatter(formatter));<NEW_LINE>final String encoding = manager.getProperty(className + ".encoding");<NEW_LINE>try {<NEW_LINE>this.stdOutHandler.setEncoding(encoding);<NEW_LINE>this.stdErrHandler.setEncoding(encoding);<NEW_LINE>} catch (final UnsupportedEncodingException e) {<NEW_LINE>ConcurrentLog.logException(e);<NEW_LINE>}<NEW_LINE>final String ignoreCtrlChrStr = manager.getProperty(className + ".ignoreCtrlChr");<NEW_LINE>this.ignoreCtrlChr = (ignoreCtrlChrStr == null) ? false : "true".equalsIgnoreCase(ignoreCtrlChrStr);<NEW_LINE>} | manager.getProperty(className + ".level"); |
1,741,090 | public void execute(final OfficeTask task) throws OfficeException {<NEW_LINE>Future<?> futureTask = taskExecutor.submit(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>if (settings.getMaxTasksPerProcess() > 0 && ++taskCount == settings.getMaxTasksPerProcess() + 1) {<NEW_LINE>logger.info(String.format("reached limit of %d maxTasksPerProcess: restarting", settings.getMaxTasksPerProcess()));<NEW_LINE>taskExecutor.setAvailable(false);<NEW_LINE>stopping = true;<NEW_LINE>managedOfficeProcess.restartAndWait();<NEW_LINE>// FIXME taskCount will be 0 rather than 1 at this point<NEW_LINE>}<NEW_LINE>task.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>currentTask = futureTask;<NEW_LINE>try {<NEW_LINE>futureTask.get(settings.getTaskExecutionTimeout(), TimeUnit.MILLISECONDS);<NEW_LINE>} catch (TimeoutException timeoutException) {<NEW_LINE>managedOfficeProcess.restartDueToTaskTimeout();<NEW_LINE>throw new OfficeException("task did not complete within timeout", timeoutException);<NEW_LINE>} catch (ExecutionException executionException) {<NEW_LINE>if (executionException.getCause() instanceof OfficeException) {<NEW_LINE>throw (OfficeException) executionException.getCause();<NEW_LINE>} else {<NEW_LINE>throw new OfficeException("task failed", executionException.getCause());<NEW_LINE>}<NEW_LINE>} catch (Exception exception) {<NEW_LINE>throw new OfficeException("task failed", exception);<NEW_LINE>}<NEW_LINE>} | execute(managedOfficeProcess.getConnection()); |
675,368 | private String replacePathMacroRecursively(String text, final String path, boolean caseSensitive) {<NEW_LINE>if (text.length() < path.length()) {<NEW_LINE>return text;<NEW_LINE>}<NEW_LINE>if (path.isEmpty())<NEW_LINE>return text;<NEW_LINE>final StringBuilder newText = new StringBuilder();<NEW_LINE>final boolean isWindowsRoot = path.endsWith(":/");<NEW_LINE>int i = 0;<NEW_LINE>while (i < text.length()) {<NEW_LINE>int occurrenceOfPath = caseSensitive ? text.indexOf(path, i) : StringUtil.indexOfIgnoreCase(text, path, i);<NEW_LINE>if (occurrenceOfPath >= 0) {<NEW_LINE>int endOfOccurrence = occurrenceOfPath + path.length();<NEW_LINE>if (!isWindowsRoot && endOfOccurrence < text.length() && text.charAt(endOfOccurrence) != '/' && text.charAt(endOfOccurrence) != '\"' && text.charAt(endOfOccurrence) != ' ' && !text.substring(endOfOccurrence).startsWith("!/")) {<NEW_LINE>newText.append(text.substring(i, endOfOccurrence));<NEW_LINE>i = endOfOccurrence;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (occurrenceOfPath > 0) {<NEW_LINE>char prev = text.charAt(occurrenceOfPath - 1);<NEW_LINE>if (Character.isLetterOrDigit(prev) || prev == '_') {<NEW_LINE>newText.append(text.substring(i, endOfOccurrence));<NEW_LINE>i = endOfOccurrence;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (occurrenceOfPath < 0) {<NEW_LINE>if (newText.length() == 0) {<NEW_LINE>return text;<NEW_LINE>}<NEW_LINE>newText.append<MASK><NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>newText.append(text.substring(i, occurrenceOfPath));<NEW_LINE>newText.append(myMacroMap.get(path));<NEW_LINE>i = occurrenceOfPath + path.length();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return newText.toString();<NEW_LINE>} | (text.substring(i)); |
1,384,205 | private <R extends IBaseResource> R populateResourceMetadataRi(Class<R> theResourceType, IBaseResourceEntity theEntity, @Nullable Collection<? extends BaseTag> theTagList, boolean theForHistoryOperation, IAnyResource res, Long theVersion) {<NEW_LINE>R retVal = (R) res;<NEW_LINE>if (theEntity.getDeleted() != null) {<NEW_LINE>res = (IAnyResource) myContext.getResourceDefinition(theResourceType).newInstance();<NEW_LINE>retVal = (R) res;<NEW_LINE>ResourceMetadataKeyEnum.DELETED_AT.put(res, new InstantDt(theEntity.getDeleted()));<NEW_LINE>if (theForHistoryOperation) {<NEW_LINE>ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, HTTPVerb.DELETE.toCode());<NEW_LINE>}<NEW_LINE>} else if (theForHistoryOperation) {<NEW_LINE>Date published = theEntity.getPublished().getValue();<NEW_LINE>Date updated = theEntity.getUpdated().getValue();<NEW_LINE>if (published.equals(updated)) {<NEW_LINE>ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, HTTPVerb.POST.toCode());<NEW_LINE>} else {<NEW_LINE>ResourceMetadataKeyEnum.ENTRY_TRANSACTION_METHOD.put(res, HTTPVerb.PUT.toCode());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>res.getMeta().setLastUpdated(null);<NEW_LINE>res.getMeta().setVersionId(null);<NEW_LINE>updateResourceMetadata(theEntity, res);<NEW_LINE>res.setId(res.getIdElement().withVersion(theVersion.toString()));<NEW_LINE>res.getMeta().setLastUpdated(theEntity.getUpdatedDate());<NEW_LINE>IDao.RESOURCE_PID.put(res, theEntity.getResourceId());<NEW_LINE>if (theTagList != null) {<NEW_LINE>res.getMeta().getTag().clear();<NEW_LINE>res.getMeta()<MASK><NEW_LINE>res.getMeta().getSecurity().clear();<NEW_LINE>for (BaseTag next : theTagList) {<NEW_LINE>switch(next.getTag().getTagType()) {<NEW_LINE>case PROFILE:<NEW_LINE>res.getMeta().addProfile(next.getTag().getCode());<NEW_LINE>break;<NEW_LINE>case SECURITY_LABEL:<NEW_LINE>IBaseCoding sec = res.getMeta().addSecurity();<NEW_LINE>sec.setSystem(next.getTag().getSystem());<NEW_LINE>sec.setCode(next.getTag().getCode());<NEW_LINE>sec.setDisplay(next.getTag().getDisplay());<NEW_LINE>break;<NEW_LINE>case TAG:<NEW_LINE>IBaseCoding tag = res.getMeta().addTag();<NEW_LINE>tag.setSystem(next.getTag().getSystem());<NEW_LINE>tag.setCode(next.getTag().getCode());<NEW_LINE>tag.setDisplay(next.getTag().getDisplay());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return retVal;<NEW_LINE>} | .getProfile().clear(); |
559,682 | private static void createOperandExpression(final SQLProvider provider, final INaviOperandTreeNode node, final int parent) throws SQLException {<NEW_LINE>if (node.getId() != -1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ExpressionType type = node.getType();<NEW_LINE>final String value = getValue(type, node.getValue());<NEW_LINE>final int moduleId = node.getOperand().getInstruction().getModule().getConfiguration().getId();<NEW_LINE>final int typeId = COperandTypeConverter.convert(type);<NEW_LINE>final String immediate = Convert.isDecString(value) ? value : "null";<NEW_LINE>final String symbol = Convert.isDecString(value) ? "null" : value;<NEW_LINE>final String parentString = parent == 0 ? "null" : String.valueOf(parent);<NEW_LINE>final ResultSet resultSet = provider.getConnection().executeQuery("select max(id)+1 AS id from " + CTableNames.EXPRESSION_TREE_TABLE + " where module_id = " + moduleId, true);<NEW_LINE>try {<NEW_LINE>if (resultSet.next()) {<NEW_LINE>final int id = resultSet.getInt("id");<NEW_LINE>final String query = String.format("insert into " + CTableNames.EXPRESSION_TREE_TABLE + "(module_id, id, type, symbol, immediate, position, parent_id) " + " values(%d, %d , %d, ?, %s, 0, %s)", moduleId, id, typeId, immediate, parentString);<NEW_LINE>final PreparedStatement statement = provider.getConnection().<MASK><NEW_LINE>try {<NEW_LINE>statement.setString(1, symbol);<NEW_LINE>statement.executeUpdate();<NEW_LINE>} finally {<NEW_LINE>statement.close();<NEW_LINE>}<NEW_LINE>node.setId(id);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>resultSet.close();<NEW_LINE>}<NEW_LINE>} | getConnection().prepareStatement(query); |
259,603 | public void showPurchaseOrderOfProduct(ActionRequest request, ActionResponse response) {<NEW_LINE>Map<String, Long> mapId = Beans.get(ProjectedStockService.class).getProductIdCompanyIdStockLocationIdFromContext(request.getContext());<NEW_LINE>if (mapId == null || mapId.get("productId") == 0L) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Long productId = mapId.get("productId");<NEW_LINE>Long companyId = mapId.get("companyId");<NEW_LINE>Long <MASK><NEW_LINE>String domain = Beans.get(PurchaseOrderStockService.class).getPurchaseOrderLineListForAProduct(productId, companyId, stockLocationId);<NEW_LINE>Product product = Beans.get(ProductRepository.class).find(mapId.get("productId"));<NEW_LINE>String title = I18n.get(VIEW_POL_OF_PRODUCT_TITLE);<NEW_LINE>title = String.format(title, product.getName());<NEW_LINE>response.setView(ActionView.define(title).model(PurchaseOrderLine.class.getName()).add("grid", "purchase-order-line-menu-grid").add("form", "purchase-order-line-all-form").domain(domain).param("popup", "true").param("popup-save", "false").param("popup.maximized", "true").map());<NEW_LINE>} | stockLocationId = mapId.get("stockLocationId"); |
271,025 | private static void upsert() {<NEW_LINE>Map<Integer, ParameterContext> params = new HashMap<>();<NEW_LINE>int i = 1;<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("insert into " + FEATURE_USAGE_STATISTICS_TABLE + " (name, val) values");<NEW_LINE>for (Map.Entry<String, AtomicLong> cacheItem : CACHE_KEY_STATISTICS.entrySet()) {<NEW_LINE>if (cacheItem.getValue().longValue() > 0) {<NEW_LINE>if (i == 1) {<NEW_LINE>sb.append("(?, ?)");<NEW_LINE>} else {<NEW_LINE>sb.append(",(?, ?)");<NEW_LINE>}<NEW_LINE>MetaDbUtil.setParameter(i++, params, ParameterMethod.setString, cacheItem.getKey());<NEW_LINE>MetaDbUtil.setParameter(i++, params, ParameterMethod.setLong, cacheItem.getValue().getAndSet(0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!params.isEmpty()) {<NEW_LINE>sb.append(" on duplicate key update val = val + values(val)");<NEW_LINE>try (Connection metaDbConn = MetaDbUtil.getConnection()) {<NEW_LINE>MetaDbUtil.insert(sb.toString(), params, metaDbConn);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error(<MASK><NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_GMS_ACCESS_TO_SYSTEM_TABLE, e, "query", FEATURE_USAGE_STATISTICS_TABLE, e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "Failed to query the system table '" + FEATURE_USAGE_STATISTICS_TABLE + "'", e); |
1,567,082 | private void sendSPSandPPS(MediaFormat mediaFormat) {<NEW_LINE>// H265<NEW_LINE>if (type.equals(CodecUtil.H265_MIME)) {<NEW_LINE>List<ByteBuffer> byteBufferList = extractVpsSpsPpsFromH265<MASK><NEW_LINE>oldSps = byteBufferList.get(1);<NEW_LINE>oldPps = byteBufferList.get(2);<NEW_LINE>oldVps = byteBufferList.get(0);<NEW_LINE>getVideoData.onSpsPpsVps(oldSps, oldPps, oldVps);<NEW_LINE>// H264<NEW_LINE>} else {<NEW_LINE>oldSps = mediaFormat.getByteBuffer("csd-0");<NEW_LINE>oldPps = mediaFormat.getByteBuffer("csd-1");<NEW_LINE>oldVps = null;<NEW_LINE>getVideoData.onSpsPpsVps(oldSps, oldPps, oldVps);<NEW_LINE>}<NEW_LINE>} | (mediaFormat.getByteBuffer("csd-0")); |
301,937 | private ReentrantCycleDetectingLock<?> addAllLockIdsAfter(Thread thread, ReentrantCycleDetectingLock<?> lock, ListMultimap<Thread, ID> potentialLocksCycle) {<NEW_LINE>boolean found = false;<NEW_LINE>Collection<ReentrantCycleDetectingLock<?>> <MASK><NEW_LINE>Preconditions.checkNotNull(ownedLocks, "Internal error: No locks were found taken by a thread");<NEW_LINE>for (ReentrantCycleDetectingLock<?> ownedLock : ownedLocks) {<NEW_LINE>if (ownedLock == lock) {<NEW_LINE>found = true;<NEW_LINE>}<NEW_LINE>if (found && ownedLock.lockFactory == this.lockFactory) {<NEW_LINE>// All locks are stored in a shared map therefore there is no way to<NEW_LINE>// enforce type safety. We know that our cast is valid as we check for a lock's<NEW_LINE>// factory. If the lock was generated by the<NEW_LINE>// same factory it has to have same type as the current lock.<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>ID userLockId = (ID) ownedLock.userLockId;<NEW_LINE>potentialLocksCycle.put(thread, userLockId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Preconditions.checkState(found, "Internal error: We can not find locks that created a cycle that we detected");<NEW_LINE>ReentrantCycleDetectingLock<?> unownedLock = lockThreadIsWaitingOn.get(thread);<NEW_LINE>// If this thread is waiting for a lock add it to the cycle and return it<NEW_LINE>if (unownedLock != null && unownedLock.lockFactory == this.lockFactory) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>ID typed = (ID) unownedLock.userLockId;<NEW_LINE>potentialLocksCycle.put(thread, typed);<NEW_LINE>}<NEW_LINE>return unownedLock;<NEW_LINE>} | ownedLocks = locksOwnedByThread.get(thread); |
893,939 | public void truncateOffset(long offset) {<NEW_LINE>Object[] mfs = this.copyMappedFiles();<NEW_LINE>if (mfs == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<MmapFile> willRemoveFiles = new ArrayList<MmapFile>();<NEW_LINE>for (int i = 0; i < mfs.length; i++) {<NEW_LINE>MmapFile file = (MmapFile) mfs[i];<NEW_LINE>long fileTailOffset = file<MASK><NEW_LINE>if (fileTailOffset > offset) {<NEW_LINE>if (offset >= file.getFileFromOffset()) {<NEW_LINE>file.setWrotePosition((int) (offset % this.mappedFileSize));<NEW_LINE>file.setCommittedPosition((int) (offset % this.mappedFileSize));<NEW_LINE>file.setFlushedPosition((int) (offset % this.mappedFileSize));<NEW_LINE>} else {<NEW_LINE>willRemoveFiles.add(file);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.destroyExpiredFiles(willRemoveFiles);<NEW_LINE>this.deleteExpiredFiles(willRemoveFiles);<NEW_LINE>} | .getFileFromOffset() + this.mappedFileSize; |
622,465 | public static PaymentAccount fromProto(protobuf.PaymentAccount proto, CoreProtoResolver coreProtoResolver) {<NEW_LINE>String paymentMethodId = proto.getPaymentMethod().getId();<NEW_LINE>List<TradeCurrency> tradeCurrencies = proto.getTradeCurrenciesList().stream().map(TradeCurrency::fromProto).collect(Collectors.toList());<NEW_LINE>// We need to remove NGN for Transferwise<NEW_LINE>Optional<TradeCurrency> ngnTwOptional = tradeCurrencies.stream().filter(e -> paymentMethodId.equals(TRANSFERWISE_ID)).filter(e -> e.getCode().equals("NGN")).findAny();<NEW_LINE>// We cannot remove it in the stream as it would cause a concurrentModificationException<NEW_LINE>ngnTwOptional.ifPresent(tradeCurrencies::remove);<NEW_LINE>try {<NEW_LINE>PaymentAccount account = PaymentAccountFactory.getPaymentAccount(PaymentMethod.getPaymentMethod(paymentMethodId));<NEW_LINE>account.getTradeCurrencies().clear();<NEW_LINE>account.setId(proto.getId());<NEW_LINE>account.setCreationDate(proto.getCreationDate());<NEW_LINE>account.setAccountName(proto.getAccountName());<NEW_LINE>account.setPersistedAccountName(proto.getAccountName());<NEW_LINE>account.<MASK><NEW_LINE>account.setPaymentAccountPayload(coreProtoResolver.fromProto(proto.getPaymentAccountPayload()));<NEW_LINE>if (proto.hasSelectedTradeCurrency())<NEW_LINE>account.setSelectedTradeCurrency(TradeCurrency.fromProto(proto.getSelectedTradeCurrency()));<NEW_LINE>return account;<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>log.warn("Could not load account: {}, exception: {}", paymentMethodId, e.toString());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | getTradeCurrencies().addAll(tradeCurrencies); |
182,722 | public void visitType(JavacNode typeNode, JCClassDecl type) {<NEW_LINE>AnnotationValues<FieldDefaults> fieldDefaults = null;<NEW_LINE>JavacNode source = typeNode;<NEW_LINE>boolean levelIsExplicit = false;<NEW_LINE>boolean makeFinalIsExplicit = false;<NEW_LINE>FieldDefaults fd = null;<NEW_LINE>for (JavacNode jn : typeNode.down()) {<NEW_LINE>if (jn.getKind() != Kind.ANNOTATION)<NEW_LINE>continue;<NEW_LINE>JCAnnotation ann = (JCAnnotation) jn.get();<NEW_LINE>JCTree typeTree = ann.annotationType;<NEW_LINE>if (typeTree == null)<NEW_LINE>continue;<NEW_LINE>String typeTreeToString = typeTree.toString();<NEW_LINE>if (!typeTreeToString.equals("FieldDefaults") && !typeTreeToString.equals("lombok.experimental.FieldDefaults"))<NEW_LINE>continue;<NEW_LINE>if (!typeMatches(FieldDefaults.class, jn, typeTree))<NEW_LINE>continue;<NEW_LINE>source = jn;<NEW_LINE>fieldDefaults = createAnnotation(FieldDefaults.class, jn);<NEW_LINE>levelIsExplicit = fieldDefaults.isExplicit("level");<NEW_LINE>makeFinalIsExplicit = fieldDefaults.isExplicit("makeFinal");<NEW_LINE>handleExperimentalFlagUsage(jn, ConfigurationKeys.FIELD_DEFAULTS_FLAG_USAGE, "@FieldDefaults");<NEW_LINE>fd = fieldDefaults.getInstance();<NEW_LINE>if (!levelIsExplicit && !makeFinalIsExplicit) {<NEW_LINE>jn.addError("This does nothing; provide either level or makeFinal or both.");<NEW_LINE>}<NEW_LINE>if (levelIsExplicit && fd.level() == AccessLevel.NONE) {<NEW_LINE>jn.addError("AccessLevel.NONE doesn't mean anything here. Pick another value.");<NEW_LINE>levelIsExplicit = false;<NEW_LINE>}<NEW_LINE>deleteAnnotationIfNeccessary(jn, FieldDefaults.class);<NEW_LINE>deleteImportFromCompilationUnit(jn, "lombok.AccessLevel");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (fd == null && (type.mods.flags & (Flags.INTERFACE | Flags.ANNOTATION)) != 0)<NEW_LINE>return;<NEW_LINE>boolean defaultToPrivate = levelIsExplicit ? false : Boolean.TRUE.equals(typeNode.getAst().readConfiguration(ConfigurationKeys.FIELD_DEFAULTS_PRIVATE_EVERYWHERE));<NEW_LINE>boolean defaultToFinal = makeFinalIsExplicit ? false : Boolean.TRUE.equals(typeNode.getAst().readConfiguration(ConfigurationKeys.FIELD_DEFAULTS_FINAL_EVERYWHERE));<NEW_LINE>if (!defaultToPrivate && !defaultToFinal && fieldDefaults == null)<NEW_LINE>return;<NEW_LINE>// Do not apply field defaults to records if set using the the config system<NEW_LINE>if (fieldDefaults == null && !isClassOrEnum(typeNode))<NEW_LINE>return;<NEW_LINE>AccessLevel fdAccessLevel = (fieldDefaults != null && levelIsExplicit) ? fd.level() <MASK><NEW_LINE>boolean fdToFinal = (fieldDefaults != null && makeFinalIsExplicit) ? fd.makeFinal() : defaultToFinal;<NEW_LINE>generateFieldDefaultsForType(typeNode, source, fdAccessLevel, fdToFinal, false);<NEW_LINE>} | : defaultToPrivate ? AccessLevel.PRIVATE : null; |
690,023 | public static Query<Collection<ActivityIndex>> activityIndexForNewPlayers(long after, long before, Long threshold) {<NEW_LINE>String selectNewUUIDs = SELECT + UsersTable.USER_UUID + FROM + UsersTable.TABLE_NAME + WHERE + UsersTable.REGISTERED + "<=?" + AND + UsersTable.REGISTERED + ">=?";<NEW_LINE>String sql = SELECT + "activity_index" + FROM + '(' + selectNewUUIDs + ") n" + INNER_JOIN + '(' + selectActivityIndexSQL() + ") a on n." + SessionsTable.USER_UUID + "=a." + SessionsTable.USER_UUID;<NEW_LINE>return new QueryStatement<Collection<ActivityIndex>>(sql) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void prepare(PreparedStatement statement) throws SQLException {<NEW_LINE>statement.setLong(1, before);<NEW_LINE>statement.setLong(2, after);<NEW_LINE>setSelectActivityIndexSQLParameters(<MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Collection<ActivityIndex> processResults(ResultSet set) throws SQLException {<NEW_LINE>Collection<ActivityIndex> indexes = new ArrayList<>();<NEW_LINE>while (set.next()) {<NEW_LINE>indexes.add(new ActivityIndex(set.getDouble("activity_index"), before));<NEW_LINE>}<NEW_LINE>return indexes;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | statement, 3, threshold, before); |
934,752 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_chromecast_example);<NEW_LINE>youTubePlayerView = findViewById(R.id.youtube_player_view);<NEW_LINE>mediaRouteButtonRoot = findViewById(R.id.media_route_button_root);<NEW_LINE>chromeCastControlsRoot = findViewById(R.id.chromecast_controls_root);<NEW_LINE>getLifecycle().addObserver(youTubePlayerView);<NEW_LINE>notificationManager = new NotificationManager(this, ChromeCastExampleActivity.class);<NEW_LINE>youTubePlayersManager = new YouTubePlayersManager(this, youTubePlayerView, chromeCastControlsRoot, notificationManager, getLifecycle());<NEW_LINE>mediaRouteButton = MediaRouteButtonUtils.initMediaRouteButton(this);<NEW_LINE>registerBroadcastReceiver();<NEW_LINE>// can't use CastContext until I'm sure the user has GooglePlayServices<NEW_LINE>PlayServicesUtils.checkGooglePlayServicesAvailability(<MASK><NEW_LINE>} | this, googlePlayServicesAvailabilityRequestCode, this::initChromeCast); |
1,095,820 | private static void try_load_from_jar() throws IOException {<NEW_LINE>// create temp directory<NEW_LINE>Path tempDirectory = Files.createTempDirectory("tmplibvw");<NEW_LINE>tempDirectory.toFile().deleteOnExit();<NEW_LINE>// Extract library and dependencies<NEW_LINE>File jarFile = new File(Native.class.getProtectionDomain().getCodeSource().<MASK><NEW_LINE>JarFile jar = null;<NEW_LINE>try {<NEW_LINE>jar = new JarFile(jarFile);<NEW_LINE>Enumeration<JarEntry> entries = jar.entries();<NEW_LINE>while (entries.hasMoreElements()) {<NEW_LINE>final String name = entries.nextElement().getName();<NEW_LINE>if (name.endsWith("/"))<NEW_LINE>continue;<NEW_LINE>if (name.startsWith("natives/linux_64/")) {<NEW_LINE>Path parent = Paths.get(name).getParent();<NEW_LINE>if (parent != null)<NEW_LINE>Files.createDirectories(tempDirectory.resolve(parent));<NEW_LINE>Files.copy(Native.class.getResourceAsStream("/" + name), tempDirectory.resolve(name));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (jar != null)<NEW_LINE>jar.close();<NEW_LINE>}<NEW_LINE>// load the library<NEW_LINE>System.load(tempDirectory.resolve("natives/linux_64/libvw_jni.so").toString());<NEW_LINE>} | getLocation().getPath()); |
752,021 | final CreateRecommenderConfigurationResult executeCreateRecommenderConfiguration(CreateRecommenderConfigurationRequest createRecommenderConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createRecommenderConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateRecommenderConfigurationRequest> request = null;<NEW_LINE>Response<CreateRecommenderConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateRecommenderConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createRecommenderConfigurationRequest));<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, "Pinpoint");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateRecommenderConfiguration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateRecommenderConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateRecommenderConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
225,380 | public void onClick(View v) {<NEW_LINE>switch(v.getId()) {<NEW_LINE>case R.id.IV_main_setting_add_topic:<NEW_LINE>TopicDetailDialogFragment createTopicDialogFragment = TopicDetailDialogFragment.newInstance(false, -1, -1, "", -1, Color.BLACK);<NEW_LINE>createTopicDialogFragment.show(getFragmentManager(), "createTopicDialogFragment");<NEW_LINE>dismiss();<NEW_LINE>break;<NEW_LINE>case R.id.IV_main_setting_setting_page:<NEW_LINE>Intent settingPageIntent = new Intent(getActivity(), SettingActivity.class);<NEW_LINE>getActivity().startActivity(settingPageIntent);<NEW_LINE>dismiss();<NEW_LINE>break;<NEW_LINE>case R.id.IV_main_setting_setting_security:<NEW_LINE>Intent securityPageIntent = new Intent(getActivity(), PasswordActivity.class);<NEW_LINE>if (((MyDiaryApplication) getActivity().getApplication()).isHasPassword()) {<NEW_LINE>securityPageIntent.putExtra("password_mode", PasswordActivity.REMOVE_PASSWORD);<NEW_LINE>} else {<NEW_LINE>securityPageIntent.putExtra("password_mode", PasswordActivity.CREATE_PASSWORD);<NEW_LINE>}<NEW_LINE>getActivity().startActivity(securityPageIntent);<NEW_LINE>dismiss();<NEW_LINE>break;<NEW_LINE>case R.id.IV_main_setting_backup:<NEW_LINE>Intent backupIntent = new Intent(getActivity(), BackupActivity.class);<NEW_LINE><MASK><NEW_LINE>dismiss();<NEW_LINE>break;<NEW_LINE>case R.id.IV_main_setting_about:<NEW_LINE>Intent aboutPageIntent = new Intent(getActivity(), AboutActivity.class);<NEW_LINE>getActivity().startActivity(aboutPageIntent);<NEW_LINE>dismiss();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | getActivity().startActivity(backupIntent); |
289,432 | protected AssemblyResolution solveLeftCircularShift(PatternExpression expValue, PatternExpression expShift, int size, int dir, MaskedLong goal, Map<String, Long> vals, AssemblyResolvedPatterns cur, Set<SolverHint> hints, String description) throws NeedsBackfillException, SolverException {<NEW_LINE>MaskedLong valValue = solver.getValue(expValue, vals, cur);<NEW_LINE>MaskedLong valShift = solver.getValue(expShift, vals, cur);<NEW_LINE>if (valValue != null && !valValue.isFullyDefined()) {<NEW_LINE>if (!valValue.isFullyUndefined()) {<NEW_LINE>dbg.println("Partially-defined f for left circular shift solver: " + valValue);<NEW_LINE>}<NEW_LINE>valValue = null;<NEW_LINE>}<NEW_LINE>if (valShift != null && valShift.isFullyDefined()) {<NEW_LINE>if (!valShift.isFullyUndefined()) {<NEW_LINE>dbg.println("Partially-defined g for left circular shift solver: " + valShift);<NEW_LINE>}<NEW_LINE>valShift = null;<NEW_LINE>}<NEW_LINE>if (valValue != null && valShift != null) {<NEW_LINE>throw new AssertionError("Should not have constants when solving special forms");<NEW_LINE>} else if (valValue != null) {<NEW_LINE>return solver.solve(expShift, computeCircShiftG(valValue, size, dir, goal), <MASK><NEW_LINE>} else if (valShift != null) {<NEW_LINE>return solver.solve(expValue, computeCircShiftF(valShift, size, dir, goal), vals, cur, hints, description);<NEW_LINE>}<NEW_LINE>// Oiy. Try guessing the shift amount, starting at 0<NEW_LINE>if (hints.contains(DefaultSolverHint.GUESSING_CIRCULAR_SHIFT_AMOUNT)) {<NEW_LINE>throw new SolverException("Already guessing circular shift amount. " + "Try to express a double-shift as a shift by sum.");<NEW_LINE>}<NEW_LINE>Set<SolverHint> hintsWithCircularShift = SolverHint.with(hints, DefaultSolverHint.GUESSING_CIRCULAR_SHIFT_AMOUNT);<NEW_LINE>for (int shift = 0; shift < size; shift++) {<NEW_LINE>try {<NEW_LINE>MaskedLong reqShift = MaskedLong.fromLong(shift);<NEW_LINE>MaskedLong reqValue = computeCircShiftF(reqShift, size, dir, goal);<NEW_LINE>AssemblyResolution resValue = solver.solve(expValue, reqValue, vals, cur, hintsWithCircularShift, description);<NEW_LINE>if (resValue.isError()) {<NEW_LINE>AssemblyResolvedError err = (AssemblyResolvedError) resValue;<NEW_LINE>throw new SolverException("Solving f failed: " + err.getError());<NEW_LINE>}<NEW_LINE>AssemblyResolution resShift = solver.solve(expShift, reqShift, vals, cur, hints, description);<NEW_LINE>if (resShift.isError()) {<NEW_LINE>AssemblyResolvedError err = (AssemblyResolvedError) resShift;<NEW_LINE>throw new SolverException("Solving g failed: " + err.getError());<NEW_LINE>}<NEW_LINE>AssemblyResolvedPatterns solValue = (AssemblyResolvedPatterns) resValue;<NEW_LINE>AssemblyResolvedPatterns solShift = (AssemblyResolvedPatterns) resShift;<NEW_LINE>AssemblyResolvedPatterns sol = solValue.combine(solShift);<NEW_LINE>if (sol == null) {<NEW_LINE>throw new SolverException("value and shift solutions conflict for shift=" + shift);<NEW_LINE>}<NEW_LINE>return sol;<NEW_LINE>} catch (SolverException | UnsupportedOperationException e) {<NEW_LINE>Msg.trace(this, "Shift of " + shift + " resulted in " + e);<NEW_LINE>// try the next<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new SolverException("Could not solve circular shift with variable bits and shift amount");<NEW_LINE>} | vals, cur, hints, description); |
151,584 | public static DescribePreCheckProgressListResponse unmarshall(DescribePreCheckProgressListResponse describePreCheckProgressListResponse, UnmarshallerContext _ctx) {<NEW_LINE>describePreCheckProgressListResponse.setRequestId(_ctx.stringValue("DescribePreCheckProgressListResponse.RequestId"));<NEW_LINE>describePreCheckProgressListResponse.setStatus(_ctx.stringValue("DescribePreCheckProgressListResponse.Status"));<NEW_LINE>describePreCheckProgressListResponse.setProgress(_ctx.integerValue("DescribePreCheckProgressListResponse.Progress"));<NEW_LINE>describePreCheckProgressListResponse.setSuccess(_ctx.booleanValue("DescribePreCheckProgressListResponse.Success"));<NEW_LINE>describePreCheckProgressListResponse.setErrCode(_ctx.stringValue("DescribePreCheckProgressListResponse.ErrCode"));<NEW_LINE>describePreCheckProgressListResponse.setErrMessage(_ctx.stringValue("DescribePreCheckProgressListResponse.ErrMessage"));<NEW_LINE>describePreCheckProgressListResponse.setHttpStatusCode<MASK><NEW_LINE>List<PreCheckProgressDetail> items = new ArrayList<PreCheckProgressDetail>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribePreCheckProgressListResponse.Items.Length"); i++) {<NEW_LINE>PreCheckProgressDetail preCheckProgressDetail = new PreCheckProgressDetail();<NEW_LINE>preCheckProgressDetail.setJobId(_ctx.stringValue("DescribePreCheckProgressListResponse.Items[" + i + "].JobId"));<NEW_LINE>preCheckProgressDetail.setState(_ctx.stringValue("DescribePreCheckProgressListResponse.Items[" + i + "].State"));<NEW_LINE>preCheckProgressDetail.setOrderNum(_ctx.stringValue("DescribePreCheckProgressListResponse.Items[" + i + "].OrderNum"));<NEW_LINE>preCheckProgressDetail.setErrMsg(_ctx.stringValue("DescribePreCheckProgressListResponse.Items[" + i + "].ErrMsg"));<NEW_LINE>preCheckProgressDetail.setNames(_ctx.stringValue("DescribePreCheckProgressListResponse.Items[" + i + "].Names"));<NEW_LINE>preCheckProgressDetail.setItem(_ctx.stringValue("DescribePreCheckProgressListResponse.Items[" + i + "].Item"));<NEW_LINE>preCheckProgressDetail.setBootTime(_ctx.longValue("DescribePreCheckProgressListResponse.Items[" + i + "].BootTime"));<NEW_LINE>preCheckProgressDetail.setFinishTime(_ctx.longValue("DescribePreCheckProgressListResponse.Items[" + i + "].FinishTime"));<NEW_LINE>items.add(preCheckProgressDetail);<NEW_LINE>}<NEW_LINE>describePreCheckProgressListResponse.setItems(items);<NEW_LINE>return describePreCheckProgressListResponse;<NEW_LINE>} | (_ctx.integerValue("DescribePreCheckProgressListResponse.HttpStatusCode")); |
950,545 | // Returns as iterator to traverse the tree in order<NEW_LINE>private java.util.Iterator<T> inOrderTraversal() {<NEW_LINE>final int expectedNodeCount = nodeCount;<NEW_LINE>final java.util.Stack<Node> stack = new java.util.Stack<>();<NEW_LINE>stack.push(root);<NEW_LINE>return new java.util.Iterator<T>() {<NEW_LINE><NEW_LINE>Node trav = root;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean hasNext() {<NEW_LINE>if (expectedNodeCount != nodeCount)<NEW_LINE>throw new java.util.ConcurrentModificationException();<NEW_LINE>return root != <MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public T next() {<NEW_LINE>if (expectedNodeCount != nodeCount)<NEW_LINE>throw new java.util.ConcurrentModificationException();<NEW_LINE>// Dig left<NEW_LINE>while (trav != null && trav.left != null) {<NEW_LINE>stack.push(trav.left);<NEW_LINE>trav = trav.left;<NEW_LINE>}<NEW_LINE>Node node = stack.pop();<NEW_LINE>// Try moving down right once<NEW_LINE>if (node.right != null) {<NEW_LINE>stack.push(node.right);<NEW_LINE>trav = node.right;<NEW_LINE>}<NEW_LINE>return node.data;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void remove() {<NEW_LINE>throw new UnsupportedOperationException();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | null && !stack.isEmpty(); |
1,347,164 | VirtualMachineScaleSetMsiHandler withoutLocalManagedServiceIdentity() {<NEW_LINE>if (this.scaleSet.innerModel().identity() == null || this.scaleSet.innerModel().identity().type() == null || this.scaleSet.innerModel().identity().type().equals(ResourceIdentityType.NONE) || this.scaleSet.innerModel().identity().type().equals(ResourceIdentityType.USER_ASSIGNED)) {<NEW_LINE>return this;<NEW_LINE>} else if (this.scaleSet.innerModel().identity().type().equals(ResourceIdentityType.SYSTEM_ASSIGNED)) {<NEW_LINE>this.scaleSet.innerModel().identity().withType(ResourceIdentityType.NONE);<NEW_LINE>} else if (this.scaleSet.innerModel().identity().type().equals(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED)) {<NEW_LINE>this.scaleSet.innerModel().identity(<MASK><NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | ).withType(ResourceIdentityType.USER_ASSIGNED); |
350,428 | private boolean verifyMagicChecksumAndDecryptPage(final ByteBuffer buffer, final int intId, final long pageIndex) {<NEW_LINE>assert buffer.order<MASK><NEW_LINE>buffer.position(MAGIC_NUMBER_OFFSET);<NEW_LINE>final long magicNumber = OLongSerializer.INSTANCE.deserializeFromByteBufferObject(buffer);<NEW_LINE>if ((aesKey == null && magicNumber != MAGIC_NUMBER_WITH_CHECKSUM) || (magicNumber != MAGIC_NUMBER_WITH_CHECKSUM && (magicNumber & 0xFF) != MAGIC_NUMBER_WITH_CHECKSUM_ENCRYPTED)) {<NEW_LINE>if ((aesKey == null && magicNumber != MAGIC_NUMBER_WITHOUT_CHECKSUM) || (magicNumber != MAGIC_NUMBER_WITHOUT_CHECKSUM && (magicNumber & 0xFF) != MAGIC_NUMBER_WITHOUT_CHECKSUM_ENCRYPTED)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (aesKey != null && (magicNumber & 0xFF) == MAGIC_NUMBER_WITHOUT_CHECKSUM_ENCRYPTED) {<NEW_LINE>doEncryptionDecryption(intId, (int) pageIndex, Cipher.DECRYPT_MODE, buffer, magicNumber >>> 8);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (aesKey != null && (magicNumber & 0xFF) == MAGIC_NUMBER_WITH_CHECKSUM_ENCRYPTED) {<NEW_LINE>doEncryptionDecryption(intId, (int) pageIndex, Cipher.DECRYPT_MODE, buffer, magicNumber >>> 8);<NEW_LINE>}<NEW_LINE>buffer.position(CHECKSUM_OFFSET);<NEW_LINE>final int storedChecksum = OIntegerSerializer.INSTANCE.deserializeFromByteBufferObject(buffer);<NEW_LINE>buffer.position(PAGE_OFFSET_TO_CHECKSUM_FROM);<NEW_LINE>final CRC32 crc32 = new CRC32();<NEW_LINE>crc32.update(buffer);<NEW_LINE>final int computedChecksum = (int) crc32.getValue();<NEW_LINE>return computedChecksum == storedChecksum;<NEW_LINE>} | () == ByteOrder.nativeOrder(); |
1,459,321 | public static DescribeLoghubDetailResponse unmarshall(DescribeLoghubDetailResponse describeLoghubDetailResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeLoghubDetailResponse.setRequestId(_ctx.stringValue("DescribeLoghubDetailResponse.RequestId"));<NEW_LINE>LoghubInfo loghubInfo = new LoghubInfo();<NEW_LINE>loghubInfo.setAccessKey<MASK><NEW_LINE>loghubInfo.setTableName(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.TableName"));<NEW_LINE>loghubInfo.setAccessSecret(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.AccessSecret"));<NEW_LINE>loghubInfo.setProjectName(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.ProjectName"));<NEW_LINE>loghubInfo.setSchemaName(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.SchemaName"));<NEW_LINE>loghubInfo.setDBType(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.DBType"));<NEW_LINE>loghubInfo.setDeliverName(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.DeliverName"));<NEW_LINE>loghubInfo.setRegionId(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.RegionId"));<NEW_LINE>loghubInfo.setPassword(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.Password"));<NEW_LINE>loghubInfo.setDBClusterId(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.DBClusterId"));<NEW_LINE>loghubInfo.setDescription(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.Description"));<NEW_LINE>loghubInfo.setFilterDirtyData(_ctx.booleanValue("DescribeLoghubDetailResponse.LoghubInfo.FilterDirtyData"));<NEW_LINE>loghubInfo.setZoneId(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.ZoneId"));<NEW_LINE>loghubInfo.setLogStoreName(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.LogStoreName"));<NEW_LINE>loghubInfo.setUserName(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.UserName"));<NEW_LINE>loghubInfo.setDomainUrl(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.DomainUrl"));<NEW_LINE>loghubInfo.setDeliverTime(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.DeliverTime"));<NEW_LINE>List<LogHubStore> logHubStores = new ArrayList<LogHubStore>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeLoghubDetailResponse.LoghubInfo.LogHubStores.Length"); i++) {<NEW_LINE>LogHubStore logHubStore = new LogHubStore();<NEW_LINE>logHubStore.setType(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.LogHubStores[" + i + "].Type"));<NEW_LINE>logHubStore.setLogKey(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.LogHubStores[" + i + "].LogKey"));<NEW_LINE>logHubStore.setFieldKey(_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.LogHubStores[" + i + "].FieldKey"));<NEW_LINE>logHubStores.add(logHubStore);<NEW_LINE>}<NEW_LINE>loghubInfo.setLogHubStores(logHubStores);<NEW_LINE>describeLoghubDetailResponse.setLoghubInfo(loghubInfo);<NEW_LINE>return describeLoghubDetailResponse;<NEW_LINE>} | (_ctx.stringValue("DescribeLoghubDetailResponse.LoghubInfo.AccessKey")); |
1,278,241 | private Bootstrap newBootstrap(ChannelFactory<? extends Channel> channelFactory, EventLoopGroup eventLoopGroup, AsyncHttpClientConfig config) {<NEW_LINE>@SuppressWarnings("deprecation")<NEW_LINE>Bootstrap bootstrap = new Bootstrap().channelFactory(channelFactory).group(eventLoopGroup).option(ChannelOption.ALLOCATOR, config.getAllocator() != null ? config.getAllocator() : ByteBufAllocator.DEFAULT).option(ChannelOption.TCP_NODELAY, config.isTcpNoDelay()).option(ChannelOption.SO_REUSEADDR, config.isSoReuseAddress()).option(ChannelOption.SO_KEEPALIVE, config.isSoKeepAlive()).option(ChannelOption.AUTO_CLOSE, false);<NEW_LINE>if (config.getConnectTimeout() > 0) {<NEW_LINE>bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.getConnectTimeout());<NEW_LINE>}<NEW_LINE>if (config.getSoLinger() >= 0) {<NEW_LINE>bootstrap.option(ChannelOption.SO_LINGER, config.getSoLinger());<NEW_LINE>}<NEW_LINE>if (config.getSoSndBuf() >= 0) {<NEW_LINE>bootstrap.option(ChannelOption.SO_SNDBUF, config.getSoSndBuf());<NEW_LINE>}<NEW_LINE>if (config.getSoRcvBuf() >= 0) {<NEW_LINE>bootstrap.option(ChannelOption.<MASK><NEW_LINE>}<NEW_LINE>for (Entry<ChannelOption<Object>, Object> entry : config.getChannelOptions().entrySet()) {<NEW_LINE>bootstrap.option(entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>return bootstrap;<NEW_LINE>} | SO_RCVBUF, config.getSoRcvBuf()); |
1,692,004 | public int session_read_data(String connected_device_name, byte[] buf, int max_length) {<NEW_LINE>if (!mBluetoothIsEnabled)<NEW_LINE>return 0;<NEW_LINE>RhoBluetoothManager.logi(TAG, "session_read_data()");<NEW_LINE>if ((buf == null) || (max_length == 0)) {<NEW_LINE>return mInputBufferSize;<NEW_LINE>}<NEW_LINE>int real_readed = 0;<NEW_LINE>int i;<NEW_LINE>synchronized (mInputBuffer) {<NEW_LINE>// read;<NEW_LINE>real_readed = mInputBufferSize;<NEW_LINE>if (real_readed > max_length) {<NEW_LINE>real_readed = max_length;<NEW_LINE>}<NEW_LINE>// copy<NEW_LINE>for (i = 0; i < real_readed; i++) {<NEW_LINE>buf<MASK><NEW_LINE>}<NEW_LINE>// adjust input buf<NEW_LINE>if (mInputBufferSize > max_length) {<NEW_LINE>for (i = 0; i < (mInputBufferSize - max_length); i++) {<NEW_LINE>mInputBuffer[i] = mInputBuffer[i + max_length];<NEW_LINE>}<NEW_LINE>mInputBufferSize = mInputBufferSize - max_length;<NEW_LINE>} else {<NEW_LINE>mInputBufferSize = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>RhoBluetoothManager.logi(TAG, " readed " + String.valueOf(real_readed) + " bytes");<NEW_LINE>return real_readed;<NEW_LINE>} | [i] = mInputBuffer[i]; |
1,352,471 | private void calculateFutureDateFlags(final PwmRequest pwmRequest, final GuestRegistrationBean guestRegistrationBean) {<NEW_LINE>final PwmDateFormat dateFormat = MiscUtil.newPwmDateFormat("yyyy-MM-dd");<NEW_LINE>final long maxValidDays = pwmRequest.getDomainConfig().readSettingAsLong(PwmSetting.GUEST_MAX_VALID_DAYS);<NEW_LINE>pwmRequest.setAttribute(PwmRequestAttribute.GuestMaximumValidDays, String.valueOf(maxValidDays));<NEW_LINE>final String maxExpirationDate;<NEW_LINE>{<NEW_LINE>if (maxValidDays > 0) {<NEW_LINE>final long futureMS = maxValidDays * 24 * 60 * 60 * 1000;<NEW_LINE>final Instant maxValidDate = Instant.ofEpochMilli(System.currentTimeMillis() + futureMS);<NEW_LINE>maxExpirationDate = dateFormat.format(maxValidDate);<NEW_LINE>} else {<NEW_LINE>maxExpirationDate = "";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final String currentExpirationDate;<NEW_LINE>{<NEW_LINE>final String selectedDate = guestRegistrationBean.getFormValues().get(HTTP_PARAM_EXPIRATION_DATE);<NEW_LINE>if (selectedDate == null || selectedDate.isEmpty()) {<NEW_LINE>final Instant currentDate = guestRegistrationBean.getUpdateUserExpirationDate();<NEW_LINE>if (currentDate == null) {<NEW_LINE>currentExpirationDate = maxExpirationDate;<NEW_LINE>} else {<NEW_LINE>currentExpirationDate = dateFormat.format(currentDate);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>currentExpirationDate = dateFormat.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>pwmRequest.setAttribute(PwmRequestAttribute.GuestCurrentExpirationDate, currentExpirationDate);<NEW_LINE>pwmRequest.setAttribute(PwmRequestAttribute.GuestMaximumExpirationDate, maxExpirationDate);<NEW_LINE>} | format(Instant.now()); |
734,253 | private Map<String, List<String>> freshMap() throws IOException {<NEW_LINE>final String body = new RqPrint(this.req).printBody();<NEW_LINE>final Map<String, List<String>> map = new HashMap<>(1);<NEW_LINE>// @checkstyle MultipleStringLiteralsCheck (1 line)<NEW_LINE>for (final String pair : body.split("&")) {<NEW_LINE>if (pair.isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// @checkstyle MultipleStringLiteralsCheck (1 line)<NEW_LINE>final String[] parts = pair.split("=", 2);<NEW_LINE>if (parts.length < 2) {<NEW_LINE>throw new HttpException(HttpURLConnection.HTTP_BAD_REQUEST, String.format("invalid form body pair: %s", pair));<NEW_LINE>}<NEW_LINE>final String key = RqFormBase.decode(new Lowered(parts[0]));<NEW_LINE>if (!map.containsKey(key)) {<NEW_LINE>map.put(key<MASK><NEW_LINE>}<NEW_LINE>map.get(key).add(RqFormBase.decode(new Trimmed(new TextOf(parts[1]))));<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | , new LinkedList<>()); |
1,830,668 | protected Response handleLogoutResponse(SAMLDocumentHolder holder, StatusResponseType responseType, String relayState) {<NEW_LINE>if (relayState == null) {<NEW_LINE>logger.error("no valid user session");<NEW_LINE>event.event(EventType.LOGOUT);<NEW_LINE>event.error(Errors.USER_SESSION_NOT_FOUND);<NEW_LINE>return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.IDENTITY_PROVIDER_UNEXPECTED_ERROR);<NEW_LINE>}<NEW_LINE>UserSessionModel userSession = session.sessions().getUserSession(realm, relayState);<NEW_LINE>if (userSession == null) {<NEW_LINE>logger.error("no valid user session");<NEW_LINE>event.event(EventType.LOGOUT);<NEW_LINE>event.error(Errors.USER_SESSION_NOT_FOUND);<NEW_LINE>return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.IDENTITY_PROVIDER_UNEXPECTED_ERROR);<NEW_LINE>}<NEW_LINE>if (userSession.getState() != UserSessionModel.State.LOGGING_OUT) {<NEW_LINE>logger.error("usersession in different state");<NEW_LINE><MASK><NEW_LINE>event.error(Errors.USER_SESSION_NOT_FOUND);<NEW_LINE>return ErrorPage.error(session, null, Response.Status.BAD_REQUEST, Messages.SESSION_NOT_ACTIVE);<NEW_LINE>}<NEW_LINE>return AuthenticationManager.finishBrowserLogout(session, realm, userSession, session.getContext().getUri(), clientConnection, headers);<NEW_LINE>} | event.event(EventType.LOGOUT); |
1,140,102 | private void processMouseClickInLayout(RADComponent metacomp, MouseEvent e) {<NEW_LINE>if (formDesigner.getMenuEditLayer().isVisible()) {<NEW_LINE>if (!formDesigner.getMenuEditLayer().isMenuLayerComponent(metacomp)) {<NEW_LINE>formDesigner.getMenuEditLayer().hideMenuLayer();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (metacomp != null && metacomp.getBeanClass().getName().equals(javax.swing.JMenu.class.getName())) {<NEW_LINE>formDesigner.openMenu(metacomp);<NEW_LINE>}<NEW_LINE>if (!(metacomp instanceof RADVisualComponent)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>selectTabInUnknownTabbedPane((RADVisualComponent) metacomp, e.getPoint());<NEW_LINE>RADVisualContainer metacont = metacomp instanceof RADVisualContainer ? (RADVisualContainer) metacomp : (RADVisualContainer) metacomp.getParentComponent();<NEW_LINE>if (metacont == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>LayoutSupportManager laysup = metacont.getLayoutSupport();<NEW_LINE>if (laysup == null) {<NEW_LINE>Point p = convertPointToComponent(e.getPoint(), formDesigner.getTopDesignComponentView());<NEW_LINE>if (formDesigner.getLayoutDesigner().selectInside(p)) {<NEW_LINE>// NOI18N<NEW_LINE>FormEditor.getAssistantModel(getFormModel()).setContext("layoutGaps", "selectedLayoutGaps");<NEW_LINE>repaint();<NEW_LINE>mouseHint = formDesigner.<MASK><NEW_LINE>showToolTip(e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Container cont = (Container) formDesigner.getComponent(metacont);<NEW_LINE>Container contDelegate = metacont.getContainerDelegate(cont);<NEW_LINE>Point p = convertPointToComponent(e.getPoint(), contDelegate);<NEW_LINE>laysup.processMouseClick(p, cont, contDelegate);<NEW_LINE>}<NEW_LINE>} | getLayoutDesigner().getToolTipText(p); |
1,805,091 | public void execute() throws BuildException {<NEW_LINE>if (url != null ^ file == null)<NEW_LINE>throw new BuildException("You must define the url or file attributes", getLocation());<NEW_LINE>if (url == null) {<NEW_LINE>url = file<MASK><NEW_LINE>}<NEW_LINE>log("Browsing: " + url);<NEW_LINE>try {<NEW_LINE>URL u = new URL(url);<NEW_LINE>URL appRoot = null;<NEW_LINE>if (context != null) {<NEW_LINE>FileObject fo = FileUtil.toFileObject(context);<NEW_LINE>org.netbeans.api.project.Project p = null;<NEW_LINE>if (fo != null) {<NEW_LINE>p = FileOwnerQuery.getOwner(fo);<NEW_LINE>}<NEW_LINE>if (urlPath != null && urlPath.length() > 0) {<NEW_LINE>if (!url.endsWith(urlPath)) {<NEW_LINE>throw new BuildException("The urlPath(" + urlPath + ") is not part of the url(" + url + ")", getLocation());<NEW_LINE>}<NEW_LINE>appRoot = new URL(url.substring(0, url.length() - urlPath.length()));<NEW_LINE>}<NEW_LINE>if (p != null) {<NEW_LINE>URLDisplayerImplementation urlDisplayer = (URLDisplayerImplementation) p.getLookup().lookup(URLDisplayerImplementation.class);<NEW_LINE>if (urlDisplayer != null) {<NEW_LINE>urlDisplayer.showURL(appRoot != null ? appRoot : u, u, fo);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>HtmlBrowser.URLDisplayer.getDefault().showURL(u);<NEW_LINE>} catch (MalformedURLException e) {<NEW_LINE>throw new BuildException(e, getLocation());<NEW_LINE>}<NEW_LINE>} | .toURI().toString(); |
96,590 | public InteractionResultHolder<ItemStack> use(Level worldIn, Player playerIn, @NotNull InteractionHand handIn) {<NEW_LINE>ItemStack itemstack = playerIn.getItemInHand(handIn);<NEW_LINE>if (!worldIn.isClientSide) {<NEW_LINE>ThrownEnderpearl enderpearlentity = new ThrownEnderpearl(worldIn, playerIn);<NEW_LINE>enderpearlentity.setItem(itemstack);<NEW_LINE>enderpearlentity.shootFromRotation(playerIn, playerIn.getXRot(), playerIn.getYRot(), 0.0F, 1.5F, 1.0F);<NEW_LINE>if (!worldIn.addFreshEntity(enderpearlentity)) {<NEW_LINE>if (playerIn instanceof ServerPlayerEntityBridge) {<NEW_LINE>((ServerPlayerEntityBridge) playerIn)<MASK><NEW_LINE>}<NEW_LINE>return new InteractionResultHolder<>(InteractionResult.FAIL, itemstack);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>worldIn.playSound(null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), SoundEvents.ENDER_PEARL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (worldIn.getRandom().nextFloat() * 0.4F + 0.8F));<NEW_LINE>playerIn.getCooldowns().addCooldown(this, 20);<NEW_LINE>playerIn.awardStat(Stats.ITEM_USED.get(this));<NEW_LINE>if (!playerIn.getAbilities().instabuild) {<NEW_LINE>itemstack.shrink(1);<NEW_LINE>}<NEW_LINE>return InteractionResultHolder.sidedSuccess(itemstack, worldIn.isClientSide());<NEW_LINE>} | .bridge$getBukkitEntity().updateInventory(); |
743,293 | protected StateMachineConfig<S, E> performBuild() throws Exception {<NEW_LINE>// TODO: should prevent calling state/transition builder if model is given<NEW_LINE>StateMachineModelBuilder<?, ?> modelBuilder = getSharedObject(StateMachineModelBuilder.class);<NEW_LINE>StateMachineConfigurationBuilder<?, ?> configurationBuilder = getSharedObject(StateMachineConfigurationBuilder.class);<NEW_LINE>StateMachineTransitionBuilder<?, ?> <MASK><NEW_LINE>StateMachineStateBuilder<?, ?> stateBuilder = getSharedObject(StateMachineStateBuilder.class);<NEW_LINE>ModelData<S, E> model = (ModelData<S, E>) modelBuilder.build();<NEW_LINE>ConfigurationData<S, E> stateMachineConfigurationConfig = null;<NEW_LINE>stateMachineConfigurationConfig = (ConfigurationData<S, E>) configurationBuilder.build();<NEW_LINE>transitionBuilder.setSharedObject(ConfigurationData.class, stateMachineConfigurationConfig);<NEW_LINE>TransitionsData<S, E> transitions = (TransitionsData<S, E>) transitionBuilder.build();<NEW_LINE>StatesData<S, E> states = (StatesData<S, E>) stateBuilder.build();<NEW_LINE>return new StateMachineConfig<S, E>(stateMachineConfigurationConfig, transitions, states, model);<NEW_LINE>} | transitionBuilder = getSharedObject(StateMachineTransitionBuilder.class); |
1,626,096 | public <E extends Exception & QueryExceptionMarkerInterface> void findTargetsBeneathDirectory(RepositoryName repository, String originalPattern, String directory, boolean rulesOnly, ImmutableSet<PathFragment> repositoryIgnoredSubdirectories, ImmutableSet<PathFragment> excludedSubdirectories, BatchCallback<Void, E> callback, Class<E> exceptionClass) throws TargetParsingException, E, InterruptedException {<NEW_LINE>PathFragment directoryPathFragment = TargetPatternResolverUtil.getPathFragment(directory);<NEW_LINE>Preconditions.checkArgument(excludedSubdirectories.isEmpty(), excludedSubdirectories);<NEW_LINE>FilteringPolicy policy = rulesOnly <MASK><NEW_LINE>List<Root> roots = new ArrayList<>();<NEW_LINE>if (repository.isMain()) {<NEW_LINE>roots.addAll(pkgRoots);<NEW_LINE>} else {<NEW_LINE>RepositoryDirectoryValue repositoryValue = (RepositoryDirectoryValue) env.getValue(RepositoryDirectoryValue.key(repository));<NEW_LINE>if (repositoryValue == null) {<NEW_LINE>throw new MissingDepException();<NEW_LINE>}<NEW_LINE>if (!repositoryValue.repositoryExists()) {<NEW_LINE>// This shouldn't be possible; we're given a repository, so we assume that the caller has<NEW_LINE>// already checked for its existence.<NEW_LINE>throw new IllegalStateException(String.format("No such repository '%s': %s", repository, repositoryValue.getErrorMsg()));<NEW_LINE>}<NEW_LINE>roots.add(Root.fromPath(repositoryValue.getPath()));<NEW_LINE>}<NEW_LINE>for (Root root : roots) {<NEW_LINE>RootedPath rootedPath = RootedPath.toRootedPath(root, directoryPathFragment);<NEW_LINE>if (GraphTraversingHelper.declareDependenciesAndCheckIfValuesMissing(env, getDeps(repository, repositoryIgnoredSubdirectories, policy, rootedPath))) {<NEW_LINE>throw new MissingDepException();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ? FilteringPolicies.RULES_ONLY : FilteringPolicies.NO_FILTER; |
255,068 | // / Create an enumeration data type.<NEW_LINE>public <T extends Sort> void enumExampleTyped(Context ctx) throws TestFailedException {<NEW_LINE>System.out.println("EnumExample");<NEW_LINE>Log.append("EnumExample");<NEW_LINE>Symbol name = ctx.mkSymbol("fruit");<NEW_LINE>EnumSort<T> fruit = ctx.mkEnumSort(name, ctx.mkSymbol("apple"), ctx.mkSymbol("banana"), ctx.mkSymbol("orange"));<NEW_LINE>// helper function for consistent typing: https://docs.oracle.com/javase/tutorial/java/generics/capture.html<NEW_LINE>System.out.println((fruit.getConsts()[0]));<NEW_LINE>System.out.println((fruit.getConsts()[1]));<NEW_LINE>System.out.println((fruit.getConsts()[2]));<NEW_LINE>System.out.println((fruit.getTesterDecls()[0]));<NEW_LINE>System.out.println((fruit.getTesterDecls()[1]));<NEW_LINE>System.out.println((fruit.getTesterDecls()[2]));<NEW_LINE>Expr<EnumSort<T>> apple = <MASK><NEW_LINE>Expr<EnumSort<T>> banana = fruit.getConsts()[1];<NEW_LINE>Expr<EnumSort<T>> orange = fruit.getConsts()[2];<NEW_LINE>prove(ctx, ctx.mkApp(fruit.getTesterDecls()[0], apple), false);<NEW_LINE>prove(ctx, ctx.mkOr(ctx.mkEq(fruity, apple), ctx.mkEq(fruity, banana), ctx.mkEq(fruity, orange)), false);<NEW_LINE>} | fruit.getConsts()[0]; |
294,831 | public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest request) throws Exception {<NEW_LINE>log.trace("filterWrite nextFilter: {} session: {} request: {}", nextFilter, session, request);<NEW_LINE>Cipher cipher = (Cipher) session.getAttribute(RTMPConnection.RTMPE_CIPHER_OUT);<NEW_LINE>if (cipher == null) {<NEW_LINE>if (log.isTraceEnabled()) {<NEW_LINE>log.trace("Writing message");<NEW_LINE>}<NEW_LINE>nextFilter.filterWrite(session, request);<NEW_LINE>} else {<NEW_LINE>IoBuffer message = (IoBuffer) request.getMessage();<NEW_LINE>if (!message.hasRemaining()) {<NEW_LINE>if (log.isTraceEnabled()) {<NEW_LINE>log.trace("Ignoring empty message");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Encrypting message: {}", message);<NEW_LINE>}<NEW_LINE>byte[] plain = new byte[message.remaining()];<NEW_LINE>message.get(plain);<NEW_LINE>message.clear();<NEW_LINE>message.free();<NEW_LINE>// encrypt and write<NEW_LINE>byte[] encrypted = cipher.update(plain);<NEW_LINE>IoBuffer messageEncrypted = IoBuffer.wrap(encrypted);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("Writing encrypted message: {}", messageEncrypted);<NEW_LINE>}<NEW_LINE>nextFilter.filterWrite(session, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | new EncryptedWriteRequest(request, messageEncrypted)); |
34,521 | final ListEventSourcesResult executeListEventSources(ListEventSourcesRequest listEventSourcesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listEventSourcesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListEventSourcesRequest> request = null;<NEW_LINE>Response<ListEventSourcesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListEventSourcesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listEventSourcesRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EventBridge");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEventSources");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListEventSourcesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListEventSourcesResultJsonUnmarshaller());<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.SIGNING_REGION, getSigningRegion()); |
535,823 | // todo: remove/move this, we no longer support xml access like this<NEW_LINE>private void generateXMLAccess(BLangXMLAccessExpr xmlAccessExpr, BIROperand tempVarRef, BIROperand varRefRegIndex, BIROperand keyRegIndex) {<NEW_LINE>this.env.targetOperand = tempVarRef;<NEW_LINE>InstructionKind insKind;<NEW_LINE>if (xmlAccessExpr.fieldType == FieldKind.ALL) {<NEW_LINE>setScopeAndEmit(new BIRNonTerminator.XMLAccess(xmlAccessExpr.pos, InstructionKind.XML_LOAD_ALL, tempVarRef, varRefRegIndex));<NEW_LINE>return;<NEW_LINE>} else if (xmlAccessExpr.indexExpr.getBType().tag == TypeTags.STRING) {<NEW_LINE>insKind = InstructionKind.XML_LOAD;<NEW_LINE>} else {<NEW_LINE>insKind = InstructionKind.XML_SEQ_LOAD;<NEW_LINE>}<NEW_LINE>setScopeAndEmit(new BIRNonTerminator.FieldAccess(xmlAccessExpr.pos, insKind<MASK><NEW_LINE>} | , tempVarRef, keyRegIndex, varRefRegIndex)); |
880,060 | public void visitModuleDeclaration(ModuleDeclaration moduleDeclaration) {<NEW_LINE>logger.trace("PRINT " + moduleDeclaration.getName());<NEW_LINE>currentModuleName = getCurrentModuleName();<NEW_LINE>String dependenciesNamesString = null;<NEW_LINE>if (context.libModules.contains(currentModuleName)) {<NEW_LINE>List<String> dependenciesNames = context.dependencyGraph.getDestinationElements(moduleDeclaration.getName());<NEW_LINE>dependenciesNamesString = "";<NEW_LINE>if (dependenciesNames != null) {<NEW_LINE>for (int i = 0; i < dependenciesNames.size(); i++) {<NEW_LINE>dependenciesNames.set(i, "\"" + dependenciesNames<MASK><NEW_LINE>}<NEW_LINE>dependenciesNamesString = join(dependenciesNames, ",");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>File f = new File(outputDir, currentModuleName.replace('.', '/') + "/package-info.java");<NEW_LINE>f.getParentFile().mkdirs();<NEW_LINE>try {<NEW_LINE>if (dependenciesNamesString != null) {<NEW_LINE>//<NEW_LINE>//<NEW_LINE>FileUtils.//<NEW_LINE>write(f, "/** This package contains the " + moduleDeclaration.getName() + " library (source: Definitely Typed). */\n");<NEW_LINE>String mixins = "";<NEW_LINE>if (context.getMixins(currentModuleName) != null) {<NEW_LINE>mixins = StringUtils.join(context.getMixins(currentModuleName).stream().map(t -> context.getTypeName(t)).toArray(), ".class,") + ".class";<NEW_LINE>}<NEW_LINE>FileUtils.write(f, "@" + JSweetDefTranslatorConfig.ANNOTATION_ROOT + "(dependencies={" + dependenciesNamesString + "}, mixins={" + mixins + "})\n", true);<NEW_LINE>} else {<NEW_LINE>//<NEW_LINE>//<NEW_LINE>FileUtils.//<NEW_LINE>write(f, "/** (source: Definitely Typed) */\n");<NEW_LINE>}<NEW_LINE>CharSequence annosDecls = annotationsToString(moduleDeclaration);<NEW_LINE>if (!isBlank(annosDecls)) {<NEW_LINE>FileUtils.write(f, annosDecls, true);<NEW_LINE>}<NEW_LINE>if (context.externalModules.keySet().contains(currentModuleName)) {<NEW_LINE>FileUtils.write(f, "@" + JSweetDefTranslatorConfig.ANNOTATION_MODULE + "(\"" + context.externalModules.get(currentModuleName) + "\")\n", true);<NEW_LINE>}<NEW_LINE>FileUtils.write(f, "package " + currentModuleName + ";\n", true);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>scan(moduleDeclaration.getMembers());<NEW_LINE>} | .get(i) + "\""); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.