idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
263,987 | public polyglot.ast.Node compile(polyglot.frontend.Compiler compiler, String fileName, polyglot.frontend.ExtensionInfo extInfo) {<NEW_LINE>SourceLoader source_loader = compiler.sourceExtension().sourceLoader();<NEW_LINE>try {<NEW_LINE>FileSource source = new FileSource(new File(fileName));<NEW_LINE>// This hack is to stop the catch block at the bottom causing an error<NEW_LINE>// with versions of Polyglot where the constructor above can't throw IOException<NEW_LINE>// It should be removed as soon as Polyglot 1.3 is no longer supported.<NEW_LINE>if (false) {<NEW_LINE>throw new IOException("Bogus exception");<NEW_LINE>}<NEW_LINE>SourceJob job = null;<NEW_LINE>if (compiler.sourceExtension() instanceof soot.javaToJimple.jj.ExtensionInfo) {<NEW_LINE>soot.javaToJimple.jj.ExtensionInfo jjInfo = (soot.javaToJimple.jj.ExtensionInfo) compiler.sourceExtension();<NEW_LINE>if (jjInfo.sourceJobMap() != null) {<NEW_LINE>job = (SourceJob) jjInfo.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (job == null) {<NEW_LINE>job = compiler.sourceExtension().addJob(source);<NEW_LINE>}<NEW_LINE>boolean result = false;<NEW_LINE>result = compiler.sourceExtension().runToCompletion();<NEW_LINE>if (!result) {<NEW_LINE>throw new soot.CompilationDeathException(0, "Could not compile");<NEW_LINE>}<NEW_LINE>polyglot.ast.Node node = job.ast();<NEW_LINE>return node;<NEW_LINE>} catch (IOException e) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | sourceJobMap().get(source); |
849,411 | public static ReferenceTestProtocolSchedules create() {<NEW_LINE>final ImmutableMap.Builder<String, ProtocolSchedule> builder = ImmutableMap.builder();<NEW_LINE>builder.put("Frontier", createSchedule(new StubGenesisConfigOptions()));<NEW_LINE>builder.put("FrontierToHomesteadAt5", createSchedule(new StubGenesisConfigOptions().homesteadBlock(5)));<NEW_LINE>builder.put("Homestead", createSchedule(new StubGenesisConfigOptions().homesteadBlock(0)));<NEW_LINE>builder.put("HomesteadToEIP150At5", createSchedule(new StubGenesisConfigOptions().homesteadBlock(0<MASK><NEW_LINE>builder.put("HomesteadToDaoAt5", createSchedule(new StubGenesisConfigOptions().homesteadBlock(0).daoForkBlock(5)));<NEW_LINE>builder.put("EIP150", createSchedule(new StubGenesisConfigOptions().eip150Block(0)));<NEW_LINE>builder.put("EIP158", createSchedule(new StubGenesisConfigOptions().eip158Block(0)));<NEW_LINE>builder.put("EIP158ToByzantiumAt5", createSchedule(new StubGenesisConfigOptions().eip158Block(0).byzantiumBlock(5)));<NEW_LINE>builder.put("Byzantium", createSchedule(new StubGenesisConfigOptions().byzantiumBlock(0)));<NEW_LINE>builder.put("Constantinople", createSchedule(new StubGenesisConfigOptions().constantinopleBlock(0)));<NEW_LINE>builder.put("ConstantinopleFix", createSchedule(new StubGenesisConfigOptions().petersburgBlock(0)));<NEW_LINE>builder.put("Petersburg", createSchedule(new StubGenesisConfigOptions().petersburgBlock(0)));<NEW_LINE>builder.put("Istanbul", createSchedule(new StubGenesisConfigOptions().istanbulBlock(0)));<NEW_LINE>builder.put("MuirGlacier", createSchedule(new StubGenesisConfigOptions().muirGlacierBlock(0)));<NEW_LINE>builder.put("Berlin", createSchedule(new StubGenesisConfigOptions().berlinBlock(0)));<NEW_LINE>builder.put("London", createSchedule(new StubGenesisConfigOptions().londonBlock(0)));<NEW_LINE>builder.put("ArrowGlacier", createSchedule(new StubGenesisConfigOptions().arrowGlacierBlock(0)));<NEW_LINE>return new ReferenceTestProtocolSchedules(builder.build());<NEW_LINE>} | ).eip150Block(5))); |
642,627 | final IRubyObject uptoEndless(ThreadContext context, Block block) {<NEW_LINE>Ruby runtime = context.runtime;<NEW_LINE>StringSites sites = sites(context);<NEW_LINE>CallSite succ = sites.succ;<NEW_LINE>boolean isAscii = scanForCodeRange() == CR_7BIT;<NEW_LINE>RubyString current = strDup(context.runtime);<NEW_LINE>if (isAscii && ASCII.isDigit(value.getUnsafeBytes()[value.getBegin()])) {<NEW_LINE>IRubyObject b = stringToInum(10);<NEW_LINE>RubyArray argsArr = RubyArray.newArray(runtime, RubyFixnum.newFixnum(runtime, value.length()), context.nil);<NEW_LINE>ByteList to;<NEW_LINE>if (b instanceof RubyFixnum) {<NEW_LINE>long bl = RubyNumeric.fix2long(b);<NEW_LINE>while (bl < RubyFixnum.MAX) {<NEW_LINE>argsArr.eltSetOk(1, RubyFixnum.newFixnum(runtime, bl));<NEW_LINE>to = new ByteList(value.length() + 5);<NEW_LINE>Sprintf.sprintf(to, "%.*d", argsArr);<NEW_LINE>current = RubyString.newStringNoCopy(runtime, <MASK><NEW_LINE>block.yield(context, current);<NEW_LINE>bl++;<NEW_LINE>}<NEW_LINE>argsArr.eltSetOk(1, RubyFixnum.newFixnum(runtime, bl));<NEW_LINE>to = new ByteList(value.length() + 5);<NEW_LINE>Sprintf.sprintf(to, "%.*d", argsArr);<NEW_LINE>current = RubyString.newStringNoCopy(runtime, to, USASCIIEncoding.INSTANCE, CR_7BIT);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>IRubyObject next = succ.call(context, current, current);<NEW_LINE>block.yield(context, current);<NEW_LINE>if (next == null)<NEW_LINE>break;<NEW_LINE>current = next.convertToString();<NEW_LINE>if (current.getByteList().length() == 0)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | to, USASCIIEncoding.INSTANCE, CR_7BIT); |
1,007,393 | public BufferedImage intelligentResize(File incomingImage, int width, int height, int resampleOption) {<NEW_LINE>final String hash = DigestUtils.sha256Hex(incomingImage.getAbsolutePath());<NEW_LINE>Dimension originalSize = getWidthHeight(incomingImage);<NEW_LINE>width = <MASK><NEW_LINE>height = Math.min(maxSize, height);<NEW_LINE>// resample huge images to a maxSize (prevents OOM)<NEW_LINE>if ((originalSize.width > maxSize || originalSize.height > maxSize)) {<NEW_LINE>final Map<String, String[]> params = ImmutableMap.of("subsample_w", new String[] { String.valueOf(maxSize) }, "subsample_h", new String[] { String.valueOf(maxSize) }, "subsample_hash", new String[] { hash }, "filter", new String[] { "subsample" });<NEW_LINE>incomingImage = new SubSampleImageFilter().runFilter(incomingImage, params);<NEW_LINE>}<NEW_LINE>return this.resizeImage(incomingImage, width, height, resampleOption);<NEW_LINE>} | Math.min(maxSize, width); |
1,471,425 | public void bind(OCShare publicShare, ShareeListAdapterListener listener) {<NEW_LINE>if (ShareType.EMAIL == publicShare.getShareType()) {<NEW_LINE>binding.name.setText(publicShare.getSharedWithDisplayName());<NEW_LINE>binding.icon.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_email, null));<NEW_LINE>binding.<MASK><NEW_LINE>binding.icon.getBackground().setColorFilter(context.getResources().getColor(R.color.nc_grey), PorterDuff.Mode.SRC_IN);<NEW_LINE>binding.icon.getDrawable().mutate().setColorFilter(context.getResources().getColor(R.color.icon_on_nc_grey), PorterDuff.Mode.SRC_IN);<NEW_LINE>} else {<NEW_LINE>if (!TextUtils.isEmpty(publicShare.getLabel())) {<NEW_LINE>String text = String.format(context.getString(R.string.share_link_with_label), publicShare.getLabel());<NEW_LINE>binding.name.setText(text);<NEW_LINE>} else {<NEW_LINE>binding.name.setText(R.string.share_link);<NEW_LINE>}<NEW_LINE>themeAvatarUtils.colorIconImageViewWithBackground(binding.icon, context, themeColorUtils);<NEW_LINE>}<NEW_LINE>String permissionName = SharingMenuHelper.getPermissionName(context, publicShare);<NEW_LINE>setPermissionName(permissionName);<NEW_LINE>binding.copyLink.setOnClickListener(v -> listener.copyLink(publicShare));<NEW_LINE>binding.overflowMenu.setOnClickListener(v -> listener.showSharingMenuActionSheet(publicShare));<NEW_LINE>binding.shareByLinkContainer.setOnClickListener(v -> listener.showPermissionsDialog(publicShare));<NEW_LINE>} | copyLink.setVisibility(View.GONE); |
1,092,686 | private StringBuilder replace(String wmlTemplateString, int offset, StringBuilder strB, java.util.Map<String, ?> mappings) {<NEW_LINE>int startKey = wmlTemplateString.indexOf("${", offset);<NEW_LINE>if (startKey == -1)<NEW_LINE>return strB.append(wmlTemplateString.substring(offset));<NEW_LINE>else {<NEW_LINE>strB.append(wmlTemplateString.substring(offset, startKey));<NEW_LINE>int keyEnd = wmlTemplateString.indexOf('}', startKey);<NEW_LINE>if (keyEnd > 0) {<NEW_LINE>String key = wmlTemplateString.<MASK><NEW_LINE>Object val = mappings.get(key);<NEW_LINE>if (val == null) {<NEW_LINE>System.out.println("Invalid key '" + key + "' or key not mapped to a value");<NEW_LINE>strB.append(key);<NEW_LINE>} else {<NEW_LINE>strB.append(val.toString());<NEW_LINE>}<NEW_LINE>return replace(wmlTemplateString, keyEnd + 1, strB, mappings);<NEW_LINE>} else {<NEW_LINE>System.out.println("Invalid key: could not find '}' ");<NEW_LINE>strB.append("$");<NEW_LINE>return replace(wmlTemplateString, offset + 1, strB, mappings);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | substring(startKey + 2, keyEnd); |
1,841,634 | public boolean enterImportSpecifierNode(ImportSpecifierNode importSpecifierNode) {<NEW_LINE>if (importSpecifierNode.getIdentifier() != null) {<NEW_LINE>int start = importSpecifierNode.getIdentifier().getFinish();<NEW_LINE>TokenSequence<? extends JsTokenId> ts = LexUtilities.getJsPositionedSequence(result.getSnapshot(), start);<NEW_LINE>if (ts != null) {<NEW_LINE>Token<? extends JsTokenId> token = LexUtilities.findNextNonWsNonComment(ts);<NEW_LINE>if (token != null && (token.id() == JsTokenId.IDENTIFIER || token.id() == JsTokenId.PRIVATE_IDENTIFIER) && ts.offset() < importSpecifierNode.getBindingIdentifier().getStart()) {<NEW_LINE>// it has to be "as"<NEW_LINE>highlights.put(LexUtilities.getLexerOffsets(result, new OffsetRange(ts.offset(), ts.offset() + token.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | length())), SEMANTIC_KEYWORD); |
13,619 | private static <T, P extends PersistentProperty<P>> PreferredConstructor<T, P> buildPreferredConstructor(Constructor<?> constructor, TypeInformation<T> typeInformation, @Nullable PersistentEntity<T, P> entity) {<NEW_LINE>if (constructor.getParameterCount() == 0) {<NEW_LINE>return new PreferredConstructor<>((Constructor<T>) constructor);<NEW_LINE>}<NEW_LINE>List<TypeInformation<?>> <MASK><NEW_LINE>String[] parameterNames = PARAMETER_NAME_DISCOVERER.getParameterNames(constructor);<NEW_LINE>Parameter<Object, P>[] parameters = new Parameter[parameterTypes.size()];<NEW_LINE>Annotation[][] parameterAnnotations = constructor.getParameterAnnotations();<NEW_LINE>for (int i = 0; i < parameterTypes.size(); i++) {<NEW_LINE>String name = parameterNames == null || parameterNames.length <= i ? null : parameterNames[i];<NEW_LINE>TypeInformation<?> type = parameterTypes.get(i);<NEW_LINE>Annotation[] annotations = parameterAnnotations[i];<NEW_LINE>parameters[i] = new Parameter(name, type, annotations, entity);<NEW_LINE>}<NEW_LINE>return new PreferredConstructor<>((Constructor<T>) constructor, parameters);<NEW_LINE>} | parameterTypes = typeInformation.getParameterTypes(constructor); |
1,710,229 | private void handleAsyncException(@NonNull final UserId errorNotificationRecipient, @NonNull final Exception e1) {<NEW_LINE>final Throwable cause = AdempiereException.extractCause(e1);<NEW_LINE>final AdIssueId issueId = Services.get(IErrorManager<MASK><NEW_LINE>final TargetRecordAction targetAction = TargetRecordAction.ofRecordAndWindow(TableRecordReference.of(I_AD_Issue.Table_Name, issueId), IErrorManager.AD_ISSUE_WINDOW_ID.getRepoId());<NEW_LINE>final UserNotificationRequest userNotificationRequest = UserNotificationRequest.builder().important(true).recipientUserId(errorNotificationRecipient).subjectADMessage(AdMessageKey.of(I_AD_Issue.COLUMNNAME_AD_Issue_ID)).contentPlain(AdempiereException.extractMessage(cause)).targetAction(targetAction).build();<NEW_LINE>Services.get(INotificationBL.class).send(userNotificationRequest);<NEW_LINE>} | .class).createIssue(cause); |
800,948 | Object tofile(VirtualFrame frame, PArray self, Object file, @Cached PyObjectCallMethodObjArgs callMethod) {<NEW_LINE>if (self.getLength() > 0) {<NEW_LINE>int remaining = self.getLength() * self.getFormat().bytesize;<NEW_LINE>int blocksize = 64 * 1024;<NEW_LINE>int nblocks = (remaining + blocksize - 1) / blocksize;<NEW_LINE>byte[] buffer = null;<NEW_LINE>for (int i = 0; i < nblocks; i++) {<NEW_LINE>if (remaining < blocksize) {<NEW_LINE>buffer = new byte[remaining];<NEW_LINE>} else if (buffer == null) {<NEW_LINE>buffer = new byte[blocksize];<NEW_LINE>}<NEW_LINE>PythonUtils.arraycopy(self.getBuffer(), i * blocksize, <MASK><NEW_LINE>callMethod.execute(frame, file, "write", factory().createBytes(buffer));<NEW_LINE>remaining -= blocksize;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return PNone.NONE;<NEW_LINE>} | buffer, 0, buffer.length); |
700,458 | private void trashComment() {<NEW_LINE>if (!isAdded() || mComment == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>CommentStatus status = CommentStatus.fromString(mComment.getStatus());<NEW_LINE>// If the comment status is trash or spam, next deletion is a permanent deletion.<NEW_LINE>if (status == CommentStatus.TRASH || status == CommentStatus.SPAM) {<NEW_LINE>AlertDialog.Builder dialogBuilder = new MaterialAlertDialogBuilder(getActivity());<NEW_LINE>dialogBuilder.setTitle(getResources().getText(R.string.delete));<NEW_LINE>dialogBuilder.setMessage(getResources().getText<MASK><NEW_LINE>dialogBuilder.setPositiveButton(getResources().getText(R.string.yes), (dialog, whichButton) -> {<NEW_LINE>moderateComment(CommentStatus.DELETED);<NEW_LINE>announceCommentStatusChangeForAccessibility(CommentStatus.DELETED);<NEW_LINE>});<NEW_LINE>dialogBuilder.setNegativeButton(getResources().getText(R.string.no), null);<NEW_LINE>dialogBuilder.setCancelable(true);<NEW_LINE>dialogBuilder.create().show();<NEW_LINE>} else {<NEW_LINE>moderateComment(CommentStatus.TRASH);<NEW_LINE>announceCommentStatusChangeForAccessibility(CommentStatus.TRASH);<NEW_LINE>}<NEW_LINE>} | (R.string.dlg_sure_to_delete_comment)); |
1,358,542 | private RubyNumeric fix_expt(ThreadContext context, RubyInteger other, final int sign) {<NEW_LINE>final RubyInteger tnum, tden;<NEW_LINE>if (sign > 0) {<NEW_LINE>// other > 0<NEW_LINE>// exp > 0<NEW_LINE>tnum = (RubyInteger) <MASK><NEW_LINE>// exp > 0<NEW_LINE>tden = (RubyInteger) f_expt(context, den, other);<NEW_LINE>} else if (sign < 0) {<NEW_LINE>// other < 0<NEW_LINE>RubyInteger otherNeg = other.negate();<NEW_LINE>// exp.negate > 0<NEW_LINE>tnum = (RubyInteger) f_expt(context, den, otherNeg);<NEW_LINE>// exp.negate > 0<NEW_LINE>tden = (RubyInteger) f_expt(context, num, otherNeg);<NEW_LINE>} else {<NEW_LINE>// other == 0<NEW_LINE>tnum = tden = RubyFixnum.one(context.runtime);<NEW_LINE>}<NEW_LINE>return RubyRational.newInstance(context, getMetaClass(), tnum, tden);<NEW_LINE>} | f_expt(context, num, other); |
1,266,684 | private void checkAuthAttributesNoDuplicates(final Map<String, List<AuthorizationAttribute>> allAttributes) throws UnableProcessException {<NEW_LINE>final String duplicatesErrMessage = allAttributes.entrySet().stream().map(entry -> {<NEW_LINE>final String property = entry.getKey();<NEW_LINE>final List<AuthorizationAttribute> attrs = entry.getValue();<NEW_LINE>final List<AuthorizationAttribute> duplicates = newArrayList(attrs);<NEW_LINE>final Set<AuthorizationAttribute> uniqueAttrs = newHashSet(attrs);<NEW_LINE>uniqueAttrs.forEach(duplicates::remove);<NEW_LINE>if (!duplicates.isEmpty()) {<NEW_LINE>final String duplicatesStr = duplicates.stream().distinct().map(attr -> String.format("%s:%s", attr.getDataType(), attr.getValue())).collect(Collectors.joining(", "));<NEW_LINE>final String err = String.<MASK><NEW_LINE>return Optional.of(err);<NEW_LINE>} else {<NEW_LINE>return Optional.<String>empty();<NEW_LINE>}<NEW_LINE>}).filter(Optional::isPresent).map(Optional::get).collect(Collectors.joining("; "));<NEW_LINE>if (!Strings.isNullOrEmpty(duplicatesErrMessage)) {<NEW_LINE>throw new UnableProcessException(duplicatesErrMessage);<NEW_LINE>}<NEW_LINE>} | format("authorization property '%s' contains duplicated attribute(s): %s", property, duplicatesStr); |
447,029 | private void extractPeakListList() throws UnsupportedAudioFileException {<NEW_LINE><MASK><NEW_LINE>TarsosDSPAudioInputStream stream = f.getMonoStream(sampleRate, 0);<NEW_LINE>final SpectralPeakProcessor spectralPeakFollower = new SpectralPeakProcessor(fftsize, overlap, sampleRate);<NEW_LINE>AudioDispatcher dispatcher = new AudioDispatcher(stream, fftsize, overlap);<NEW_LINE>dispatcher.addAudioProcessor(spectralPeakFollower);<NEW_LINE>dispatcher.addAudioProcessor(new AudioProcessor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void processingFinished() {<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean process(AudioEvent audioEvent) {<NEW_LINE>magnitudesList.add(spectralPeakFollower.getMagnitudes());<NEW_LINE>frequencyEstimatesList.add(spectralPeakFollower.getFrequencyEstimates());<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>dispatcher.run();<NEW_LINE>} | PipedAudioStream f = new PipedAudioStream(fileName); |
1,642,096 | private void executeCommand(String slicePath) {<NEW_LINE>if (exec == null)<NEW_LINE>return;<NEW_LINE>try {<NEW_LINE>String[] newArr = new String[exec.length + 1];<NEW_LINE>System.arraycopy(exec, 0, <MASK><NEW_LINE>newArr[exec.length] = slicePath;<NEW_LINE>ProcessWrapper pw = new ProcessWrapper(newArr, null);<NEW_LINE>int exit = pw.execute();<NEW_LINE>if (verbose)<NEW_LINE>System.out.println(Platform.stringFromBytes(pw.getOut()));<NEW_LINE>byte[] err = pw.getErr();<NEW_LINE>if (err.length > 0) {<NEW_LINE>System.err.println(Platform.stringFromBytes(err));<NEW_LINE>}<NEW_LINE>if (exit != 0) {<NEW_LINE>System.err.println("Command '" + join(newArr) + "' exited with code: " + exit);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | newArr, 0, exec.length); |
1,543,442 | public Status insert(String table, String key, Map<String, ByteIterator> values) {<NEW_LINE>try {<NEW_LINE>Set<String> fields = values.keySet();<NEW_LINE>PreparedStatement stmt = insertStmts.get(fields);<NEW_LINE>// Prepare statement on demand<NEW_LINE>if (stmt == null) {<NEW_LINE>Insert insertStmt = QueryBuilder.insertInto(table);<NEW_LINE>// Add key<NEW_LINE>insertStmt.value(<MASK><NEW_LINE>// Add fields<NEW_LINE>for (String field : fields) {<NEW_LINE>insertStmt.value(field, QueryBuilder.bindMarker());<NEW_LINE>}<NEW_LINE>stmt = session.prepare(insertStmt);<NEW_LINE>stmt.setConsistencyLevel(writeConsistencyLevel);<NEW_LINE>if (trace) {<NEW_LINE>stmt.enableTracing();<NEW_LINE>}<NEW_LINE>PreparedStatement prevStmt = insertStmts.putIfAbsent(new HashSet(fields), stmt);<NEW_LINE>if (prevStmt != null) {<NEW_LINE>stmt = prevStmt;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug(stmt.getQueryString());<NEW_LINE>logger.debug("key = {}", key);<NEW_LINE>for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {<NEW_LINE>logger.debug("{} = {}", entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Add key<NEW_LINE>BoundStatement boundStmt = stmt.bind().setString(0, key);<NEW_LINE>// Add fields<NEW_LINE>ColumnDefinitions vars = stmt.getVariables();<NEW_LINE>for (int i = 1; i < vars.size(); i++) {<NEW_LINE>boundStmt.setString(i, values.get(vars.getName(i)).toString());<NEW_LINE>}<NEW_LINE>session.execute(boundStmt);<NEW_LINE>return Status.OK;<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error(MessageFormatter.format("Error inserting key: {}", key).getMessage(), e);<NEW_LINE>}<NEW_LINE>return Status.ERROR;<NEW_LINE>} | YCSB_KEY, QueryBuilder.bindMarker()); |
584,279 | public Site2SiteCustomerGatewayResponse createSite2SiteCustomerGatewayResponse(Site2SiteCustomerGateway result) {<NEW_LINE>Site2SiteCustomerGatewayResponse response = new Site2SiteCustomerGatewayResponse();<NEW_LINE>response.setId(result.getUuid());<NEW_LINE>response.setName(result.getName());<NEW_LINE>response.setGatewayIp(result.getGatewayIp());<NEW_LINE>response.setGuestCidrList(result.getGuestCidrList());<NEW_LINE>response.setIpsecPsk(result.getIpsecPsk());<NEW_LINE>response.setIkePolicy(result.getIkePolicy());<NEW_LINE>response.<MASK><NEW_LINE>response.setIkeLifetime(result.getIkeLifetime());<NEW_LINE>response.setEspLifetime(result.getEspLifetime());<NEW_LINE>response.setDpd(result.getDpd());<NEW_LINE>response.setEncap(result.getEncap());<NEW_LINE>response.setRemoved(result.getRemoved());<NEW_LINE>response.setIkeVersion(result.getIkeVersion());<NEW_LINE>response.setSplitConnections(result.getSplitConnections());<NEW_LINE>response.setObjectName("vpncustomergateway");<NEW_LINE>response.setHasAnnotation(annotationDao.hasAnnotations(result.getUuid(), AnnotationService.EntityType.VPN_CUSTOMER_GATEWAY.name(), _accountMgr.isRootAdmin(CallContext.current().getCallingAccount().getId())));<NEW_LINE>populateAccount(response, result.getAccountId());<NEW_LINE>populateDomain(response, result.getDomainId());<NEW_LINE>return response;<NEW_LINE>} | setEspPolicy(result.getEspPolicy()); |
1,040,069 | private Observable<Boolean> addDepictsProperty(final String fileEntityId, final List<String> depictedItems) {<NEW_LINE>final EditClaim data = editClaim(// Wikipedia:Sandbox (Q10)<NEW_LINE>ConfigUtils.isBetaFlavour() ? // Wikipedia:Sandbox (Q10)<NEW_LINE>Collections.singletonList("Q10") : depictedItems);<NEW_LINE>return wikiBaseClient.postEditEntity(PAGE_ID_PREFIX + fileEntityId, gson.toJson(data)).doOnNext(success -> {<NEW_LINE>if (success) {<NEW_LINE>Timber.d("DEPICTS property was set successfully for %s", fileEntityId);<NEW_LINE>} else {<NEW_LINE>Timber.d("Unable to set DEPICTS property for %s", fileEntityId);<NEW_LINE>}<NEW_LINE>}).doOnError(throwable -> {<NEW_LINE>Timber.e(throwable, "Error occurred while setting DEPICTS property");<NEW_LINE>ViewUtil.showLongToast(<MASK><NEW_LINE>}).subscribeOn(Schedulers.io());<NEW_LINE>} | context, throwable.toString()); |
1,471,659 | protected XML resolveXml(Annotated a, Annotation[] annotations, io.swagger.v3.oas.annotations.media.Schema schema) {<NEW_LINE>// if XmlRootElement annotation, construct an Xml object and attach it to the model<NEW_LINE>XmlRootElement rootAnnotation = null;<NEW_LINE>if (a != null) {<NEW_LINE>rootAnnotation = a.getAnnotation(XmlRootElement.class);<NEW_LINE>}<NEW_LINE>if (rootAnnotation == null) {<NEW_LINE>if (annotations != null) {<NEW_LINE>for (Annotation ann : annotations) {<NEW_LINE>if (ann instanceof XmlRootElement) {<NEW_LINE>rootAnnotation = (XmlRootElement) ann;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (rootAnnotation != null && !"".equals(rootAnnotation.name()) && !JAXB_DEFAULT.equals(rootAnnotation.name())) {<NEW_LINE>XML xml = new XML().<MASK><NEW_LINE>if (rootAnnotation.namespace() != null && !"".equals(rootAnnotation.namespace()) && !JAXB_DEFAULT.equals(rootAnnotation.namespace())) {<NEW_LINE>xml.namespace(rootAnnotation.namespace());<NEW_LINE>}<NEW_LINE>return xml;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | name(rootAnnotation.name()); |
1,336,413 | public static SceneGraphImageObject fromJSONObject(SceneGraphImage img, JSONObject obj) {<NEW_LINE>List<String> names = (List<String>) obj.get("names");<NEW_LINE>List<JSONArray> labelArrays = (List<JSONArray>) obj.get("labels");<NEW_LINE>List<<MASK><NEW_LINE>if (labelArrays != null) {<NEW_LINE>labelsList = Generics.newArrayList(labelArrays.size());<NEW_LINE>for (JSONArray arr : labelArrays) {<NEW_LINE>List<CoreLabel> tokens = Generics.newArrayList(arr.size());<NEW_LINE>for (String str : (List<String>) arr) {<NEW_LINE>tokens.add(SceneGraphImageUtils.labelFromString(str));<NEW_LINE>}<NEW_LINE>labelsList.add(tokens);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>JSONObject boundingBoxObj = (JSONObject) obj.get("bbox");<NEW_LINE>int h = ((Number) boundingBoxObj.get("h")).intValue();<NEW_LINE>int w = ((Number) boundingBoxObj.get("w")).intValue();<NEW_LINE>int x = ((Number) boundingBoxObj.get("x")).intValue();<NEW_LINE>int y = ((Number) boundingBoxObj.get("y")).intValue();<NEW_LINE>SceneGraphImageBoundingBox boundingBox = new SceneGraphImageBoundingBox(h, w, x, y);<NEW_LINE>return new SceneGraphImageObject(boundingBox, names, labelsList);<NEW_LINE>} | List<CoreLabel>> labelsList = null; |
1,266,569 | public void testSkipFirstExecution(PrintWriter out) throws Exception {<NEW_LINE>DBIncrementTask task = new DBIncrementTask("testSkipFirstExecution");<NEW_LINE>task.getExecutionProperties().put(AutoPurge.PROPERTY_NAME, AutoPurge.NEVER.toString());<NEW_LINE>Trigger trigger = new FixedRepeatTrigger(2, 59, 1);<NEW_LINE>TaskStatus<Integer> status = scheduler.schedule((Callable<Integer>) task, trigger);<NEW_LINE>try {<NEW_LINE>boolean done = status.isDone();<NEW_LINE>throw new Exception("Task should not have done status " + done + " until it runs at least once.");<NEW_LINE>} catch (IllegalStateException x) {<NEW_LINE>}<NEW_LINE>// poll for result, ignoring skips<NEW_LINE>for (long start = System.nanoTime(); System.nanoTime() - start < TIMEOUT_NS; Thread.sleep(POLL_INTERVAL)) {<NEW_LINE>status = scheduler.getStatus(status.getTaskId());<NEW_LINE>try {<NEW_LINE>if (status == null || status.hasResult() && Integer.valueOf(1).equals(status.getResult()))<NEW_LINE>break;<NEW_LINE>} catch (SkippedException x) {<NEW_LINE>// allow for skips<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!status.isDone())<NEW_LINE>throw new Exception("Task should be done. " + status);<NEW_LINE>long delay = status.getDelay(TimeUnit.MICROSECONDS);<NEW_LINE>if (delay > 0)<NEW_LINE>throw new Exception("Delay must not be positive for completed task. " + status);<NEW_LINE><MASK><NEW_LINE>if (!Integer.valueOf(1).equals(result))<NEW_LINE>throw new Exception("Unexpected result " + result + " for task. " + status);<NEW_LINE>if (status.cancel(true))<NEW_LINE>throw new Exception("Should not be able to cancel task that already completed its final execution. " + status);<NEW_LINE>if (status.isCancelled())<NEW_LINE>throw new Exception("Task should not be canceled. " + status);<NEW_LINE>} | Integer result = status.get(); |
195,587 | public ContextManager build(final ContextManagerBuilderParameter parameter) throws SQLException {<NEW_LINE>ModeScheduleContextFactory.getInstance().init(parameter.getInstanceDefinition().getInstanceId().getId(), parameter.getModeConfig());<NEW_LINE>ClusterPersistRepository repository = ClusterPersistRepositoryFactory.newInstance((ClusterPersistRepositoryConfiguration) parameter.getModeConfig().getRepository(), parameter.getInstanceDefinition());<NEW_LINE><MASK><NEW_LINE>persistConfigurations(metaDataPersistService, parameter);<NEW_LINE>RegistryCenter registryCenter = new RegistryCenter(repository);<NEW_LINE>MetaDataContextsBuilder metaDataContextsBuilder = createMetaDataContextsBuilder(metaDataPersistService, parameter);<NEW_LINE>Map<String, ShardingSphereDatabase> databaseMap = metaDataContextsBuilder.getDatabaseMap().isEmpty() ? Collections.emptyMap() : metaDataContextsBuilder.getDatabaseMap();<NEW_LINE>persistMetaData(metaDataPersistService, databaseMap);<NEW_LINE>MetaDataContexts metaDataContexts = metaDataContextsBuilder.build(metaDataPersistService);<NEW_LINE>Properties transactionProps = getTransactionProperties(metaDataContexts);<NEW_LINE>persistTransactionConfiguration(parameter, metaDataPersistService, transactionProps);<NEW_LINE>ContextManager result = createContextManager(repository, metaDataPersistService, parameter.getInstanceDefinition(), metaDataContexts, transactionProps, parameter.getModeConfig());<NEW_LINE>registerOnline(metaDataPersistService, parameter.getInstanceDefinition(), result, registryCenter);<NEW_LINE>return result;<NEW_LINE>} | MetaDataPersistService metaDataPersistService = new MetaDataPersistService(repository); |
265,039 | public void refresh(TableCell cell) {<NEW_LINE>Object ds = cell.getDataSource();<NEW_LINE>if (!(ds instanceof Download)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Download dm = (Download) ds;<NEW_LINE>long value;<NEW_LINE>long sortValue;<NEW_LINE>String prefix = "";<NEW_LINE>int iState;<NEW_LINE>iState = dm.getState();<NEW_LINE>if (iState == Download.ST_DOWNLOADING) {<NEW_LINE>value = dm.getStats().getDownloadAverage();<NEW_LINE>((TableCellSWT<MASK><NEW_LINE>} else if (iState == Download.ST_SEEDING) {<NEW_LINE>value = dm.getStats().getUploadAverage();<NEW_LINE>((TableCellSWT) cell).setIcon(imgUp);<NEW_LINE>} else {<NEW_LINE>((TableCellSWT) cell).setIcon(null);<NEW_LINE>value = 0;<NEW_LINE>}<NEW_LINE>if (cell.isSecondarySortEnabled()) {<NEW_LINE>sortValue = (value << 4) | iState;<NEW_LINE>} else {<NEW_LINE>sortValue = value;<NEW_LINE>}<NEW_LINE>if (cell.setSortValue(sortValue) || !cell.isValid()) {<NEW_LINE>cell.setText(value > 0 ? prefix + DisplayFormatters.formatByteCountToKiBEtcPerSec(value) : "");<NEW_LINE>}<NEW_LINE>} | ) cell).setIcon(imgDown); |
1,360,338 | public final Result doWork() {<NEW_LINE>final PackageDirectory dir = Repository.get().getPackageDirectory();<NEW_LINE>if (dir == null)<NEW_LINE>return Result.retry();<NEW_LINE>dm.setPackageDirectory(dir);<NEW_LINE>if (BuildConfig.DEBUG)<NEW_LINE>Log.v(TAG, "doWork: " + getClass().getName());<NEW_LINE>DataPack p = getTarget();<NEW_LINE>if (p == null) {<NEW_LINE>if (BuildConfig.DEBUG)<NEW_LINE>Log.e(TAG, "No target defined");<NEW_LINE>return Result.failure();<NEW_LINE>}<NEW_LINE>if (BuildConfig.DEBUG)<NEW_LINE>Log.v(TAG, "Target: " + p.getId());<NEW_LINE>final String key = p.getType() + "." + p.getId();<NEW_LINE>Lock <MASK><NEW_LINE>if (!lock.tryLock())<NEW_LINE>return Result.retry();<NEW_LINE>try {<NEW_LINE>Result res = doWork(p);<NEW_LINE>if (BuildConfig.DEBUG)<NEW_LINE>Log.v(TAG, "Result from " + getClass().getName() + ": " + res);<NEW_LINE>return res;<NEW_LINE>} finally {<NEW_LINE>lock.unlock();<NEW_LINE>}<NEW_LINE>} | lock = locks.get(key); |
1,154,285 | public boolean onTouch(View v, MotionEvent event) {<NEW_LINE>postAction();<NEW_LINE>if (event.getAction() == MotionEvent.ACTION_DOWN && popupView.getLayoutParams() != null) {<NEW_LINE>x = event.getRawX();<NEW_LINE>y = event.getRawY();<NEW_LINE>w = popupView.getLayoutParams().width;<NEW_LINE>h = popupView.getLayoutParams().height;<NEW_LINE><MASK><NEW_LINE>y2 = AnchorHelper.getY(anchor);<NEW_LINE>} else if (event.getAction() == MotionEvent.ACTION_MOVE && popupView.getLayoutParams() != null) {<NEW_LINE>int nWidth = (int) (w + (x - event.getRawX()));<NEW_LINE>if (nWidth > MIN_WH) {<NEW_LINE>popupView.getLayoutParams().width = nWidth;<NEW_LINE>AnchorHelper.setX(anchor, event.getRawX() + (x2 - x));<NEW_LINE>}<NEW_LINE>int nHeight = (int) (h + (event.getRawY() - y));<NEW_LINE>if (nHeight > MIN_WH) {<NEW_LINE>popupView.getLayoutParams().height = nHeight;<NEW_LINE>}<NEW_LINE>AnchorHelper.setY(anchor, y2);<NEW_LINE>popupView.requestLayout();<NEW_LINE>LOG.d("Anchor WxH", Dips.pxToDp(anchor.getWidth()), Dips.pxToDp(anchor.getHeight()));<NEW_LINE>} else if (event.getAction() == MotionEvent.ACTION_UP) {<NEW_LINE>saveLayout();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | x2 = AnchorHelper.getX(anchor); |
368,562 | public void addServiceService(final String objectName, final String serviceAddress, final ServiceQueue serviceQueue) {<NEW_LINE>servicesToStop.add(serviceQueue);<NEW_LINE>servicesToFlush.add(serviceQueue);<NEW_LINE><MASK><NEW_LINE>if (serviceAddress != null && !serviceAddress.isEmpty()) {<NEW_LINE>serviceMapping.put(serviceAddress, dispatch);<NEW_LINE>}<NEW_LINE>if (objectName != null) {<NEW_LINE>serviceMapping.put(objectName, dispatch);<NEW_LINE>}<NEW_LINE>serviceMapping.put(serviceQueue.name().toLowerCase(), dispatch);<NEW_LINE>serviceMapping.put(serviceQueue.name(), dispatch);<NEW_LINE>serviceMapping.put(serviceQueue.address(), dispatch);<NEW_LINE>serviceMapping.put(serviceQueue.address().toLowerCase(), dispatch);<NEW_LINE>sendQueues.add(dispatch.requests);<NEW_LINE>final Collection<String> addresses = serviceQueue.addresses(this.rootAddress);<NEW_LINE>if (debug) {<NEW_LINE>logger.debug(ServiceBundleImpl.class.getName() + " addresses: " + addresses);<NEW_LINE>}<NEW_LINE>for (String addr : addresses) {<NEW_LINE>serviceMapping.put(addr, dispatch);<NEW_LINE>}<NEW_LINE>} | QueueDispatch dispatch = new QueueDispatch(serviceQueue); |
779,245 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source));<NEW_LINE>MageObject <MASK><NEW_LINE>if (controller != null && player != null && mageObject != null) {<NEW_LINE>FilterCreaturePermanent filter = new FilterCreaturePermanent("face down creature controlled by " + player.getLogName());<NEW_LINE>filter.add(FaceDownPredicate.instance);<NEW_LINE>filter.add(new ControllerIdPredicate(player.getId()));<NEW_LINE>TargetCreaturePermanent target = new TargetCreaturePermanent(1, 1, filter, true);<NEW_LINE>if (target.canChoose(controller.getId(), source, game)) {<NEW_LINE>while (controller.chooseUse(outcome, "Look at a face down creature controlled by " + player.getLogName() + "?", source, game)) {<NEW_LINE>target.clearChosen();<NEW_LINE>while (!target.isChosen() && target.canChoose(controller.getId(), source, game) && controller.canRespond()) {<NEW_LINE>controller.chooseTarget(outcome, target, source, game);<NEW_LINE>}<NEW_LINE>Permanent faceDownCreature = game.getPermanent(target.getFirstTarget());<NEW_LINE>if (faceDownCreature != null) {<NEW_LINE>Permanent copyFaceDown = faceDownCreature.copy();<NEW_LINE>copyFaceDown.setFaceDown(false, game);<NEW_LINE>Cards cards = new CardsImpl(copyFaceDown);<NEW_LINE>controller.lookAtCards("face down card - " + mageObject.getName(), cards, game);<NEW_LINE>game.informPlayers(controller.getLogName() + " looks at a face down creature controlled by " + player.getLogName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | mageObject = game.getObject(source); |
1,808,722 | public void onError(Channel channel, Throwable error) {<NEW_LINE>if (error instanceof OutOfMemoryError) {<NEW_LINE>OutOfMemoryErrorDispatcher.onOutOfMemory((OutOfMemoryError) error);<NEW_LINE>}<NEW_LINE>if (channel == null) {<NEW_LINE>// todo: question is if logging is the best solution. If an exception happened without a channel, it is a pretty<NEW_LINE>// big event and perhaps we should shutdown the whole HZ instance.<NEW_LINE>logger.severe(error);<NEW_LINE>} else {<NEW_LINE>TcpServerConnection connection = (TcpServerConnection) channel.attributeMap().get(ServerConnection.class);<NEW_LINE>if (connection != null) {<NEW_LINE>String closeReason = (error instanceof EOFException) ? "Connection closed by the other side" : "Exception in " + connection + ", thread=" + Thread.currentThread().getName();<NEW_LINE>connection.close(closeReason, error);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | logger.warning("Channel error occurred", error); |
898,436 | public void testDynamicDisableWithNoContextInfo() throws Exception {<NEW_LINE>// Step 1 - Update server configuration - ContextInfo = false , Threshold = 2s<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "---> Updating server with ContextInfo = false");<NEW_LINE>server.setServerConfigurationFile("server_NOContextInfo.xml");<NEW_LINE>waitForConfigurationUpdate();<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "-----> Started Server with contextInfo disabled");<NEW_LINE>// Step 2 - create request for 3seconds and look for slow request warnings (they should have no contextInfo)<NEW_LINE>createRequest("?sleepTime=3000");<NEW_LINE>int slowCount = fetchNoOfslowRequestWarnings();<NEW_LINE>assertTrue("No Slow request timing records found! : ", (slowCount > 0));<NEW_LINE>List<String> lines = server.findStringsInFileInLibertyServerRoot("ms", MESSAGE_LOG);<NEW_LINE>for (String line : lines) {<NEW_LINE>assertFalse("contextInfo found when it was disabled..", line.contains("|"));<NEW_LINE>}<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "---------> As expected : Pattern Not Found! ...");<NEW_LINE>// Step 3 - Reset back to a configuration with contextInfo enabled.<NEW_LINE>server.setMarkToEndOfLog();<NEW_LINE>server.setServerConfigurationFile("server_slowRequestThreshold1.xml");<NEW_LINE>waitForConfigurationUpdate();<NEW_LINE>// Step 4 - Create request for 3 seconds and look for slow request warning, should contain contextInfo now.<NEW_LINE>createRequest("?sleepTime=3000");<NEW_LINE>server.waitForStringInLogUsingMark("TRAS0112W", 20000);<NEW_LINE>lines = server.findStringsInLogsUsingMark("ms", MESSAGE_LOG);<NEW_LINE>for (String line : lines) {<NEW_LINE>if (!line.contains("TRAS0112W") && !line.contains("TRAS0113I") && !line.contains("CWWKG0028A")) {<NEW_LINE>assertTrue("contextInfo is missing...", line.contains("|"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CommonTasks.writeLogMsg(Level.INFO, "************** Removed request timing element **************");<NEW_LINE>// Step 5 - Remove Request Timing Feature<NEW_LINE>server.setMarkToEndOfLog();<NEW_LINE>server.setServerConfigurationFile("server_withOutReqTiming.xml");<NEW_LINE>boolean removed = isRequestTimingRemoved();<NEW_LINE>assertTrue("Request timing feature is not disabled..", removed);<NEW_LINE>CommonTasks.<MASK><NEW_LINE>} | writeLogMsg(Level.INFO, "********* Removed Request Timing Feature..! *********"); |
838,630 | static double powerSeries(double a, double b, double x) throws ArithmeticException {<NEW_LINE>double s, t, u, v, n, t1, z, ai;<NEW_LINE>ai = 1.0 / a;<NEW_LINE>u = (1.0 - b) * x;<NEW_LINE>v = u / (a + 1.0);<NEW_LINE>t1 = v;<NEW_LINE>t = u;<NEW_LINE>n = 2.0;<NEW_LINE>s = 0.0;<NEW_LINE>z = MACHEP * ai;<NEW_LINE>while (Math.abs(v) > z) {<NEW_LINE>u = (n - b) * x / n;<NEW_LINE>t *= u;<NEW_LINE>v = t / (a + n);<NEW_LINE>s += v;<NEW_LINE>n += 1.0;<NEW_LINE>}<NEW_LINE>s += t1;<NEW_LINE>s += ai;<NEW_LINE>u = <MASK><NEW_LINE>if ((a + b) < MAXGAM && Math.abs(u) < MAXLOG) {<NEW_LINE>t = GammaFunctions.gamma(a + b) / (GammaFunctions.gamma(a) * GammaFunctions.gamma(b));<NEW_LINE>s = s * t * Math.pow(x, a);<NEW_LINE>} else {<NEW_LINE>t = GammaFunctions.logGamma(a + b) - GammaFunctions.logGamma(a) - GammaFunctions.logGamma(b) + u + Math.log(s);<NEW_LINE>if (t < MINLOG)<NEW_LINE>s = 0.0;<NEW_LINE>else<NEW_LINE>s = Math.exp(t);<NEW_LINE>}<NEW_LINE>return s;<NEW_LINE>} | a * Math.log(x); |
949,637 | private void openPathSegments(String[] pathSegments, int from) throws IOException {<NEW_LINE>for (int i = from; i < pathSegments.length; i++) {<NEW_LINE>StringBuilder sb = new StringBuilder(pathSegments[0]);<NEW_LINE>StringBuilder parentPath = new StringBuilder(pathSegments[0]);<NEW_LINE>for (int j = 1; j <= i; j++) {<NEW_LINE>sb.append(".").append(pathSegments[j]);<NEW_LINE>if (j < i) {<NEW_LINE>parentPath.append(".")<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>SchemaNode parent = pathToObjectNode.get(parentPath.toString());<NEW_LINE>String currentProperty = pathSegments[i];<NEW_LINE>boolean foundPreviousRepeated = false;<NEW_LINE>ArrayList<String> vizMembers = visitedMembers.get(parent);<NEW_LINE>String lastVisitedProp = null;<NEW_LINE>int lastVisitedPropIdx = -1;<NEW_LINE>int currentPropIdx = parent.indexOfMember(currentProperty);<NEW_LINE>if (vizMembers != null && vizMembers.size() > 0) {<NEW_LINE>lastVisitedProp = vizMembers.get(vizMembers.size() - 1);<NEW_LINE>lastVisitedPropIdx = parent.indexOfMember(lastVisitedProp);<NEW_LINE>}<NEW_LINE>// before opening new path, check if previous has repeated values to be written<NEW_LINE>if (parent.isArray()) {<NEW_LINE>if (lastVisitedProp != null) {<NEW_LINE>foundPreviousRepeated = writeReapeatedValues(parent, lastVisitedPropIdx + 1, currentPropIdx, false);<NEW_LINE>} else {<NEW_LINE>vizMembers = new ArrayList<>();<NEW_LINE>visitedMembers.put(parent, vizMembers);<NEW_LINE>}<NEW_LINE>vizMembers.add(currentProperty);<NEW_LINE>}<NEW_LINE>if (// got another property of the same object<NEW_LINE>foundPreviousRepeated || (lastVisitedPropIdx != -1 && currentPropIdx > lastVisitedPropIdx)) {<NEW_LINE>writer.write(",");<NEW_LINE>}<NEW_LINE>if (escapeMembers) {<NEW_LINE>writer.write("\"" + currentProperty + "\":");<NEW_LINE>} else {<NEW_LINE>writer.write(currentProperty + ":");<NEW_LINE>}<NEW_LINE>SchemaNode toOpen = pathToObjectNode.get(sb.toString());<NEW_LINE>openedSchemaNodes.add(toOpen);<NEW_LINE>if (toOpen.isObject()) {<NEW_LINE>writer.write("{");<NEW_LINE>} else {<NEW_LINE>writer.write("[{");<NEW_LINE>}<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("\t\topening " + toOpen.getType().getName() + " path: " + sb.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .append(pathSegments[j]); |
1,605,393 | public void destroy() {<NEW_LINE>if (logger.isInfoEnabled()) {<NEW_LINE>logger.info("Destroying protocol [" + this.getClass().getSimpleName() + "] ...");<NEW_LINE>}<NEW_LINE>super.destroy();<NEW_LINE>if (connectionMonitor != null) {<NEW_LINE>connectionMonitor.shutdown();<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, ProtocolServer> entry : serverMap.entrySet()) {<NEW_LINE>try {<NEW_LINE>if (logger.isInfoEnabled()) {<NEW_LINE>logger.info("Closing the rest server at " + entry.getKey());<NEW_LINE>}<NEW_LINE>entry.getValue().close();<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.warn("Error closing rest server", t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>serverMap.clear();<NEW_LINE>if (logger.isInfoEnabled()) {<NEW_LINE>logger.info("Closing rest clients");<NEW_LINE>}<NEW_LINE>for (ResteasyClient client : clients) {<NEW_LINE>try {<NEW_LINE>client.close();<NEW_LINE>} catch (Throwable t) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>clients.clear();<NEW_LINE>} | logger.warn("Error closing rest client", t); |
1,809,286 | public Hover onMouseMove(Fonts.TextMeasurer m, Repainter repainter, double x, double y, int mods) {<NEW_LINE>if (y >= (timeline.getPreferredHeight() / 2) && y <= timeline.getPreferredHeight() && x > LABEL_WIDTH) {<NEW_LINE>return flagHover(x);<NEW_LINE>}<NEW_LINE>double topHeight = top.getPreferredHeight();<NEW_LINE>Hover result = (y < topHeight) ? top.onMouseMove(m, repainter, x, y, mods) : bottom.onMouseMove(m, repainter.transformed(a -> a.translate(0, topHeight - state.getScrollOffset())), x, y - topHeight + state.getScrollOffset(), mods).transformed(a -> a.translate(0, topHeight - state.getScrollOffset()));<NEW_LINE>if (x >= LABEL_WIDTH && y >= topHeight && result == Hover.NONE) {<NEW_LINE>result = result.withClick(() -> state.resetSelections());<NEW_LINE>}<NEW_LINE>if (x >= LABEL_WIDTH) {<NEW_LINE>result = result.withClick(() -> {<NEW_LINE>TimeSpan highlight = state.getHighlight();<NEW_LINE>if (!highlight.isEmpty() && !highlight.contains(state.pxToTime(x - LABEL_WIDTH))) {<NEW_LINE><MASK><NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>});<NEW_LINE>}<NEW_LINE>if (checkHighlightEdgeHovered(x)) {<NEW_LINE>result = result.withRedraw(Area.FULL);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | state.setHighlight(TimeSpan.ZERO); |
760,218 | static int multiplyAndSubtract(int[] a, int start, int[] b, int bLen, int c) {<NEW_LINE>long carry0 = 0;<NEW_LINE>long carry1 = 0;<NEW_LINE>for (int i = 0; i < bLen; i++) {<NEW_LINE>carry0 = TMultiplication.unsignedMultAddAdd(b[i], c, (int) carry0, 0);<NEW_LINE>carry1 = (a[start + i] & 0xffffffffL) - (carry0 & 0xffffffffL) + carry1;<NEW_LINE>a[start + i] = (int) carry1;<NEW_LINE>// -1 or 0<NEW_LINE>carry1 >>= 32;<NEW_LINE>carry0 >>>= 32;<NEW_LINE>}<NEW_LINE>carry1 = (a[start + bLen<MASK><NEW_LINE>a[start + bLen] = (int) carry1;<NEW_LINE>// -1 or 0<NEW_LINE>return (int) (carry1 >> 32);<NEW_LINE>} | ] & 0xffffffffL) - carry0 + carry1; |
561,992 | public static byte[] generateWARCInfo(Map<String, String> fields) {<NEW_LINE>StringBuffer buffer = new StringBuffer();<NEW_LINE>buffer.append(WARC_VERSION);<NEW_LINE>buffer.append(CRLF);<NEW_LINE>buffer.append("WARC-Type: ").append(WARC_TYPE_WARCINFO).append(CRLF);<NEW_LINE>String mainID = UUID.randomUUID().toString();<NEW_LINE>// retrieve the date and filename from the map<NEW_LINE>String date = fields.get("WARC-Date");<NEW_LINE>buffer.append("WARC-Date: ").append(date).append(CRLF);<NEW_LINE>String filename = fields.get("WARC-Filename");<NEW_LINE>buffer.append("WARC-Filename: ").append<MASK><NEW_LINE>buffer.append("WARC-Record-ID").append(": ").append("<urn:uuid:").append(mainID).append(">").append(CRLF);<NEW_LINE>buffer.append("Content-Type").append(": ").append("application/warc-fields").append(CRLF);<NEW_LINE>StringBuilder fieldsBuffer = new StringBuilder();<NEW_LINE>// add WARC fields<NEW_LINE>// http://bibnum.bnf.fr/warc/WARC_ISO_28500_version1_latestdraft.pdf<NEW_LINE>Iterator<Entry<String, String>> iter = fields.entrySet().iterator();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>Entry<String, String> entry = iter.next();<NEW_LINE>String key = entry.getKey();<NEW_LINE>if (key.startsWith("WARC-"))<NEW_LINE>continue;<NEW_LINE>fieldsBuffer.append(key).append(": ").append(entry.getValue()).append(CRLF);<NEW_LINE>}<NEW_LINE>buffer.append("Content-Length").append(": ").append(fieldsBuffer.toString().getBytes(StandardCharsets.UTF_8).length).append(CRLF);<NEW_LINE>buffer.append(CRLF);<NEW_LINE>buffer.append(fieldsBuffer.toString());<NEW_LINE>buffer.append(CRLF);<NEW_LINE>buffer.append(CRLF);<NEW_LINE>return buffer.toString().getBytes(StandardCharsets.UTF_8);<NEW_LINE>} | (filename).append(CRLF); |
65,420 | public boolean apply(Game game, Ability source) {<NEW_LINE>if (game.getPermanentEntering(source.getSourceId()) != null) {<NEW_LINE>OneShotEffect returnToHandEffect = new ReturnToHandTargetEffect();<NEW_LINE>ConditionalOneShotEffect mustBeOnBattlefieldToReturn = new <MASK><NEW_LINE>mustBeOnBattlefieldToReturn.setText("return the dashed creature from the battlefield to its owner's hand");<NEW_LINE>// init target pointer now because the dashed creature will only be returned from battlefield zone (now in entering state so zone change counter is not raised yet)<NEW_LINE>mustBeOnBattlefieldToReturn.setTargetPointer(new FixedTarget(source.getSourceId(), game.getState().getZoneChangeCounter(source.getSourceId()) + 1));<NEW_LINE>DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(mustBeOnBattlefieldToReturn);<NEW_LINE>game.addDelayedTriggeredAbility(delayedAbility, source);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ConditionalOneShotEffect(returnToHandEffect, DashAddDelayedTriggeredAbilityEffect::check); |
726,960 | public void visitPhpBinaryExpression(@NotNull BinaryExpression expression) {<NEW_LINE>final Collection<BooleanSupplier> callbacks = new ArrayList<>();<NEW_LINE>callbacks.add(() -> InstanceOfTraitStrategy.apply(expression, holder));<NEW_LINE>callbacks.add(() -> EqualsInAssignmentContextStrategy.apply(expression, holder));<NEW_LINE>callbacks.add(() -> GreaterOrEqualInHashElementStrategy.apply(expression, holder));<NEW_LINE>callbacks.add(() -> NullableArgumentComparisonStrategy.apply(expression, holder));<NEW_LINE>callbacks.add(() -> IdenticalOperandsStrategy.apply(expression, holder));<NEW_LINE>callbacks.add(() -> MisplacedOperatorStrategy<MASK><NEW_LINE>callbacks.add(() -> NullCoalescingOperatorCorrectnessStrategy.apply(expression, holder));<NEW_LINE>callbacks.add(() -> ConcatenationWithArrayStrategy.apply(expression, holder));<NEW_LINE>if (VERIFY_CONSTANTS_IN_CONDITIONS) {<NEW_LINE>callbacks.add(() -> HardcodedConstantValuesStrategy.apply(expression, holder));<NEW_LINE>}<NEW_LINE>if (VERIFY_UNCLEAR_OPERATIONS_PRIORITIES) {<NEW_LINE>callbacks.add(() -> UnclearOperationsPriorityStrategy.apply(expression, holder));<NEW_LINE>} | .apply(expression, holder)); |
1,219,710 | public BlazeCommandResult exec(CommandEnvironment env, OptionsParsingResult options) {<NEW_LINE>env.getEventBus()<MASK><NEW_LINE>BlazeRuntime runtime = env.getRuntime();<NEW_LINE>OutErr outErr = env.getReporter().getOutErr();<NEW_LINE>Options helpOptions = options.getOptions(Options.class);<NEW_LINE>if (options.getResidue().isEmpty()) {<NEW_LINE>emitBlazeVersionInfo(outErr, runtime.getProductName());<NEW_LINE>emitGenericHelp(outErr, runtime);<NEW_LINE>return BlazeCommandResult.success();<NEW_LINE>}<NEW_LINE>if (options.getResidue().size() != 1) {<NEW_LINE>String message = "You must specify exactly one command";<NEW_LINE>env.getReporter().handle(Event.error(message));<NEW_LINE>return createFailureResult(message, Code.MISSING_ARGUMENT);<NEW_LINE>}<NEW_LINE>String helpSubject = options.getResidue().get(0);<NEW_LINE>String productName = runtime.getProductName();<NEW_LINE>// Go through the custom subjects before going through Bazel commands.<NEW_LINE>switch(helpSubject) {<NEW_LINE>case "startup_options":<NEW_LINE>emitBlazeVersionInfo(outErr, runtime.getProductName());<NEW_LINE>emitStartupOptions(outErr, helpOptions.helpVerbosity, runtime);<NEW_LINE>return BlazeCommandResult.success();<NEW_LINE>case "target-syntax":<NEW_LINE>emitBlazeVersionInfo(outErr, runtime.getProductName());<NEW_LINE>emitTargetSyntaxHelp(outErr, productName);<NEW_LINE>return BlazeCommandResult.success();<NEW_LINE>case "info-keys":<NEW_LINE>emitInfoKeysHelp(env, outErr);<NEW_LINE>return BlazeCommandResult.success();<NEW_LINE>case "completion":<NEW_LINE>emitCompletionHelp(runtime, outErr);<NEW_LINE>return BlazeCommandResult.success();<NEW_LINE>case "flags-as-proto":<NEW_LINE>emitFlagsAsProtoHelp(runtime, outErr);<NEW_LINE>return BlazeCommandResult.success();<NEW_LINE>case "everything-as-html":<NEW_LINE>new HtmlEmitter(runtime).emit(outErr);<NEW_LINE>return BlazeCommandResult.success();<NEW_LINE>// fall out<NEW_LINE>default:<NEW_LINE>}<NEW_LINE>BlazeCommand command = runtime.getCommandMap().get(helpSubject);<NEW_LINE>if (command == null) {<NEW_LINE>String message = "'" + helpSubject + "' is not a known command";<NEW_LINE>env.getReporter().handle(Event.error(null, message));<NEW_LINE>return createFailureResult(message, Code.COMMAND_NOT_FOUND);<NEW_LINE>}<NEW_LINE>emitBlazeVersionInfo(outErr, productName);<NEW_LINE>outErr.printOut(BlazeCommandUtils.getUsage(command.getClass(), helpOptions.helpVerbosity, runtime.getBlazeModules(), runtime.getRuleClassProvider(), productName));<NEW_LINE>return BlazeCommandResult.success();<NEW_LINE>} | .post(new NoBuildEvent()); |
1,518,822 | public void started(Container moduleContainer) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug("started");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>WebAppConfiguration webConfig = (WebAppConfiguration) moduleContainer.adapt(WebAppConfig.class);<NEW_LINE>String name = webConfig.getModuleName();<NEW_LINE>SipAppDescManager appDescMangar = SipAppDescManager.getInstance();<NEW_LINE>SipAppDesc appDesc = appDescMangar.getSipAppDesc(name);<NEW_LINE>if (appDesc == null) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug("SipModuleStateListener Failed finding SipAppDesc for " + name);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String vhost = webConfig.getVirtualHostName();<NEW_LINE>appDesc.setVirtualHost(vhost, webConfig.getVirtualHostList());<NEW_LINE>List<SipServletDesc<MASK><NEW_LINE>for (SipServletDesc sipDesc : siplets) {<NEW_LINE>// if the application contains load on startup servlets we<NEW_LINE>// need to initialize the application now.<NEW_LINE>// we can't simply use the Web Container initialization<NEW_LINE>// because of additional SIP Container properties that can<NEW_LINE>// only be set after the initialization<NEW_LINE>if (sipDesc.isServletLoadOnStartup()) {<NEW_LINE>try {<NEW_LINE>appDescMangar.initSipAppIfNeeded(name);<NEW_LINE>} catch (ServletException e) {<NEW_LINE>if (c_logger.isErrorEnabled()) {<NEW_LINE>c_logger.error("error.init.loadonstartup.app", null, e.getLocalizedMessage());<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>if (c_logger.isErrorEnabled()) {<NEW_LINE>c_logger.error("error.init.loadonstartup.app", null, e.getLocalizedMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<SipServlet> sipServletsList = appDesc.getLoadOnStartupServlets();<NEW_LINE>synchronized (sipServletsList) {<NEW_LINE>Iterator<SipServlet> iterator = sipServletsList.iterator();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>SipServlet sipServlet = (SipServlet) iterator.next();<NEW_LINE>EventsDispatcher.sipServletInitiated(appDesc, sipServlet, webConfig.getWebApp(), -1);<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(null, "module started", "Triggering event servlet initialized, servlet name " + sipServlet.getServletName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (UnableToAdaptException e) {<NEW_LINE>if (c_logger.isTraceDebugEnabled()) {<NEW_LINE>c_logger.traceDebug(null, "started", "not SipAppDesc found not a sip application: " + moduleContainer.getName(), e);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (c_logger.isTraceEntryExitEnabled()) {<NEW_LINE>c_logger.traceExit(null, "moduleStarted");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | > siplets = appDesc.getSipServlets(); |
1,764,202 | private void syncInstancesIfTimestampDiffers(String appName, String id, InstanceInfo info, InstanceInfo infoFromPeer) {<NEW_LINE>try {<NEW_LINE>if (infoFromPeer != null) {<NEW_LINE>logger.warn("Peer wants us to take the instance information from it, since the timestamp differs," + "Id : {} My Timestamp : {}, Peer's timestamp: {}", id, info.getLastDirtyTimestamp(), infoFromPeer.getLastDirtyTimestamp());<NEW_LINE>if (infoFromPeer.getOverriddenStatus() != null && !InstanceStatus.UNKNOWN.equals(infoFromPeer.getOverriddenStatus())) {<NEW_LINE>logger.warn("Overridden Status info -id {}, mine {}, peer's {}", id, info.getOverriddenStatus(), infoFromPeer.getOverriddenStatus());<NEW_LINE>registry.storeOverriddenStatusIfRequired(appName, id, infoFromPeer.getOverriddenStatus());<NEW_LINE>}<NEW_LINE>registry.register(infoFromPeer, true);<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | logger.warn("Exception when trying to set information from peer :", e); |
1,175,991 | private void validateChecks(Set<String> tableChecks, Set<String> fieldChecks) {<NEW_LINE>if (tableChecks.isEmpty() && fieldChecks.isEmpty()) {<NEW_LINE>// Nothing to validate<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Set<String<MASK><NEW_LINE>List<String> undefinedChecks = Stream.concat(tableChecks.stream(), fieldChecks.stream()).filter(check -> !(elideSecurityConfig.hasCheckDefined(check) || staticChecks.contains(check))).sorted().collect(Collectors.toList());<NEW_LINE>if (!undefinedChecks.isEmpty()) {<NEW_LINE>throw new IllegalStateException("Found undefined security checks: " + undefinedChecks);<NEW_LINE>}<NEW_LINE>tableChecks.stream().filter(check -> dictionary.getCheckMappings().containsKey(check)).forEach(check -> {<NEW_LINE>Class<? extends Check> checkClass = dictionary.getCheck(check);<NEW_LINE>// Validates if the permission check either user Check or FilterExpressionCheck Check<NEW_LINE>if (!(UserCheck.class.isAssignableFrom(checkClass) || FilterExpressionCheck.class.isAssignableFrom(checkClass))) {<NEW_LINE>throw new IllegalStateException("Table or Namespace cannot have Operation Checks. Given: " + checkClass);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>fieldChecks.stream().filter(check -> dictionary.getCheckMappings().containsKey(check)).forEach(check -> {<NEW_LINE>Class<? extends Check> checkClass = dictionary.getCheck(check);<NEW_LINE>// Validates if the permission check is User check<NEW_LINE>if (!UserCheck.class.isAssignableFrom(checkClass)) {<NEW_LINE>throw new IllegalStateException("Field can only have User checks or Roles. Given: " + checkClass);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | > staticChecks = dictionary.getCheckIdentifiers(); |
138,936 | private void processRankProfiles(List<RankProfile> ready, QueryProfileRegistry queryProfiles, ImportedMlModels importedModels, Schema schema, AttributeFields attributeFields, ModelContext.Properties deployProperties, ExecutorService executor) {<NEW_LINE>Map<String, Future<RawRankProfile>> futureRawRankProfiles = new LinkedHashMap<>();<NEW_LINE>for (RankProfile rank : ready) {<NEW_LINE>if (schema == null) {<NEW_LINE>onnxModels.<MASK><NEW_LINE>}<NEW_LINE>futureRawRankProfiles.put(rank.name(), executor.submit(() -> new RawRankProfile(rank, largeRankExpressions, queryProfiles, importedModels, attributeFields, deployProperties)));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>for (Future<RawRankProfile> rawFuture : futureRawRankProfiles.values()) {<NEW_LINE>RawRankProfile rawRank = rawFuture.get();<NEW_LINE>rankProfiles.put(rawRank.getName(), rawRank);<NEW_LINE>}<NEW_LINE>} catch (InterruptedException | ExecutionException e) {<NEW_LINE>throw new IllegalStateException(e);<NEW_LINE>}<NEW_LINE>} | add(rank.onnxModels()); |
381,589 | public DB2TableUniqueKey configureObject(DBRProgressMonitor monitor, Object table, DB2TableUniqueKey constraint, Map<String, Object> options) {<NEW_LINE>return new UITask<DB2TableUniqueKey>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected DB2TableUniqueKey runTask() {<NEW_LINE>EditConstraintPage editPage = new EditConstraintPage(DB2Messages.edit_db2_constraint_manager_dialog_title, constraint, CONS_TYPES);<NEW_LINE>if (!editPage.edit()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>constraint.setConstraintType(editPage.getConstraintType());<NEW_LINE>constraint.setName(editPage.getConstraintName());<NEW_LINE>List<DB2TableKeyColumn> columns = new ArrayList<>(editPage.<MASK><NEW_LINE>DB2TableKeyColumn column;<NEW_LINE>int colIndex = 1;<NEW_LINE>for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {<NEW_LINE>column = new DB2TableKeyColumn(constraint, (DB2TableColumn) tableColumn, colIndex++);<NEW_LINE>columns.add(column);<NEW_LINE>}<NEW_LINE>constraint.setColumns(columns);<NEW_LINE>return constraint;<NEW_LINE>}<NEW_LINE>}.execute();<NEW_LINE>} | getSelectedAttributes().size()); |
908,237 | private void loadContent() {<NEW_LINE>new RefreshBlobTask(repo, sha, this) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onSuccess(Blob blob) throws Exception {<NEW_LINE>super.onSuccess(blob);<NEW_LINE><MASK><NEW_LINE>ViewUtils.setGone(codeView, false);<NEW_LINE>editor.setSource(path, blob);<NEW_LINE>CommitFileViewActivity.this.blob = blob;<NEW_LINE>if (markdownItem != null)<NEW_LINE>markdownItem.setEnabled(true);<NEW_LINE>if (isMarkdownFile && PreferenceUtils.getCodePreferences(CommitFileViewActivity.this).getBoolean(RENDER_MARKDOWN, true))<NEW_LINE>loadMarkdown();<NEW_LINE>else {<NEW_LINE>ViewUtils.setGone(loadingBar, true);<NEW_LINE>ViewUtils.setGone(codeView, false);<NEW_LINE>editor.setSource(path, blob);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onException(Exception e) throws RuntimeException {<NEW_LINE>super.onException(e);<NEW_LINE>Log.d(TAG, "Loading commit file contents failed", e);<NEW_LINE>ViewUtils.setGone(loadingBar, true);<NEW_LINE>ViewUtils.setGone(codeView, false);<NEW_LINE>ToastUtils.show(CommitFileViewActivity.this, e, R.string.error_file_load);<NEW_LINE>}<NEW_LINE>}.execute();<NEW_LINE>} | ViewUtils.setGone(loadingBar, true); |
1,263,037 | public final void initBeforeMapping(@NotNull final File file, @NotNull final RandomAccessFile raf, final long headerEnd, final boolean recover) throws IOException {<NEW_LINE>this.file = file;<NEW_LINE>this.raf = raf;<NEW_LINE>this.headerSize = roundUpMapHeaderSize(headerEnd);<NEW_LINE>if (!createdOrInMemory) {<NEW_LINE>// This block is for reading segmentHeadersOffset before main mapping<NEW_LINE>// After the mapping globalMutableState value's bytes are reassigned<NEW_LINE>final ByteBuffer globalMutableStateBuffer = ByteBuffer.allocate((<MASK><NEW_LINE>final FileChannel fileChannel = raf.getChannel();<NEW_LINE>while (globalMutableStateBuffer.remaining() > 0) {<NEW_LINE>if (fileChannel.read(globalMutableStateBuffer, this.headerSize + GLOBAL_MUTABLE_STATE_VALUE_OFFSET + globalMutableStateBuffer.position()) == -1) {<NEW_LINE>throw throwRecoveryOrReturnIOException(file, "truncated", recover);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>globalMutableStateBuffer.flip();<NEW_LINE>// noinspection unchecked<NEW_LINE>globalMutableState.bytesStore(BytesStore.wrap(globalMutableStateBuffer), 0, globalMutableState.maxSize());<NEW_LINE>}<NEW_LINE>} | int) globalMutableState.maxSize()); |
410,636 | public static void main(String[] args) {<NEW_LINE>String fileName = UtilIO.pathExample("background/highway_bridge_jitter.mp4");<NEW_LINE>ImageType type = ImageType.pl(3, GrayU8.class);<NEW_LINE>// ImageType type = ImageType.single(GrayU8.class);<NEW_LINE>// ImageType type = ImageType.pl(3, GrayF32.class);<NEW_LINE>// ImageType type = ImageType.single(GrayF32.class);<NEW_LINE>var sequence = new JCodecSimplified<>(fileName, type);<NEW_LINE>BufferedImage out;<NEW_LINE>if (sequence.hasNext()) {<NEW_LINE>ImageBase frame = sequence.next();<NEW_LINE>out = new BufferedImage(frame.width, frame.height, BufferedImage.TYPE_INT_RGB);<NEW_LINE>ConvertBufferedImage.<MASK><NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("No first frame?!?!");<NEW_LINE>}<NEW_LINE>var gui = new ImagePanel(out);<NEW_LINE>ShowImages.showWindow(gui, "Video!", true);<NEW_LINE>long totalNano = 0;<NEW_LINE>while (sequence.hasNext()) {<NEW_LINE>long before = System.nanoTime();<NEW_LINE>ImageBase frame = sequence.next();<NEW_LINE>totalNano += System.nanoTime() - before;<NEW_LINE>ConvertBufferedImage.convertTo(frame, out, false);<NEW_LINE>gui.repaint();<NEW_LINE>// slow it down to make it easier to see what's going on<NEW_LINE>BoofMiscOps.sleep(20);<NEW_LINE>}<NEW_LINE>System.out.printf("JCodec FPS %.1f\n", sequence.getFrameNumber() / (totalNano / 1.0e9));<NEW_LINE>} | convertTo(frame, out, false); |
190,778 | public void collectInit(InitMessage request, StreamObserver<InitResponse> responseObserver) {<NEW_LINE>String agentId = request.getAgentId();<NEW_LINE>String v09AgentRollupId = request.getV09AgentRollupId();<NEW_LINE>if (!v09AgentRollupId.isEmpty()) {<NEW_LINE>// handle agents prior to 0.10.0<NEW_LINE>String v09AgentId = agentId;<NEW_LINE>agentId = GrpcCommon.convertFromV09AgentRollupId(v09AgentRollupId) + v09AgentId;<NEW_LINE>try {<NEW_LINE>v09AgentRollupDao.store(v09AgentId, v09AgentRollupId);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.error("{} - {}", agentId, t.getMessage(), t);<NEW_LINE>responseObserver.onError(t);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>AgentConfig updatedAgentConfig;<NEW_LINE>try {<NEW_LINE>updatedAgentConfig = SchemaUpgrade.upgradeOldAgentConfig(request.getAgentConfig());<NEW_LINE>updatedAgentConfig = agentConfigDao.store(agentId, updatedAgentConfig, request.getOverwriteExistingAgentConfig());<NEW_LINE>environmentDao.store(agentId, request.getEnvironment());<NEW_LINE>MoreFutures.waitForAll(activeAgentDao.insert(agentId, clock.currentTimeMillis()));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.error("{} - {}", agentId, t.getMessage(), t);<NEW_LINE>responseObserver.onError(t);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>logger.info("agent connected: {}, version {}", agentId, request.getEnvironment().<MASK><NEW_LINE>InitResponse.Builder response = InitResponse.newBuilder().setGlowrootCentralVersion(version);<NEW_LINE>if (!updatedAgentConfig.equals(request.getAgentConfig())) {<NEW_LINE>response.setAgentConfig(updatedAgentConfig);<NEW_LINE>}<NEW_LINE>responseObserver.onNext(response.build());<NEW_LINE>responseObserver.onCompleted();<NEW_LINE>} | getJavaInfo().getGlowrootAgentVersion()); |
38,300 | private void updateText() {<NEW_LINE>MapActivity mapActivity = getMapActivity();<NEW_LINE>if (mapActivity != null) {<NEW_LINE>TextView distanceTv = (TextView) mainView.findViewById(R.id.markers_distance_text_view);<NEW_LINE>TextView timeTv = (TextView) mainView.findViewById(R.id.markers_time_text_view);<NEW_LINE>TextView countTv = (TextView) mainView.findViewById(R.id.markers_count_text_view);<NEW_LINE>ApplicationMode appMode = planRouteContext.getSnappedMode();<NEW_LINE>TrkSegment snapTrkSegment = planRouteContext.getSnapTrkSegment();<NEW_LINE>boolean defaultMode = appMode == ApplicationMode.DEFAULT;<NEW_LINE>float dist = 0;<NEW_LINE>for (int i = 1; i < snapTrkSegment.points.size(); i++) {<NEW_LINE>WptPt pt1 = snapTrkSegment.points.get(i - 1);<NEW_LINE>WptPt pt2 = snapTrkSegment.points.get(i);<NEW_LINE>dist += MapUtils.getDistance(pt1.lat, pt1.lon, pt2.lat, pt2.lon);<NEW_LINE>}<NEW_LINE>distanceTv.setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()) + (defaultMode ? "" : ","));<NEW_LINE>if (defaultMode) {<NEW_LINE>timeTv.setText("");<NEW_LINE>} else {<NEW_LINE>int seconds = (int) (<MASK><NEW_LINE>timeTv.setText("~ " + OsmAndFormatter.getFormattedDuration(seconds, mapActivity.getMyApplication()));<NEW_LINE>}<NEW_LINE>countTv.setText(mapActivity.getString(R.string.shared_string_markers) + ": " + selectedCount);<NEW_LINE>}<NEW_LINE>} | dist / appMode.getDefaultSpeed()); |
475,032 | public Request<ListEntitiesForPolicyRequest> marshall(ListEntitiesForPolicyRequest listEntitiesForPolicyRequest) {<NEW_LINE>if (listEntitiesForPolicyRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<ListEntitiesForPolicyRequest> request = new DefaultRequest<ListEntitiesForPolicyRequest>(listEntitiesForPolicyRequest, "AmazonIdentityManagement");<NEW_LINE>request.addParameter("Action", "ListEntitiesForPolicy");<NEW_LINE>request.addParameter("Version", "2010-05-08");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>if (listEntitiesForPolicyRequest.getPolicyArn() != null) {<NEW_LINE>request.addParameter("PolicyArn", StringUtils.fromString(listEntitiesForPolicyRequest.getPolicyArn()));<NEW_LINE>}<NEW_LINE>if (listEntitiesForPolicyRequest.getEntityFilter() != null) {<NEW_LINE>request.addParameter("EntityFilter", StringUtils.fromString(listEntitiesForPolicyRequest.getEntityFilter()));<NEW_LINE>}<NEW_LINE>if (listEntitiesForPolicyRequest.getPathPrefix() != null) {<NEW_LINE>request.addParameter("PathPrefix", StringUtils.fromString(listEntitiesForPolicyRequest.getPathPrefix()));<NEW_LINE>}<NEW_LINE>if (listEntitiesForPolicyRequest.getPolicyUsageFilter() != null) {<NEW_LINE>request.addParameter("PolicyUsageFilter", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>if (listEntitiesForPolicyRequest.getMarker() != null) {<NEW_LINE>request.addParameter("Marker", StringUtils.fromString(listEntitiesForPolicyRequest.getMarker()));<NEW_LINE>}<NEW_LINE>if (listEntitiesForPolicyRequest.getMaxItems() != null) {<NEW_LINE>request.addParameter("MaxItems", StringUtils.fromInteger(listEntitiesForPolicyRequest.getMaxItems()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (listEntitiesForPolicyRequest.getPolicyUsageFilter())); |
1,168,643 | private void doInterceptByTypeAndRate(LimiterManager.LimitConfigBean limitConfigBean, String resource, Invocation inv) {<NEW_LINE>switch(limitConfigBean.getType()) {<NEW_LINE>case LimitType.CONCURRENCY:<NEW_LINE>doInterceptForConcurrency(limitConfigBean.getRate(), resource, null, inv);<NEW_LINE>break;<NEW_LINE>case LimitType.IP_CONCURRENCY:<NEW_LINE>String resKey1 = RequestUtil.getIpAddress(inv.getController().<MASK><NEW_LINE>doInterceptForConcurrency(limitConfigBean.getRate(), resKey1, null, inv);<NEW_LINE>break;<NEW_LINE>case LimitType.TOKEN_BUCKET:<NEW_LINE>doInterceptForTokenBucket(limitConfigBean.getRate(), resource, null, inv);<NEW_LINE>break;<NEW_LINE>case LimitType.IP_TOKEN_BUCKET:<NEW_LINE>String resKey2 = RequestUtil.getIpAddress(inv.getController().getRequest()) + ":" + resource;<NEW_LINE>doInterceptForTokenBucket(limitConfigBean.getRate(), resKey2, null, inv);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | getRequest()) + ":" + resource; |
109,355 | protected void showControl() {<NEW_LINE>Animation upAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f);<NEW_LINE>upAction.setDuration(300);<NEW_LINE>Animation downAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, -<MASK><NEW_LINE>downAction.setDuration(300);<NEW_LINE>if (mSeekBar.getMax() != max) {<NEW_LINE>mSeekBar.setMax(max);<NEW_LINE>mSeekBar.setProgress(max);<NEW_LINE>}<NEW_LINE>mSeekBar.setProgress(progress);<NEW_LINE>mProgressLayout.startAnimation(upAction);<NEW_LINE>mProgressLayout.setVisibility(View.VISIBLE);<NEW_LINE>mBackLayout.startAnimation(downAction);<NEW_LINE>mBackLayout.setVisibility(View.VISIBLE);<NEW_LINE>if (mHideInfo) {<NEW_LINE>mInfoLayout.startAnimation(downAction);<NEW_LINE>mInfoLayout.setVisibility(View.VISIBLE);<NEW_LINE>}<NEW_LINE>} | 1.0f, Animation.RELATIVE_TO_SELF, 0.0f); |
457,301 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {<NEW_LINE>super.onViewCreated(view, savedInstanceState);<NEW_LINE>// create border paint<NEW_LINE>paintBorder.setColor(Color.BLACK);<NEW_LINE>paintBorder.setAntiAlias(true);<NEW_LINE>paintBorder.setStrokeWidth(25);<NEW_LINE>paintBorder.setStyle(Paint.Style.STROKE);<NEW_LINE>paintBorder.setStrokeJoin(Paint.Join.ROUND);<NEW_LINE>paintBorder.setStrokeCap(Paint.Cap.ROUND);<NEW_LINE>paintBorder.setAntiAlias(true);<NEW_LINE>// create mapping paint<NEW_LINE>paintMapping.setAntiAlias(true);<NEW_LINE>paintMapping.setStrokeWidth(20);<NEW_LINE>paintMapping.setStyle(Paint.Style.FILL_AND_STROKE);<NEW_LINE>paintMapping.setStrokeJoin(Paint.Join.ROUND);<NEW_LINE>paintMapping.setStrokeCap(Paint.Cap.ROUND);<NEW_LINE>paintMapping.setAntiAlias(true);<NEW_LINE>// setup initial data<NEW_LINE>mInitialData = new ArrayList<>();<NEW_LINE>mInitialData.add(new PointWithScalar(new GeoPoint(37.0, -11.0), 10));<NEW_LINE>mInitialData.add(new PointWithScalar(new GeoPoint(37.0, -11.0), 0.0f));<NEW_LINE>mInitialData.add(new PointWithScalar(new GeoPoint(37.5, -11.5), 20.0f));<NEW_LINE>mInitialData.add(new PointWithScalar(new GeoPoint(38.0, -11.0), 10.0f));<NEW_LINE>mInitialData.add(new PointWithScalar(new GeoPoint(38.5, -11.5), 30.0f));<NEW_LINE>mInitialData.add(new PointWithScalar(new GeoPoint(39.0<MASK><NEW_LINE>mInitialData.add(new PointWithScalar(new GeoPoint(39.5, -11.5), 25.0f));<NEW_LINE>// setup extended data<NEW_LINE>// please note: the last scalar is not used, N points use N - 1 scalars<NEW_LINE>mExtendedData = new ArrayList<>();<NEW_LINE>mExtendedData.add(new PointWithScalar(new GeoPoint(40.0, -11.0), 80.0f));<NEW_LINE>mExtendedData.add(new PointWithScalar(new GeoPoint(40.5, -11.5), 60.f));<NEW_LINE>mExtendedData.add(new PointWithScalar(new GeoPoint(41.0, -11.0), 100.0f));<NEW_LINE>mExtendedData.add(new PointWithScalar(new GeoPoint(41.5, -11.5), 100.0f));<NEW_LINE>// center to line once here<NEW_LINE>centerToLine();<NEW_LINE>} | , -11.0), 50.0f)); |
1,170,157 | private static void register(FileObject serverInstanceDir, String serverLocation, String domainLocation, String host, String port) throws IOException {<NEW_LINE>String displayName = generateDisplayName(serverInstanceDir);<NEW_LINE>// NOI18N<NEW_LINE>String url = URI_PREFIX + host <MASK><NEW_LINE>// NOI18N<NEW_LINE>String name = FileUtil.findFreeFileName(serverInstanceDir, "instance", null);<NEW_LINE>FileObject instanceFO = serverInstanceDir.createData(name);<NEW_LINE>instanceFO.setAttribute(InstanceProperties.URL_ATTR, url);<NEW_LINE>instanceFO.setAttribute(InstanceProperties.USERNAME_ATTR, "");<NEW_LINE>instanceFO.setAttribute(InstanceProperties.PASSWORD_ATTR, "");<NEW_LINE>instanceFO.setAttribute(InstanceProperties.DISPLAY_NAME_ATTR, displayName);<NEW_LINE>instanceFO.setAttribute(InstanceProperties.REMOVE_FORBIDDEN, "true");<NEW_LINE>// NOI18N<NEW_LINE>instanceFO.setAttribute(JBPluginProperties.PROPERTY_SERVER, "default");<NEW_LINE>String deployDir = JBPluginUtils.getDeployDir(domainLocation);<NEW_LINE>instanceFO.setAttribute(JBPluginProperties.PROPERTY_DEPLOY_DIR, deployDir);<NEW_LINE>instanceFO.setAttribute(JBPluginProperties.PROPERTY_SERVER_DIR, domainLocation);<NEW_LINE>instanceFO.setAttribute(JBPluginProperties.PROPERTY_ROOT_DIR, serverLocation);<NEW_LINE>instanceFO.setAttribute(JBPluginProperties.PROPERTY_HOST, host);<NEW_LINE>instanceFO.setAttribute(JBPluginProperties.PROPERTY_PORT, port);<NEW_LINE>} | + ":" + port + "#default&" + serverLocation; |
1,212,680 | public int write(HollowSchema schema, HollowWriteRecord rec) {<NEW_LINE>int schemaOrdinal = schemaIdMapper.getSchemaId(schema);<NEW_LINE>int nextRecordOrdinal = recordLocationsByOrdinal.size();<NEW_LINE>int recStart = (int) buf.length();<NEW_LINE>VarInt.writeVInt(buf, schemaOrdinal);<NEW_LINE>if (rec instanceof HollowHashableWriteRecord)<NEW_LINE>((HollowHashableWriteRecord) rec).writeDataTo(buf, HashBehavior.IGNORED_HASHES);<NEW_LINE>else<NEW_LINE>rec.writeDataTo(buf);<NEW_LINE>int recLen = (int) (buf.length() - recStart);<NEW_LINE>Integer recordHashCode = HashCodes.hashCode(buf.getUnderlyingArray(), recStart, recLen);<NEW_LINE>List<RecordLocation> <MASK><NEW_LINE>if (existingRecLocs == null) {<NEW_LINE>RecordLocation newRecordLocation = new RecordLocation(nextRecordOrdinal, recStart, recLen);<NEW_LINE>existingRecLocs = Collections.<RecordLocation>singletonList(newRecordLocation);<NEW_LINE>recordLocationsByHashCode.put(recordHashCode, existingRecLocs);<NEW_LINE>recordLocationsByOrdinal.add(recStart);<NEW_LINE>return newRecordLocation.ordinal;<NEW_LINE>} else {<NEW_LINE>for (RecordLocation existing : existingRecLocs) {<NEW_LINE>if (recLen == existing.len && buf.getUnderlyingArray().rangeEquals(recStart, buf.getUnderlyingArray(), existing.start, recLen)) {<NEW_LINE>buf.setPosition(recStart);<NEW_LINE>return existing.ordinal;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>RecordLocation newRecordLocation = new RecordLocation(nextRecordOrdinal, recStart, recLen);<NEW_LINE>if (existingRecLocs.size() == 1) {<NEW_LINE>List<RecordLocation> newRecLocs = new ArrayList<>(2);<NEW_LINE>newRecLocs.add(existingRecLocs.get(0));<NEW_LINE>newRecLocs.add(newRecordLocation);<NEW_LINE>recordLocationsByHashCode.put(recordHashCode, newRecLocs);<NEW_LINE>} else {<NEW_LINE>existingRecLocs.add(newRecordLocation);<NEW_LINE>}<NEW_LINE>recordLocationsByOrdinal.add(recStart);<NEW_LINE>return newRecordLocation.ordinal;<NEW_LINE>}<NEW_LINE>} | existingRecLocs = recordLocationsByHashCode.get(recordHashCode); |
467,305 | void delete(Business business, ApplicationDict applicationDict, String... paths) throws Exception {<NEW_LINE>EntityManagerContainer emc = business.entityManagerContainer();<NEW_LINE>List<ApplicationDictItem> exists = this.listWithApplicationDictWithPath(business, applicationDict.getId(), paths);<NEW_LINE>if (exists.isEmpty()) {<NEW_LINE>throw new Exception("applicationDict{id:" + applicationDict + "} on path:" + StringUtils.join(paths, ".") + " is not existed.");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>for (ApplicationDictItem o : exists) {<NEW_LINE>emc.remove(o);<NEW_LINE>}<NEW_LINE>if (NumberUtils.isCreatable(paths[paths.length - 1])) {<NEW_LINE>int position = paths.length - 1;<NEW_LINE>for (ApplicationDictItem o : this.listWithApplicationDictWithPathWithAfterLocation(business, applicationDict.getId(), NumberUtils.toInt(paths[position]), paths)) {<NEW_LINE>o.path(Integer.toString(o.pathLocation(position) - 1), position);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | emc.beginTransaction(ApplicationDictItem.class); |
32,935 | // @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })<NEW_LINE>@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })<NEW_LINE>public Response update(@HeaderParam(Constants.SESSION_TOKEN_HEADER_NAME) String sessionToken, @PathParam("entityClass") String entityClassName, String input, @Context HttpHeaders headers) {<NEW_LINE>sessionToken = sessionToken.replaceAll("^\"|\"$", "");<NEW_LINE>input = input.replaceAll("^\"|\"$", "");<NEW_LINE>log.debug("PUT: sessionToken:" + sessionToken);<NEW_LINE>log.debug("PUT: entityClassName:" + entityClassName);<NEW_LINE>String mediaType = headers != null && headers.getRequestHeaders().containsKey("Content-type") ? headers.getRequestHeader("Content-type").get(0) : MediaType.APPLICATION_JSON;<NEW_LINE>mediaType = mediaType.equalsIgnoreCase(MediaType.APPLICATION_XML) ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON;<NEW_LINE>log.debug("POST: Media Type:" + mediaType);<NEW_LINE>Object output;<NEW_LINE>Class<?> entityClass;<NEW_LINE>Object entity;<NEW_LINE>EntityMetadata entityMetadata = null;<NEW_LINE>try {<NEW_LINE>EntityManager em = EMRepository.INSTANCE.getEM(sessionToken);<NEW_LINE>entityClass = EntityUtils.getEntityClass(entityClassName, em);<NEW_LINE>log.debug("PUT: entityClass: " + entityClass);<NEW_LINE>entityMetadata = EntityUtils.getEntityMetaData(<MASK><NEW_LINE>entity = JAXBUtils.toObject(input, entityClass, mediaType);<NEW_LINE>output = em.merge(entity);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error(e.getMessage());<NEW_LINE>return Response.serverError().build();<NEW_LINE>}<NEW_LINE>if (output == null) {<NEW_LINE>return Response.notModified().build();<NEW_LINE>}<NEW_LINE>output = JAXBUtils.toString(output, mediaType);<NEW_LINE>if (mediaType.equalsIgnoreCase(MediaType.APPLICATION_JSON)) {<NEW_LINE>return Response.ok(ResponseBuilder.buildOutput(entityClass, entityMetadata, output), mediaType).build();<NEW_LINE>} else {<NEW_LINE>return Response.ok(output.toString(), mediaType).build();<NEW_LINE>}<NEW_LINE>} | entityClass.getSimpleName(), em); |
667,575 | public static void print(IntegralKernel kernel) {<NEW_LINE>int x0 = 0, x1 = 0, y0 = 0, y1 = 0;<NEW_LINE>for (int blockIdx = 0; blockIdx < kernel.blocks.length; blockIdx++) {<NEW_LINE>ImageRectangle k = kernel.blocks[blockIdx];<NEW_LINE>if (k.x0 < x0)<NEW_LINE>x0 = k.x0;<NEW_LINE>if (k.y0 < y0)<NEW_LINE>y0 = k.y0;<NEW_LINE>if (k.x1 > x1)<NEW_LINE>x1 = k.x1;<NEW_LINE>if (k.y1 > y1)<NEW_LINE>y1 = k.y1;<NEW_LINE>}<NEW_LINE>int w = x1 - x0;<NEW_LINE>int h = y1 - y0;<NEW_LINE>int[] sum = new int[w * h];<NEW_LINE>for (int i = 0; i < kernel.blocks.length; i++) {<NEW_LINE>ImageRectangle <MASK><NEW_LINE>int value = kernel.scales[i];<NEW_LINE>for (int y = r.y0; y < r.y1; y++) {<NEW_LINE>int yy = y - y0;<NEW_LINE>for (int x = r.x0; x < r.x1; x++) {<NEW_LINE>int xx = x - x0;<NEW_LINE>sum[yy * w + xx] += value;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("IntegralKernel: TL = (" + (x0 + 1) + "," + (y0 + 1) + ") BR=(" + x1 + "," + y1 + ")");<NEW_LINE>for (int y = 0; y < h; y++) {<NEW_LINE>for (int x = 0; x < w; x++) {<NEW_LINE>System.out.printf("%4d ", sum[y * w + x]);<NEW_LINE>}<NEW_LINE>System.out.println();<NEW_LINE>}<NEW_LINE>} | r = kernel.blocks[i]; |
1,855,330 | private void doRedirect(final HttpResponse httpResponse, final CompletionHandler<HttpResponse> completionHandler) {<NEW_LINE>// get location header<NEW_LINE>String locationString = null;<NEW_LINE>final List<String> locationHeader = httpResponse.getHeader("Location");<NEW_LINE>if (locationHeader != null && !locationHeader.isEmpty()) {<NEW_LINE>locationString = locationHeader.get(0);<NEW_LINE>}<NEW_LINE>if (locationString == null || locationString.isEmpty()) {<NEW_LINE>completionHandler.failed(new RedirectException(LocalizationMessages.REDIRECT_NO_LOCATION()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>URI location;<NEW_LINE>try {<NEW_LINE>location = new URI(locationString);<NEW_LINE>if (!location.isAbsolute()) {<NEW_LINE>// location is not absolute, we need to resolve it.<NEW_LINE>URI baseUri = lastRequestUri;<NEW_LINE>location = baseUri.<MASK><NEW_LINE>}<NEW_LINE>} catch (URISyntaxException e) {<NEW_LINE>completionHandler.failed(new RedirectException(LocalizationMessages.REDIRECT_ERROR_DETERMINING_LOCATION(), e));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// infinite loop detection<NEW_LINE>boolean alreadyRequested = !redirectUriHistory.add(location);<NEW_LINE>if (alreadyRequested) {<NEW_LINE>completionHandler.failed(new RedirectException(LocalizationMessages.REDIRECT_INFINITE_LOOP()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// maximal number of redirection<NEW_LINE>if (redirectUriHistory.size() > maxRedirects) {<NEW_LINE>completionHandler.failed(new RedirectException(LocalizationMessages.REDIRECT_LIMIT_REACHED(maxRedirects)));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String method = originalHttpRequest.getMethod();<NEW_LINE>Map<String, List<String>> headers = originalHttpRequest.getHeaders();<NEW_LINE>if (httpResponse.getStatusCode() == 303 && !method.equals(Constants.HEAD)) {<NEW_LINE>// in case of 303 we rewrite every method except HEAD to GET<NEW_LINE>method = Constants.GET;<NEW_LINE>// remove entity-transport headers if present<NEW_LINE>headers.remove(Constants.CONTENT_LENGTH);<NEW_LINE>headers.remove(Constants.TRANSFER_ENCODING_HEADER);<NEW_LINE>}<NEW_LINE>HttpRequest httpRequest = HttpRequest.createBodyless(method, location);<NEW_LINE>httpRequest.getHeaders().putAll(headers);<NEW_LINE>lastRequestUri = location;<NEW_LINE>httpConnectionPool.send(httpRequest, completionHandler);<NEW_LINE>} | resolve(location.normalize()); |
276,565 | private void computeContainment(int imageArea) {<NEW_LINE>// mark that the track is in the inlier set and compute the containment rectangle<NEW_LINE>contRect.x0 = contRect.y0 = Double.MAX_VALUE;<NEW_LINE>contRect.x1 = contRect.y1 = -Double.MAX_VALUE;<NEW_LINE>List<AssociatedPair> matchSet = motion.getModelMatcher().getMatchSet();<NEW_LINE>for (int matchIdx = 0; matchIdx < matchSet.size(); matchIdx++) {<NEW_LINE>AssociatedPair <MASK><NEW_LINE>Point2D_F64 t = p.p2;<NEW_LINE>if (t.x > contRect.x1)<NEW_LINE>contRect.x1 = t.x;<NEW_LINE>if (t.y > contRect.y1)<NEW_LINE>contRect.y1 = t.y;<NEW_LINE>if (t.x < contRect.x0)<NEW_LINE>contRect.x0 = t.x;<NEW_LINE>if (t.y < contRect.y0)<NEW_LINE>contRect.y0 = t.y;<NEW_LINE>}<NEW_LINE>containment = contRect.area() / imageArea;<NEW_LINE>} | p = matchSet.get(matchIdx); |
1,469,927 | private static Map<String, Set<OffsetEquation>> sequencesAndOffsetsToMap(List<String> sequences, List<String> offsets, OffsetEquation extraEq) {<NEW_LINE>Map<String, Set<OffsetEquation>> map = new HashMap<>(CollectionsPlume.mapCapacity(sequences));<NEW_LINE>if (offsets.isEmpty()) {<NEW_LINE>for (String sequence : sequences) {<NEW_LINE>// Not `Collections.singleton(extraEq)` because the values get modified<NEW_LINE>Set<OffsetEquation> thisSet = new HashSet<>(1);<NEW_LINE>thisSet.add(extraEq);<NEW_LINE>map.put(sequence, thisSet);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>assert sequences.size() == offsets.size();<NEW_LINE>for (int i = 0; i < sequences.size(); i++) {<NEW_LINE>String <MASK><NEW_LINE>String offset = offsets.get(i);<NEW_LINE>Set<OffsetEquation> set = map.computeIfAbsent(sequence, __ -> new HashSet<>());<NEW_LINE>OffsetEquation eq = OffsetEquation.createOffsetFromJavaExpression(offset);<NEW_LINE>if (eq.hasError()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>eq = eq.copyAdd('+', extraEq);<NEW_LINE>set.add(eq);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | sequence = sequences.get(i); |
377,759 | void collectAndAggregatePartitionClassStorageStats(Map<String, Map<Long, Map<Short, Map<Short, ContainerStorageStats>>>> hostPartitionClassStorageStatsMap, PartitionId partitionId, List<PartitionId> unreachablePartitions) {<NEW_LINE>Store store = <MASK><NEW_LINE>if (store == null) {<NEW_LINE>unreachablePartitions.add(partitionId);<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>long fetchAndAggregatePerStoreStartTimeMs = time.milliseconds();<NEW_LINE>StoreStats storeStats = store.getStoreStats();<NEW_LINE>Map<Short, Map<Short, ContainerStorageStats>> containerStatsMap = storeStats.getContainerStorageStats(time.milliseconds(), publishExcludeAccountIds);<NEW_LINE>String partitionClassName = partitionId.getPartitionClass();<NEW_LINE>hostPartitionClassStorageStatsMap.computeIfAbsent(partitionClassName, k -> new HashMap<>()).put(partitionId.getId(), containerStatsMap);<NEW_LINE>metrics.fetchAndAggregateTimePerStoreMs.update(time.milliseconds() - fetchAndAggregatePerStoreStartTimeMs);<NEW_LINE>} catch (StoreException e) {<NEW_LINE>unreachablePartitions.add(partitionId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | storageManager.getStore(partitionId, false); |
1,017,755 | public void validate() {<NEW_LINE>final String kafkaSources = analysis.getAllDataSources().stream().filter(s -> s.getDataSource().getKsqlTopic().getValueFormat().getFormat().equals(KafkaFormat.NAME)).map(AliasedDataSource::getAlias).map(SourceName::text).collect<MASK><NEW_LINE>if (kafkaSources.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isJoin) {<NEW_LINE>throw new KsqlException("Source(s) " + kafkaSources + " are using the 'KAFKA' value format." + " This format does not yet support JOIN." + System.lineSeparator() + KAFKA_VALUE_FORMAT_LIMITATION_DETAILS);<NEW_LINE>}<NEW_LINE>if (isGroupBy) {<NEW_LINE>throw new KsqlException("Source(s) " + kafkaSources + " are using the 'KAFKA' value format." + " This format does not yet support GROUP BY." + System.lineSeparator() + KAFKA_VALUE_FORMAT_LIMITATION_DETAILS);<NEW_LINE>}<NEW_LINE>} | (Collectors.joining(", ")); |
1,649,888 | final GetContentModerationResult executeGetContentModeration(GetContentModerationRequest getContentModerationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getContentModerationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetContentModerationRequest> request = null;<NEW_LINE>Response<GetContentModerationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetContentModerationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getContentModerationRequest));<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, "Rekognition");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetContentModeration");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetContentModerationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetContentModerationResultJsonUnmarshaller());<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.ADVANCED_CONFIG, advancedConfig); |
173,530 | private boolean initOpenVRCompositor(boolean set) {<NEW_LINE>if (set && vrSystem != null) {<NEW_LINE>vrCompositor = new VR_IVRCompositor_FnTable(JOpenVRLibrary.VR_GetGenericInterface(JOpenVRLibrary.IVRCompositor_Version, hmdErrorStore));<NEW_LINE>if (hmdErrorStore.get(0) == 0) {<NEW_LINE>logger.info("OpenVR Compositor initialized OK.");<NEW_LINE>vrCompositor.setAutoSynch(false);<NEW_LINE>vrCompositor.read();<NEW_LINE>vrCompositor.SetTrackingSpace.apply(JOpenVRLibrary.ETrackingUniverseOrigin.ETrackingUniverseOrigin_TrackingUniverseStanding);<NEW_LINE>} else {<NEW_LINE>String errorString = jopenvr.JOpenVRLibrary.VR_GetVRInitErrorAsEnglishDescription(hmdErrorStore.get(0)).getString(0);<NEW_LINE><MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (vrCompositor == null) {<NEW_LINE>logger.info("Skipping VR Compositor...");<NEW_LINE>}<NEW_LINE>// left eye<NEW_LINE>texBounds.uMax = 1f;<NEW_LINE>texBounds.uMin = 0f;<NEW_LINE>texBounds.vMax = 1f;<NEW_LINE>texBounds.vMin = 0f;<NEW_LINE>texBounds.setAutoSynch(false);<NEW_LINE>texBounds.setAutoRead(false);<NEW_LINE>texBounds.setAutoWrite(false);<NEW_LINE>texBounds.write();<NEW_LINE>// texture type<NEW_LINE>for (int nEye = 0; nEye < 2; nEye++) {<NEW_LINE>texType[0].eColorSpace = JOpenVRLibrary.EColorSpace.EColorSpace_ColorSpace_Gamma;<NEW_LINE>texType[0].eType = JOpenVRLibrary.EGraphicsAPIConvention.EGraphicsAPIConvention_API_OpenGL;<NEW_LINE>texType[0].setAutoSynch(false);<NEW_LINE>texType[0].setAutoRead(false);<NEW_LINE>texType[0].setAutoWrite(false);<NEW_LINE>texType[0].handle = -1;<NEW_LINE>texType[0].write();<NEW_LINE>}<NEW_LINE>logger.info("OpenVR Compositor initialized OK.");<NEW_LINE>return true;<NEW_LINE>} | logger.info("vrCompositor initialization failed:" + errorString); |
647,467 | public void requestTeleport(double d0, double d1, double d2, float f, float f1, Set<PlayerPositionLookS2CPacket.Flag> set, boolean flag) {<NEW_LINE>// CraftBukkit - Return event status<NEW_LINE>Player player = this.getPlayer();<NEW_LINE>Location from = player.getLocation();<NEW_LINE>double x = d0;<NEW_LINE>double y = d1;<NEW_LINE>double z = d2;<NEW_LINE>float yaw = f;<NEW_LINE>float pitch = f1;<NEW_LINE>Location to = new Location(this.getPlayer().getWorld(), x, y, z, yaw, pitch);<NEW_LINE>// SPIGOT-5171: Triggered on join<NEW_LINE>if (from.equals(to)) {<NEW_LINE>this.internalTeleport(d0, d1, d2, f, f1, set, flag);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), PlayerTeleportEvent.TeleportCause.UNKNOWN);<NEW_LINE>Bukkit.<MASK><NEW_LINE>if (event.isCancelled() || !to.equals(event.getTo())) {<NEW_LINE>// Can't relative teleport<NEW_LINE>set.clear();<NEW_LINE>to = event.isCancelled() ? event.getFrom() : event.getTo();<NEW_LINE>d0 = to.getX();<NEW_LINE>d1 = to.getY();<NEW_LINE>d2 = to.getZ();<NEW_LINE>f = to.getYaw();<NEW_LINE>f1 = to.getPitch();<NEW_LINE>}<NEW_LINE>this.internalTeleport(d0, d1, d2, f, f1, set, flag);<NEW_LINE>return;<NEW_LINE>} | getPluginManager().callEvent(event); |
259,904 | public Query rewrite(IndexReader reader) throws IOException {<NEW_LINE>Query rewritten = super.rewrite(reader);<NEW_LINE>if (rewritten != this) {<NEW_LINE>return rewritten;<NEW_LINE>}<NEW_LINE>if (termArrays.isEmpty()) {<NEW_LINE>return new MatchNoDocsQuery();<NEW_LINE>}<NEW_LINE>MultiPhraseQuery.Builder query = new MultiPhraseQuery.Builder();<NEW_LINE>query.setSlop(slop);<NEW_LINE>int sizeMinus1 = termArrays.size() - 1;<NEW_LINE>for (int i = 0; i < sizeMinus1; i++) {<NEW_LINE>query.add(termArrays.get(i), positions.get(i));<NEW_LINE>}<NEW_LINE>Term[] suffixTerms = termArrays.get(sizeMinus1);<NEW_LINE>int <MASK><NEW_LINE>ObjectHashSet<Term> terms = new ObjectHashSet<>();<NEW_LINE>for (Term term : suffixTerms) {<NEW_LINE>getPrefixTerms(terms, term, reader);<NEW_LINE>if (terms.size() > maxExpansions) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (terms.isEmpty()) {<NEW_LINE>if (sizeMinus1 == 0) {<NEW_LINE>// no prefix and the phrase query is empty<NEW_LINE>return Queries.newMatchNoDocsQuery("No terms supplied for " + MultiPhrasePrefixQuery.class.getName());<NEW_LINE>}<NEW_LINE>// if the terms does not exist we could return a MatchNoDocsQuery but this would break the unified highlighter<NEW_LINE>// which rewrites query with an empty reader.<NEW_LINE>return new BooleanQuery.Builder().add(query.build(), BooleanClause.Occur.MUST).add(Queries.newMatchNoDocsQuery("No terms supplied for " + MultiPhrasePrefixQuery.class.getName()), BooleanClause.Occur.MUST).build();<NEW_LINE>}<NEW_LINE>query.add(terms.toArray(Term.class), position);<NEW_LINE>return query.build();<NEW_LINE>} | position = positions.get(sizeMinus1); |
241,242 | public static ImageResult toJpeg(@NonNull ImageProxy image, boolean flip) throws IOException {<NEW_LINE>ImageProxy.PlaneProxy[] planes = image.getPlanes();<NEW_LINE>ByteBuffer buffer = planes[0].getBuffer();<NEW_LINE>Rect cropRect = shouldCropImage(image) ? image.getCropRect() : null;<NEW_LINE>byte[] data = new byte[buffer.capacity()];<NEW_LINE>int rotation = image.getImageInfo().getRotationDegrees();<NEW_LINE>buffer.get(data);<NEW_LINE>try {<NEW_LINE>Pair<Integer, Integer> dimens = BitmapUtil.getDimensions(new ByteArrayInputStream(data));<NEW_LINE>if (dimens.first != image.getWidth() && dimens.second != image.getHeight()) {<NEW_LINE>Log.w(TAG, String.format(Locale.ENGLISH, "Decoded image dimensions differed from stated dimensions! Stated: %d x %d, Decoded: %d x %d", image.getWidth(), image.getHeight(), dimens<MASK><NEW_LINE>Log.w(TAG, "Ignoring the stated rotation and rotating the crop rect 90 degrees (stated rotation is " + rotation + " degrees).");<NEW_LINE>rotation = 0;<NEW_LINE>if (cropRect != null) {<NEW_LINE>cropRect = new Rect(cropRect.top, cropRect.left, cropRect.bottom, cropRect.right);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (BitmapDecodingException e) {<NEW_LINE>Log.w(TAG, "Failed to decode!", e);<NEW_LINE>}<NEW_LINE>if (cropRect != null || rotation != 0 || flip) {<NEW_LINE>data = transformByteArray(data, cropRect, rotation, flip);<NEW_LINE>}<NEW_LINE>int width = cropRect != null ? (cropRect.right - cropRect.left) : image.getWidth();<NEW_LINE>int height = cropRect != null ? (cropRect.bottom - cropRect.top) : image.getHeight();<NEW_LINE>if (rotation == 90 || rotation == 270) {<NEW_LINE>int swap = width;<NEW_LINE>width = height;<NEW_LINE>height = swap;<NEW_LINE>}<NEW_LINE>return new ImageResult(data, width, height);<NEW_LINE>} | .first, dimens.second)); |
1,126,624 | public static MapToolVariableResolver callEventHandlerOld(final String macroTarget, final String args, final Token tokenInContext, Map<String, Object> varsToSet, boolean suppressChatOutput) {<NEW_LINE>if (varsToSet == null)<NEW_LINE>varsToSet = Collections.emptyMap();<NEW_LINE>MapToolVariableResolver newResolver = new MapToolVariableResolver(tokenInContext);<NEW_LINE>try {<NEW_LINE>for (Map.Entry<String, Object> entry : varsToSet.entrySet()) {<NEW_LINE>newResolver.setVariable(entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>String resultVal = MapTool.getParser().runMacro(newResolver, tokenInContext, macroTarget, args, false);<NEW_LINE>if (!suppressChatOutput && resultVal != null && !resultVal.equals("")) {<NEW_LINE>MapTool.addMessage(new TextMessage(TextMessage.Channel.SAY, null, MapTool.getPlayer().getName(), resultVal, null));<NEW_LINE>}<NEW_LINE>} catch (AbortFunctionException afe) {<NEW_LINE>// Do nothing<NEW_LINE>} catch (ParserException e) {<NEW_LINE>MapTool.addLocalMessage("Event continuing after error running " + macroTarget + ": " + e.getMessage());<NEW_LINE>LOGGER.debug("error running {}: {}", macroTarget, <MASK><NEW_LINE>}<NEW_LINE>return newResolver;<NEW_LINE>} | e.getMessage(), e); |
1,571,396 | private boolean testCount() {<NEW_LINE>final long start = System.currentTimeMillis();<NEW_LINE>final String dynWhere = getSQLWhere();<NEW_LINE>final <MASK><NEW_LINE>if (dynWhere.length() > 0) {<NEW_LINE>// includes first AND<NEW_LINE>sql.append(dynWhere);<NEW_LINE>}<NEW_LINE>final IStringExpression sqlExpression = Services.get(IExpressionFactory.class).compile(sql.toString(), IStringExpression.class);<NEW_LINE>// onlyWindow=false<NEW_LINE>final Evaluatee evalCtx = Evaluatees.ofCtx(getCtx(), getWindowNo(), false);<NEW_LINE>// ignoreUnparsable=true<NEW_LINE>String countSql = sqlExpression.evaluate(evalCtx, true);<NEW_LINE>countSql = Env.getUserRolePermissions().addAccessSQL(countSql, getTableName(), IUserRolePermissions.SQL_FULLYQUALIFIED, Access.READ);<NEW_LINE>log.trace(countSql);<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>ResultSet rs = null;<NEW_LINE>int no = -1;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(countSql, null);<NEW_LINE>setParameters(pstmt, true);<NEW_LINE>rs = pstmt.executeQuery();<NEW_LINE>if (rs.next()) {<NEW_LINE>no = rs.getInt(1);<NEW_LINE>}<NEW_LINE>} catch (final Exception e) {<NEW_LINE>log.error(countSql, e);<NEW_LINE>no = -2;<NEW_LINE>} finally {<NEW_LINE>DB.close(rs, pstmt);<NEW_LINE>rs = null;<NEW_LINE>pstmt = null;<NEW_LINE>}<NEW_LINE>log.debug("#" + no + " - " + (System.currentTimeMillis() - start) + "ms");<NEW_LINE>// Armen: add role checking (Patch #1694788 )<NEW_LINE>final GridTabMaxRowsRestrictionChecker maxRowsChecker = // .setAD_Role(role) // use default role<NEW_LINE>GridTabMaxRowsRestrictionChecker.builder().// .setGridTab(gridTab) // no grid tab available<NEW_LINE>build();<NEW_LINE>if (maxRowsChecker.isQueryMax(no)) {<NEW_LINE>return ADialog.ask(p_WindowNo, getWindow(), "InfoHighRecordCount", String.valueOf(no));<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | StringBuilder sql = new StringBuilder(m_sqlCount); |
1,422,402 | private void schemeSpecificPart(final UriParser parser) {<NEW_LINE>if (parser.isOpaque()) {<NEW_LINE>if (parser.getSsp() != null) {<NEW_LINE>this.authority = this.host = this.port = null;<NEW_LINE>this.path.setLength(0);<NEW_LINE>this.query.setLength(0);<NEW_LINE>// TODO encode or validate scheme specific part<NEW_LINE>this.ssp = parser.getSsp();<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>this.ssp = null;<NEW_LINE>if (parser.getAuthority() != null) {<NEW_LINE>if (parser.getUserInfo() == null && parser.getHost() == null && parser.getPort() == null) {<NEW_LINE>this.authority = encode(parser.getAuthority(), UriComponent.Type.AUTHORITY);<NEW_LINE>this.userInfo = null;<NEW_LINE>this.host = null;<NEW_LINE>this.port = null;<NEW_LINE>} else {<NEW_LINE>this.authority = null;<NEW_LINE>if (parser.getUserInfo() != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (parser.getHost() != null) {<NEW_LINE>host(parser.getHost());<NEW_LINE>}<NEW_LINE>if (parser.getPort() != null) {<NEW_LINE>this.port = parser.getPort();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (parser.getPath() != null) {<NEW_LINE>this.path.setLength(0);<NEW_LINE>path(parser.getPath());<NEW_LINE>}<NEW_LINE>if (parser.getQuery() != null) {<NEW_LINE>this.query.setLength(0);<NEW_LINE>this.query.append(parser.getQuery());<NEW_LINE>}<NEW_LINE>} | userInfo(parser.getUserInfo()); |
40,320 | protected void checkEventTimeWindows() {<NEW_LINE>int expectedWatermarks = upstreamWatermarks.size();<NEW_LINE>int arrived = 0;<NEW_LINE>int good = 0;<NEW_LINE>for (Iterator<TimeWindow> windowIterator = windowToTriggers.keySet().iterator(); windowIterator.hasNext(); ) {<NEW_LINE>TimeWindow pendingWindow = windowIterator.next();<NEW_LINE>if (watermarkTriggerPolicy == WatermarkTriggerPolicy.GLOBAL_MAX_TIMESTAMP) {<NEW_LINE>fireOrReregisterEventWindow(pendingWindow, currentWatermark > pendingWindow.maxTimestamp());<NEW_LINE>} else {<NEW_LINE>long windowStart = pendingWindow.getStart();<NEW_LINE>long windowEnd = pendingWindow.getEnd();<NEW_LINE>for (Map.Entry<Integer, Long> entry : upstreamWatermarks.entrySet()) {<NEW_LINE>long ts = entry.getValue();<NEW_LINE>if (ts >= windowStart) {<NEW_LINE>arrived++;<NEW_LINE>}<NEW_LINE>if (ts >= windowEnd) {<NEW_LINE>good++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (watermarkTriggerPolicy == WatermarkTriggerPolicy.TASK_MAX_GLOBAL_MIN_TIMESTAMP) {<NEW_LINE>fireOrReregisterEventWindow(pendingWindow, good == expectedWatermarks);<NEW_LINE>} else if (watermarkTriggerPolicy == WatermarkTriggerPolicy.MAX_TIMESTAMP_WITH_RATIO) {<NEW_LINE><MASK><NEW_LINE>fireOrReregisterEventWindow(pendingWindow, ratio >= watermarkRatio);<NEW_LINE>}<NEW_LINE>windowContext.registerEventTimeTimer(pendingWindow.getEnd() + maxLagMs, pendingWindow);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | double ratio = good * 1.0d / expectedWatermarks; |
1,315,750 | final DescribeFleetMetricResult executeDescribeFleetMetric(DescribeFleetMetricRequest describeFleetMetricRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeFleetMetricRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeFleetMetricRequest> request = null;<NEW_LINE>Response<DescribeFleetMetricResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeFleetMetricRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeFleetMetricRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeFleetMetric");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeFleetMetricResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeFleetMetricResultJsonUnmarshaller());<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.CLIENT_ENDPOINT, endpoint); |
128,766 | final PublishBatchResult executePublishBatch(PublishBatchRequest publishBatchRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(publishBatchRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PublishBatchRequest> request = null;<NEW_LINE>Response<PublishBatchResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PublishBatchRequestMarshaller().marshall(super.beforeMarshalling(publishBatchRequest));<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, "SNS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PublishBatch");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<PublishBatchResult> responseHandler = new StaxResponseHandler<PublishBatchResult>(new PublishBatchResultStaxUnmarshaller());<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.ADVANCED_CONFIG, advancedConfig); |
1,682,835 | public static String genSignature(HttpServletRequestEx requestEx) {<NEW_LINE>Hasher hasher = Hashing.sha256().newHasher();<NEW_LINE>hasher.putString(requestEx.getRequestURI(), StandardCharsets.UTF_8);<NEW_LINE>for (String paramName : paramNames) {<NEW_LINE>String paramValue = requestEx.getHeader(paramName);<NEW_LINE>if (paramValue != null) {<NEW_LINE>hasher.<MASK><NEW_LINE>hasher.putString(paramValue, StandardCharsets.UTF_8);<NEW_LINE>System.out.printf("%s %s\n", paramName, paramValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!StringUtils.startsWithIgnoreCase(requestEx.getContentType(), MediaType.APPLICATION_FORM_URLENCODED)) {<NEW_LINE>byte[] bytes = requestEx.getBodyBytes();<NEW_LINE>if (bytes != null) {<NEW_LINE>hasher.putBytes(bytes, 0, requestEx.getBodyBytesLength());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return hasher.hash().toString();<NEW_LINE>} | putString(paramName, StandardCharsets.UTF_8); |
1,036,672 | final GetInvitationsCountResult executeGetInvitationsCount(GetInvitationsCountRequest getInvitationsCountRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getInvitationsCountRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetInvitationsCountRequest> request = null;<NEW_LINE>Response<GetInvitationsCountResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetInvitationsCountRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getInvitationsCountRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Macie2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetInvitationsCount");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetInvitationsCountResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetInvitationsCountResultJsonUnmarshaller());<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.CLIENT_ENDPOINT, endpoint); |
311,247 | private int compareRowsByColumn(int row1, int row2, int column) {<NEW_LINE>Class type = getColumnClass(column);<NEW_LINE>Object o1 = getValueAt(row1, column);<NEW_LINE>Object o2 = getValueAt(row2, column);<NEW_LINE>// If both values are null, return 0.<NEW_LINE>if (o1 == null && o2 == null) {<NEW_LINE>return 0;<NEW_LINE>} else if (o1 == null) {<NEW_LINE>return -1;<NEW_LINE>} else if (o2 == null) {<NEW_LINE>return 1;<NEW_LINE>}<NEW_LINE>// Compare String<NEW_LINE>if (type == String.class) {<NEW_LINE>String s1 = (String) getValueAt(row1, column);<NEW_LINE>String s2 = (String) getValueAt(row2, column);<NEW_LINE>int <MASK><NEW_LINE>if (result < 0) {<NEW_LINE>return -1;<NEW_LINE>} else if (result > 0) {<NEW_LINE>return 1;<NEW_LINE>} else {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | result = s1.compareTo(s2); |
1,210,184 | public INDArray[] executeGraph(SameDiff sd, ExecutorConfiguration configuration) {<NEW_LINE>ByteBuffer buffer = convertToFlatBuffers(sd, configuration);<NEW_LINE>BytePointer bPtr = new BytePointer(buffer);<NEW_LINE>log.info("Buffer length: {}", buffer.limit());<NEW_LINE>NativeOps nativeOps = NativeOpsHolder.getInstance().getDeviceNativeOps();<NEW_LINE>OpaqueResultWrapper res = nativeOps.executeFlatGraph(null, bPtr);<NEW_LINE>if (res == null)<NEW_LINE>throw new ND4JIllegalStateException("Graph execution failed");<NEW_LINE>PagedPointer pagedPointer = new PagedPointer(nativeOps.getResultWrapperPointer(res), nativeOps.getResultWrapperSize(res));<NEW_LINE>FlatResult fr = FlatResult.getRootAsFlatResult(pagedPointer.asBytePointer().asByteBuffer());<NEW_LINE>log.info("VarMap: {}", sd.variableMap());<NEW_LINE>INDArray[] results = new INDArray[fr.variablesLength()];<NEW_LINE>for (int e = 0; e < fr.variablesLength(); e++) {<NEW_LINE>FlatVariable var = fr.variables(e);<NEW_LINE>String varName = var.name();<NEW_LINE>// log.info("Var received: id: [{}:{}/<{}>];", var.id().first(), var.id().second(), var.name());<NEW_LINE>FlatArray ndarray = var.ndarray();<NEW_LINE>INDArray val = Nd4j.createFromFlatArray(ndarray);<NEW_LINE>results[e] = val;<NEW_LINE>if (var.name() != null && sd.variableMap().containsKey(var.name())) {<NEW_LINE>if (sd.getVariable(varName).getVariableType() != VariableType.ARRAY) {<NEW_LINE>sd.associateArrayWithVariable(val, sd.variableMap().get(var.name()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (sd.variableMap().get(var.name()) != null) {<NEW_LINE>sd.associateArrayWithVariable(val, sd.getVariable(var.name()));<NEW_LINE>} else {<NEW_LINE>log.warn(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// now we need to release native memory<NEW_LINE>nativeOps.deleteResultWrapper(res);<NEW_LINE>return results;<NEW_LINE>} | "Unknown variable received: [{}]", var.name()); |
1,382,829 | public UpdateItemEnhancedResponse<T> transformResponse(UpdateItemResponse response, TableSchema<T> tableSchema, OperationContext operationContext, DynamoDbEnhancedClientExtension extension) {<NEW_LINE>try {<NEW_LINE>T attributes = readAndTransformSingleItem(response.attributes(), tableSchema, operationContext, extension);<NEW_LINE>return UpdateItemEnhancedResponse.<T>builder(null).attributes(attributes).consumedCapacity(response.consumedCapacity()).itemCollectionMetrics(response.<MASK><NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>// With a partial update it's possible to update the record into a state that the mapper can no longer<NEW_LINE>// read or validate. This is more likely to happen with signed and encrypted records that undergo partial<NEW_LINE>// updates (that practice is discouraged for this reason).<NEW_LINE>throw new IllegalStateException("Unable to read the new item returned by UpdateItem after the update " + "occurred. Rollbacks are not supported by this operation, therefore the " + "record may no longer be readable using this model.", e);<NEW_LINE>}<NEW_LINE>} | itemCollectionMetrics()).build(); |
1,268,322 | private void formatTimeInterval(StringBuilder buf, TimeInterval timeInterval, SimpleDateFormat timeFormat, boolean local) {<NEW_LINE>if (isWeekdaySession) {<NEW_LINE>try {<NEW_LINE>for (int i = 0; i < weekdayOffsets.length; i++) {<NEW_LINE>buf.append(DayConverter.toString(weekdayOffsets[i]));<NEW_LINE>buf.append(", ");<NEW_LINE>}<NEW_LINE>} catch (ConfigError ex) {<NEW_LINE>// this can't happen as these are created using DayConverter.toInteger<NEW_LINE>}<NEW_LINE>} else if (!isDailySession()) {<NEW_LINE>buf.append("weekly, ");<NEW_LINE>formatDayOfWeek(buf, startTime.getDay());<NEW_LINE>buf.append(" ");<NEW_LINE>} else {<NEW_LINE>buf.append("daily, ");<NEW_LINE>}<NEW_LINE>if (local) {<NEW_LINE>timeFormat.setTimeZone(startTime.getTimeZone());<NEW_LINE>}<NEW_LINE>buf.append(timeFormat.format(timeInterval.getStart().getTime()));<NEW_LINE>buf.append(" - ");<NEW_LINE>if (!isDailySession()) {<NEW_LINE>formatDayOfWeek(buf, endTime.getDay());<NEW_LINE>buf.append(" ");<NEW_LINE>}<NEW_LINE>if (local) {<NEW_LINE>timeFormat.<MASK><NEW_LINE>}<NEW_LINE>buf.append(timeFormat.format(timeInterval.getEnd().getTime()));<NEW_LINE>} | setTimeZone(endTime.getTimeZone()); |
355,399 | public CommandResult executeCommandInNode(List<String> command, boolean logOutput) {<NEW_LINE>CommandResult result = container.executeCommandInContainer(nodeAgentCtx, nodeAgentCtx.users().vespa(), command.toArray(new String[0]));<NEW_LINE>String cmdString = command.stream().map(s -> "'" + s + "'").collect(Collectors.joining<MASK><NEW_LINE>int exitCode = result.getExitCode();<NEW_LINE>String output = result.getOutput().trim();<NEW_LINE>String prefixedOutput = output.contains("\n") ? "\n" + output : (output.isEmpty() ? "<no output>" : output);<NEW_LINE>if (exitCode > 0) {<NEW_LINE>String errorMsg = logOutput ? String.format("Failed to execute %s (exited with code %d): %s", cmdString, exitCode, prefixedOutput) : String.format("Failed to execute %s (exited with code %d)", cmdString, exitCode);<NEW_LINE>throw new RuntimeException(errorMsg);<NEW_LINE>} else {<NEW_LINE>String logMsg = logOutput ? String.format("Executed command %s. Exited with code %d and output: %s", cmdString, exitCode, prefixedOutput) : String.format("Executed command %s. Exited with code %d.", cmdString, exitCode);<NEW_LINE>nodeAgentCtx.log(log, logMsg);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | (" ", "\"", "\"")); |
879,713 | final SetRepositoryPolicyResult executeSetRepositoryPolicy(SetRepositoryPolicyRequest setRepositoryPolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(setRepositoryPolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SetRepositoryPolicyRequest> request = null;<NEW_LINE>Response<SetRepositoryPolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new SetRepositoryPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(setRepositoryPolicyRequest));<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, "ECR");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<SetRepositoryPolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SetRepositoryPolicyResultJsonUnmarshaller());<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.OPERATION_NAME, "SetRepositoryPolicy"); |
1,025,592 | private void updateFileLinks(File old_save_path, File new_save_path) {<NEW_LINE>old_save_path = FileUtil.getCanonicalFileSafe(old_save_path);<NEW_LINE>new_save_path = FileUtil.getCanonicalFileSafe(new_save_path);<NEW_LINE>// System.out.println( "update_file_links: " + old_save_path + " -> " + new_save_path );<NEW_LINE>LinkFileMap links = download_manager_state.getFileLinks();<NEW_LINE>Iterator<LinkFileMap.Entry> it = links.entryIterator();<NEW_LINE>List<Integer> <MASK><NEW_LINE>List<File> from_links = new ArrayList<>();<NEW_LINE>List<File> to_links = new ArrayList<>();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>LinkFileMap.Entry entry = it.next();<NEW_LINE>try {<NEW_LINE>File to = entry.getToFile();<NEW_LINE>if (to == null) {<NEW_LINE>// represents a deleted link, nothing to update<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>to = FileUtil.getCanonicalFileSafe(to);<NEW_LINE>int file_index = entry.getIndex();<NEW_LINE>File from = entry.getFromFile();<NEW_LINE>from = FileUtil.getCanonicalFileSafe(from);<NEW_LINE>updateFileLink(file_index, old_save_path, new_save_path, from, to, from_indexes, from_links, to_links);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Debug.printStackTrace(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (from_links.size() > 0) {<NEW_LINE>download_manager_state.setFileLinks(from_indexes, from_links, to_links);<NEW_LINE>}<NEW_LINE>} | from_indexes = new ArrayList<>(); |
423,484 | public double runDouble(Doubles values) {<NEW_LINE>// TODO(cl) - Can we get anything other than a DataPoint?<NEW_LINE>if (values instanceof DataPoint) {<NEW_LINE>long ts = ((DataPoint) values).timestamp();<NEW_LINE>// data point falls outside required range<NEW_LINE>if (ts < start || ts > end) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final double[] doubles = new double[total_series];<NEW_LINE>int ix = 0;<NEW_LINE>doubles[ix++] = values.nextDoubleValue();<NEW_LINE>while (values.hasNextValue()) {<NEW_LINE>doubles[ix++] = values.nextDoubleValue();<NEW_LINE>}<NEW_LINE>for (int i = 0; i < total_series; i++) {<NEW_LINE>// TODO(cl) - Properly handle NaNs here<NEW_LINE>max_doubles[i] = Math.max(max_doubles[<MASK><NEW_LINE>}<NEW_LINE>has_doubles = true;<NEW_LINE>return 0;<NEW_LINE>} | i], doubles[i]); |
439,955 | protected RenameJavaElementDescriptor createRefactoringDescriptor() {<NEW_LINE>final IField field = getField();<NEW_LINE>String project = null;<NEW_LINE>IJavaProject javaProject = field.getJavaProject();<NEW_LINE>if (javaProject != null) {<NEW_LINE>project = javaProject.getElementName();<NEW_LINE>}<NEW_LINE>int flags = JavaRefactoringDescriptor.JAR_MIGRATION | JavaRefactoringDescriptor.JAR_REFACTORING | RefactoringDescriptor.STRUCTURAL_CHANGE;<NEW_LINE>final IType declaring = field.getDeclaringType();<NEW_LINE>try {<NEW_LINE>if (!Flags.isPrivate(declaring.getFlags())) {<NEW_LINE>flags |= RefactoringDescriptor.MULTI_CHANGE;<NEW_LINE>}<NEW_LINE>if (declaring.isAnonymous() || declaring.isLocal()) {<NEW_LINE>flags |= JavaRefactoringDescriptor.JAR_SOURCE_ATTACHMENT;<NEW_LINE>}<NEW_LINE>} catch (JavaModelException exception) {<NEW_LINE>JavaLanguageServerPlugin.log(exception);<NEW_LINE>}<NEW_LINE>final String description = Messages.format(RefactoringCoreMessages.RenameEnumConstProcessor_descriptor_description_short, BasicElementLabels.getJavaElementName(fField.getElementName()));<NEW_LINE>final String header = Messages.format(RefactoringCoreMessages.RenameEnumConstProcessor_descriptor_description, new String[] { BasicElementLabels.getJavaElementName(field.getElementName()), JavaElementLabels.getElementLabel(field.getParent(), JavaElementLabels.ALL_FULLY_QUALIFIED), BasicElementLabels.<MASK><NEW_LINE>final String comment = new JDTRefactoringDescriptorComment(project, this, header).asString();<NEW_LINE>final RenameJavaElementDescriptor descriptor = RefactoringSignatureDescriptorFactory.createRenameJavaElementDescriptor(IJavaRefactorings.RENAME_ENUM_CONSTANT);<NEW_LINE>descriptor.setProject(project);<NEW_LINE>descriptor.setDescription(description);<NEW_LINE>descriptor.setComment(comment);<NEW_LINE>descriptor.setFlags(flags);<NEW_LINE>descriptor.setJavaElement(field);<NEW_LINE>descriptor.setNewName(getNewElementName());<NEW_LINE>descriptor.setUpdateReferences(fUpdateReferences);<NEW_LINE>descriptor.setUpdateTextualOccurrences(fUpdateTextualMatches);<NEW_LINE>return descriptor;<NEW_LINE>} | getJavaElementName(getNewElementName()) }); |
1,222,753 | protected void startInner() {<NEW_LINE>// Configure the server.<NEW_LINE>this.workerPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(config.getNumRestServiceNettyWorkerThreads());<NEW_LINE>this.bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newFixedThreadPool(config.getNumRestServiceNettyBossThreads()), workerPool));<NEW_LINE>this.bootstrap.setOption("backlog", config.getRestServiceNettyServerBacklog());<NEW_LINE>this.bootstrap.setOption("child.tcpNoDelay", true);<NEW_LINE>this.bootstrap.setOption("child.keepAlive", true);<NEW_LINE>this.bootstrap.setOption("child.reuseAddress", true);<NEW_LINE>this.bootstrap.setPipelineFactory(new RestPipelineFactory(storeRepository, config, localZoneId, storeDefinitions, allChannels));<NEW_LINE>// Bind and start to accept incoming connections.<NEW_LINE>this.nettyServerChannel = this.bootstrap.bind(<MASK><NEW_LINE>allChannels.add(nettyServerChannel);<NEW_LINE>logger.info("REST service started on port " + this.port);<NEW_LINE>// Register MBeans for Netty worker pool stats<NEW_LINE>if (config.isJmxEnabled()) {<NEW_LINE>JmxUtils.registerMbean(this, JmxUtils.createObjectName(JmxUtils.getPackageName(this.getClass()), JmxUtils.getClassName(this.getClass())));<NEW_LINE>}<NEW_LINE>} | new InetSocketAddress(this.port)); |
1,251,317 | private static void copyFiles(Manifest manifest, JarFile in, JarOutputStream out, long timestamp) throws IOException {<NEW_LINE>byte[] buffer = new byte[4096];<NEW_LINE>int num;<NEW_LINE>Map<String, Attributes<MASK><NEW_LINE>List<String> names = new ArrayList<>(entries.keySet());<NEW_LINE>Collections.sort(names);<NEW_LINE>for (String name : names) {<NEW_LINE>JarEntry inEntry = in.getJarEntry(name);<NEW_LINE>JarEntry outEntry = null;<NEW_LINE>if (inEntry.getMethod() == JarEntry.STORED) {<NEW_LINE>// Preserve the STORED method of the input entry.<NEW_LINE>outEntry = new JarEntry(inEntry);<NEW_LINE>} else {<NEW_LINE>// Create a new entry so that the compressed len is recomputed.<NEW_LINE>outEntry = new JarEntry(name);<NEW_LINE>}<NEW_LINE>outEntry.setTime(timestamp);<NEW_LINE>out.putNextEntry(outEntry);<NEW_LINE>InputStream data = in.getInputStream(inEntry);<NEW_LINE>while ((num = data.read(buffer)) > 0) {<NEW_LINE>out.write(buffer, 0, num);<NEW_LINE>}<NEW_LINE>out.flush();<NEW_LINE>}<NEW_LINE>} | > entries = manifest.getEntries(); |
1,136,295 | private static void initializeFunctionDataCallTarget(JSFunctionData functionData, JSBuiltin builtin, JSFunctionData.Target target, CallTarget callTarget) {<NEW_LINE>JSContext context = functionData.getContext();<NEW_LINE>NodeFactory factory = NodeFactory.getDefaultInstance();<NEW_LINE>FrameDescriptor frameDescriptor = null;<NEW_LINE>if (target == JSFunctionData.Target.Call) {<NEW_LINE>functionData.setCallTarget(callTarget);<NEW_LINE>} else if (target == JSFunctionData.Target.Construct) {<NEW_LINE>RootNode constructRoot;<NEW_LINE>if (builtin.hasSeparateConstructor()) {<NEW_LINE>JSBuiltinNode constructNode = JSBuiltinNode.createBuiltin(context, builtin, true, false);<NEW_LINE>constructRoot = FunctionRootNode.create(constructNode, frameDescriptor, functionData, getSourceSection(), builtin.getFullName());<NEW_LINE>} else {<NEW_LINE>constructRoot = factory.createConstructorRootNode(functionData, callTarget, false);<NEW_LINE>}<NEW_LINE>functionData.setConstructTarget(constructRoot.getCallTarget());<NEW_LINE>} else if (target == JSFunctionData.Target.ConstructNewTarget) {<NEW_LINE>JavaScriptRootNode constructNewTargetRoot;<NEW_LINE>if (builtin.hasNewTargetConstructor()) {<NEW_LINE>AbstractBodyNode constructNewTargetNode = JSBuiltinNode.createBuiltin(context, builtin, true, true);<NEW_LINE>constructNewTargetRoot = FunctionRootNode.create(constructNewTargetNode, frameDescriptor, functionData, getSourceSection(), builtin.getFullName());<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>constructNewTargetRoot = factory.createDropNewTarget(functionData.getContext(), constructTarget);<NEW_LINE>}<NEW_LINE>functionData.setConstructNewTarget(constructNewTargetRoot.getCallTarget());<NEW_LINE>}<NEW_LINE>} | CallTarget constructTarget = functionData.getConstructTarget(); |
1,807,678 | private CreateReaderGroupEvent buildCreateRGEvent(String scope, String rgName, ReaderGroupConfig config, final long requestId, final long createTimestamp) {<NEW_LINE>Map<String, RGStreamCutRecord> startStreamCuts = config.getStartingStreamCuts().entrySet().stream().collect(Collectors.toMap(e -> e.getKey().getScopedName(), e -> new RGStreamCutRecord(ImmutableMap.copyOf(ModelHelper.getStreamCutMap(e.<MASK><NEW_LINE>Map<String, RGStreamCutRecord> endStreamCuts = config.getEndingStreamCuts().entrySet().stream().collect(Collectors.toMap(e -> e.getKey().getScopedName(), e -> new RGStreamCutRecord(ImmutableMap.copyOf(ModelHelper.getStreamCutMap(e.getValue())))));<NEW_LINE>return new CreateReaderGroupEvent(requestId, scope, rgName, config.getGroupRefreshTimeMillis(), config.getAutomaticCheckpointIntervalMillis(), config.getMaxOutstandingCheckpointRequest(), config.getRetentionType().ordinal(), config.getGeneration(), config.getReaderGroupId(), startStreamCuts, endStreamCuts, createTimestamp);<NEW_LINE>} | getValue()))))); |
1,446,335 | public static ColumnDef build(String name, String charset, String type, short pos, boolean signed, String[] enumValues, Long columnLength) {<NEW_LINE>name = name.intern();<NEW_LINE>if (charset != null)<NEW_LINE>charset = charset.intern();<NEW_LINE>switch(type) {<NEW_LINE>case "tinyint":<NEW_LINE>case "smallint":<NEW_LINE>case "mediumint":<NEW_LINE>case "int":<NEW_LINE>return IntColumnDef.create(name, type, pos, signed);<NEW_LINE>case "bigint":<NEW_LINE>return BigIntColumnDef.create(name, type, pos, signed);<NEW_LINE>case "tinytext":<NEW_LINE>case "text":<NEW_LINE>case "mediumtext":<NEW_LINE>case "longtext":<NEW_LINE>case "varchar":<NEW_LINE>case "char":<NEW_LINE>return StringColumnDef.create(name, type, pos, charset);<NEW_LINE>case "tinyblob":<NEW_LINE>case "blob":<NEW_LINE>case "mediumblob":<NEW_LINE>case "longblob":<NEW_LINE>case "binary":<NEW_LINE>case "varbinary":<NEW_LINE>return StringColumnDef.create(name, type, pos, "binary");<NEW_LINE>case "geometry":<NEW_LINE>case "geometrycollection":<NEW_LINE>case "linestring":<NEW_LINE>case "multilinestring":<NEW_LINE>case "multipoint":<NEW_LINE>case "multipolygon":<NEW_LINE>case "polygon":<NEW_LINE>case "point":<NEW_LINE>return GeometryColumnDef.<MASK><NEW_LINE>case "float":<NEW_LINE>case "double":<NEW_LINE>return FloatColumnDef.create(name, type, pos);<NEW_LINE>case "decimal":<NEW_LINE>return DecimalColumnDef.create(name, type, pos);<NEW_LINE>case "date":<NEW_LINE>return DateColumnDef.create(name, type, pos);<NEW_LINE>case "datetime":<NEW_LINE>case "timestamp":<NEW_LINE>return DateTimeColumnDef.create(name, type, pos, columnLength);<NEW_LINE>case "time":<NEW_LINE>return TimeColumnDef.create(name, type, pos, columnLength);<NEW_LINE>case "year":<NEW_LINE>return YearColumnDef.create(name, type, pos);<NEW_LINE>case "enum":<NEW_LINE>return EnumColumnDef.create(name, type, pos, enumValues);<NEW_LINE>case "set":<NEW_LINE>return SetColumnDef.create(name, type, pos, enumValues);<NEW_LINE>case "bit":<NEW_LINE>return BitColumnDef.create(name, type, pos);<NEW_LINE>case "json":<NEW_LINE>return JsonColumnDef.create(name, type, pos);<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("unsupported column type " + type);<NEW_LINE>}<NEW_LINE>} | create(name, type, pos); |
444,249 | public void testBMTEJBTimeoutMessageDrivenContext() throws Exception {<NEW_LINE>String deliveryID = "test09";<NEW_LINE>prepareTRA();<NEW_LINE>// construct a FVTMessage<NEW_LINE>FVTMessage message = new FVTMessage();<NEW_LINE>message.addTestResult("MDBTimedBMTBean", 49);<NEW_LINE>// Add a FVTXAResourceImpl for this delivery.<NEW_LINE>message.addXAResource("MDBTimedBMTBean", 49, new FVTXAResourceImpl());<NEW_LINE>// Add a option A delivery.<NEW_LINE>message.add("MDBTimedBMTBean", deliveryID, 49);<NEW_LINE>System.out.println(message.toString());<NEW_LINE>baseProvider.sendDirectMessage(deliveryID, message);<NEW_LINE>MessageEndpointTestResults results = baseProvider.getTestResult(deliveryID);<NEW_LINE>assertTrue("Number of messages delivered is 1", results.getNumberOfMessagesDelivered() == 1);<NEW_LINE>int counter = 0;<NEW_LINE><MASK><NEW_LINE>while (counter < maxSleepTime) {<NEW_LINE>if (MDBTimedBMTBean.results != null) {<NEW_LINE>checkResults(MDBTimedBMTBean.results);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>Thread.sleep(1000);<NEW_LINE>counter++;<NEW_LINE>}<NEW_LINE>baseProvider.releaseDeliveryId(deliveryID);<NEW_LINE>} | System.out.println("Waiting for results ..."); |
1,129,524 | public static DescribeDBClusterPerformanceResponse unmarshall(DescribeDBClusterPerformanceResponse describeDBClusterPerformanceResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDBClusterPerformanceResponse.setRequestId(_ctx.stringValue("DescribeDBClusterPerformanceResponse.RequestId"));<NEW_LINE>describeDBClusterPerformanceResponse.setEndTime(_ctx.stringValue("DescribeDBClusterPerformanceResponse.EndTime"));<NEW_LINE>describeDBClusterPerformanceResponse.setStartTime(_ctx.stringValue("DescribeDBClusterPerformanceResponse.StartTime"));<NEW_LINE>describeDBClusterPerformanceResponse.setDBClusterId(_ctx.stringValue("DescribeDBClusterPerformanceResponse.DBClusterId"));<NEW_LINE>List<PerformanceItem> performances = new ArrayList<PerformanceItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDBClusterPerformanceResponse.Performances.Length"); i++) {<NEW_LINE>PerformanceItem performanceItem = new PerformanceItem();<NEW_LINE>performanceItem.setKey(_ctx.stringValue("DescribeDBClusterPerformanceResponse.Performances[" + i + "].Key"));<NEW_LINE>performanceItem.setUnit(_ctx.stringValue("DescribeDBClusterPerformanceResponse.Performances[" + i + "].Unit"));<NEW_LINE>performanceItem.setName(_ctx.stringValue("DescribeDBClusterPerformanceResponse.Performances[" + i + "].Name"));<NEW_LINE>List<SeriesItem> series = new ArrayList<SeriesItem>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeDBClusterPerformanceResponse.Performances[" + i + "].Series.Length"); j++) {<NEW_LINE>SeriesItem seriesItem = new SeriesItem();<NEW_LINE>seriesItem.setName(_ctx.stringValue("DescribeDBClusterPerformanceResponse.Performances[" + i + "].Series[" + j + "].Name"));<NEW_LINE>List<ValueItem> values = new ArrayList<ValueItem>();<NEW_LINE>for (int k = 0; k < _ctx.lengthValue("DescribeDBClusterPerformanceResponse.Performances[" + i + "].Series[" + j + "].Values.Length"); k++) {<NEW_LINE>ValueItem valueItem = new ValueItem();<NEW_LINE>List<String> point <MASK><NEW_LINE>for (int l = 0; l < _ctx.lengthValue("DescribeDBClusterPerformanceResponse.Performances[" + i + "].Series[" + j + "].Values[" + k + "].Point.Length"); l++) {<NEW_LINE>point.add(_ctx.stringValue("DescribeDBClusterPerformanceResponse.Performances[" + i + "].Series[" + j + "].Values[" + k + "].Point[" + l + "]"));<NEW_LINE>}<NEW_LINE>valueItem.setPoint(point);<NEW_LINE>values.add(valueItem);<NEW_LINE>}<NEW_LINE>seriesItem.setValues(values);<NEW_LINE>series.add(seriesItem);<NEW_LINE>}<NEW_LINE>performanceItem.setSeries(series);<NEW_LINE>performances.add(performanceItem);<NEW_LINE>}<NEW_LINE>describeDBClusterPerformanceResponse.setPerformances(performances);<NEW_LINE>return describeDBClusterPerformanceResponse;<NEW_LINE>} | = new ArrayList<String>(); |
1,699,530 | public boolean loadExisting() {<NEW_LINE>if (!nodes.loadExisting() || !edges.loadExisting())<NEW_LINE>return false;<NEW_LINE>// now load some properties from stored data<NEW_LINE>final int nodesVersion = <MASK><NEW_LINE>GHUtility.checkDAVersion("nodes", Constants.VERSION_NODE, nodesVersion);<NEW_LINE>nodeEntryBytes = nodes.getHeader(1 * 4);<NEW_LINE>nodeCount = nodes.getHeader(2 * 4);<NEW_LINE>bounds.minLon = Helper.intToDegree(nodes.getHeader(3 * 4));<NEW_LINE>bounds.maxLon = Helper.intToDegree(nodes.getHeader(4 * 4));<NEW_LINE>bounds.minLat = Helper.intToDegree(nodes.getHeader(5 * 4));<NEW_LINE>bounds.maxLat = Helper.intToDegree(nodes.getHeader(6 * 4));<NEW_LINE>boolean hasElevation = nodes.getHeader(7 * 4) == 1;<NEW_LINE>if (hasElevation != withElevation)<NEW_LINE>// :( we should load data from disk to create objects, not the other way around!<NEW_LINE>throw new IllegalStateException("Configured dimension elevation=" + withElevation + " is not equal " + "to dimension of loaded graph elevation =" + hasElevation);<NEW_LINE>if (withElevation) {<NEW_LINE>bounds.minEle = Helper.intToEle(nodes.getHeader(8 * 4));<NEW_LINE>bounds.maxEle = Helper.intToEle(nodes.getHeader(9 * 4));<NEW_LINE>}<NEW_LINE>frozen = nodes.getHeader(10 * 4) == 1;<NEW_LINE>final int edgesVersion = edges.getHeader(0 * 4);<NEW_LINE>GHUtility.checkDAVersion("edges", Constants.VERSION_EDGE, edgesVersion);<NEW_LINE>edgeEntryBytes = edges.getHeader(1 * 4);<NEW_LINE>edgeCount = edges.getHeader(2 * 4);<NEW_LINE>return true;<NEW_LINE>} | nodes.getHeader(0 * 4); |
814,054 | private JComponent buildWsdlContentTab() {<NEW_LINE>partTabs = new JTabbedPane();<NEW_LINE>partTabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);<NEW_LINE>rootNode = new <MASK><NEW_LINE>treeModel = new DefaultTreeModel(rootNode);<NEW_LINE>tree = new JTree(treeModel);<NEW_LINE>tree.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));<NEW_LINE>tree.setExpandsSelectedPaths(true);<NEW_LINE>tree.addTreeSelectionListener(new InternalTreeSelectionListener());<NEW_LINE>tree.addMouseListener(new MouseAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mouseClicked(MouseEvent arg0) {<NEW_LINE>if (arg0.getClickCount() > 1) {<NEW_LINE>TreePath selectionPath = tree.getSelectionPath();<NEW_LINE>if (selectionPath != null) {<NEW_LINE>DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) selectionPath.getLastPathComponent();<NEW_LINE>Object userObject = treeNode.getUserObject();<NEW_LINE>if (userObject instanceof InspectItem) {<NEW_LINE>InspectItem item = (InspectItem) userObject;<NEW_LINE>if (item != null && item.selector != null) {<NEW_LINE>item.selector.selectNode(item);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>JScrollPane scrollPane = new JScrollPane(tree);<NEW_LINE>JSplitPane split = UISupport.createHorizontalSplit(scrollPane, UISupport.createTabPanel(partTabs, true));<NEW_LINE>split.setDividerLocation(250);<NEW_LINE>split.setResizeWeight(0.3);<NEW_LINE>initTreeModel(iface);<NEW_LINE>JPanel panel = new JPanel(new BorderLayout());<NEW_LINE>panel.add(split, BorderLayout.CENTER);<NEW_LINE>panel.add(buildWsdlTabToolbar(), BorderLayout.PAGE_START);<NEW_LINE>statusBar = new JEditorStatusBar();<NEW_LINE>panel.add(statusBar, BorderLayout.PAGE_END);<NEW_LINE>setPreferredSize(new Dimension(600, 500));<NEW_LINE>projectListener = new InternalProjectListener();<NEW_LINE>iface.getProject().addProjectListener(projectListener);<NEW_LINE>return panel;<NEW_LINE>} | DefaultMutableTreeNode(iface.getName()); |
751,697 | private void makeLastModifiedTag() {<NEW_LINE>String username = pageData.getAttribute(LAST_MODIFYING_USER);<NEW_LINE>String dateString = pageData.getAttribute(LAST_MODIFIED);<NEW_LINE>if (dateString == null)<NEW_LINE>dateString = "";<NEW_LINE>if (!dateString.isEmpty()) {<NEW_LINE>try {<NEW_LINE>Date date = WikiPageProperty.getTimeFormat().parse(dateString);<NEW_LINE>dateString = " on " + new SimpleDateFormat("MMM dd, yyyy").format(date) + " at " + new SimpleDateFormat<MASK><NEW_LINE>} catch (ParseException e) {<NEW_LINE>dateString = " on " + dateString;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (username == null || "".equals(username))<NEW_LINE>html.put("lastModified", "Last modified anonymously" + dateString);<NEW_LINE>else<NEW_LINE>html.put("lastModified", "Last modified by " + username + dateString);<NEW_LINE>} | ("hh:mm:ss a").format(date); |
656,833 | List<RepositoryResource> createInstallList(SampleResource resource) {<NEW_LINE>Map<String, Integer> maxDistanceMap = new HashMap<>();<NEW_LINE>List<MissingRequirement> missingRequirements = new ArrayList<>();<NEW_LINE>boolean allDependenciesResolved = true;<NEW_LINE>if (resource.getRequireFeature() != null) {<NEW_LINE>for (String featureName : resource.getRequireFeature()) {<NEW_LINE>// Check that the sample actually exists<NEW_LINE>ProvisioningFeatureDefinition feature = resolverRepository.getFeature(featureName);<NEW_LINE>if (feature == null) {<NEW_LINE>allDependenciesResolved = false;<NEW_LINE>// Unless we know it exists but applies to another product, note the missing requirement as well<NEW_LINE>if (featuresMissing.contains(featureName)) {<NEW_LINE>missingRequirements.add(new MissingRequirement(featureName, resource));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Build distance map and check dependencies<NEW_LINE>allDependenciesResolved &= populateMaxDistanceMap(maxDistanceMap, featureName, 1, new HashSet<ProvisioningFeatureDefinition>(), missingRequirements);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!allDependenciesResolved) {<NEW_LINE>missingTopLevelRequirements.add(resource.getShortName());<NEW_LINE>this.missingRequirements.addAll(missingRequirements);<NEW_LINE>}<NEW_LINE>ArrayList<RepositoryResource> <MASK><NEW_LINE>installList.addAll(convertFeatureNamesToResources(maxDistanceMap.keySet()));<NEW_LINE>Collections.sort(installList, byMaxDistance(maxDistanceMap));<NEW_LINE>installList.add(resource);<NEW_LINE>return installList;<NEW_LINE>} | installList = new ArrayList<>(); |
587,854 | public static RectangleLength2D_F64 boundBoxInside(int srcWidth, int srcHeight, PixelTransform<Point2D_F64> transform, Point2D_F64 work) {<NEW_LINE>List<Point2D_F64> points = computeBoundingPoints(srcWidth, srcHeight, transform, work);<NEW_LINE>Point2D_F64 center = new Point2D_F64();<NEW_LINE>UtilPoint2D_F64.mean(points, center);<NEW_LINE>double x0, x1, y0, y1;<NEW_LINE>x0 = y0 = Float.MAX_VALUE;<NEW_LINE>x1 = y1 = -Float.MAX_VALUE;<NEW_LINE>for (int i = 0; i < points.size(); i++) {<NEW_LINE>Point2D_F64 p = points.get(i);<NEW_LINE>if (p.x < x0)<NEW_LINE>x0 = p.x;<NEW_LINE>if (p.x > x1)<NEW_LINE>x1 = p.x;<NEW_LINE>if (p.y < y0)<NEW_LINE>y0 = p.y;<NEW_LINE>if (p.y > y1)<NEW_LINE>y1 = p.y;<NEW_LINE>}<NEW_LINE>x0 -= center.x;<NEW_LINE>x1 -= center.x;<NEW_LINE>y0 -= center.y;<NEW_LINE>y1 -= center.y;<NEW_LINE>double ox0 = x0;<NEW_LINE>double oy0 = y0;<NEW_LINE>double ox1 = x1;<NEW_LINE>double oy1 = y1;<NEW_LINE>for (int i = 0; i < points.size(); i++) {<NEW_LINE>Point2D_F64 p = points.get(i);<NEW_LINE>double dx = p.x - center.x;<NEW_LINE>double dy = p.y - center.y;<NEW_LINE>// see if the point is inside the box<NEW_LINE>if (dx > x0 && dy > y0 && dx < x1 && dy < y1) {<NEW_LINE>// find smallest reduction in side length and closest to original rectangle<NEW_LINE>double d0 = (double) Math.abs(dx - x0) + x0 - ox0;<NEW_LINE>double d1 = (double) Math.abs(dx - x1) + ox1 - x1;<NEW_LINE>double d2 = (double) Math.abs(<MASK><NEW_LINE>double d3 = (double) Math.abs(dy - y1) + oy1 - y1;<NEW_LINE>if (d0 <= d1 && d0 <= d2 && d0 <= d3) {<NEW_LINE>x0 = dx;<NEW_LINE>} else if (d1 <= d2 && d1 <= d3) {<NEW_LINE>x1 = dx;<NEW_LINE>} else if (d2 <= d3) {<NEW_LINE>y0 = dy;<NEW_LINE>} else {<NEW_LINE>y1 = dy;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new RectangleLength2D_F64(x0 + center.x, y0 + center.y, x1 - x0, y1 - y0);<NEW_LINE>} | dy - y0) + y0 - oy0; |
1,522,720 | private void writeKey(XMLStreamWriter writer, SubGraph ops, ExportConfig config) throws Exception {<NEW_LINE>Map<String, Class> keyTypes = new HashMap<>();<NEW_LINE>for (Node node : ops.getNodes()) {<NEW_LINE>if (node.getLabels().iterator().hasNext()) {<NEW_LINE>keyTypes.<MASK><NEW_LINE>}<NEW_LINE>updateKeyTypes(keyTypes, node);<NEW_LINE>}<NEW_LINE>boolean useTypes = config.useTypes();<NEW_LINE>ExportFormat format = config.getFormat();<NEW_LINE>if (format == ExportFormat.GEPHI) {<NEW_LINE>keyTypes.put("TYPE", String.class);<NEW_LINE>}<NEW_LINE>writeKey(writer, keyTypes, "node", useTypes);<NEW_LINE>keyTypes.clear();<NEW_LINE>for (Relationship rel : ops.getRelationships()) {<NEW_LINE>keyTypes.put("label", String.class);<NEW_LINE>updateKeyTypes(keyTypes, rel);<NEW_LINE>}<NEW_LINE>if (format == ExportFormat.GEPHI) {<NEW_LINE>keyTypes.put("TYPE", String.class);<NEW_LINE>}<NEW_LINE>writeKey(writer, keyTypes, "edge", useTypes);<NEW_LINE>} | put("labels", String.class); |
278,089 | final ListHarvestJobsResult executeListHarvestJobs(ListHarvestJobsRequest listHarvestJobsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listHarvestJobsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<ListHarvestJobsRequest> request = null;<NEW_LINE>Response<ListHarvestJobsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListHarvestJobsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listHarvestJobsRequest));<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, "MediaPackage");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListHarvestJobs");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListHarvestJobsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListHarvestJobsResultJsonUnmarshaller());<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); |
747,512 | private void postNewForecast() {<NEW_LINE>String newSagerCode = sagerWeatherCaster.getSagerCode();<NEW_LINE>if (!newSagerCode.equals(currentSagerCode)) {<NEW_LINE>logger.debug("Sager prediction changed to {}", newSagerCode);<NEW_LINE>currentSagerCode = newSagerCode;<NEW_LINE>updateChannelTimeStamp(GROUP_OUTPUT, CHANNEL_TIMESTAMP, ZonedDateTime.now());<NEW_LINE>String forecast = sagerWeatherCaster.getForecast();<NEW_LINE>// Sharpens forecast if current temp is below 2 degrees, likely to be flurries rather than shower<NEW_LINE>forecast += SHOWERS.contains(forecast) ? (currentTemp > 2) ? "1" : "2" : "";<NEW_LINE>updateChannelString(GROUP_OUTPUT, CHANNEL_FORECAST, forecast);<NEW_LINE>updateChannelString(GROUP_OUTPUT, CHANNEL_WINDFROM, sagerWeatherCaster.getWindDirection());<NEW_LINE>updateChannelString(GROUP_OUTPUT, CHANNEL_WINDTO, sagerWeatherCaster.getWindDirection2());<NEW_LINE>updateChannelString(GROUP_OUTPUT, CHANNEL_VELOCITY, sagerWeatherCaster.getWindVelocity());<NEW_LINE>updateChannelDecimal(GROUP_OUTPUT, <MASK><NEW_LINE>}<NEW_LINE>} | CHANNEL_VELOCITY_BEAUFORT, sagerWeatherCaster.getPredictedBeaufort()); |
1,281,955 | public BatchDetachObject unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>BatchDetachObject batchDetachObject = new BatchDetachObject();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("ParentReference", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>batchDetachObject.setParentReference(ObjectReferenceJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("LinkName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>batchDetachObject.setLinkName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("BatchReferenceName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>batchDetachObject.setBatchReferenceName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return batchDetachObject;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.