idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,107,994 | public void process(LArrayAccessor<TupleDesc_U8> points, DogArray_I32 assignments, FastAccess<TupleDesc_U8> clusters) {<NEW_LINE>// see if it should run the single thread version instead<NEW_LINE>if (points.size() < minimumForConcurrent) {<NEW_LINE>super.process(points, assignments, clusters);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (assignments.size != points.size())<NEW_LINE>throw new IllegalArgumentException("Points and assignments need to be the same size");<NEW_LINE>// Compute the sum of all points in each cluster<NEW_LINE>BoofConcurrency.loopBlocks(0, points.size(), threadData, (data, idx0, idx1) -> {<NEW_LINE>final TupleDesc_U8 tuple = data.point;<NEW_LINE>final DogArray<int[]> sums = data.clusterSums;<NEW_LINE>sums.resize(clusters.size);<NEW_LINE>for (int i = 0; i < sums.size; i++) {<NEW_LINE>Arrays.fill(sums.data[i], 0);<NEW_LINE>}<NEW_LINE>final DogArray_I32 counts = data.counts;<NEW_LINE>counts.resize(sums.size, 0);<NEW_LINE>for (int pointIdx = idx0; pointIdx < idx1; pointIdx++) {<NEW_LINE>points.getCopy(pointIdx, tuple);<NEW_LINE>final <MASK><NEW_LINE>int clusterIdx = assignments.get(pointIdx);<NEW_LINE>counts.data[clusterIdx]++;<NEW_LINE>int[] sum = sums.get(clusterIdx);<NEW_LINE>for (int i = 0; i < point.length; i++) {<NEW_LINE>sum[i] += point[i] & 0xFF;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// Stitch results from threads back together<NEW_LINE>counts.reset();<NEW_LINE>counts.resize(clusters.size, 0);<NEW_LINE>means.resize(clusters.size);<NEW_LINE>for (int i = 0; i < clusters.size; i++) {<NEW_LINE>Arrays.fill(means.data[i], 0);<NEW_LINE>}<NEW_LINE>for (int threadIdx = 0; threadIdx < threadData.size(); threadIdx++) {<NEW_LINE>ThreadData data = threadData.get(threadIdx);<NEW_LINE>for (int clusterIdx = 0; clusterIdx < clusters.size; clusterIdx++) {<NEW_LINE>int[] a = data.clusterSums.get(clusterIdx);<NEW_LINE>int[] b = means.get(clusterIdx);<NEW_LINE>for (int i = 0; i < b.length; i++) {<NEW_LINE>b[i] += a[i];<NEW_LINE>}<NEW_LINE>counts.data[clusterIdx] += data.counts.data[clusterIdx];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Divide to get the average value in each cluster<NEW_LINE>for (int clusterIdx = 0; clusterIdx < clusters.size; clusterIdx++) {<NEW_LINE>int[] sum = means.get(clusterIdx);<NEW_LINE>byte[] cluster = clusters.get(clusterIdx).data;<NEW_LINE>double divisor = counts.get(clusterIdx);<NEW_LINE>for (int i = 0; i < cluster.length; i++) {<NEW_LINE>cluster[i] = (byte) (sum[i] / divisor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | byte[] point = tuple.data; |
937,104 | public Operand buildOpAsgnConstDeclNode(OpAsgnConstDeclNode node) {<NEW_LINE>if (node.isOr()) {<NEW_LINE>Variable result = createTemporaryVariable();<NEW_LINE>Label falseCheck = getNewLabel();<NEW_LINE>Label done = getNewLabel();<NEW_LINE>Label assign = getNewLabel();<NEW_LINE>Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, false);<NEW_LINE>addInstr(BNEInstr.create(falseCheck, result, UndefinedValue.UNDEFINED));<NEW_LINE>addInstr(new JumpInstr(assign));<NEW_LINE><MASK><NEW_LINE>addInstr(BNEInstr.create(done, result, manager.getFalse()));<NEW_LINE>addInstr(new LabelInstr(assign));<NEW_LINE>Operand rhsValue = build(node.getSecondNode());<NEW_LINE>copy(result, rhsValue);<NEW_LINE>addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue));<NEW_LINE>addInstr(new LabelInstr(done));<NEW_LINE>return result;<NEW_LINE>} else if (node.isAnd()) {<NEW_LINE>Variable result = createTemporaryVariable();<NEW_LINE>Label done = getNewLabel();<NEW_LINE>Operand module = buildColon2ForConstAsgnDeclNode(node.getFirstNode(), result, true);<NEW_LINE>addInstr(new BFalseInstr(done, result));<NEW_LINE>Operand rhsValue = build(node.getSecondNode());<NEW_LINE>copy(result, rhsValue);<NEW_LINE>addInstr(new PutConstInstr(module, ((Colon3Node) node.getFirstNode()).getName(), rhsValue));<NEW_LINE>addInstr(new LabelInstr(done));<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>Variable result = createTemporaryVariable();<NEW_LINE>Operand lhs = build(node.getFirstNode());<NEW_LINE>Operand rhs = build(node.getSecondNode());<NEW_LINE>addInstr(CallInstr.create(scope, result, node.getSymbolOperator(), lhs, new Operand[] { rhs }, null));<NEW_LINE>return addResultInstr(new CopyInstr(createTemporaryVariable(), putConstantAssignment(node, result)));<NEW_LINE>} | addInstr(new LabelInstr(falseCheck)); |
1,428,892 | public void customize(MavenBuild mavenBuild) {<NEW_LINE>Version platformVersion <MASK><NEW_LINE>String sccPluginVersion = this.projectsVersionResolver.resolveVersion(platformVersion, "org.springframework.cloud:spring-cloud-contract-verifier");<NEW_LINE>if (sccPluginVersion == null) {<NEW_LINE>logger.warn("Spring Cloud Contract Verifier Maven plugin version could not be resolved for Spring Boot version: " + platformVersion.toString());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mavenBuild.plugins().add("org.springframework.cloud", "spring-cloud-contract-maven-plugin", (plugin) -> {<NEW_LINE>plugin.extensions(true).version(sccPluginVersion);<NEW_LINE>plugin.configuration((builder) -> builder.add("testFramework", "JUNIT5"));<NEW_LINE>if (mavenBuild.dependencies().has("webflux")) {<NEW_LINE>plugin.configuration((builder) -> builder.add("testMode", "WEBTESTCLIENT"));<NEW_LINE>mavenBuild.dependencies().add("rest-assured-spring-web-test-client", Dependency.withCoordinates("io.rest-assured", "spring-web-test-client").scope(DependencyScope.TEST_COMPILE));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>configurePluginRepositories(mavenBuild, sccPluginVersion);<NEW_LINE>} | = this.description.getPlatformVersion(); |
247,827 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));<NEW_LINE>if (controller != null) {<NEW_LINE>if (permanent != null) {<NEW_LINE>int counterCount = 0;<NEW_LINE>counterCount = permanent.getCounters(game).values().stream().map((counter) -> counter.getCount()).reduce(counterCount, Integer::sum);<NEW_LINE>permanent.destroy(source, game, false);<NEW_LINE>if (counterCount > 0) {<NEW_LINE>Target target = new TargetControlledPermanent(1, 1, <MASK><NEW_LINE>if (target.canChoose(controller.getId(), source, game)) {<NEW_LINE>controller.chooseTarget(Outcome.Benefit, target, source, game);<NEW_LINE>Permanent artifact = game.getPermanent(target.getFirstTarget());<NEW_LINE>Counter counter;<NEW_LINE>if (controller.chooseUse(Outcome.BoostCreature, "Choose which kind of counters to add", null, "+1/+1 counters", "Charge counters", source, game)) {<NEW_LINE>counter = CounterType.P1P1.createInstance(counterCount);<NEW_LINE>} else {<NEW_LINE>counter = CounterType.CHARGE.createInstance(counterCount);<NEW_LINE>}<NEW_LINE>if (artifact != null) {<NEW_LINE>artifact.addCounters(counter, source.getControllerId(), source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | new FilterControlledArtifactPermanent("an artifact you control"), true); |
326,611 | protected void registerDefaultAnnotationBinders(Map<Class<? extends Annotation>, RequestArgumentBinder> byAnnotation) {<NEW_LINE>DefaultBodyAnnotationBinder bodyBinder = new DefaultBodyAnnotationBinder(conversionService);<NEW_LINE>byAnnotation.put(Body.class, bodyBinder);<NEW_LINE>CookieAnnotationBinder<Object> cookieAnnotationBinder = new CookieAnnotationBinder<>(conversionService);<NEW_LINE>byAnnotation.put(cookieAnnotationBinder.getAnnotationType(), cookieAnnotationBinder);<NEW_LINE>HeaderAnnotationBinder<Object> headerAnnotationBinder = new HeaderAnnotationBinder<>(conversionService);<NEW_LINE>byAnnotation.put(headerAnnotationBinder.getAnnotationType(), headerAnnotationBinder);<NEW_LINE>ParameterAnnotationBinder<Object> parameterAnnotationBinder = new ParameterAnnotationBinder<>(conversionService);<NEW_LINE>byAnnotation.put(parameterAnnotationBinder.getAnnotationType(), parameterAnnotationBinder);<NEW_LINE>RequestAttributeAnnotationBinder<Object> requestAttributeAnnotationBinder <MASK><NEW_LINE>byAnnotation.put(requestAttributeAnnotationBinder.getAnnotationType(), requestAttributeAnnotationBinder);<NEW_LINE>PathVariableAnnotationBinder<Object> pathVariableAnnotationBinder = new PathVariableAnnotationBinder<>(conversionService);<NEW_LINE>byAnnotation.put(pathVariableAnnotationBinder.getAnnotationType(), pathVariableAnnotationBinder);<NEW_LINE>RequestBeanAnnotationBinder<Object> requestBeanAnnotationBinder = new RequestBeanAnnotationBinder<>(this, conversionService);<NEW_LINE>byAnnotation.put(requestBeanAnnotationBinder.getAnnotationType(), requestBeanAnnotationBinder);<NEW_LINE>if (KOTLIN_COROUTINES_SUPPORTED) {<NEW_LINE>ContinuationArgumentBinder continuationArgumentBinder = new ContinuationArgumentBinder();<NEW_LINE>byType.put(continuationArgumentBinder.argumentType().typeHashCode(), continuationArgumentBinder);<NEW_LINE>}<NEW_LINE>} | = new RequestAttributeAnnotationBinder<>(conversionService); |
1,779,981 | public <T> List<T> publish(Query<T> query, Transaction transaction) {<NEW_LINE>Class<T> beanType = query.getBeanType();<NEW_LINE>BeanDescriptor<T> desc = server.descriptor(beanType);<NEW_LINE>DraftHandler<T> draftHandler = new DraftHandler<>(desc, transaction);<NEW_LINE>List<T> draftBeans = draftHandler.fetchSourceBeans(query, true);<NEW_LINE>PUB.debug("publish [{}] count[{}]", desc.name(), draftBeans.size());<NEW_LINE>if (draftBeans.isEmpty()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>draftHandler.fetchDestinationBeans(draftBeans, false);<NEW_LINE>BeanManager<T> mgr = beanDescriptorManager.beanManager(beanType);<NEW_LINE>List<T> livePublish = new ArrayList<>(draftBeans.size());<NEW_LINE>for (T draftBean : draftBeans) {<NEW_LINE>T <MASK><NEW_LINE>livePublish.add(liveBean);<NEW_LINE>// reset @DraftDirty and @DraftReset properties<NEW_LINE>draftHandler.resetDraft(draftBean);<NEW_LINE>Type persistType = draftHandler.isInsert() ? Type.INSERT : Type.UPDATE;<NEW_LINE>PUB.trace("publish bean [{}] id[{}] type[{}]", desc.name(), draftHandler.getId(), persistType);<NEW_LINE>PersistRequestBean<T> request = createRequest(liveBean, transaction, null, mgr, persistType, Flags.PUBLISH_RECURSE);<NEW_LINE>if (persistType == Type.INSERT) {<NEW_LINE>insert(request);<NEW_LINE>} else {<NEW_LINE>update(request);<NEW_LINE>}<NEW_LINE>request.resetDepth();<NEW_LINE>}<NEW_LINE>draftHandler.updateDrafts(transaction, mgr);<NEW_LINE>PUB.debug("publish - complete for [{}]", desc.name());<NEW_LINE>return livePublish;<NEW_LINE>} | liveBean = draftHandler.publishToDestinationBean(draftBean); |
511,530 | public static List<VolumeResponse> createVolumeResponse(ResponseView view, VolumeJoinVO... volumes) {<NEW_LINE>Hashtable<Long, VolumeResponse> vrDataList = new Hashtable<Long, VolumeResponse>();<NEW_LINE><MASK><NEW_LINE>for (VolumeJoinVO vr : volumes) {<NEW_LINE>VolumeResponse vrData = vrDataList.get(vr.getId());<NEW_LINE>if (vrData == null) {<NEW_LINE>// first time encountering this volume<NEW_LINE>vrData = ApiDBUtils.newVolumeResponse(view, vr);<NEW_LINE>} else {<NEW_LINE>// update tags<NEW_LINE>vrData = ApiDBUtils.fillVolumeDetails(view, vrData, vr);<NEW_LINE>}<NEW_LINE>vrDataList.put(vr.getId(), vrData);<NEW_LINE>VolumeStats vs = null;<NEW_LINE>if (vr.getFormat() == ImageFormat.VHD || vr.getFormat() == ImageFormat.QCOW2 || vr.getFormat() == ImageFormat.RAW) {<NEW_LINE>if (vrData.getPath() != null) {<NEW_LINE>vs = ApiDBUtils.getVolumeStatistics(vrData.getPath());<NEW_LINE>}<NEW_LINE>} else if (vr.getFormat() == ImageFormat.OVA) {<NEW_LINE>if (vrData.getChainInfo() != null) {<NEW_LINE>vs = ApiDBUtils.getVolumeStatistics(vrData.getChainInfo());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (vs != null) {<NEW_LINE>long vsz = vs.getVirtualSize();<NEW_LINE>long psz = vs.getPhysicalSize();<NEW_LINE>double util = (double) psz / vsz;<NEW_LINE>vrData.setUtilization(df.format(util));<NEW_LINE>if (view == ResponseView.Full) {<NEW_LINE>vrData.setVirtualsize(vsz);<NEW_LINE>vrData.setPhysicalsize(psz);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ArrayList<VolumeResponse>(vrDataList.values());<NEW_LINE>} | DecimalFormat df = new DecimalFormat("0.0%"); |
1,326,886 | private I_MKTG_ContactPerson createOrUpdateRecordDontSave(@NonNull final ContactPerson contactPerson) {<NEW_LINE>final I_MKTG_ContactPerson contactPersonRecord = loadRecordIfPossible(contactPerson).orElse(newInstance(I_MKTG_ContactPerson.class));<NEW_LINE>contactPersonRecord.setAD_User_ID(UserId.toRepoIdOr(contactPerson.getUserId(), -1));<NEW_LINE>contactPersonRecord.setC_BPartner_ID(BPartnerId.toRepoIdOr(contactPerson.getBPartnerId(), 0));<NEW_LINE>if (contactPerson.getBPartnerId() != null) {<NEW_LINE>if (contactPerson.getBpLocationId() != null) {<NEW_LINE>final BPartnerLocationAndCaptureId bpLocationId = bpartnerDAO.getBPartnerLocationAndCaptureIdInTrx(contactPerson.getBpLocationId());<NEW_LINE>contactPersonRecord.setC_BPartner_Location_ID(bpLocationId.getBPartnerLocationRepoId());<NEW_LINE>contactPersonRecord.setC_Location_ID(bpLocationId.getLocationCaptureRepoId());<NEW_LINE>} else {<NEW_LINE>contactPersonRecord.setC_BPartner_Location(null);<NEW_LINE>contactPersonRecord.setC_Location(null);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>contactPersonRecord.setC_Location_ID(LocationId.toRepoIdOr(contactPerson.getLocationId(), 0));<NEW_LINE>}<NEW_LINE>contactPersonRecord.setName(contactPerson.getName());<NEW_LINE>contactPersonRecord.setAD_Language(Language.asLanguageStringOrNull(contactPerson.getLanguage()));<NEW_LINE>contactPersonRecord.setMKTG_Platform_ID(contactPerson.getPlatformId().getRepoId());<NEW_LINE>contactPersonRecord.setRemoteRecordId(contactPerson.getRemoteId());<NEW_LINE>// set email stuff<NEW_LINE>final Optional<EmailAddress> email = EmailAddress.cast(contactPerson.getAddress());<NEW_LINE>final String emailString = email.map(EmailAddress<MASK><NEW_LINE>contactPersonRecord.setEMail(emailString);<NEW_LINE>// set deactivated stuff<NEW_LINE>final Boolean deactivatedBool = email.map(EmailAddress::getActiveOnRemotePlatformOrNull).orElse(null);<NEW_LINE>final String deactivatedString = StringUtils.ofBoolean(deactivatedBool, X_MKTG_ContactPerson.DEACTIVATEDONREMOTEPLATFORM_UNKNOWN);<NEW_LINE>contactPersonRecord.setDeactivatedOnRemotePlatform(deactivatedString);<NEW_LINE>return contactPersonRecord;<NEW_LINE>} | ::getValue).orElse(null); |
976,659 | private void genServiceInterfaceToProtocolBuffers(PrintWriter out, String sourceName, String targetName, SClass parameterType) {<NEW_LINE>for (SField field : parameterType.getAllFields()) {<NEW_LINE>SClass fieldType = field.getType();<NEW_LINE>SClass fieldClass = fieldType;<NEW_LINE>if (fieldClass.isList()) {<NEW_LINE>out.println("\t\t\tfor (" + fieldType.getName() + " o : " + sourceName + "." + field.getName() + "()) {");<NEW_LINE>out.println("\t\t\t\t" + targetName + ".add" + field.getName() + "(o);");<NEW_LINE>out.println("\t\t\t}");<NEW_LINE>} else if (fieldClass.isDate()) {<NEW_LINE>out.println("\t\t\t" + targetName + ".set" + field.getName() + "(" + sourceName + "." + field.getName() + "().getTime());");<NEW_LINE>} else if (fieldType.getInstanceClass() == byte[].class) {<NEW_LINE>out.println("\t\t\t" + targetName + ".set" + field.getName() + "(ByteString.copyFrom(" + sourceName + "." + <MASK><NEW_LINE>} else if (fieldClass.isEnum()) {<NEW_LINE>out.println("\t\t\t" + targetName + ".set" + field.getName() + "(" + fieldType.getInstanceClass().getSimpleName() + ".values()[" + sourceName + "." + field.getName() + "().ordinal()]);");<NEW_LINE>} else {<NEW_LINE>out.println("\t\t\t" + targetName + ".set" + field.getName() + "(" + sourceName + "." + field.getName() + "());");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | field.getName() + "()));"); |
1,408,810 | private void imageCell(Image image) throws SAXException {<NEW_LINE>this.emitter.startElementWithClass("td", "img");<NEW_LINE>String src = image.getSrc();<NEW_LINE>if (src == null) {<NEW_LINE>this.emitter.startElement("i");<NEW_LINE>this.emitter.characters(NOT_RESOLVABLE);<NEW_LINE>this.emitter.endElement("i");<NEW_LINE>} else {<NEW_LINE>int width = image.getWidth();<NEW_LINE>int height = image.getHeight();<NEW_LINE>if (width < 1 || height < 1) {<NEW_LINE>width = height = -1;<NEW_LINE>} else if (width > height) {<NEW_LINE>if (width > IMAGE_CLAMP) {<NEW_LINE>height = (int) Math.ceil(height * (((double) IMAGE_CLAMP) / ((double) width)));<NEW_LINE>width = IMAGE_CLAMP;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (height > IMAGE_CLAMP) {<NEW_LINE>width = (int) Math.ceil(width * (((double) IMAGE_CLAMP) / ((double) height)));<NEW_LINE>height = IMAGE_CLAMP;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>attrs.clear();<NEW_LINE>attrs.addAttribute("src", src);<NEW_LINE>if (width != -1) {<NEW_LINE>attrs.addAttribute("width", Integer.toString(width));<NEW_LINE>attrs.addAttribute("height", Integer.toString(height));<NEW_LINE>}<NEW_LINE>this.emitter.startElement("img", attrs);<NEW_LINE>this.emitter.endElement("img");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | this.emitter.endElement("td"); |
1,595,727 | public void testStartLTend() {<NEW_LINE>ScheduleExpression se = new ScheduleExpression();<NEW_LINE>se.year(9996);<NEW_LINE>// 587889<NEW_LINE>se.month(12);<NEW_LINE>se.dayOfMonth("Last");<NEW_LINE>se.start(new Date(stringToMillis("9996-04-15")));<NEW_LINE>se.end(new Date(stringToMillis("9997-05-16")));<NEW_LINE>String info = "Timer with start < end";<NEW_LINE>Timer t = createCalTimerWithSE(se, info);<NEW_LINE>Date startDate = t<MASK><NEW_LINE>Date endDate = t.getSchedule().getEnd();<NEW_LINE>try {<NEW_LINE>t.getNextTimeout();<NEW_LINE>} catch (Throwable th) {<NEW_LINE>fail("With se.start==" + startDate + " and se.end==" + endDate + ", erroneously got Throwable: " + th);<NEW_LINE>}<NEW_LINE>t.cancel();<NEW_LINE>} | .getSchedule().getStart(); |
76,882 | public Object visit(Path.Field path, Object parent) {<NEW_LINE>if (parent instanceof Path.State) {<NEW_LINE>return path.toBuilder().setState((Path.State) parent).build();<NEW_LINE>} else if (parent instanceof Path.GlobalState) {<NEW_LINE>return path.toBuilder().setGlobalState((Path.GlobalState) parent).build();<NEW_LINE>} else if (parent instanceof Path.Field) {<NEW_LINE>return path.toBuilder().setField((Path.Field) parent).build();<NEW_LINE>} else if (parent instanceof Path.ArrayIndex) {<NEW_LINE>return path.toBuilder().setArrayIndex((Path.<MASK><NEW_LINE>} else if (parent instanceof Path.Slice) {<NEW_LINE>return path.toBuilder().setSlice((Path.Slice) parent).build();<NEW_LINE>} else if (parent instanceof Path.MapIndex) {<NEW_LINE>return path.toBuilder().setMapIndex((Path.MapIndex) parent).build();<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Path.Field cannot set parent to " + parent.getClass().getName());<NEW_LINE>}<NEW_LINE>} | ArrayIndex) parent).build(); |
1,262,469 | public Object executeCommand(String commandId, List<Object> arguments, IProgressMonitor monitor) throws Exception {<NEW_LINE>Map<String, Object> obj = (Map<String, Object>) arguments.get(0);<NEW_LINE>String uri = (<MASK><NEW_LINE>URI projectUri = URI.create(uri);<NEW_LINE>String bindingKey = (String) obj.get("bindingKey");<NEW_LINE>Boolean lookInOtherProjects = (Boolean) obj.get("lookInOtherProjects");<NEW_LINE>String content = JavadocUtils.javadoc(JavadocContentAccess2::getMarkdownContentReader, projectUri, bindingKey, JavaDataParams.isLookInOtherProjects(uri, lookInOtherProjects));<NEW_LINE>if (content == null) {<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>MarkupContent mc = new MarkupContent();<NEW_LINE>mc.setKind(MarkupKind.MARKDOWN);<NEW_LINE>mc.setValue(content);<NEW_LINE>return mc;<NEW_LINE>}<NEW_LINE>} | String) obj.get("projectUri"); |
1,853 | private OptimizerStats execImpl(OptimizerContext optimizerCtx) {<NEW_LINE>OptimizerStats stats = new OptimizerStats(NAME);<NEW_LINE>FindStaticDispatchSitesVisitor finder = new FindStaticDispatchSitesVisitor();<NEW_LINE>Set<JMethod> modifiedMethods = optimizerCtx.getModifiedMethodsSince(optimizerCtx.getLastStepFor(NAME));<NEW_LINE>Set<JMethod> affectedMethods = affectedMethods(modifiedMethods, optimizerCtx);<NEW_LINE>optimizerCtx.traverse(finder, affectedMethods);<NEW_LINE>CreateStaticImplsVisitor creator = new CreateStaticImplsVisitor(program, optimizerCtx);<NEW_LINE>for (JMethod method : toBeMadeStatic) {<NEW_LINE>creator.accept(method);<NEW_LINE>}<NEW_LINE>for (JMethod method : toBeMadeStatic) {<NEW_LINE>// if method has specialization, add it to the static method<NEW_LINE>Specialization specialization = method.getSpecialization();<NEW_LINE>if (specialization != null) {<NEW_LINE>JMethod staticMethod = program.getStaticImpl(method);<NEW_LINE>List<JType> params = Lists.newArrayList(specialization.getParams());<NEW_LINE>params.add(0, staticMethod.getParams().get<MASK><NEW_LINE>staticMethod.setSpecialization(params, specialization.getReturns(), staticMethod.getName());<NEW_LINE>staticMethod.getSpecialization().resolve(params, specialization.getReturns(), program.getStaticImpl(specialization.getTargetMethod()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>RewriteCallSites rewriter = new RewriteCallSites(optimizerCtx);<NEW_LINE>rewriter.accept(program);<NEW_LINE>stats.recordModified(rewriter.getNumMods());<NEW_LINE>assert (rewriter.didChange() || toBeMadeStatic.isEmpty());<NEW_LINE>JavaAstVerifier.assertProgramIsConsistent(program);<NEW_LINE>return stats;<NEW_LINE>} | (0).getType()); |
430,974 | public static CdmTypeAttributeDefinition fromData(final CdmCorpusContext ctx, final JsonNode obj, final String entityName) {<NEW_LINE>if (obj == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final CdmTypeAttributeDefinition typeAttribute = ctx.getCorpus().makeObject(CdmObjectType.TypeAttributeDef, obj.has("name") ? obj.get("name").asText() : null);<NEW_LINE>typeAttribute.setPurpose(PurposeReferencePersistence.fromData(ctx, obj.get("purpose")));<NEW_LINE>typeAttribute.setDataType(DataTypeReferencePersistence.fromData(ctx, obj.get("dataType")));<NEW_LINE>typeAttribute.setCardinality(Utils.cardinalitySettingsFromData(obj.get("cardinality"), typeAttribute));<NEW_LINE>typeAttribute.setAttributeContext(AttributeContextReferencePersistence.fromData(ctx, obj.get("attributeContext")));<NEW_LINE>Utils.addListToCdmCollection(typeAttribute.getAppliedTraits(), Utils.createTraitReferenceList(ctx, obj.get("appliedTraits")));<NEW_LINE>typeAttribute.setResolutionGuidance(AttributeResolutionGuidancePersistence.fromData(ctx, obj.get("resolutionGuidance")));<NEW_LINE>if (obj.has("isPrimaryKey") && obj.get("isPrimaryKey").asBoolean() && entityName != null) {<NEW_LINE>TraitToPropertyMap t2pMap = new TraitToPropertyMap(typeAttribute);<NEW_LINE>t2pMap.updatePropertyValue(CdmPropertyName.IS_PRIMARY_KEY, entityName + "/(resolvedAttributes)/" + typeAttribute.getName());<NEW_LINE>}<NEW_LINE>typeAttribute.setExplanation(Utils.propertyFromDataToString(obj.get("explanation")));<NEW_LINE>typeAttribute.updateDescription(Utils.propertyFromDataToString(obj.get("description")));<NEW_LINE>typeAttribute.updateIsReadOnly(Utils.propertyFromDataToBoolean(obj.get("isReadOnly")));<NEW_LINE>typeAttribute.updateIsNullable(Utils.propertyFromDataToBoolean(obj.get("isNullable")));<NEW_LINE>typeAttribute.updateSourceName(Utils.propertyFromDataToString(obj.get("sourceName")));<NEW_LINE>typeAttribute.updateSourceOrdering(Utils.propertyFromDataToInt(obj.get("sourceOrdering")));<NEW_LINE>typeAttribute.updateDisplayName(Utils.propertyFromDataToString(obj.get("displayName")));<NEW_LINE>typeAttribute.updateValueConstrainedToList(Utils.propertyFromDataToBoolean(obj.get("valueConstrainedToList")));<NEW_LINE>typeAttribute.updateMaximumLength(Utils.propertyFromDataToInt(obj.get("maximumLength")));<NEW_LINE>typeAttribute.updateMaximumValue(Utils.propertyFromDataToString(obj.get("maximumValue")));<NEW_LINE>typeAttribute.updateMinimumValue(Utils.propertyFromDataToString(obj.get("minimumValue")));<NEW_LINE>typeAttribute.updateDefaultValue(obj.get("defaultValue"));<NEW_LINE>typeAttribute.setProjection(ProjectionPersistence.fromData(ctx, <MASK><NEW_LINE>final String dataFormat = obj.has("dataFormat") ? obj.get("dataFormat").asText() : null;<NEW_LINE>if (dataFormat != null) {<NEW_LINE>CdmDataFormat cdmDataFormat = CdmDataFormat.fromString(dataFormat);<NEW_LINE>if (cdmDataFormat != CdmDataFormat.Unknown) {<NEW_LINE>typeAttribute.updateDataFormat(cdmDataFormat);<NEW_LINE>} else {<NEW_LINE>Logger.warning(ctx, TAG, "fromData", null, CdmLogCode.WarnPersistEnumNotFound, dataFormat);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return typeAttribute;<NEW_LINE>} | obj.get("projection"))); |
1,714,860 | public boolean visit(TypeReference typeReference, BlockScope scope) {<NEW_LINE>if (this.continueSearch) {<NEW_LINE>inspectArrayDimensions(typeReference.getAnnotationsOnDimensions(), typeReference.dimensions());<NEW_LINE>if (this.continueSearch) {<NEW_LINE>int[] nestingDepths = computeNestingDepth(typeReference);<NEW_LINE>Annotation[][] annotations = typeReference.annotations;<NEW_LINE>TypeReference[][] typeArguments = typeReference.getTypeArguments();<NEW_LINE><MASK><NEW_LINE>int size = this.typePathEntries.size();<NEW_LINE>for (int i = levels - 1; this.continueSearch && i >= 0; i--) {<NEW_LINE>// traverse outwards, see comment below about type annotations from SE7 locations.<NEW_LINE>this.typePathEntries.setSize(size);<NEW_LINE>for (int j = 0, depth = nestingDepths[i]; j < depth; j++) this.typePathEntries.add(TYPE_PATH_INNER_TYPE);<NEW_LINE>if (annotations != null)<NEW_LINE>inspectAnnotations(annotations[i]);<NEW_LINE>if (this.continueSearch && typeArguments != null) {<NEW_LINE>inspectTypeArguments(typeArguments[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// if annotation is not found in the type reference, it must be one from SE7 location, typePathEntries captures the proper path entries for them.<NEW_LINE>return false;<NEW_LINE>} | int levels = typeReference.getAnnotatableLevels(); |
982,174 | static void exportAttributes(final ODTExporter thisNode, final String uuid, final SecurityContext securityContext) throws FrameworkException {<NEW_LINE>final File output = thisNode.getResultDocument();<NEW_LINE>final VirtualType transformation = thisNode.getTransformationProvider();<NEW_LINE>try {<NEW_LINE>final App app = StructrApp.getInstance(securityContext);<NEW_LINE>final ResultStream result = app.nodeQuery(AbstractNode.class).and(GraphObject.id, uuid).getResultStream();<NEW_LINE>final ResultStream transformedResult = transformation.transformOutput(<MASK><NEW_LINE>Map<String, Object> nodeProperties = new HashMap<>();<NEW_LINE>GraphObjectMap node = (GraphObjectMap) Iterables.first(transformedResult);<NEW_LINE>node.getPropertyKeys(null).forEach(p -> nodeProperties.put(p.dbName(), node.getProperty(p)));<NEW_LINE>TextDocument text = TextDocument.loadDocument(output.getFileOnDisk().getAbsolutePath());<NEW_LINE>NodeList nodes = text.getContentRoot().getElementsByTagName(ODT_FIELD_TAG_NAME);<NEW_LINE>for (int i = 0; i < nodes.getLength(); i++) {<NEW_LINE>Node currentNode = nodes.item(i);<NEW_LINE>NamedNodeMap attrs = currentNode.getAttributes();<NEW_LINE>Node fieldName = attrs.getNamedItem(ODT_FIELD_ATTRIBUTE_NAME);<NEW_LINE>Object nodeFieldValue = nodeProperties.get(fieldName.getNodeValue());<NEW_LINE>Node currentContent = attrs.getNamedItem(ODT_FIELD_ATTRIBUTE_VALUE);<NEW_LINE>if (nodeFieldValue != null) {<NEW_LINE>if (nodeFieldValue instanceof String[]) {<NEW_LINE>String[] arr = (String[]) nodeFieldValue;<NEW_LINE>List<String> list = new ArrayList<>(Arrays.asList(arr));<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>list.forEach(s -> sb.append(s + "\n"));<NEW_LINE>currentContent.setNodeValue(sb.toString());<NEW_LINE>} else if (nodeFieldValue instanceof Collection) {<NEW_LINE>Collection col = (Collection) nodeFieldValue;<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>col.forEach(s -> sb.append(s + "\n"));<NEW_LINE>currentContent.setNodeValue(sb.toString());<NEW_LINE>} else {<NEW_LINE>currentContent.setNodeValue(nodeFieldValue.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>text.save(output.getFileOnDisk().getAbsolutePath());<NEW_LINE>text.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>final Logger logger = LoggerFactory.getLogger(ODTExporter.class);<NEW_LINE>logger.error("Error while exporting to ODT", e);<NEW_LINE>}<NEW_LINE>} | securityContext, AbstractNode.class, result); |
1,265,996 | public String extractContent(String language, Path file) {<NEW_LINE>String content = null;<NEW_LINE>try (InputStream inputStream = Files.newInputStream(file);<NEW_LINE>PDDocument pdfDocument = PDDocument.load(inputStream)) {<NEW_LINE>content = new PDFTextStripper().getText(pdfDocument);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Error while extracting text from the PDF", e);<NEW_LINE>}<NEW_LINE>// No text content, try to OCR it<NEW_LINE>if (language != null && content != null && content.trim().isEmpty()) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>try (InputStream inputStream = Files.newInputStream(file);<NEW_LINE>PDDocument pdfDocument = PDDocument.load(inputStream)) {<NEW_LINE>PDFRenderer renderer = new PDFRenderer(pdfDocument);<NEW_LINE>for (int pageIndex = 0; pageIndex < pdfDocument.getNumberOfPages(); pageIndex++) {<NEW_LINE>log.info("OCR page " + (pageIndex + 1) + "/" + <MASK><NEW_LINE>sb.append(" ");<NEW_LINE>sb.append(FileUtil.ocrFile(language, renderer.renderImageWithDPI(pageIndex, 300, ImageType.GRAY)));<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Error while OCR-izing the PDF", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return content;<NEW_LINE>} | pdfDocument.getNumberOfPages() + " of PDF file containing only images"); |
121,703 | private static DegraderTrackerClient createDegraderTrackerClient(URI uri, UriProperties uriProperties, ServiceProperties serviceProperties, String loadBalancerStrategyName, TransportClient transportClient, Clock clock, boolean doNotSlowStart) {<NEW_LINE>DegraderImpl.Config config = null;<NEW_LINE>if (serviceProperties.getLoadBalancerStrategyProperties() != null) {<NEW_LINE>Map<String, Object> loadBalancerStrategyProperties = serviceProperties.getLoadBalancerStrategyProperties();<NEW_LINE>clock = MapUtil.getWithDefault(loadBalancerStrategyProperties, PropertyKeys.<MASK><NEW_LINE>}<NEW_LINE>if (serviceProperties.getDegraderProperties() != null && !serviceProperties.getDegraderProperties().isEmpty()) {<NEW_LINE>config = DegraderConfigFactory.toDegraderConfig(serviceProperties.getDegraderProperties());<NEW_LINE>config.setLogger(new RateLimitedLogger(LOG, LOG_RATE_MS, clock));<NEW_LINE>}<NEW_LINE>long trackerClientInterval = getInterval(loadBalancerStrategyName, serviceProperties);<NEW_LINE>Pattern errorStatusPattern = getErrorStatusPattern(serviceProperties);<NEW_LINE>return new DegraderTrackerClientImpl(uri, uriProperties.getPartitionDataMap(uri), transportClient, clock, config, trackerClientInterval, errorStatusPattern, doNotSlowStart);<NEW_LINE>} | CLOCK, clock, Clock.class); |
1,619,979 | public ResourceCreationResponseEntries resourceResourceIdChildrenPost(String resourceId, List<ResourceCreationRepresentationArrayInner> body, String cookie, String ifMatch, String conflictResolution, String lockToken, OptionsQueryParam option) throws ApiException {<NEW_LINE>Object localVarPostBody = body;<NEW_LINE>// verify the required parameter 'resourceId' is set<NEW_LINE>if (resourceId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'resourceId' when calling resourceResourceIdChildrenPost");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/resource/{resourceId}/children".replaceAll("\\{" + "resourceId" + "\\}", apiClient.escapeString(resourceId.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "conflictResolution", conflictResolution));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "lockToken", lockToken));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "option", option));<NEW_LINE>if (cookie != null)<NEW_LINE>localVarHeaderParams.put("cookie", apiClient.parameterToString(cookie));<NEW_LINE>if (ifMatch != null)<NEW_LINE>localVarHeaderParams.put("If-Match", apiClient.parameterToString(ifMatch));<NEW_LINE>final String[] localVarAccepts = { "application/json;charset=utf-8" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final <MASK><NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "bearerAuth" };<NEW_LINE>GenericType<ResourceCreationResponseEntries> localVarReturnType = new GenericType<ResourceCreationResponseEntries>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | String[] localVarContentTypes = { "application/json" }; |
674,287 | public static int parseChunkSize(ByteBuffer buffer, int start, int end) throws IOException {<NEW_LINE>byte[] bufa = buffer.array();<NEW_LINE>int size = 0;<NEW_LINE>for (int i = start; i < end; i++) {<NEW_LINE>byte b = bufa[i];<NEW_LINE>if (b >= b0 && b <= b9) {<NEW_LINE>size = size * 16 + (b - b0);<NEW_LINE>} else if (b >= ba && b <= bf) {<NEW_LINE>size = size * 16 + ((b - ba) + 10);<NEW_LINE>} else if (b >= bA && b <= bF) {<NEW_LINE>size = size * 16 + (<MASK><NEW_LINE>} else if (b == CR || b == SEMI) {<NEW_LINE>// SEMI-colon starts a chunk extension. We ignore extensions currently.<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>throw new IOException("Error parsing chunk size; unexpected char " + b + " at offset " + i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return size;<NEW_LINE>} | (b - bA) + 10); |
1,043,372 | public void scroll(Coordinates where, int xOffset, int yOffset) {<NEW_LINE>long downTime = SystemClock.uptimeMillis();<NEW_LINE>List<MotionEvent> motionEvents = new ArrayList<MotionEvent>();<NEW_LINE>Point origin = where.getLocationOnScreen();<NEW_LINE>Point destination = new Point(origin.x + xOffset, origin.y + yOffset);<NEW_LINE>motionEvents.add(getMotionEvent(downTime, downTime, MotionEvent.ACTION_DOWN, origin));<NEW_LINE>Scroll scroll = new <MASK><NEW_LINE>// Initial acceleration from origin to reference point<NEW_LINE>motionEvents.add(getBatchedMotionEvent(downTime, downTime, origin, scroll.getDecelerationPoint(), Scroll.INITIAL_STEPS, Scroll.TIME_BETWEEN_EVENTS));<NEW_LINE>// Deceleration phase from reference point to destination<NEW_LINE>motionEvents.add(getBatchedMotionEvent(downTime, scroll.getEventTimeForReferencePoint(), scroll.getDecelerationPoint(), destination, Scroll.DECELERATION_STEPS, Scroll.TIME_BETWEEN_EVENTS));<NEW_LINE>motionEvents.add(getMotionEvent(downTime, (downTime + scroll.getEventTimeForDestinationPoint()), MotionEvent.ACTION_UP, destination));<NEW_LINE>motions.send(motionEvents);<NEW_LINE>} | Scroll(origin, destination, downTime); |
1,504,968 | public void checkAndLoad(JSONObject rawRules) {<NEW_LINE>Long upperDuration = null;<NEW_LINE>if (rawRules.containsKey(FailureLevel.P0.name())) {<NEW_LINE>FailureLevelWithBoundary p0 = new FailureLevelWithBoundary(FailureLevel.P0);<NEW_LINE>p0.setLowerBoundary(TimeUtils.parseDuration(rawRules.getString(FailureLevel.P0.name())));<NEW_LINE>upperDuration = p0.getLowerBoundary();<NEW_LINE>failureLevels.add(p0);<NEW_LINE>}<NEW_LINE>if (rawRules.containsKey(FailureLevel.P1.name())) {<NEW_LINE>FailureLevelWithBoundary p1 = new FailureLevelWithBoundary(FailureLevel.P1);<NEW_LINE>p1.setLowerBoundary(TimeUtils.parseDuration(rawRules.getString(FailureLevel.P1.name())));<NEW_LINE>p1.setUpperBoundary(upperDuration);<NEW_LINE>upperDuration = p1.getLowerBoundary();<NEW_LINE>failureLevels.add(p1);<NEW_LINE>}<NEW_LINE>if (rawRules.containsKey(FailureLevel.P2.name())) {<NEW_LINE>FailureLevelWithBoundary p2 = new FailureLevelWithBoundary(FailureLevel.P2);<NEW_LINE>p2.setLowerBoundary(TimeUtils.parseDuration(rawRules.getString(FailureLevel.P2.name())));<NEW_LINE>p2.setUpperBoundary(upperDuration);<NEW_LINE>upperDuration = p2.getLowerBoundary();<NEW_LINE>failureLevels.add(p2);<NEW_LINE>}<NEW_LINE>if (rawRules.containsKey(FailureLevel.P3.name())) {<NEW_LINE>FailureLevelWithBoundary p3 = new FailureLevelWithBoundary(FailureLevel.P3);<NEW_LINE>p3.setLowerBoundary(TimeUtils.parseDuration(rawRules.getString(FailureLevel.P3.name())));<NEW_LINE>p3.setUpperBoundary(upperDuration);<NEW_LINE>upperDuration = p3.getLowerBoundary();<NEW_LINE>failureLevels.add(p3);<NEW_LINE>}<NEW_LINE>if (rawRules.containsKey(FailureLevel.P4.name())) {<NEW_LINE>FailureLevelWithBoundary p4 = new FailureLevelWithBoundary(FailureLevel.P4);<NEW_LINE>p4.setLowerBoundary(TimeUtils.parseDuration(rawRules.getString(FailureLevel.<MASK><NEW_LINE>p4.setUpperBoundary(upperDuration);<NEW_LINE>failureLevels.add(p4);<NEW_LINE>}<NEW_LINE>} | P4.name()))); |
1,050,030 | public static app.freerouting.geometry.planar.Area transform_area_to_board(Collection<Shape> p_area, CoordinateTransform p_coordinate_transform) {<NEW_LINE>int hole_count = p_area.size() - 1;<NEW_LINE>if (hole_count <= -1) {<NEW_LINE>FRLogger.warn("Shape.transform_area_to_board: p_area.size() > 0 expected");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Iterator<Shape<MASK><NEW_LINE>Shape boundary = it.next();<NEW_LINE>app.freerouting.geometry.planar.Shape boundary_shape = boundary.transform_to_board(p_coordinate_transform);<NEW_LINE>app.freerouting.geometry.planar.Area result;<NEW_LINE>if (hole_count == 0) {<NEW_LINE>result = boundary_shape;<NEW_LINE>} else {<NEW_LINE>// Area with holes<NEW_LINE>if (!(boundary_shape instanceof app.freerouting.geometry.planar.PolylineShape)) {<NEW_LINE>FRLogger.warn("Shape.transform_area_to_board: PolylineShape expected");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>PolylineShape border = (PolylineShape) boundary_shape;<NEW_LINE>PolylineShape[] holes = new PolylineShape[hole_count];<NEW_LINE>for (int i = 0; i < holes.length; ++i) {<NEW_LINE>app.freerouting.geometry.planar.Shape hole_shape = it.next().transform_to_board(p_coordinate_transform);<NEW_LINE>if (!(hole_shape instanceof PolylineShape)) {<NEW_LINE>FRLogger.warn("Shape.transform_area_to_board: PolylineShape expected");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>holes[i] = (PolylineShape) hole_shape;<NEW_LINE>}<NEW_LINE>result = new app.freerouting.geometry.planar.PolylineArea(border, holes);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | > it = p_area.iterator(); |
1,517,909 | private static void parsePokerSellStraight(List<PokerSell> pokerSells, SellType sellType) {<NEW_LINE>int minLength = -1;<NEW_LINE>int width = -1;<NEW_LINE>SellType targetSellType = null;<NEW_LINE>if (sellType == SellType.SINGLE) {<NEW_LINE>minLength = 5;<NEW_LINE>width = 1;<NEW_LINE>targetSellType = SellType.SINGLE_STRAIGHT;<NEW_LINE>} else if (sellType == SellType.DOUBLE) {<NEW_LINE>minLength = 3;<NEW_LINE>width = 2;<NEW_LINE>targetSellType = SellType.DOUBLE_STRAIGHT;<NEW_LINE>} else if (sellType == SellType.THREE) {<NEW_LINE>minLength = 2;<NEW_LINE>width = 3;<NEW_LINE>targetSellType = SellType.THREE_STRAIGHT;<NEW_LINE>} else if (sellType == SellType.BOMB) {<NEW_LINE>minLength = 2;<NEW_LINE>width = 4;<NEW_LINE>targetSellType = SellType.FOUR_STRAIGHT;<NEW_LINE>}<NEW_LINE>int increase_1 = 0;<NEW_LINE>int lastLevel_1 = -1;<NEW_LINE>List<Poker> sellPokers_1 = new ArrayList<>(4);<NEW_LINE>for (int index = 0; index < pokerSells.size(); index++) {<NEW_LINE>PokerSell <MASK><NEW_LINE>if (sell.getSellType() != sellType) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>int level = sell.getCoreLevel();<NEW_LINE>if (lastLevel_1 == -1) {<NEW_LINE>++increase_1;<NEW_LINE>} else {<NEW_LINE>if (level - 1 == lastLevel_1 && level != PokerLevel.LEVEL_2.getLevel()) {<NEW_LINE>++increase_1;<NEW_LINE>} else {<NEW_LINE>addPokers(pokerSells, minLength, width, targetSellType, increase_1, sellPokers_1);<NEW_LINE>increase_1 = 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sellPokers_1.addAll(sell.getSellPokers());<NEW_LINE>lastLevel_1 = level;<NEW_LINE>}<NEW_LINE>addPokers(pokerSells, minLength, width, targetSellType, increase_1, sellPokers_1);<NEW_LINE>} | sell = pokerSells.get(index); |
651,391 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see com.ibm.websphere.cache.CacheAdminMBean#invalidateCacheIDs(java.lang.String, java.lang.String, boolean)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public String[] invalidateCacheIDs(String cacheInstance, String pattern, boolean waitOnInvalidation) throws javax.management.AttributeNotFoundException {<NEW_LINE>// Get the cache for this cacheInstance<NEW_LINE>DCache cache1 = getCache(cacheInstance);<NEW_LINE>// Check to see if request is to clear the cache<NEW_LINE>if (pattern.equals("*")) {<NEW_LINE>cache1.clear();<NEW_LINE>if (tc.isDebugEnabled())<NEW_LINE><MASK><NEW_LINE>return new String[] { "*" };<NEW_LINE>}<NEW_LINE>// Check that the input pattern is a valid regular expression<NEW_LINE>Pattern cpattern = checkPattern(pattern);<NEW_LINE>// Get union of matches in memory and on disk<NEW_LINE>Collection<String> invalidateSet = new ArrayList<String>();<NEW_LINE>// Call mbeans to get matches in memory and on disk.<NEW_LINE>String[] memoryMatches = getCacheIDsInMemory(cacheInstance, pattern);<NEW_LINE>if (null != memoryMatches) {<NEW_LINE>for (int i = 0; i < memoryMatches.length; i++) {<NEW_LINE>invalidateSet.add(memoryMatches[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (cache1.getSwapToDisk()) {<NEW_LINE>String[] diskMatches = getCacheIDsOnDisk(cacheInstance, pattern);<NEW_LINE>if (null != diskMatches) {<NEW_LINE>for (int i = 0; i < diskMatches.length; i++) {<NEW_LINE>invalidateSet.add(diskMatches[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Iterator invalidates = invalidateSet.iterator();<NEW_LINE>// Invalidate the set of cache ids matched to the pattern and all<NEW_LINE>// entries dependent on the matched entry<NEW_LINE>while (invalidates.hasNext()) {<NEW_LINE>Object cacheID = invalidates.next();<NEW_LINE>cache1.invalidateById(cacheID, waitOnInvalidation);<NEW_LINE>}<NEW_LINE>if (tc.isDebugEnabled())<NEW_LINE>Tr.debug(tc, "invalidateCacheIDs: Exiting. Number of matches found = " + invalidateSet.size());<NEW_LINE>// need to convert to string array before return.<NEW_LINE>// Allocate output array #entries matched<NEW_LINE>String[] cids = invalidateSet.toArray(new String[invalidateSet.size()]);<NEW_LINE>return cids;<NEW_LINE>} | Tr.debug(tc, "invalidateCacheIDs: Exiting. Cleared memory and disk cache since input pattern is *"); |
695,955 | private void jbInit() throws Exception {<NEW_LINE>CompiereColor.setBackground(panel);<NEW_LINE>newBorder = new TitledBorder("");<NEW_LINE>accountBorder = new TitledBorder("");<NEW_LINE>mainPanel.setLayout(mainLayout);<NEW_LINE>newPanel.setBorder(newBorder);<NEW_LINE>newPanel.setLayout(newLayout);<NEW_LINE>newBorder.setTitle(Msg.getMsg(Env.getCtx(), "ChargeNewAccount"));<NEW_LINE>valueLabel.setText(Msg.translate(Env<MASK><NEW_LINE>isExpense.setSelected(true);<NEW_LINE>isExpense.setText(Msg.getMsg(Env.getCtx(), "Expense"));<NEW_LINE>nameLabel.setText(Msg.translate(Env.getCtx(), "Name"));<NEW_LINE>nameField.setColumns(20);<NEW_LINE>valueField.setColumns(10);<NEW_LINE>newButton.setText(Msg.getMsg(Env.getCtx(), "Create") + " " + Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New")));<NEW_LINE>newButton.addActionListener(this);<NEW_LINE>accountPanel.setBorder(accountBorder);<NEW_LINE>accountPanel.setLayout(accountLayout);<NEW_LINE>accountBorder.setTitle(Msg.getMsg(Env.getCtx(), "ChargeFromAccount"));<NEW_LINE>accountButton.setText(Msg.getMsg(Env.getCtx(), "Create") + " " + Msg.getMsg(Env.getCtx(), "From") + " " + Msg.getElement(Env.getCtx(), "Account_ID"));<NEW_LINE>accountButton.addActionListener(this);<NEW_LINE>accountOKPanel.setLayout(accountOKLayout);<NEW_LINE>accountOKLayout.setAlignment(FlowLayout.RIGHT);<NEW_LINE>confirmPanel.addActionListener(this);<NEW_LINE>//<NEW_LINE>mainPanel.add(newPanel, BorderLayout.NORTH);<NEW_LINE>newPanel.add(valueLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>newPanel.add(valueField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));<NEW_LINE>newPanel.add(nameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>newPanel.add(nameField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));<NEW_LINE>newPanel.add(isExpense, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>newPanel.add(newButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>mainPanel.add(accountPanel, BorderLayout.CENTER);<NEW_LINE>accountPanel.add(accountOKPanel, BorderLayout.SOUTH);<NEW_LINE>accountOKPanel.add(accountButton, null);<NEW_LINE>accountPanel.add(dataPane, BorderLayout.CENTER);<NEW_LINE>dataPane.getViewport().add(dataTable, null);<NEW_LINE>} | .getCtx(), "Value")); |
330,473 | protected Delete buildDelete(CassandraBackendEntry.Row entry) {<NEW_LINE>List<HugeKeys> idNames = this.idColumnName();<NEW_LINE>Delete delete = QueryBuilder.delete().<MASK><NEW_LINE>if (entry.columns().isEmpty()) {<NEW_LINE>// Delete just by id<NEW_LINE>List<Long> idValues = this.idColumnValue(entry);<NEW_LINE>assert idNames.size() == idValues.size();<NEW_LINE>for (int i = 0, n = idNames.size(); i < n; i++) {<NEW_LINE>delete.where(formatEQ(idNames.get(i), idValues.get(i)));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Delete just by column keys(must be id columns)<NEW_LINE>for (HugeKeys idName : idNames) {<NEW_LINE>// TODO: should support other filters (like containsKey)<NEW_LINE>delete.where(formatEQ(idName, entry.column(idName)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return delete;<NEW_LINE>} | from(this.table()); |
1,219,694 | public SQLStatement parseRollback() {<NEW_LINE>acceptIdentifier("ROLLBACK");<NEW_LINE>// DRDS async DDL.<NEW_LINE>if (isEnabled(SQLParserFeature.DRDSAsyncDDL) && lexer.identifierEquals("DDL")) {<NEW_LINE>// ROLLBACK DDL <job_id> [, <job_id>] ...<NEW_LINE>lexer.nextToken();<NEW_LINE>DrdsRollbackDDLJob stmt = new DrdsRollbackDDLJob();<NEW_LINE>while (true) {<NEW_LINE>stmt.addJobId(lexer.integerValue().longValue());<NEW_LINE>accept(Token.LITERAL_INT);<NEW_LINE>if (Token.COMMA == lexer.token()) {<NEW_LINE>lexer.nextToken();<NEW_LINE>} else if (lexer.token() == Token.EOF || lexer.token() == Token.SEMI) {<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>throw new ParserException("syntax error, expect job id, actual " + lexer.token() + ", " + lexer.info());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return stmt;<NEW_LINE>}<NEW_LINE>SQLRollbackStatement stmt = new SQLRollbackStatement();<NEW_LINE>if (lexer.identifierEquals("WORK")) {<NEW_LINE>lexer.nextToken();<NEW_LINE>}<NEW_LINE>if (lexer.token() == Token.AND) {<NEW_LINE>lexer.nextToken();<NEW_LINE>if (lexer.token() == Token.NOT) {<NEW_LINE>lexer.nextToken();<NEW_LINE>acceptIdentifier(CHAIN);<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>acceptIdentifier(CHAIN);<NEW_LINE>stmt.setChain(Boolean.TRUE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (lexer.token() == Token.TO) {<NEW_LINE>lexer.nextToken();<NEW_LINE>if (lexer.identifierEquals("SAVEPOINT")) {<NEW_LINE>lexer.nextToken();<NEW_LINE>}<NEW_LINE>stmt.setTo(this.exprParser.name());<NEW_LINE>}<NEW_LINE>return stmt;<NEW_LINE>} | stmt.setChain(Boolean.FALSE); |
1,187,574 | private boolean probeReferenceLocalDependencies(AttributeDefRef facet, Set<DefDescriptor<?>> processed) throws QuickFixException {<NEW_LINE>Object v = facet.getValue();<NEW_LINE>if (v instanceof ArrayList) {<NEW_LINE>for (Object fl : ((ArrayList<?>) v)) {<NEW_LINE>if (fl instanceof DefinitionReference) {<NEW_LINE>DefinitionReference cdr = (DefinitionReference) fl;<NEW_LINE>DefDescriptor<?> descriptor = cdr.getDescriptor();<NEW_LINE><MASK><NEW_LINE>if (defType == DefType.APPLICATION || defType == DefType.COMPONENT) {<NEW_LINE>if (!processed.contains(descriptor)) {<NEW_LINE>processed.add(descriptor);<NEW_LINE>BaseComponentDefImpl<?> def = (BaseComponentDefImpl<?>) descriptor.getDef();<NEW_LINE>if (def.hasLocalDependencies(processed)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (AttributeDefRef attrValue : cdr.getAttributeValueList()) {<NEW_LINE>if (probeReferenceLocalDependencies(attrValue, processed)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | DefType defType = descriptor.getDefType(); |
1,333,961 | private Optional<Submission> loadBaseCode(Set<File> rootDirectories, Map<File, Submission> foundSubmissions) throws ExitException {<NEW_LINE>// Extract the basecode submission if necessary.<NEW_LINE>Optional<Submission> baseCodeSubmission = Optional.empty();<NEW_LINE>if (options.hasBaseCode()) {<NEW_LINE>String baseCodeName = options.getBaseCodeSubmissionName().get();<NEW_LINE>Submission baseCode = loadBaseCodeAsPath(baseCodeName);<NEW_LINE>if (baseCode == null) {<NEW_LINE>if (rootDirectories.size() > 1) {<NEW_LINE>throw new BasecodeException("The base code submission needs to be specified by path instead of by name!");<NEW_LINE>}<NEW_LINE>File rootDirectory = rootDirectories.iterator().next();<NEW_LINE>// Single root-directory, try the legacy way of specifying basecode.<NEW_LINE>baseCode = loadBaseCodeViaName(baseCodeName, rootDirectory, foundSubmissions);<NEW_LINE>}<NEW_LINE>baseCodeSubmission = Optional.of(baseCode);<NEW_LINE>System.out.println(String.format("Basecode directory \"%s\" will be used.", baseCode.getName()));<NEW_LINE>// Basecode may also be registered as a user submission. If so, remove the latter.<NEW_LINE>Submission removed = foundSubmissions.<MASK><NEW_LINE>if (removed != null) {<NEW_LINE>System.out.println(String.format("Submission \"%s\" is the specified basecode, it will be skipped during comparison.", removed.getName()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return baseCodeSubmission;<NEW_LINE>} | remove(baseCode.getRoot()); |
1,138,337 | public short[] readShortArray(String name, short[] defVal) throws IOException {<NEW_LINE>try {<NEW_LINE>Element tmpEl;<NEW_LINE>if (name != null) {<NEW_LINE>tmpEl = findChildElement(currentElem, name);<NEW_LINE>} else {<NEW_LINE>tmpEl = currentElem;<NEW_LINE>}<NEW_LINE>if (tmpEl == null) {<NEW_LINE>return defVal;<NEW_LINE>}<NEW_LINE>String <MASK><NEW_LINE>String[] strings = parseTokens(tmpEl.getAttribute("data"));<NEW_LINE>if (sizeString.length() > 0) {<NEW_LINE>int requiredSize = Integer.parseInt(sizeString);<NEW_LINE>if (strings.length != requiredSize)<NEW_LINE>throw new IOException("Wrong number of shorts for '" + name + "'. size says " + requiredSize + ", data contains " + strings.length);<NEW_LINE>}<NEW_LINE>short[] tmp = new short[strings.length];<NEW_LINE>for (int i = 0; i < tmp.length; i++) {<NEW_LINE>tmp[i] = Short.parseShort(strings[i]);<NEW_LINE>}<NEW_LINE>return tmp;<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>throw ioe;<NEW_LINE>} catch (NumberFormatException | DOMException nfe) {<NEW_LINE>IOException io = new IOException(nfe.toString());<NEW_LINE>io.initCause(nfe);<NEW_LINE>throw io;<NEW_LINE>}<NEW_LINE>} | sizeString = tmpEl.getAttribute("size"); |
688,309 | /*<NEW_LINE>* localOrder<NEW_LINE>*/<NEW_LINE>void imposeLocalOrder(Comparator<BibEntry> entryComparator) {<NEW_LINE>// For JabRef52 the single pageInfo is always in the last-in-localorder citation.<NEW_LINE>// We adjust here accordingly by taking it out and adding it back after sorting.<NEW_LINE>final int last = this.numberOfCitations() - 1;<NEW_LINE>Optional<OOText> lastPageInfo = Optional.empty();<NEW_LINE>if (dataModel == OODataModel.JabRef52) {<NEW_LINE>Citation lastCitation = <MASK><NEW_LINE>lastPageInfo = lastCitation.getPageInfo();<NEW_LINE>lastCitation.setPageInfo(Optional.empty());<NEW_LINE>}<NEW_LINE>this.localOrder = OOListUtil.order(citationsInStorageOrder, new CompareCitation(entryComparator, true));<NEW_LINE>if (dataModel == OODataModel.JabRef52) {<NEW_LINE>getCitationsInLocalOrder().get(last).setPageInfo(lastPageInfo);<NEW_LINE>}<NEW_LINE>} | getCitationsInLocalOrder().get(last); |
1,754,091 | private void check(APIRecoverImageMsg msg, Map<String, Quota.QuotaPair> pairs) {<NEW_LINE>String currentAccountUuid = msg.getSession().getAccountUuid();<NEW_LINE>String resourceTargetOwnerAccountUuid = new QuotaUtil().getResourceOwnerAccountUuid(msg.getImageUuid());<NEW_LINE>long imageNumQuota = pairs.get(ImageQuotaConstant.IMAGE_NUM).getValue();<NEW_LINE>long imageSizeQuota = pairs.get(<MASK><NEW_LINE>long imageNumUsed = new ImageQuotaUtil().getUsedImageNum(resourceTargetOwnerAccountUuid);<NEW_LINE>long imageSizeUsed = new ImageQuotaUtil().getUsedImageSize(resourceTargetOwnerAccountUuid);<NEW_LINE>ImageVO image = dbf.getEntityManager().find(ImageVO.class, msg.getImageUuid());<NEW_LINE>long imageNumAsked = 1;<NEW_LINE>long imageSizeAsked = image.getSize();<NEW_LINE>QuotaUtil.QuotaCompareInfo quotaCompareInfo;<NEW_LINE>{<NEW_LINE>quotaCompareInfo = new QuotaUtil.QuotaCompareInfo();<NEW_LINE>quotaCompareInfo.currentAccountUuid = currentAccountUuid;<NEW_LINE>quotaCompareInfo.resourceTargetOwnerAccountUuid = resourceTargetOwnerAccountUuid;<NEW_LINE>quotaCompareInfo.quotaName = ImageQuotaConstant.IMAGE_NUM;<NEW_LINE>quotaCompareInfo.quotaValue = imageNumQuota;<NEW_LINE>quotaCompareInfo.currentUsed = imageNumUsed;<NEW_LINE>quotaCompareInfo.request = imageNumAsked;<NEW_LINE>new QuotaUtil().CheckQuota(quotaCompareInfo);<NEW_LINE>}<NEW_LINE>{<NEW_LINE>quotaCompareInfo = new QuotaUtil.QuotaCompareInfo();<NEW_LINE>quotaCompareInfo.currentAccountUuid = currentAccountUuid;<NEW_LINE>quotaCompareInfo.resourceTargetOwnerAccountUuid = resourceTargetOwnerAccountUuid;<NEW_LINE>quotaCompareInfo.quotaName = ImageQuotaConstant.IMAGE_SIZE;<NEW_LINE>quotaCompareInfo.quotaValue = imageSizeQuota;<NEW_LINE>quotaCompareInfo.currentUsed = imageSizeUsed;<NEW_LINE>quotaCompareInfo.request = imageSizeAsked;<NEW_LINE>new QuotaUtil().CheckQuota(quotaCompareInfo);<NEW_LINE>}<NEW_LINE>} | ImageQuotaConstant.IMAGE_SIZE).getValue(); |
1,056,285 | protected void persistCommit(BatchTracker committingBatch) {<NEW_LINE>TopoMasterCtrlEvent event = new TopoMasterCtrlEvent(EventType.transactionCommit);<NEW_LINE>event.addEventValue(committingBatch.getBatchId());<NEW_LINE>byte[] persistData = (byte[]) committingBatch.getState().getUserCheckpoint();<NEW_LINE>Object persistKey;<NEW_LINE>try {<NEW_LINE>persistKey = boltExecutor.commit(committingBatch.getBatchId(), Utils.maybe_deserialize(persistData));<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.warn("Failed to persist user checkpoint for batch-" + committingBatch.getBatchId(), e);<NEW_LINE>fail(committingBatch.getBatchId());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (persistKey == TransactionCommon.COMMIT_FAIL) {<NEW_LINE>LOG.warn("Failed to persist user checkpoint for batch-{}", committingBatch.getBatchId());<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>committingBatch.getState().setUserCheckpoint(persistKey);<NEW_LINE>event.addEventValue(committingBatch.getState());<NEW_LINE>outputCollector.emitDirectCtrl(topologyMasterId, Common.TOPOLOGY_MASTER_CONTROL_STREAM_ID, null, new Values(event));<NEW_LINE>} | fail(committingBatch.getBatchId()); |
1,855,539 | private // The derivatives are [0] spot, [1] strike, [2] rate, [3] cost-of-carry, [4] volatility, [5] timeToExpiry, [6] spot twice<NEW_LINE>ValueDerivatives priceDerivatives(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities) {<NEW_LINE>validate(option, ratesProvider, volatilities);<NEW_LINE>SimpleConstantContinuousBarrier barrier = (SimpleConstantContinuousBarrier) option.getBarrier();<NEW_LINE>ResolvedFxVanillaOption underlyingOption = option.getUnderlyingOption();<NEW_LINE>double[] derivatives = new double[7];<NEW_LINE>if (volatilities.relativeTime(underlyingOption.getExpiry()) < 0d) {<NEW_LINE>return ValueDerivatives.of(0d, DoubleArray.ofUnsafe(derivatives));<NEW_LINE>}<NEW_LINE>ResolvedFxSingle underlyingFx = underlyingOption.getUnderlying();<NEW_LINE>CurrencyPair currencyPair = underlyingFx.getCurrencyPair();<NEW_LINE>Currency ccyBase = currencyPair.getBase();<NEW_LINE><MASK><NEW_LINE>DiscountFactors baseDiscountFactors = ratesProvider.discountFactors(ccyBase);<NEW_LINE>DiscountFactors counterDiscountFactors = ratesProvider.discountFactors(ccyCounter);<NEW_LINE>double rateBase = baseDiscountFactors.zeroRate(underlyingFx.getPaymentDate());<NEW_LINE>double rateCounter = counterDiscountFactors.zeroRate(underlyingFx.getPaymentDate());<NEW_LINE>double costOfCarry = rateCounter - rateBase;<NEW_LINE>double dfBase = baseDiscountFactors.discountFactor(underlyingFx.getPaymentDate());<NEW_LINE>double dfCounter = counterDiscountFactors.discountFactor(underlyingFx.getPaymentDate());<NEW_LINE>double todayFx = ratesProvider.fxRate(currencyPair);<NEW_LINE>double strike = underlyingOption.getStrike();<NEW_LINE>double forward = todayFx * dfBase / dfCounter;<NEW_LINE>double volatility = volatilities.volatility(currencyPair, underlyingOption.getExpiry(), strike, forward);<NEW_LINE>double timeToExpiry = volatilities.relativeTime(underlyingOption.getExpiry());<NEW_LINE>ValueDerivatives valueDerivatives = BARRIER_PRICER.priceAdjoint(todayFx, strike, timeToExpiry, costOfCarry, rateCounter, volatility, underlyingOption.getPutCall().isCall(), barrier);<NEW_LINE>if (!option.getRebate().isPresent()) {<NEW_LINE>return valueDerivatives;<NEW_LINE>}<NEW_LINE>CurrencyAmount rebate = option.getRebate().get();<NEW_LINE>ValueDerivatives valueDerivativesRebate = rebate.getCurrency().equals(ccyCounter) ? CASH_REBATE_PRICER.priceAdjoint(todayFx, timeToExpiry, costOfCarry, rateCounter, volatility, barrier.inverseKnockType()) : ASSET_REBATE_PRICER.priceAdjoint(todayFx, timeToExpiry, costOfCarry, rateCounter, volatility, barrier.inverseKnockType());<NEW_LINE>double rebateRate = rebate.getAmount() / Math.abs(underlyingFx.getBaseCurrencyPayment().getAmount());<NEW_LINE>double price = valueDerivatives.getValue() + rebateRate * valueDerivativesRebate.getValue();<NEW_LINE>derivatives[0] = valueDerivatives.getDerivative(0) + rebateRate * valueDerivativesRebate.getDerivative(0);<NEW_LINE>derivatives[1] = valueDerivatives.getDerivative(1);<NEW_LINE>for (int i = 2; i < 7; ++i) {<NEW_LINE>derivatives[i] = valueDerivatives.getDerivative(i) + rebateRate * valueDerivativesRebate.getDerivative(i - 1);<NEW_LINE>}<NEW_LINE>return ValueDerivatives.of(price, DoubleArray.ofUnsafe(derivatives));<NEW_LINE>} | Currency ccyCounter = currencyPair.getCounter(); |
1,407,887 | public synchronized void updateFromTrackParameters(TrackParameters track) {<NEW_LINE>parameters.clear();<NEW_LINE>for (TrackedParameter p : track.getAllParameters()) {<NEW_LINE>Parameter<?> option = p.getParameter();<NEW_LINE>String value = null;<NEW_LINE>if (option.isDefined()) {<NEW_LINE>if (option.tookDefaultValue()) {<NEW_LINE>value = DynamicParameters.STRING_USE_DEFAULT + option.getDefaultValueAsString();<NEW_LINE>} else {<NEW_LINE>value = option.getValueAsString();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (value == null) {<NEW_LINE>value = (option instanceof Flag) ? Flag.NOT_SET : "";<NEW_LINE>}<NEW_LINE>int bits = 0;<NEW_LINE>if (option.isOptional()) {<NEW_LINE>bits |= BIT_OPTIONAL;<NEW_LINE>}<NEW_LINE>if (option.hasDefaultValue() && option.tookDefaultValue()) {<NEW_LINE>bits |= BIT_DEFAULT_VALUE;<NEW_LINE>}<NEW_LINE>if (value.length() <= 0) {<NEW_LINE>if ((bits & BIT_DEFAULT_VALUE) == 0 && (bits & BIT_OPTIONAL) == 0) {<NEW_LINE>bits |= BIT_INCOMPLETE;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>if (!option.tookDefaultValue() && !option.isValid(value)) {<NEW_LINE>bits |= BIT_INVALID;<NEW_LINE>}<NEW_LINE>} catch (ParameterException e) {<NEW_LINE>bits |= BIT_INVALID;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int depth = 0;<NEW_LINE>{<NEW_LINE>Object <MASK><NEW_LINE>while (pos != null) {<NEW_LINE>pos = track.getParent(pos);<NEW_LINE>depth += 1;<NEW_LINE>if (depth > 10) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>parameters.add(new Node(option, value, bits, depth));<NEW_LINE>}<NEW_LINE>} | pos = track.getParent(option); |
1,180,582 | public static Notebook buildNotebookResponse(NotebookCR notebookCR) {<NEW_LINE>Notebook notebook = new Notebook();<NEW_LINE>notebook.setUid(notebookCR.getMetadata().getUid());<NEW_LINE>notebook.setName(notebookCR.getMetadata().getName());<NEW_LINE>if (notebookCR.getMetadata().getCreationTimestamp() != null) {<NEW_LINE>notebook.setCreatedTime(notebookCR.getMetadata().getCreationTimestamp().toString());<NEW_LINE>}<NEW_LINE>// notebook url<NEW_LINE>notebook.setUrl("/notebook/" + notebookCR.getMetadata().getNamespace() + "/" + notebookCR.getMetadata(<MASK><NEW_LINE>// process status<NEW_LINE>Map<String, String> statusMap = processStatus(notebookCR);<NEW_LINE>notebook.setStatus(statusMap.get("status"));<NEW_LINE>notebook.setReason(statusMap.get("reason"));<NEW_LINE>if (notebookCR.getMetadata().getDeletionTimestamp() != null) {<NEW_LINE>notebook.setDeletedTime(notebookCR.getMetadata().getDeletionTimestamp().toString());<NEW_LINE>}<NEW_LINE>return notebook;<NEW_LINE>} | ).getName() + "/lab"); |
1,250,766 | private static void createRestorerInstance() {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.entry(tc, "createRestorerInstance");<NEW_LINE>try {<NEW_LINE>Class <MASK><NEW_LINE>instance = (SIMessageHandleRestorer) cls.newInstance();<NEW_LINE>} catch (Exception e) {<NEW_LINE>FFDCFilter.processException(e, "com.ibm.wsspi.sib.core.SIMessageHandleRestorer.createRestorerInstance", "100");<NEW_LINE>SibTr.error(tc, "UNABLE_TO_CREATE_HANDLERESTORER_CWSIB0010", e);<NEW_LINE>NoClassDefFoundError ncdfe = new NoClassDefFoundError(e.getMessage());<NEW_LINE>ncdfe.initCause(e);<NEW_LINE>throw ncdfe;<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.exit(tc, "createRestorerInstance");<NEW_LINE>} | cls = Class.forName(SI_MESSAGE_HANDLE_RESTORER_CLASS); |
1,448,738 | public void updateFilters() {<NEW_LINE>updateList(R.id.domainlist, SettingValues.<MASK><NEW_LINE>updateList(R.id.subredditlist, SettingValues.subredditFilters, SettingValues.subredditFilters::remove);<NEW_LINE>updateList(R.id.userlist, SettingValues.userFilters, SettingValues.userFilters::remove);<NEW_LINE>updateList(R.id.selftextlist, SettingValues.textFilters, SettingValues.textFilters::remove);<NEW_LINE>updateList(R.id.titlelist, SettingValues.titleFilters, SettingValues.titleFilters::remove);<NEW_LINE>((LinearLayout) findViewById(R.id.flairlist)).removeAllViews();<NEW_LINE>for (String s : SettingValues.flairFilters) {<NEW_LINE>final View t = getLayoutInflater().inflate(R.layout.account_textview, (LinearLayout) findViewById(R.id.domainlist), false);<NEW_LINE>SpannableStringBuilder b = new SpannableStringBuilder();<NEW_LINE>String subname = s.split(":")[0];<NEW_LINE>SpannableStringBuilder subreddit = new SpannableStringBuilder(" /r/" + subname + " ");<NEW_LINE>if ((SettingValues.colorSubName && Palette.getColor(subname) != Palette.getDefaultColor())) {<NEW_LINE>subreddit.setSpan(new ForegroundColorSpan(Palette.getColor(subname)), 0, subreddit.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);<NEW_LINE>subreddit.setSpan(new StyleSpan(Typeface.BOLD), 0, subreddit.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);<NEW_LINE>}<NEW_LINE>b.append(subreddit).append(s.split(":")[1]);<NEW_LINE>((TextView) t.findViewById(R.id.name)).setText(b);<NEW_LINE>t.findViewById(R.id.remove).setOnClickListener(v -> {<NEW_LINE>SettingValues.flairFilters.remove(s);<NEW_LINE>updateFilters();<NEW_LINE>});<NEW_LINE>((LinearLayout) findViewById(R.id.flairlist)).addView(t);<NEW_LINE>}<NEW_LINE>} | domainFilters, SettingValues.domainFilters::remove); |
1,402,990 | private GeoRelation relateTriangle(int aX, int aY, boolean ab, int bX, int bY, boolean bc, int cX, int cY, boolean ca) {<NEW_LINE>// compute bounding box of triangle<NEW_LINE>int tMinX = StrictMath.min(StrictMath.min(aX, bX), cX);<NEW_LINE>int tMaxX = StrictMath.max(StrictMath.max(aX, bX), cX);<NEW_LINE>int tMinY = StrictMath.min(StrictMath.min(aY, bY), cY);<NEW_LINE>int tMaxY = StrictMath.max(StrictMath.max<MASK><NEW_LINE>// 1. check bounding boxes are disjoint, where north and east boundaries are not considered as crossing<NEW_LINE>if (tMaxX <= minX || tMinX > maxX || tMinY > maxY || tMaxY <= minY) {<NEW_LINE>return GeoRelation.QUERY_DISJOINT;<NEW_LINE>}<NEW_LINE>// 2. query contains any triangle points<NEW_LINE>if (contains(aX, aY) || contains(bX, bY) || contains(cX, cY)) {<NEW_LINE>return GeoRelation.QUERY_CROSSES;<NEW_LINE>}<NEW_LINE>boolean within = false;<NEW_LINE>if (edgeIntersectsQuery(aX, aY, bX, bY)) {<NEW_LINE>if (ab) {<NEW_LINE>return GeoRelation.QUERY_CROSSES;<NEW_LINE>}<NEW_LINE>within = true;<NEW_LINE>}<NEW_LINE>// right<NEW_LINE>if (edgeIntersectsQuery(bX, bY, cX, cY)) {<NEW_LINE>if (bc) {<NEW_LINE>return GeoRelation.QUERY_CROSSES;<NEW_LINE>}<NEW_LINE>within = true;<NEW_LINE>}<NEW_LINE>if (edgeIntersectsQuery(cX, cY, aX, aY)) {<NEW_LINE>if (ca) {<NEW_LINE>return GeoRelation.QUERY_CROSSES;<NEW_LINE>}<NEW_LINE>within = true;<NEW_LINE>}<NEW_LINE>if (within || pointInTriangle(tMinX, tMaxX, tMinY, tMaxY, minX, minY, aX, aY, bX, bY, cX, cY)) {<NEW_LINE>return GeoRelation.QUERY_INSIDE;<NEW_LINE>}<NEW_LINE>return GeoRelation.QUERY_DISJOINT;<NEW_LINE>} | (aY, bY), cY); |
1,008,448 | static <T> Sampler<T> of(String specification) {<NEW_LINE>requireNonNull(specification, "specification");<NEW_LINE>switch(specification.trim()) {<NEW_LINE>case "always":<NEW_LINE>return Sampler.always();<NEW_LINE>case "never":<NEW_LINE>return Sampler.never();<NEW_LINE>}<NEW_LINE>final List<String> components = KEY_VALUE_SPLITTER.splitToList(specification);<NEW_LINE>checkArgument(components.size() == 2, IAE_MSG_TEMPLATE, specification);<NEW_LINE>final String <MASK><NEW_LINE>final String value = components.get(1);<NEW_LINE>try {<NEW_LINE>switch(key) {<NEW_LINE>case "random":<NEW_LINE>return Sampler.random(Float.parseFloat(value));<NEW_LINE>case "rate-limit":<NEW_LINE>case "rate-limiting":<NEW_LINE>case "rate-limited":<NEW_LINE>return Sampler.rateLimiting(Integer.parseInt(value));<NEW_LINE>default:<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new IllegalArgumentException(String.format(Locale.ROOT, IAE_MSG_TEMPLATE, specification), e);<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException(String.format(Locale.ROOT, IAE_MSG_TEMPLATE, specification));<NEW_LINE>} | key = components.get(0); |
1,812,480 | private static void addGroupForPhoneCode1() {<NEW_LINE>HashMap<String, String> nameCodeToAreaCodes = new HashMap<>();<NEW_LINE>// ANTIGUA_AND_BARBUDA_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("ag", "268");<NEW_LINE>// ANGUILLA_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("ai", "264");<NEW_LINE>// American Samoa<NEW_LINE>nameCodeToAreaCodes.put("as", "684");<NEW_LINE>// BARBADOS_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("bb", "246");<NEW_LINE>// BERMUDA_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("bm", "441");<NEW_LINE>// BAHAMAS_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("bs", "242");<NEW_LINE>// CANADA_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("ca", "204/226/236/249/250/289/306/343/365/403/416/418/431/437/438/450/506/514/519/579/581/587/600/601/604/613/639/647/705/709/769/778/780/782/807/819/825/867/873/902/905/");<NEW_LINE>// DOMINICA_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("dm", "767");<NEW_LINE>// DOMINICAN_REPUBLIC_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("do", "809/829/849");<NEW_LINE>// GRENADA_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("gd", "473");<NEW_LINE>// Guam<NEW_LINE>nameCodeToAreaCodes.put("gu", "671");<NEW_LINE>// JAMAICA_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("jm", "876");<NEW_LINE>// SAINT_KITTS_AND_NEVIS_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("kn", "869");<NEW_LINE>// CAYMAN_ISLANDS_AREA_CODES<NEW_LINE><MASK><NEW_LINE>// SAINT_LUCIA_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("lc", "758");<NEW_LINE>// Northern Mariana Islands<NEW_LINE>nameCodeToAreaCodes.put("mp", "670");<NEW_LINE>// MONTSERRAT_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("ms", "664");<NEW_LINE>// PUERTO_RICO_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("pr", "787");<NEW_LINE>// SINT_MAARTEN_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("sx", "721");<NEW_LINE>// TURKS_AND_CAICOS_ISLANDS_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("tc", "649");<NEW_LINE>// TRINIDAD_AND_TOBAGO_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("tt", "868");<NEW_LINE>// SAINT_VINCENT_AND_THE_GRENADINES_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("vc", "784");<NEW_LINE>// BRITISH_VIRGIN_ISLANDS_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("vg", "284");<NEW_LINE>// US_VIRGIN_ISLANDS_AREA_CODES<NEW_LINE>nameCodeToAreaCodes.put("vi", "340");<NEW_LINE>// USA<NEW_LINE>countryGroups.put(1, new CCPCountryGroup("us", 3, nameCodeToAreaCodes));<NEW_LINE>} | nameCodeToAreaCodes.put("ky", "345"); |
1,846,994 | final ListMediaCapturePipelinesResult executeListMediaCapturePipelines(ListMediaCapturePipelinesRequest listMediaCapturePipelinesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listMediaCapturePipelinesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListMediaCapturePipelinesRequest> request = null;<NEW_LINE>Response<ListMediaCapturePipelinesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListMediaCapturePipelinesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listMediaCapturePipelinesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Chime");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListMediaCapturePipelines");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListMediaCapturePipelinesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListMediaCapturePipelinesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
26,583 | protected void drawStretchEdgeEffect(Canvas canvas) {<NEW_LINE>if (mAllowOverScroll && (!mEdgeGlowRight.isFinished() || !mEdgeGlowLeft.isFinished())) {<NEW_LINE>final int width = getWidth();<NEW_LINE>final int height = getHeight();<NEW_LINE>if (!mEdgeGlowLeft.isFinished() && mEdgeGlowLeft instanceof StretchEdgeEffect) {<NEW_LINE>mEdgeGlowLeft.setSize(width, height);<NEW_LINE>((StretchEdgeEffect) mEdgeGlowLeft).applyStretch(canvas, StretchEdgeEffect.POSITION_LEFT);<NEW_LINE>}<NEW_LINE>if (!mEdgeGlowRight.isFinished() && mEdgeGlowRight instanceof StretchEdgeEffect) {<NEW_LINE><MASK><NEW_LINE>((StretchEdgeEffect) mEdgeGlowRight).applyStretch(canvas, StretchEdgeEffect.POSITION_RIGHT, -Math.max(mMaxScroll, getScrollX()), 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | mEdgeGlowRight.setSize(width, height); |
91,643 | // apply joint hierarchy to joint pose frames<NEW_LINE>private void buildSkeleton(BlockHeader blockHeader, long skelAddr) throws ParsingException {<NEW_LINE>SkeletonJoint[] joints = lookupSkeleton(blockHeader, skelAddr);<NEW_LINE>SkeletalAnimationSequence[] skelAnims = new SkeletalAnimationSequence[mAnimSet.length];<NEW_LINE>for (int i = 0; i < mAnimSet.length; i++) skelAnims[i] = (SkeletalAnimationSequence) mAnimSet[i];<NEW_LINE>Matrix4 scratch1 = new Matrix4();<NEW_LINE>Matrix4 scratch2 = new Matrix4();<NEW_LINE>for (SkeletalAnimationSequence skelSeq : skelAnims) {<NEW_LINE>for (SkeletalAnimationFrame frame : skelSeq.getFrames()) {<NEW_LINE>SkeletonJoint[] poses = frame.getSkeleton().getJoints();<NEW_LINE>// apply parent transforms<NEW_LINE>for (int i = 0; i < poses.length; i++) {<NEW_LINE>// matrix and index already set, need parent & other attribs<NEW_LINE>poses[i].setParentIndex(joints[i].getParentIndex());<NEW_LINE>if (// has parent joint<NEW_LINE>poses[i].getParentIndex() >= 0) {<NEW_LINE>SkeletonJoint parentPose = poses[poses[i].getParentIndex()];<NEW_LINE>scratch1.setAll(parentPose.getMatrix()).multiply(scratch2.setAll(poses[i].getMatrix()));<NEW_LINE>poses[i].setMatrix(scratch1.getDoubleValues());<NEW_LINE>} else<NEW_LINE>scratch1.setAll(poses<MASK><NEW_LINE>// assign pos + rot from final matrix<NEW_LINE>scratch1.getTranslation(poses[i].getPosition());<NEW_LINE>poses[i].getOrientation().fromMatrix(scratch1);<NEW_LINE>poses[i].getOrientation().computeW();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 0; i < mTargets.length; i++) {<NEW_LINE>SkeletalAnimationObject3D obj = (SkeletalAnimationObject3D) mTargets[i];<NEW_LINE>// assigns INVBP, builds BP, sets joints<NEW_LINE>obj.setJointsWithInverseBindPoseMatrices(joints);<NEW_LINE>for (int j = 0; j < obj.getNumChildren(); j++) {<NEW_LINE>SkeletalAnimationChildObject3D child = (SkeletalAnimationChildObject3D) obj.getChildAt(j);<NEW_LINE>SkeletalAnimationMaterialPlugin plugin = new SkeletalAnimationMaterialPlugin(child.getNumJoints(), child.getMaxBoneWeightsPerVertex());<NEW_LINE>child.getMaterial().addPlugin(plugin);<NEW_LINE>}<NEW_LINE>obj.setAnimationSequences(skelAnims);<NEW_LINE>obj.setAnimationSequence(mActive);<NEW_LINE>if (mAutoPlay)<NEW_LINE>obj.play(true);<NEW_LINE>}<NEW_LINE>} | [i].getMatrix()); |
890,190 | protected void executeCommand(Database database) throws Exception {<NEW_LINE>ByteArrayOutputStream errorStream = new ByteArrayOutputStream();<NEW_LINE>ByteArrayOutputStream inputStream = new ByteArrayOutputStream();<NEW_LINE>ProcessBuilder pb = createProcessBuilder(database);<NEW_LINE><MASK><NEW_LINE>int returnCode = 0;<NEW_LINE>try {<NEW_LINE>// output both stdout and stderr data from proc to stdout of this process<NEW_LINE>StreamGobbler errorGobbler = createErrorGobbler(p.getErrorStream(), errorStream);<NEW_LINE>StreamGobbler outputGobbler = createErrorGobbler(p.getInputStream(), inputStream);<NEW_LINE>errorGobbler.start();<NEW_LINE>outputGobbler.start();<NEW_LINE>// check if timeout is specified<NEW_LINE>// can't use Process's new api with timeout, so just workaround it for now<NEW_LINE>long timeoutInMillis = getTimeoutInMillis();<NEW_LINE>if (timeoutInMillis > 0) {<NEW_LINE>returnCode = waitForOrKill(p, timeoutInMillis);<NEW_LINE>} else {<NEW_LINE>// do default behavior for any value equal to or less than 0<NEW_LINE>returnCode = p.waitFor();<NEW_LINE>}<NEW_LINE>errorGobbler.finish();<NEW_LINE>outputGobbler.finish();<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>// Restore thread interrupt status<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>}<NEW_LINE>String errorStreamOut = errorStream.toString(GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());<NEW_LINE>String infoStreamOut = inputStream.toString(GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue());<NEW_LINE>if (errorStreamOut != null && !errorStreamOut.isEmpty()) {<NEW_LINE>Scope.getCurrentScope().getLog(getClass()).severe(errorStreamOut);<NEW_LINE>}<NEW_LINE>Scope.getCurrentScope().getLog(getClass()).info(infoStreamOut);<NEW_LINE>processResult(returnCode, errorStreamOut, infoStreamOut, database);<NEW_LINE>} | Process p = pb.start(); |
637,978 | public boolean reset(final long nextLogIndex) {<NEW_LINE>if (nextLogIndex <= 0) {<NEW_LINE>throw new IllegalArgumentException("Invalid next log index.");<NEW_LINE>}<NEW_LINE>this.writeLock.lock();<NEW_LINE>try (final Options opt = new Options()) {<NEW_LINE>LogEntry entry = getEntry(nextLogIndex);<NEW_LINE>closeDB();<NEW_LINE>try {<NEW_LINE>RocksDB.destroyDB(this.path, opt);<NEW_LINE>onReset(nextLogIndex);<NEW_LINE>if (initAndLoad(null)) {<NEW_LINE>if (entry == null) {<NEW_LINE>entry = new LogEntry();<NEW_LINE>entry.setType(EntryType.ENTRY_TYPE_NO_OP);<NEW_LINE>entry.setId(new LogId(nextLogIndex, 0));<NEW_LINE>LOG.warn("Entry not found for nextLogIndex {} when reset in data path: {}.", nextLogIndex, this.path);<NEW_LINE>}<NEW_LINE>return appendEntry(entry);<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} catch (final RocksDBException e) {<NEW_LINE><MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>this.writeLock.unlock();<NEW_LINE>}<NEW_LINE>} | LOG.error("Fail to reset next log index.", e); |
1,675,697 | private void standardize(IBaseResource theResource, Map<String, String> theRules, IFhirPath theFhirPath) {<NEW_LINE>for (Map.Entry<String, String> rule : theRules.entrySet()) {<NEW_LINE>IStandardizer std = getStandardizer(rule);<NEW_LINE>List<IBase> values;<NEW_LINE>try {<NEW_LINE>values = theFhirPath.evaluate(theResource, rule.getKey(), IBase.class);<NEW_LINE>} catch (FhirPathExecutionException e) {<NEW_LINE>ourLog.warn("Unable to evaluate path at {} for {}", <MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (IBase v : values) {<NEW_LINE>if (!(v instanceof IPrimitiveType)) {<NEW_LINE>ourLog.warn("Value at path {} is of type {}, which is not of primitive type - skipping", rule.getKey(), v.fhirType());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>IPrimitiveType<?> value = (IPrimitiveType<?>) v;<NEW_LINE>String valueString = value.getValueAsString();<NEW_LINE>String standardizedValueString = std.standardize(valueString);<NEW_LINE>value.setValueAsString(standardizedValueString);<NEW_LINE>ourLog.debug("Standardized {} to {}", valueString, standardizedValueString);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | rule.getKey(), theResource); |
766,568 | public CreateThesaurusResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateThesaurusResult createThesaurusResult = new CreateThesaurusResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return createThesaurusResult;<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("Id", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createThesaurusResult.setId(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 createThesaurusResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,717,628 | // clamp timerange to case<NEW_LINE>@SuppressWarnings("AssignmentToMethodParameter")<NEW_LINE>synchronized public void pushTimeAndType(Interval timeRange, TimelineEventType.HierarchyLevel typeZoom) throws TskCoreException {<NEW_LINE>Interval overlappingTimeRange = this.filteredEvents.getSpanningInterval().overlap(timeRange);<NEW_LINE>EventsModelParams currentZoom = filteredEvents.modelParamsProperty().get();<NEW_LINE>if (currentZoom == null) {<NEW_LINE>advance(InitialZoomState.withTimeAndType(overlappingTimeRange, typeZoom));<NEW_LINE>} else if (currentZoom.hasTimeRange(overlappingTimeRange) == false && currentZoom.hasTypeZoomLevel(typeZoom) == false) {<NEW_LINE>advance(currentZoom.withTimeAndType(overlappingTimeRange, typeZoom));<NEW_LINE>} else if (currentZoom.hasTimeRange(overlappingTimeRange) == false) {<NEW_LINE>advance(currentZoom.withTimeRange(overlappingTimeRange));<NEW_LINE>} else if (currentZoom.hasTypeZoomLevel(typeZoom) == false) {<NEW_LINE>advance<MASK><NEW_LINE>}<NEW_LINE>} | (currentZoom.withTypeZoomLevel(typeZoom)); |
89,148 | private Result serializerFor(DefaultSerdeDiscoveryState discovery, Type type, BuildProducer<GeneratedClassBuildItem> generatedClass, BuildProducer<ReflectiveClassBuildItem> reflection, Map<String, String> alreadyGeneratedSerializers) {<NEW_LINE>Result result = serializerDeserializerFor(discovery, type, true);<NEW_LINE>if (result != null && !result.exists) {<NEW_LINE>// avoid returning Result.nonexistent() to callers, they expect a non-null Result to always be known<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// if result is null, generate a jackson deserializer, generatedClass is null if the generation is disabled.<NEW_LINE>// also, only generate the serializer/deserializer for classes and only generate once<NEW_LINE>if (result == null && type != null && generatedClass != null && type.kind() == Type.Kind.CLASS) {<NEW_LINE>// Check if already generated<NEW_LINE>String clazz = alreadyGeneratedSerializers.get(type.toString());<NEW_LINE>if (clazz == null) {<NEW_LINE>clazz = <MASK><NEW_LINE>LOGGER.infof("Generating Jackson serializer for type %s", type.name().toString());<NEW_LINE>// Serializers are access by reflection.<NEW_LINE>reflection.produce(new ReflectiveClassBuildItem(true, true, false, clazz));<NEW_LINE>alreadyGeneratedSerializers.put(type.toString(), clazz);<NEW_LINE>}<NEW_LINE>result = Result.of(clazz);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | JacksonSerdeGenerator.generateSerializer(generatedClass, type); |
1,346,112 | void processBasicInfo() {<NEW_LINE>prj.name = (String) info.get("project_name");<NEW_LINE>prj.path = (String) info.get("project_path");<NEW_LINE>prj.status = (String) info.get("project_status");<NEW_LINE>prj.parentName = (String) info.get("project_parent_name");<NEW_LINE>prj.displayName = (String) info.get("project_display_name");<NEW_LINE>prj.description = (String) info.get("project_description");<NEW_LINE>prj.group = (<MASK><NEW_LINE>prj.buildDir = (File) info.get("project_buildDir");<NEW_LINE>prj.projectDir = (File) info.get("project_projectDir");<NEW_LINE>prj.rootDir = (File) info.get("project_rootDir");<NEW_LINE>prj.version = (String) info.get("project_version");<NEW_LINE>prj.license = (String) info.get("license");<NEW_LINE>prj.plugins = new TreeSet<>(createSet((Set<String>) info.get("plugins")));<NEW_LINE>Map<String, File> rawSubprojects = (Map<String, File>) info.get("project_subProjects");<NEW_LINE>Map<String, File> refinedSubprojects = (Map<String, File>) info.get("project_subProjects");<NEW_LINE>for (Map.Entry<String, File> entry : rawSubprojects.entrySet()) {<NEW_LINE>refinedSubprojects.put(entry.getKey(), entry.getValue().isAbsolute() ? entry.getValue() : new File(prj.rootDir, entry.getValue().toString()));<NEW_LINE>}<NEW_LINE>prj.subProjects = Collections.unmodifiableMap(refinedSubprojects);<NEW_LINE>prj.includedBuilds = (Map<String, File>) info.get("project_includedBuilds");<NEW_LINE>if (info.containsKey("buildClassPath")) {<NEW_LINE>prj.buildClassPath = (Set<File>) info.get("buildClassPath");<NEW_LINE>}<NEW_LINE>if (info.containsKey("nbprops")) {<NEW_LINE>Map<String, String> props = new HashMap<>((Map<String, String>) info.get("nbprops"));<NEW_LINE>prj.netBeansProperties = Collections.unmodifiableMap(props);<NEW_LINE>}<NEW_LINE>} | String) info.get("project_group"); |
884,372 | public // to workaround an issue with references<NEW_LINE>SqlCommand sanitizeForQuery() {<NEW_LINE>if (rawArguments.size() == 0) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>StringBuilder sanitizeSqlSb = new StringBuilder();<NEW_LINE>List<Object> sanitizeArguments = new ArrayList<>();<NEW_LINE>int count = 0;<NEW_LINE>int argumentIndex = 0;<NEW_LINE>int sqlLength = sql.length();<NEW_LINE>for (int i = 0; i < sqlLength; i++) {<NEW_LINE>char ch = sql.charAt(i);<NEW_LINE>if (ch == '?') {<NEW_LINE>// If it is followed by a number<NEW_LINE>// it is an indexed param, cancel our weird conversion<NEW_LINE>if ((i + 1 < sqlLength) && Character.isDigit(sql.charAt(i + 1))) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>count++;<NEW_LINE>// no match, return the same<NEW_LINE>if (argumentIndex >= rawArguments.size()) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>Object argument = rawArguments.get(argumentIndex++);<NEW_LINE>if (argument instanceof Integer || argument instanceof Long) {<NEW_LINE>sanitizeSqlSb.append(argument.toString());<NEW_LINE>continue;<NEW_LINE>} else {<NEW_LINE>// Let the other args as is<NEW_LINE>sanitizeArguments.add(argument);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Simply append the existing<NEW_LINE>sanitizeSqlSb.append(ch);<NEW_LINE>}<NEW_LINE>// no match (there might be an extra ? somwhere), return the same<NEW_LINE>if (count != rawArguments.size()) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>return new SqlCommand(<MASK><NEW_LINE>} | sanitizeSqlSb.toString(), sanitizeArguments); |
380,360 | private boolean snapEqualToParallelSnap(LayoutInterval snapped, boolean parallel, int alignment, LayoutInterval otherSnapped) {<NEW_LINE>if (snapped.getParent() == null) {<NEW_LINE>// snapped to root<NEW_LINE>LayoutInterval group = otherSnapped.isGroup() ? otherSnapped : otherSnapped.getParent();<NEW_LINE>while (group != snapped) {<NEW_LINE>if (LayoutInterval.isPlacedAtBorder(group, snapped, dimension, alignment)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>group = group.getParent();<NEW_LINE>}<NEW_LINE>return LayoutUtils.anythingAtGroupEdge(<MASK><NEW_LINE>}<NEW_LINE>if (parallel) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>LayoutInterval neighborGap = LayoutInterval.getDirectNeighbor(snapped, alignment ^ 1, false);<NEW_LINE>return neighborGap != null && neighborGap.isEmptySpace() && neighborGap.getPreferredSize() == NOT_EXPLICITLY_DEFINED && neighborGap.getDiffToDefaultSize() == 0;<NEW_LINE>} | group, null, dimension, alignment); |
840,961 | public void checkin(long poid, String comment) throws ServerException, UserException, PublicInterfaceNotFoundException {<NEW_LINE>this.fixOids(new OidProvider() {<NEW_LINE><NEW_LINE>private long c = 1;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public long newOid(EClass eClass) {<NEW_LINE>return c++;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>try {<NEW_LINE>Class<?> stepSerializerClass = getPluginClassLoaderProvider().getClassLoaderFor("org.bimserver.ifc.step.serializer.Ifc2x3tc1StepSerializerPlugin").loadClass("org.bimserver.ifc.step.serializer.IfcStepSerializer");<NEW_LINE>Constructor<Serializer> constructor = (Constructor<Serializer>) stepSerializerClass.getConstructor(PluginConfiguration.class);<NEW_LINE>Serializer ifcStepSerializer = (Serializer) constructor<MASK><NEW_LINE>ProjectInfo projectInfo = new ProjectInfo();<NEW_LINE>ifcStepSerializer.init(this, projectInfo, true);<NEW_LINE>((HeaderTakingSerializer) ifcStepSerializer).setHeaderSchema(getPackageMetaData().getSchema().getHeaderName());<NEW_LINE>SDeserializerPluginConfiguration deserializer = bimServerClient.getServiceInterface().getSuggestedDeserializerForExtension("ifc", poid);<NEW_LINE>bimServerClient.checkinSync(poid, comment, deserializer.getOid(), false, -1, "test", new SerializerInputstream(ifcStepSerializer));<NEW_LINE>} catch (SerializerException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (ClassNotFoundException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (InstantiationException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (SecurityException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | .newInstance(new PluginConfiguration()); |
26,795 | public void commandStarted(CommandStartedEvent event) {<NEW_LINE>String databaseName = event.getDatabaseName();<NEW_LINE>// don't trace commands like "endSessions"<NEW_LINE>if ("admin".equals(databaseName))<NEW_LINE>return;<NEW_LINE>Span span = threadLocalSpan.next();<NEW_LINE>if (span == null || span.isNoop())<NEW_LINE>return;<NEW_LINE>String commandName = event.getCommandName();<NEW_LINE>BsonDocument command = event.getCommand();<NEW_LINE>String collectionName = getCollectionName(command, commandName);<NEW_LINE>span.name(getSpanName(commandName, collectionName)).kind(CLIENT).remoteServiceName("mongodb-" + databaseName<MASK><NEW_LINE>if (collectionName != null) {<NEW_LINE>span.tag("mongodb.collection", collectionName);<NEW_LINE>}<NEW_LINE>ConnectionDescription connectionDescription = event.getConnectionDescription();<NEW_LINE>if (connectionDescription != null) {<NEW_LINE>ConnectionId connectionId = connectionDescription.getConnectionId();<NEW_LINE>if (connectionId != null) {<NEW_LINE>span.tag("mongodb.cluster_id", connectionId.getServerId().getClusterId().getValue());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>InetSocketAddress socketAddress = connectionDescription.getServerAddress().getSocketAddress();<NEW_LINE>span.remoteIpAndPort(socketAddress.getAddress().getHostAddress(), socketAddress.getPort());<NEW_LINE>} catch (MongoSocketException ignored) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>span.start();<NEW_LINE>} | ).tag("mongodb.command", commandName); |
58,341 | protected ScatterData generateScatterData(int dataSets, float range, int count) {<NEW_LINE>ArrayList<IScatterDataSet> sets = new ArrayList<>();<NEW_LINE>ScatterChart.ScatterShape[] shapes = ScatterChart.ScatterShape.getAllDefaultShapes();<NEW_LINE>for (int i = 0; i < dataSets; i++) {<NEW_LINE>ArrayList<Entry> entries = new ArrayList<>();<NEW_LINE>for (int j = 0; j < count; j++) {<NEW_LINE>entries.add(new Entry(j, (float) (Math.random() * <MASK><NEW_LINE>}<NEW_LINE>ScatterDataSet ds = new ScatterDataSet(entries, getLabel(i));<NEW_LINE>ds.setScatterShapeSize(12f);<NEW_LINE>ds.setScatterShape(shapes[i % shapes.length]);<NEW_LINE>ds.setColors(ColorTemplate.COLORFUL_COLORS);<NEW_LINE>ds.setScatterShapeSize(9f);<NEW_LINE>sets.add(ds);<NEW_LINE>}<NEW_LINE>ScatterData d = new ScatterData(sets);<NEW_LINE>d.setValueTypeface(tf);<NEW_LINE>return d;<NEW_LINE>} | range) + range / 4)); |
1,696,202 | public void serializeWithType(final JanusGraphP value, final JsonGenerator jgen, final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException {<NEW_LINE>String predicateName = value.getBiPredicate().toString();<NEW_LINE>Object arg = value.getValue();<NEW_LINE>jgen.writeStartObject();<NEW_LINE>if (typeSerializer != null)<NEW_LINE>jgen.writeStringField(GraphSONTokens.VALUETYPE, TYPE_NAMESPACE + ":" + TYPE_DEFINITIONS.get(JanusGraphP.class));<NEW_LINE>jgen.writeFieldName(GraphSONTokens.VALUEPROP);<NEW_LINE>GraphSONUtil.writeStartObject(value, jgen, typeSerializer);<NEW_LINE>GraphSONUtil.writeWithType(GraphSONTokens.PREDICATE, predicateName, jgen, serializerProvider, typeSerializer);<NEW_LINE>GraphSONUtil.writeWithType(GraphSONTokens.VALUE, <MASK><NEW_LINE>GraphSONUtil.writeEndObject(value, jgen, typeSerializer);<NEW_LINE>jgen.writeEndObject();<NEW_LINE>} | arg, jgen, serializerProvider, typeSerializer); |
873,899 | public static long Extend(long fp, int x) {<NEW_LINE>final long[] mod = ByteModTable_7;<NEW_LINE>byte b = (byte) (x & 0xFF);<NEW_LINE>fp = ((fp >>> 8) ^ (mod[(b ^ ((int) fp)) & 0xFF]));<NEW_LINE>x = x >>> 8;<NEW_LINE>b = (byte) (x & 0xFF);<NEW_LINE>fp = ((fp >>> 8) ^ (mod[(b ^ ((int) <MASK><NEW_LINE>x = x >>> 8;<NEW_LINE>b = (byte) (x & 0xFF);<NEW_LINE>fp = ((fp >>> 8) ^ (mod[(b ^ ((int) fp)) & 0xFF]));<NEW_LINE>x = x >>> 8;<NEW_LINE>b = (byte) (x & 0xFF);<NEW_LINE>fp = ((fp >>> 8) ^ (mod[(b ^ ((int) fp)) & 0xFF]));<NEW_LINE>return fp;<NEW_LINE>} | fp)) & 0xFF])); |
800,865 | private Map<String, Supplier<ReferenceBinding>> initializeCommonTypeBindings() {<NEW_LINE>if (this.commonTypeBindings != null)<NEW_LINE>return this.commonTypeBindings;<NEW_LINE>Map<String, Supplier<ReferenceBinding>> t = new HashMap<>();<NEW_LINE>t.put(new String(ConstantPool.JavaLangAssertionErrorConstantPoolName), this::getJavaLangAssertionError);<NEW_LINE>t.put(new String(ConstantPool.JavaLangErrorConstantPoolName), this::getJavaLangError);<NEW_LINE>t.put(new String(ConstantPool.JavaLangIncompatibleClassChangeErrorConstantPoolName), this::getJavaLangIncompatibleClassChangeError);<NEW_LINE>t.put(new String(ConstantPool.JavaLangNoClassDefFoundErrorConstantPoolName), this::getJavaLangNoClassDefFoundError);<NEW_LINE>t.put(new String(ConstantPool.JavaLangStringBufferConstantPoolName), this::getJavaLangStringBuffer);<NEW_LINE>t.put(new String(ConstantPool.JavaLangIntegerConstantPoolName), this::getJavaLangInteger);<NEW_LINE>t.put(new String(ConstantPool.JavaLangBooleanConstantPoolName), this::getJavaLangBoolean);<NEW_LINE>t.put(new String(ConstantPool.JavaLangByteConstantPoolName), this::getJavaLangByte);<NEW_LINE>t.put(new String(ConstantPool<MASK><NEW_LINE>t.put(new String(ConstantPool.JavaLangFloatConstantPoolName), this::getJavaLangFloat);<NEW_LINE>t.put(new String(ConstantPool.JavaLangDoubleConstantPoolName), this::getJavaLangDouble);<NEW_LINE>t.put(new String(ConstantPool.JavaLangShortConstantPoolName), this::getJavaLangShort);<NEW_LINE>t.put(new String(ConstantPool.JavaLangLongConstantPoolName), this::getJavaLangLong);<NEW_LINE>t.put(new String(ConstantPool.JavaLangVoidConstantPoolName), this::getJavaLangVoid);<NEW_LINE>t.put(new String(ConstantPool.JavaLangStringConstantPoolName), this::getJavaLangString);<NEW_LINE>t.put(new String(ConstantPool.JavaLangStringBuilderConstantPoolName), this::getJavaLangStringBuilder);<NEW_LINE>t.put(new String(ConstantPool.JavaLangClassConstantPoolName), this::getJavaLangClass);<NEW_LINE>t.put(new String(ConstantPool.JAVALANGREFLECTFIELD_CONSTANTPOOLNAME), this::getJavaLangReflectField);<NEW_LINE>t.put(new String(ConstantPool.JAVALANGREFLECTMETHOD_CONSTANTPOOLNAME), this::getJavaLangReflectMethod);<NEW_LINE>t.put(new String(ConstantPool.JavaUtilIteratorConstantPoolName), this::getJavaUtilIterator);<NEW_LINE>t.put(new String(ConstantPool.JavaLangEnumConstantPoolName), this::getJavaLangEnum);<NEW_LINE>t.put(new String(ConstantPool.JavaLangObjectConstantPoolName), this::getJavaLangObject);<NEW_LINE>return this.commonTypeBindings = t;<NEW_LINE>} | .JavaLangCharacterConstantPoolName), this::getJavaLangCharacter); |
184,133 | public void marshall(CreateLicenseVersionRequest createLicenseVersionRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createLicenseVersionRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getLicenseArn(), LICENSEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getProductName(), PRODUCTNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getIssuer(), ISSUER_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getHomeRegion(), HOMEREGION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getValidity(), VALIDITY_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getLicenseMetadata(), LICENSEMETADATA_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getEntitlements(), ENTITLEMENTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getConsumptionConfiguration(), CONSUMPTIONCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getClientToken(), CLIENTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(createLicenseVersionRequest.getSourceVersion(), SOURCEVERSION_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createLicenseVersionRequest.getLicenseName(), LICENSENAME_BINDING); |
377,513 | private void processData(final LayerLightEngine<?, ?> lightProvider, final boolean doSkylight, final boolean skipEdgeLightPropagation, final CallbackInfo ci) {<NEW_LINE>// Process light removal<NEW_LINE>for (final long cPos : this.removedChunks) {<NEW_LINE>for (int y = -1; y < 17; ++y) {<NEW_LINE>final long sectionPos = SectionPos.asLong(SectionPos.x(cPos), y<MASK><NEW_LINE>this.queuedSections.remove(sectionPos);<NEW_LINE>if (this.storingLightForSection(sectionPos)) {<NEW_LINE>this.clearQueuedSectionBlocks(lightProvider, sectionPos);<NEW_LINE>if (this.changedSections.add(sectionPos))<NEW_LINE>this.updatingSectionData.copyDataLayer(sectionPos);<NEW_LINE>Arrays.fill(this.getDataLayer(sectionPos, true).getData(), (byte) 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.processRemoveLightData(cPos);<NEW_LINE>}<NEW_LINE>this.removedChunks.clear();<NEW_LINE>// Process relighting<NEW_LINE>for (final long cPos : this.relightChunks) this.processRelight(lightProvider, cPos);<NEW_LINE>this.relightChunks.clear();<NEW_LINE>} | , SectionPos.z(cPos)); |
571,420 | private void lookupAddressForMyLocationPoint() {<NEW_LINE>if (myLocationToStart != null && myLocationToStart.isSearchingAddress(ctx) && (myLocationPointRequest == null || !myLocationPointRequest.getLatLon().equals(myLocationToStart.point))) {<NEW_LINE>cancelMyLocationPointAddressRequest();<NEW_LINE>myLocationPointRequest = new AddressLookupRequest(myLocationToStart.point, new OnAddressLookupResult() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void geocodingDone(String address) {<NEW_LINE>myLocationPointRequest = null;<NEW_LINE>if (myLocationToStart != null) {<NEW_LINE>myLocationToStart.pointDescription.setName(address);<NEW_LINE>settings.setMyLocationToStart(myLocationToStart.point.getLatitude(), myLocationToStart.point.getLongitude(), myLocationToStart.pointDescription);<NEW_LINE>updateRouteAndRefresh(false);<NEW_LINE>updateTargetPoint(myLocationToStart);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}, null);<NEW_LINE>ctx.<MASK><NEW_LINE>}<NEW_LINE>} | getGeocodingLookupService().lookupAddress(myLocationPointRequest); |
1,541,358 | public int encodingLengthBytes() {<NEW_LINE>// TODO store byte[]s so we don't end up calculating again in encode<NEW_LINE>// SBE buffer is composed of:<NEW_LINE>// (a) Header: 8 bytes (4x uint16 = 8 bytes)<NEW_LINE>// (b) timestamp: fixed length long value (8 bytes)<NEW_LINE>// (b) 5 variable length fields. 4 bytes header (each) + content = 20 bytes + content<NEW_LINE>// (c) Variable length byte[]. 4 bytes header + content<NEW_LINE>int bufferSize <MASK><NEW_LINE>byte[] bSessionID = SbeUtil.toBytes(true, sessionID);<NEW_LINE>byte[] bTypeID = SbeUtil.toBytes(true, typeID);<NEW_LINE>byte[] bWorkerID = SbeUtil.toBytes(true, workerID);<NEW_LINE>byte[] bInitTypeClass = SbeUtil.toBytes(true, initTypeClass);<NEW_LINE>byte[] bUpdateTypeClass = SbeUtil.toBytes(true, updateTypeClass);<NEW_LINE>byte[] bExtraMetaData = SbeUtil.toBytesSerializable(extraMeta);<NEW_LINE>bufferSize += bSessionID.length + bTypeID.length + bWorkerID.length + bInitTypeClass.length + bUpdateTypeClass.length + bExtraMetaData.length;<NEW_LINE>return bufferSize;<NEW_LINE>} | = 8 + 8 + 20 + 4; |
1,113,813 | public synchronized Collection<ProjectProblem> doIDEConfigChecks() {<NEW_LINE>Collection<ProjectProblem> toRet = new ArrayList<ProjectProblem>();<NEW_LINE>NbMavenProject nbproject = project.getLookup().lookup(NbMavenProject.class);<NEW_LINE><MASK><NEW_LINE>if (packagings.contains(packaging)) {<NEW_LINE>// TODO check on lastpackaging to prevent re-calculation<NEW_LINE>ModuleInfo moduleInfo = listener != null ? listener.info : findModule(moduleCodenameBase);<NEW_LINE>boolean foundModule = moduleInfo != null && moduleInfo.isEnabled();<NEW_LINE>if (!foundModule) {<NEW_LINE>if (listener == null) {<NEW_LINE>ProjectProblem problem = ProjectProblem.createWarning(problemName, problemDescription, new InstallModulesResolver(kitCodeNameBase));<NEW_LINE>listener = new EnablementListener(moduleInfo, problem);<NEW_LINE>listener.startListening();<NEW_LINE>}<NEW_LINE>toRet.add(listener.problem);<NEW_LINE>} else {<NEW_LINE>if (listener != null) {<NEW_LINE>listener.stopListening();<NEW_LINE>listener = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastPackaging = packaging;<NEW_LINE>return toRet;<NEW_LINE>} | String packaging = nbproject.getPackagingType(); |
1,359,410 | public JwtResponse dynamicBuilderSpecific(@RequestBody Map<String, Object> claims) throws UnsupportedEncodingException {<NEW_LINE>JwtBuilder builder = Jwts.builder();<NEW_LINE>claims.forEach((key, value) -> {<NEW_LINE>switch(key) {<NEW_LINE>case "iss":<NEW_LINE>ensureType(key, value, String.class);<NEW_LINE>builder.setIssuer((String) value);<NEW_LINE>break;<NEW_LINE>case "sub":<NEW_LINE>ensureType(key, value, String.class);<NEW_LINE>builder<MASK><NEW_LINE>break;<NEW_LINE>case "aud":<NEW_LINE>ensureType(key, value, String.class);<NEW_LINE>builder.setAudience((String) value);<NEW_LINE>break;<NEW_LINE>case "exp":<NEW_LINE>ensureType(key, value, Long.class);<NEW_LINE>builder.setExpiration(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString()))));<NEW_LINE>break;<NEW_LINE>case "nbf":<NEW_LINE>ensureType(key, value, Long.class);<NEW_LINE>builder.setNotBefore(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString()))));<NEW_LINE>break;<NEW_LINE>case "iat":<NEW_LINE>ensureType(key, value, Long.class);<NEW_LINE>builder.setIssuedAt(Date.from(Instant.ofEpochSecond(Long.parseLong(value.toString()))));<NEW_LINE>break;<NEW_LINE>case "jti":<NEW_LINE>ensureType(key, value, String.class);<NEW_LINE>builder.setId((String) value);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>builder.claim(key, value);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>builder.signWith(SignatureAlgorithm.HS256, secretService.getHS256SecretBytes());<NEW_LINE>return new JwtResponse(builder.compact());<NEW_LINE>} | .setSubject((String) value); |
1,045,579 | public void saveDetails(HttpResponse method, HTTPSampleResult res) {<NEW_LINE>final String varyHeader = getHeader(method, HTTPConstants.VARY);<NEW_LINE>if (isCacheable(res, varyHeader)) {<NEW_LINE>String lastModified = getHeader(method, HTTPConstants.LAST_MODIFIED);<NEW_LINE>String expires = getHeader(method, HTTPConstants.EXPIRES);<NEW_LINE>String etag = getHeader(method, HTTPConstants.ETAG);<NEW_LINE>String cacheControl = getHeader(method, HTTPConstants.CACHE_CONTROL);<NEW_LINE>String date = getHeader(method, HTTPConstants.DATE);<NEW_LINE>if (anyNotBlank(lastModified, expires, etag, cacheControl)) {<NEW_LINE>setCache(lastModified, cacheControl, expires, etag, res.getUrlAsString(), date, // TODO correct URL?<NEW_LINE>getVaryHeader(// TODO correct URL?<NEW_LINE>varyHeader, asHeaders(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | res.getRequestHeaders()))); |
206,456 | public void actionPerformed(AnActionEvent e) {<NEW_LINE>final Project project = e.getDataContext().getData(CommonDataKeys.PROJECT);<NEW_LINE>String m = "Started loading content";<NEW_LINE>LOG.info(m);<NEW_LINE>System.out.println(m);<NEW_LINE>long start = System.currentTimeMillis();<NEW_LINE>count.set(0);<NEW_LINE>totalSize.set(0);<NEW_LINE>ApplicationManagerEx.getApplicationEx().runProcessWithProgressSynchronously(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>ProjectRootManager.getInstance(project).getFileIndex().iterateContent(new ContentIterator() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean processFile(VirtualFile fileOrDir) {<NEW_LINE>if (fileOrDir.isDirectory() || fileOrDir.is(VFileProperty.SPECIAL))<NEW_LINE>return true;<NEW_LINE>try {<NEW_LINE>count.incrementAndGet();<NEW_LINE>byte[] bytes = FileUtil.loadFileBytes(new File(fileOrDir.getPath()));<NEW_LINE>totalSize.addAndGet(bytes.length);<NEW_LINE>ProgressManager.getInstance().getProgressIndicator().setText(fileOrDir.getPresentableUrl());<NEW_LINE>} catch (IOException e1) {<NEW_LINE>LOG.error(e1);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>long end = System.currentTimeMillis();<NEW_LINE>String message = "Finished loading content of " + count + " files. Total size=" + StringUtil.formatFileSize(totalSize.get()) + ". Elapsed=" + ((end - start) / 1000) + "sec.";<NEW_LINE>LOG.info(message);<NEW_LINE>System.out.println(message);<NEW_LINE>} | }, "Loading", false, project); |
647,896 | public static void validateDownloaded(File f, RepositoryResource installResource) throws InstallException {<NEW_LINE>if (f == null || !f.exists() || installResource == null)<NEW_LINE>return;<NEW_LINE><MASK><NEW_LINE>logger.log(Level.FINEST, "Resource SHA256: " + rSHA256);<NEW_LINE>if (rSHA256 != null) {<NEW_LINE>String fSHA256 = null;<NEW_LINE>try {<NEW_LINE>fSHA256 = HashUtils.getFileSHA256String(f);<NEW_LINE>} catch (IOException e) {<NEW_LINE>String msgKey = null;<NEW_LINE>if (installResource.getType().equals(ResourceType.FEATURE)) {<NEW_LINE>msgKey = "ERROR_INVALID_ESA";<NEW_LINE>} else if (installResource.getType().equals(ResourceType.IFIX)) {<NEW_LINE>msgKey = "ERROR_INVALID_IFIX";<NEW_LINE>} else if (installResource.getType().equals(ResourceType.PRODUCTSAMPLE)) {<NEW_LINE>msgKey = "ERROR_INVALID_SAMPLE";<NEW_LINE>} else if (installResource.getType().equals(ResourceType.OPENSOURCE)) {<NEW_LINE>msgKey = "ERROR_INVALID_OPENSOURCE";<NEW_LINE>}<NEW_LINE>if (msgKey == null)<NEW_LINE>logger.log(Level.FINEST, "Invalid unknown asset: " + getResourceId(installResource));<NEW_LINE>else<NEW_LINE>throw ExceptionUtils.createByKey(e, msgKey, getResourceId(installResource));<NEW_LINE>}<NEW_LINE>logger.log(Level.FINEST, "Downloaded file SHA256: " + fSHA256);<NEW_LINE>if (!rSHA256.equals(fSHA256)) {<NEW_LINE>throw ExceptionUtils.createByKey("ERROR_DOWNLOADED_ASSET_INVALID_CHECKSUM", getResourceId(installResource), InstallUtils.getResourceName(installResource));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String rSHA256 = installResource.getMainAttachmentSHA256(); |
1,424,509 | public static <T extends ImageBase<T>> ImageDistort<T, T> rectifyImage(CameraPinholeBrown param, FMatrixRMaj rectify, BorderType borderType, ImageType<T> imageType) {<NEW_LINE><MASK><NEW_LINE>if (skip) {<NEW_LINE>borderType = BorderType.EXTENDED;<NEW_LINE>}<NEW_LINE>InterpolatePixel<T> interp = FactoryInterpolation.createPixel(0, 255, InterpolationType.BILINEAR, borderType, imageType);<NEW_LINE>// only compute the transform once<NEW_LINE>ImageDistort<T, T> ret = FactoryDistort.distort(true, interp, imageType);<NEW_LINE>ret.setRenderAll(!skip);<NEW_LINE>Point2Transform2_F32 transform = RectifyImageOps.transformRectToPixel(param, rectify);<NEW_LINE>ret.setModel(new PointToPixelTransform_F32(transform));<NEW_LINE>return ret;<NEW_LINE>} | boolean skip = borderType == BorderType.SKIP; |
125,040 | public void marshall(LoRaWANGetServiceProfileInfo loRaWANGetServiceProfileInfo, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (loRaWANGetServiceProfileInfo == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getUlRate(), ULRATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getUlBucketSize(), ULBUCKETSIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getUlRatePolicy(), ULRATEPOLICY_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getDlRate(), DLRATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getDlBucketSize(), DLBUCKETSIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getDlRatePolicy(), DLRATEPOLICY_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getAddGwMetadata(), ADDGWMETADATA_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getDevStatusReqFreq(), DEVSTATUSREQFREQ_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getReportDevStatusBattery(), REPORTDEVSTATUSBATTERY_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getReportDevStatusMargin(), REPORTDEVSTATUSMARGIN_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getDrMin(), DRMIN_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getDrMax(), DRMAX_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getChannelMask(), CHANNELMASK_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getPrAllowed(), PRALLOWED_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getHrAllowed(), HRALLOWED_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getRaAllowed(), RAALLOWED_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getNwkGeoLoc(), NWKGEOLOC_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getTargetPer(), TARGETPER_BINDING);<NEW_LINE>protocolMarshaller.marshall(loRaWANGetServiceProfileInfo.getMinGwDiversity(), MINGWDIVERSITY_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + <MASK><NEW_LINE>}<NEW_LINE>} | e.getMessage(), e); |
1,040,190 | public void onPostCreate(int mode) {<NEW_LINE>if (mode != Fragmentation.BUBBLE)<NEW_LINE>return;<NEW_LINE>View root = mActivity.findViewById(android.R.id.content);<NEW_LINE>if (root instanceof FrameLayout) {<NEW_LINE>FrameLayout content = (FrameLayout) root;<NEW_LINE>final ImageView stackView = new ImageView(mActivity);<NEW_LINE>stackView.<MASK><NEW_LINE>FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);<NEW_LINE>params.gravity = Gravity.END;<NEW_LINE>final int dp18 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 18, mActivity.getResources().getDisplayMetrics());<NEW_LINE>params.topMargin = dp18 * 7;<NEW_LINE>params.rightMargin = dp18;<NEW_LINE>stackView.setLayoutParams(params);<NEW_LINE>content.addView(stackView);<NEW_LINE>stackView.setOnTouchListener(new StackViewTouchListener(stackView, dp18 / 4));<NEW_LINE>stackView.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>showFragmentStackHierarchyView();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | setImageResource(R.drawable.fragmentation_ic_stack); |
44,572 | public static ColumnVector stringConcatenate(Scalar separator, Scalar narep, ColumnView[] columns, boolean separateNulls) {<NEW_LINE>assert columns != null : "input columns should not be null";<NEW_LINE>assert columns.length > 0 : "input columns should not be empty";<NEW_LINE>assert separator != null : "separator scalar provided may not be null";<NEW_LINE>assert separator.getType().equals(DType.STRING) : "separator scalar must be a string scalar";<NEW_LINE>assert narep != null : "narep scalar provided may not be null";<NEW_LINE>assert narep.getType().<MASK><NEW_LINE>long[] columnViews = new long[columns.length];<NEW_LINE>for (int i = 0; i < columns.length; i++) {<NEW_LINE>assert columns[i] != null : "Column vectors passed may not be null";<NEW_LINE>columnViews[i] = columns[i].getNativeView();<NEW_LINE>}<NEW_LINE>return new ColumnVector(stringConcatenation(columnViews, separator.getScalarHandle(), narep.getScalarHandle(), separateNulls));<NEW_LINE>} | equals(DType.STRING) : "narep scalar must be a string scalar"; |
1,372,618 | final DescribeAccountLimitsResult executeDescribeAccountLimits(DescribeAccountLimitsRequest describeAccountLimitsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAccountLimitsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAccountLimitsRequest> request = null;<NEW_LINE>Response<DescribeAccountLimitsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAccountLimitsRequestMarshaller().marshall(super.beforeMarshalling(describeAccountLimitsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Elastic Load Balancing v2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAccountLimits");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeAccountLimitsResult> responseHandler = new StaxResponseHandler<DescribeAccountLimitsResult>(new DescribeAccountLimitsResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,403,732 | public static FileSystemManager generateVfs() throws FileSystemException {<NEW_LINE>DefaultFileSystemManager vfs = new DefaultFileSystemManager();<NEW_LINE>vfs.addProvider("res", new org.apache.commons.vfs2.provider.res.ResourceFileProvider());<NEW_LINE>vfs.addProvider("zip", new org.apache.commons.vfs2.provider.zip.ZipFileProvider());<NEW_LINE>vfs.addProvider("gz", new org.apache.commons.vfs2.provider.gzip.GzipFileProvider());<NEW_LINE>vfs.addProvider("ram", new org.apache.commons.vfs2.provider.ram.RamFileProvider());<NEW_LINE>vfs.addProvider("file", new org.apache.commons.vfs2.provider.local.DefaultLocalFileProvider());<NEW_LINE>vfs.addProvider("jar", new org.apache.commons.vfs2.provider.jar.JarFileProvider());<NEW_LINE>vfs.addProvider("http", new org.apache.commons.vfs2.provider.http.HttpFileProvider());<NEW_LINE>vfs.addProvider("https", new org.apache.commons.vfs2.provider.https.HttpsFileProvider());<NEW_LINE>vfs.addProvider("ftp", new org.apache.commons.vfs2.provider.ftp.FtpFileProvider());<NEW_LINE>vfs.addProvider("ftps", new org.apache.commons.vfs2.provider.ftps.FtpsFileProvider());<NEW_LINE>vfs.addProvider("war", new org.apache.commons.vfs2.provider.jar.JarFileProvider());<NEW_LINE>vfs.addProvider("par", new org.apache.commons.vfs2.provider.jar.JarFileProvider());<NEW_LINE>vfs.addProvider("ear", new org.apache.commons.vfs2.provider.jar.JarFileProvider());<NEW_LINE>vfs.addProvider("sar", new org.apache.commons.vfs2.provider.jar.JarFileProvider());<NEW_LINE>vfs.addProvider("ejb3", new org.apache.commons.vfs2.<MASK><NEW_LINE>vfs.addProvider("tmp", new org.apache.commons.vfs2.provider.temp.TemporaryFileProvider());<NEW_LINE>vfs.addProvider("tar", new org.apache.commons.vfs2.provider.tar.TarFileProvider());<NEW_LINE>vfs.addProvider("tbz2", new org.apache.commons.vfs2.provider.tar.TarFileProvider());<NEW_LINE>vfs.addProvider("tgz", new org.apache.commons.vfs2.provider.tar.TarFileProvider());<NEW_LINE>vfs.addProvider("bz2", new org.apache.commons.vfs2.provider.bzip2.Bzip2FileProvider());<NEW_LINE>vfs.addProvider("hdfs", new HdfsFileProvider());<NEW_LINE>vfs.addExtensionMap("jar", "jar");<NEW_LINE>vfs.addExtensionMap("zip", "zip");<NEW_LINE>vfs.addExtensionMap("gz", "gz");<NEW_LINE>vfs.addExtensionMap("tar", "tar");<NEW_LINE>vfs.addExtensionMap("tbz2", "tar");<NEW_LINE>vfs.addExtensionMap("tgz", "tar");<NEW_LINE>vfs.addExtensionMap("bz2", "bz2");<NEW_LINE>vfs.addMimeTypeMap("application/x-tar", "tar");<NEW_LINE>vfs.addMimeTypeMap("application/x-gzip", "gz");<NEW_LINE>vfs.addMimeTypeMap("application/zip", "zip");<NEW_LINE>vfs.setFileContentInfoFactory(new FileContentInfoFilenameFactory());<NEW_LINE>vfs.setFilesCache(new SoftRefFilesCache());<NEW_LINE>File cacheDir = computeTopCacheDir();<NEW_LINE>vfs.setReplicator(new UniqueFileReplicator(cacheDir));<NEW_LINE>vfs.setCacheStrategy(CacheStrategy.ON_RESOLVE);<NEW_LINE>vfs.init();<NEW_LINE>vfsInstances.add(new WeakReference<>(vfs));<NEW_LINE>return vfs;<NEW_LINE>} | provider.jar.JarFileProvider()); |
145,850 | public ListWorldGenerationJobsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListWorldGenerationJobsResult listWorldGenerationJobsResult = new ListWorldGenerationJobsResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listWorldGenerationJobsResult;<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("worldGenerationJobSummaries", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listWorldGenerationJobsResult.setWorldGenerationJobSummaries(new ListUnmarshaller<WorldGenerationJobSummary>(WorldGenerationJobSummaryJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listWorldGenerationJobsResult.setNextToken(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 listWorldGenerationJobsResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,546,949 | public void validateFormalIdentifier(ByteList identifier) {<NEW_LINE>char <MASK><NEW_LINE>if (Character.isUpperCase(first)) {<NEW_LINE>compile_error("formal argument cannot be a constant");<NEW_LINE>}<NEW_LINE>switch(first) {<NEW_LINE>case '@':<NEW_LINE>if (identifier.charAt(1) == '@') {<NEW_LINE>compile_error("formal argument cannot be a class variable");<NEW_LINE>} else {<NEW_LINE>compile_error("formal argument cannot be an instance variable");<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case '$':<NEW_LINE>compile_error("formal argument cannot be a global variable");<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>// This mechanism feels a tad dicey but at this point we are dealing with a valid<NEW_LINE>// method name at least so we should not need to check the entire string...<NEW_LINE>char last = identifier.charAt(identifier.length() - 1);<NEW_LINE>if (last == '=' || last == '?' || last == '!') {<NEW_LINE>compile_error("formal argument must be local variable");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | first = identifier.charAt(0); |
665,247 | public void preloadScene(Spatial scene) {<NEW_LINE>if (scene instanceof Node) {<NEW_LINE>// recurse for all children<NEW_LINE>Node n = (Node) scene;<NEW_LINE>List<Spatial> children = n.getChildren();<NEW_LINE>for (int i = 0; i < children.size(); i++) {<NEW_LINE>preloadScene(children.get(i));<NEW_LINE>}<NEW_LINE>} else if (scene instanceof Geometry) {<NEW_LINE>// add to the render queue<NEW_LINE>Geometry gm = (Geometry) scene;<NEW_LINE>if (gm.getMaterial() == null) {<NEW_LINE>throw new IllegalStateException("No material is set for Geometry: " + gm.getName());<NEW_LINE>}<NEW_LINE>gm.getMaterial(<MASK><NEW_LINE>Mesh mesh = gm.getMesh();<NEW_LINE>if (mesh != null && mesh.getVertexCount() != 0 && mesh.getTriangleCount() != 0) {<NEW_LINE>for (VertexBuffer vb : mesh.getBufferList().getArray()) {<NEW_LINE>if (vb.getData() != null && vb.getUsage() != VertexBuffer.Usage.CpuOnly) {<NEW_LINE>renderer.updateBufferData(vb);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).preload(this, gm); |
618,391 | private void afterRestoreStarted(Client clientWithHeaders, PutFollowAction.Request request, ActionListener<PutFollowAction.Response> originalListener, RestoreService.RestoreCompletionResponse response) {<NEW_LINE>final ActionListener<PutFollowAction.Response> listener;<NEW_LINE>if (ActiveShardCount.NONE.equals(request.waitForActiveShards())) {<NEW_LINE>originalListener.onResponse(new PutFollowAction.Response(true, false, false));<NEW_LINE>listener = new ActionListener<>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onResponse(PutFollowAction.Response response) {<NEW_LINE>logger.debug("put follow {} completed with {}", request, response);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(Exception e) {<NEW_LINE>logger.debug(() -> new ParameterizedMessage("put follow {} failed during the restore process", request), e);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} else {<NEW_LINE>listener = originalListener;<NEW_LINE>}<NEW_LINE>RestoreClusterStateListener.createAndRegisterListener(clusterService, response, listener.delegateFailure((delegatedListener, restoreSnapshotResponse) -> {<NEW_LINE>RestoreInfo restoreInfo = restoreSnapshotResponse.getRestoreInfo();<NEW_LINE>if (restoreInfo == null) {<NEW_LINE>// If restoreInfo is null then it is possible there was a master failure during the<NEW_LINE>// restore.<NEW_LINE>delegatedListener.onResponse(new PutFollowAction.Response(true, false, false));<NEW_LINE>} else if (restoreInfo.failedShards() == 0) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>assert restoreInfo.failedShards() > 0 : "Should have failed shards";<NEW_LINE>delegatedListener.onResponse(new PutFollowAction.Response(true, false, false));<NEW_LINE>}<NEW_LINE>}), threadPool.getThreadContext());<NEW_LINE>} | initiateFollowing(clientWithHeaders, request, delegatedListener); |
1,395,919 | void process(Parser.Result r) {<NEW_LINE>if (!(r instanceof GroovyParserResult)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>groovyResult = (GroovyParserResult) r;<NEW_LINE>// CSL context for completion<NEW_LINE>cslContext = new CompletionRequestContext(offset, queryType, groovyResult, true);<NEW_LINE>proposals.addAll(impl().makeProposals<MASK><NEW_LINE>for (CompletionProposal cp : proposals) {<NEW_LINE>Completion.Kind k = lspCompletionKind(cp.getKind());<NEW_LINE>if (k == null) {<NEW_LINE>// unknown / unrepresentable completion kind, ignore.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>builder = CompletionCollector.newBuilder(cp.getName()).kind(k);<NEW_LINE>Builder b = buildCompletion(cp);<NEW_LINE>if (b != null) {<NEW_LINE>b.documentation(() -> getDocumentation(cp));<NEW_LINE>consumer.accept(b.build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (cslContext).getProposals()); |
1,527,665 | private ProcessStatus outputVerificationResponseBean(final PwmRequest pwmRequest, final boolean passed, final HelpdeskVerificationStateBean verificationStateBean) throws IOException, PwmUnrecoverableException {<NEW_LINE>// add a delay to prevent continuous checks<NEW_LINE>final long delayMs = JavaHelper.silentParseLong(pwmRequest.getDomainConfig().readAppProperty(AppProperty.HELPDESK_VERIFICATION_INVALID_DELAY_MS), 500);<NEW_LINE>PwmTimeUtil.jitterPause(TimeDuration.of(delayMs, TimeDuration.Unit.MILLISECONDS), pwmRequest.getPwmDomain().getSecureService(), 0.3f);<NEW_LINE>final HelpdeskVerificationResponseBean responseBean = new HelpdeskVerificationResponseBean(passed, verificationStateBean.toClientString<MASK><NEW_LINE>final RestResultBean restResultBean = RestResultBean.withData(responseBean, HelpdeskVerificationResponseBean.class);<NEW_LINE>pwmRequest.outputJsonResult(restResultBean);<NEW_LINE>return ProcessStatus.Halt;<NEW_LINE>} | (pwmRequest.getPwmDomain())); |
1,041,319 | private boolean checkController(JavaClass cls) {<NEW_LINE>if (cls.isAnnotation() || cls.isEnum()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>JavaClass superClass = cls.getSuperJavaClass();<NEW_LINE>List<JavaAnnotation> classAnnotations = new ArrayList<>();<NEW_LINE>if (Objects.nonNull(superClass)) {<NEW_LINE>classAnnotations.addAll(superClass.getAnnotations());<NEW_LINE>}<NEW_LINE>classAnnotations.addAll(cls.getAnnotations());<NEW_LINE>for (JavaAnnotation annotation : classAnnotations) {<NEW_LINE>String annotationName = annotation.getType().getFullyQualifiedName();<NEW_LINE>if (JAXRSAnnotations.JAX_PATH_FULLY.equals(annotationName)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// use custom doc tag to support Feign.<NEW_LINE>List<DocletTag> docletTags = cls.getTags();<NEW_LINE>for (DocletTag docletTag : docletTags) {<NEW_LINE><MASK><NEW_LINE>if (DocTags.DUBBO_REST.equals(value)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | String value = docletTag.getName(); |
216,708 | public void addMergeFromValue(SourceBuilder code, String value) {<NEW_LINE>Excerpt defaults = Declarations.freshBuilder(code, datatype).orElse(null);<NEW_LINE>if (defaults != null) {<NEW_LINE>code.add("if (");<NEW_LINE>if (!hasDefault) {<NEW_LINE>code.add("%s.contains(%s.%s) || ", UNSET_PROPERTIES.on(defaults), datatype.getPropertyEnum(), property.getAllCapsName());<NEW_LINE>}<NEW_LINE>code.add(ObjectsExcerpts.notEquals(Excerpts.add("%s.%s()", value, property.getGetterName()), Excerpts.add("%s.%s()", defaults, getter(property)), kind));<NEW_LINE>code.add(") {%n");<NEW_LINE>}<NEW_LINE>code.addLine(" %s(%s.%s());", setter(property), <MASK><NEW_LINE>if (defaults != null) {<NEW_LINE>code.addLine("}");<NEW_LINE>}<NEW_LINE>} | value, property.getGetterName()); |
1,007,733 | private void initImpl(LoadedSnapshot ls) {<NEW_LINE>this.snapshot = ls;<NEW_LINE>updateSaveState();<NEW_LINE>setOpaque(false);<NEW_LINE>setFocusable(true);<NEW_LINE>setRequestFocusEnabled(true);<NEW_LINE>refreshTabName();<NEW_LINE>switch(snapshot.getType()) {<NEW_LINE>case LoadedSnapshot.SNAPSHOT_TYPE_CPU:<NEW_LINE>setIcon(WINDOW_ICON_CPU);<NEW_LINE>helpCtx = new HelpCtx(HELP_CTX_KEY_CPU);<NEW_LINE>getAccessibleContext().setAccessibleDescription(Bundle.SnapshotResultsWindow_CpuSnapshotAccessDescr());<NEW_LINE>setupCPUResultsView();<NEW_LINE>break;<NEW_LINE>// case LoadedSnapshot.SNAPSHOT_TYPE_CODEFRAGMENT:<NEW_LINE>// getAccessibleContext().setAccessibleDescription(Bundle.SnapshotResultsWindow_FragmentSnapshotAccessDescr());<NEW_LINE>// displayCodeRegionResults(ls);<NEW_LINE>//<NEW_LINE>// break;<NEW_LINE>case LoadedSnapshot.SNAPSHOT_TYPE_MEMORY_ALLOCATIONS:<NEW_LINE>case LoadedSnapshot.SNAPSHOT_TYPE_MEMORY_LIVENESS:<NEW_LINE>case LoadedSnapshot.SNAPSHOT_TYPE_MEMORY_SAMPLED:<NEW_LINE>setIcon(WINDOW_ICON_MEMORY);<NEW_LINE>helpCtx = new HelpCtx(HELP_CTX_KEY_MEM);<NEW_LINE>getAccessibleContext().setAccessibleDescription(Bundle.SnapshotResultsWindow_MemorySnapshotAccessDescr());<NEW_LINE>setupMemoryResultsView();<NEW_LINE>break;<NEW_LINE>case LoadedSnapshot.SNAPSHOT_TYPE_CPU_JDBC:<NEW_LINE>setIcon(WINDOW_ICON_JDBC);<NEW_LINE>helpCtx = new HelpCtx(HELP_CTX_KEY_CPU);<NEW_LINE>getAccessibleContext().setAccessibleDescription(Bundle.SnapshotResultsWindow_CpuSnapshotAccessDescr());<NEW_LINE>setupJDBCResultsView();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (displayedPanel != null) {<NEW_LINE>add(displayedPanel, BorderLayout.CENTER);<NEW_LINE>invalidate();<NEW_LINE>doLayout();<NEW_LINE>repaint();<NEW_LINE>}<NEW_LINE>listener = Lookup.getDefault(<MASK><NEW_LINE>listener.registerSnapshotResultsWindow(this);<NEW_LINE>} | ).lookup(SnapshotListener.class); |
1,574,881 | void registerInterceptorBindings(@Observes BeforeBeanDiscovery discovery, BeanManager bm) {<NEW_LINE>// Check if fault tolerance and its metrics are enabled<NEW_LINE>final Config config = ConfigProvider.getConfig();<NEW_LINE>isFaultToleranceEnabled = // default is enabled<NEW_LINE>config.getOptionalValue(MP_FT_NON_FALLBACK_ENABLED, Boolean.class).// default is enabled<NEW_LINE>orElse(true);<NEW_LINE>isFaultToleranceMetricsEnabled = // default is enabled<NEW_LINE>config.getOptionalValue(MP_FT_METRICS_ENABLED, Boolean.class).// default is enabled<NEW_LINE>orElse(true);<NEW_LINE>discovery.addInterceptorBinding(new AnnotatedTypeWrapper<>(bm.createAnnotatedType(Retry.class), LiteralCommandBinding.getInstance()));<NEW_LINE>discovery.addInterceptorBinding(new AnnotatedTypeWrapper<>(bm.createAnnotatedType(CircuitBreaker.class), LiteralCommandBinding.getInstance()));<NEW_LINE>discovery.addInterceptorBinding(new AnnotatedTypeWrapper<>(bm.createAnnotatedType(Timeout.class), LiteralCommandBinding.getInstance()));<NEW_LINE>discovery.addInterceptorBinding(new AnnotatedTypeWrapper<>(bm.createAnnotatedType(Asynchronous.class), LiteralCommandBinding.getInstance()));<NEW_LINE>discovery.addInterceptorBinding(new AnnotatedTypeWrapper<>(bm.createAnnotatedType(Bulkhead.class), LiteralCommandBinding.getInstance()));<NEW_LINE>discovery.addInterceptorBinding(new AnnotatedTypeWrapper<>(bm.createAnnotatedType(Fallback.class), LiteralCommandBinding.getInstance()));<NEW_LINE>discovery.addAnnotatedType(bm.createAnnotatedType(CommandInterceptor.class), CommandInterceptor.class.getName());<NEW_LINE>discovery.addAnnotatedType(bm.createAnnotatedType(JerseyRequestScopeAsCdiBean.class), <MASK><NEW_LINE>} | JerseyRequestScopeAsCdiBean.class.getName()); |
1,315,215 | public IReplRequestHandlerResult handleRequest(final PO po, IReplRequestHandlerCtx ctx) {<NEW_LINE>final Properties ctxToUse = ctx.getEnvCtxToUse();<NEW_LINE>if (!Util.same(po.getCtx(), ctxToUse)) {<NEW_LINE>// this shall not happen, it's an internal error<NEW_LINE>throw new ReplicationException("PO does not have same context as we need it to use").setParameter("PO", po).setParameter("Ctx", po.getCtx()).setParameter("CtxToUse", ctxToUse);<NEW_LINE>// Alternative: reload the given PO with 'ctxToUse' and therefore see if the current role really has access<NEW_LINE>// final PO poToSend = MTable.get(ctxToUse, po.get_Table_ID()).getPO(po.get_ID(), po.get_TrxName());<NEW_LINE>}<NEW_LINE>final IReplRequestHandlerResult result = Services.get(IReplRequestHandlerBL.class).createInitialRequestHandlerResult();<NEW_LINE>final IUserRolePermissions <MASK><NEW_LINE>final boolean allowResponse = // createError<NEW_LINE>role.// createError<NEW_LINE>canUpdate(// createError<NEW_LINE>ClientId.ofRepoId(po.getAD_Client_ID()), // createError<NEW_LINE>OrgId.ofRepoId(po.getAD_Org_ID()), // createError<NEW_LINE>po.get_Table_ID(), // createError<NEW_LINE>po.get_ID(), false);<NEW_LINE>if (!allowResponse) {<NEW_LINE>logger.warn("Response not allowed because there is no access to '{}'", po);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>final PO poToSend = createResponse(ctx, po);<NEW_LINE>result.setPOToExport(poToSend);<NEW_LINE>return result;<NEW_LINE>} | role = Env.getUserRolePermissions(ctxToUse); |
1,852,705 | public void execute(DiagramHandler handler) {<NEW_LINE>super.execute(handler);<NEW_LINE>if (entities == null) {<NEW_LINE>entities = new Vector<GridElement>();<NEW_LINE>for (GridElement e : ClipBoard.getInstance().paste()) {<NEW_LINE>GridElement clone = ElementFactorySwing.createCopy(e, handler);<NEW_LINE>entities.add(clone);<NEW_LINE>}<NEW_LINE>Selector.replaceGroupsWithNewGroups(entities, handler.getDrawPanel().getSelector());<NEW_LINE>}<NEW_LINE>// AB: first execution of paste<NEW_LINE>if (origin == null) {<NEW_LINE>origin = handler.getDrawPanel().getOriginAtDefaultZoom();<NEW_LINE>// AB: Include viewport position to paste on visible area<NEW_LINE>Point viewp = handler.getDrawPanel().getScrollPane().getViewport().getViewPosition();<NEW_LINE>// adjust viewport by ctxmenu displacement if insert was done via ctxmenu<NEW_LINE>viewp.x += ctxMenuLocation.x;<NEW_LINE>viewp.y += ctxMenuLocation.y;<NEW_LINE>viewpX = handler.realignToGrid(false, (int) viewp.getX()) / handler.getGridSize();<NEW_LINE>viewpY = handler.realignToGrid(false, (int) viewp.getY()) / handler.getGridSize();<NEW_LINE>}<NEW_LINE>if (entities.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DiagramHandler.zoomEntities(Constants.DEFAULTGRIDSIZE, handler.getGridSize(), entities);<NEW_LINE>// Calculate the rectangle around the copied entities<NEW_LINE>int minX = Integer.MAX_VALUE;<NEW_LINE>int minY = Integer.MAX_VALUE;<NEW_LINE>for (GridElement e : entities) {<NEW_LINE>minX = Math.min(e.<MASK><NEW_LINE>minY = Math.min(e.getRectangle().y, minY);<NEW_LINE>}<NEW_LINE>for (GridElement e : entities) {<NEW_LINE>e.setLocationDifference(viewpX * handler.getGridSize() - minX + handler.getGridSize() * Constants.PASTE_DISPLACEMENT_GRIDS, viewpY * handler.getGridSize() - minY + handler.getGridSize() * Constants.PASTE_DISPLACEMENT_GRIDS);<NEW_LINE>}<NEW_LINE>int offsetX = origin.x - handler.getDrawPanel().getOriginAtDefaultZoom().x;<NEW_LINE>int offsetY = origin.y - handler.getDrawPanel().getOriginAtDefaultZoom().y;<NEW_LINE>offsetX = offsetX * handler.getGridSize() / Constants.DEFAULTGRIDSIZE;<NEW_LINE>offsetY = offsetY * handler.getGridSize() / Constants.DEFAULTGRIDSIZE;<NEW_LINE>for (GridElement e : entities) {<NEW_LINE>new AddElement(e, handler.realignToGrid(e.getRectangle().x + offsetX), handler.realignToGrid(e.getRectangle().y + offsetY), false).execute(handler);<NEW_LINE>}<NEW_LINE>handler.getDrawPanel().getSelector().deselectAll();<NEW_LINE>for (GridElement e : entities) {<NEW_LINE>handler.getDrawPanel().getSelector().select(e);<NEW_LINE>}<NEW_LINE>handler.getDrawPanel().updatePanelAndScrollbars();<NEW_LINE>} | getRectangle().x, minX); |
1,070,140 | public void doLayout() {<NEW_LINE>clear();<NEW_LINE>GwtToolWindowStripe topLayout = myStripes.get(DockLayoutState.Constraint.TOP);<NEW_LINE>if (topLayout != null && topLayout.canShow()) {<NEW_LINE>add(topLayout);<NEW_LINE>setAnywhereSize(this, <MASK><NEW_LINE>}<NEW_LINE>HorizontalPanel centerBlock = new HorizontalPanel();<NEW_LINE>GwtUIUtil.fill(centerBlock);<NEW_LINE>GwtToolWindowStripe leftLayout = myStripes.get(DockLayoutState.Constraint.LEFT);<NEW_LINE>if (leftLayout != null && leftLayout.canShow()) {<NEW_LINE>centerBlock.add(leftLayout);<NEW_LINE>setAnywhereSize(centerBlock, leftLayout, "100%", "22px", "Right");<NEW_LINE>}<NEW_LINE>add(centerBlock);<NEW_LINE>centerBlock.add(myCenterPanel);<NEW_LINE>setAnywhereSize(centerBlock, myCenterPanel, "100%", "100%", null);<NEW_LINE>GwtToolWindowStripe rightLayout = myStripes.get(DockLayoutState.Constraint.RIGHT);<NEW_LINE>if (rightLayout != null && rightLayout.canShow()) {<NEW_LINE>centerBlock.add(rightLayout);<NEW_LINE>setAnywhereSize(centerBlock, rightLayout, "100%", "22px", "Left");<NEW_LINE>}<NEW_LINE>GwtToolWindowStripe bottomLayout = myStripes.get(DockLayoutState.Constraint.BOTTOM);<NEW_LINE>if (bottomLayout != null && bottomLayout.canShow()) {<NEW_LINE>add(bottomLayout);<NEW_LINE>setAnywhereSize(this, bottomLayout, "22px", "100%", "Top");<NEW_LINE>}<NEW_LINE>} | topLayout, "22px", "100%", "Bottom"); |
684,049 | public void execute(String commandName, ConsoleInput ci, CommandLine commandLine) {<NEW_LINE>String userName = commandLine.getOptionValue('u');<NEW_LINE>if (userName == null) {<NEW_LINE>ci.out.println("> ModifyUser: (u)sername option not specified");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>UserProfile profile = getUserManager().getUser(userName);<NEW_LINE>if (profile == null) {<NEW_LINE>ci.out.println("> ModifyUser: error - user '" + userName + "' not found");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean modified = false;<NEW_LINE>String <MASK><NEW_LINE>if (userType != null) {<NEW_LINE>if (UserProfile.isValidUserType(userType.toLowerCase())) {<NEW_LINE>profile.setUserType(userType.toLowerCase());<NEW_LINE>modified = true;<NEW_LINE>} else {<NEW_LINE>ci.out.println("> ModifyUser: invalid profile type '" + userType + "'. Valid values are: " + UserProfile.ADMIN + "," + UserProfile.USER + "," + UserProfile.GUEST);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String password = commandLine.getOptionValue('p');<NEW_LINE>if (password != null) {<NEW_LINE>profile.setPassword(password);<NEW_LINE>modified = true;<NEW_LINE>}<NEW_LINE>String defaultSaveDirectory = commandLine.getOptionValue('d');<NEW_LINE>if (defaultSaveDirectory != null) {<NEW_LINE>modified = true;<NEW_LINE>if (defaultSaveDirectory.length() > 0) {<NEW_LINE>profile.setDefaultSaveDirectory(defaultSaveDirectory);<NEW_LINE>} else {<NEW_LINE>profile.setDefaultSaveDirectory(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (modified) {<NEW_LINE>ci.out.println("> ModifyUser: user '" + userName + "' modified");<NEW_LINE>saveUserManagerConfig(ci.out);<NEW_LINE>} else<NEW_LINE>printHelp(ci.out, commandLine.getArgList());<NEW_LINE>} | userType = commandLine.getOptionValue('t'); |
37,916 | private static List<Pair<ArgumentMarshaller>> marshallers() {<NEW_LINE>final List<Pair<ArgumentMarshaller>> list = new ArrayList<MASK><NEW_LINE>// Use the new V2 boolean marshallers.<NEW_LINE>addStandardDateMarshallers(list);<NEW_LINE>addV2BooleanMarshallers(list);<NEW_LINE>addStandardNumberMarshallers(list);<NEW_LINE>addStandardStringMarshallers(list);<NEW_LINE>addStandardBinaryMarshallers(list);<NEW_LINE>addStandardS3LinkMarshallers(list);<NEW_LINE>// Add marshallers for the new list and map types.<NEW_LINE>list.add(Pair.of(List.class, ListToListMarshaller.instance()));<NEW_LINE>list.add(Pair.of(Map.class, MapToMapMarshaller.instance()));<NEW_LINE>// Make sure I'm last since I'll catch anything.<NEW_LINE>list.add(Pair.of(Object.class, ObjectToMapMarshaller.instance()));<NEW_LINE>return list;<NEW_LINE>} | <Pair<ArgumentMarshaller>>(); |
1,687,176 | boolean writeClass(DataOutputStream dd) {<NEW_LINE>// outputs the .class file from the loaded one<NEW_LINE>try {<NEW_LINE>// first write magic number<NEW_LINE>dd.writeInt((int) magic);<NEW_LINE>dd.writeShort(minor_version);<NEW_LINE>dd.writeShort(major_version);<NEW_LINE>dd.writeShort(constant_pool_count);<NEW_LINE>if (!writeConstantPool(dd)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>dd.writeShort(access_flags);<NEW_LINE>dd.writeShort(this_class);<NEW_LINE>dd.writeShort(super_class);<NEW_LINE>dd.writeShort(interfaces_count);<NEW_LINE>if (interfaces_count > 0) {<NEW_LINE>int j;<NEW_LINE>for (j = 0; j < interfaces_count; j++) {<NEW_LINE>dd.writeShort(interfaces[j]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>dd.writeShort(fields_count);<NEW_LINE>writeFields(dd);<NEW_LINE>dd.writeShort(methods_count);<NEW_LINE>writeMethods(dd);<NEW_LINE>dd.writeShort(attributes_count);<NEW_LINE>if (attributes_count > 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.debug("IOException with " + fn + ": " + e.getMessage());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | writeAttributes(dd, attributes_count, attributes); |
1,044,013 | /*<NEW_LINE>* Compute an 8-byte hash of a byte array of length greater than 64 bytes.<NEW_LINE>*/<NEW_LINE>private static long fullFingerprint(byte[] bytes, int offset, int length) {<NEW_LINE>// For lengths over 64 bytes we hash the end first, and then as we<NEW_LINE>// loop we keep 56 bytes of state: v, w, x, y, and z.<NEW_LINE>long x = load64(bytes, offset);<NEW_LINE>long y = load64(bytes, offset + length - 16) ^ K1;<NEW_LINE>long z = load64(bytes, offset + length - 56) ^ K0;<NEW_LINE>long[<MASK><NEW_LINE>long[] w = new long[2];<NEW_LINE>weakHashLength32WithSeeds(bytes, offset + length - 64, length, y, v);<NEW_LINE>weakHashLength32WithSeeds(bytes, offset + length - 32, length * K1, K0, w);<NEW_LINE>z += shiftMix(v[1]) * K1;<NEW_LINE>x = rotateRight(z + x, 39) * K1;<NEW_LINE>y = rotateRight(y, 33) * K1;<NEW_LINE>// Decrease length to the nearest multiple of 64, and operate on 64-byte chunks.<NEW_LINE>length = (length - 1) & ~63;<NEW_LINE>do {<NEW_LINE>x = rotateRight(x + y + v[0] + load64(bytes, offset + 16), 37) * K1;<NEW_LINE>y = rotateRight(y + v[1] + load64(bytes, offset + 48), 42) * K1;<NEW_LINE>x ^= w[1];<NEW_LINE>y ^= v[0];<NEW_LINE>z = rotateRight(z ^ w[0], 33);<NEW_LINE>weakHashLength32WithSeeds(bytes, offset, v[1] * K1, x + w[0], v);<NEW_LINE>weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y, w);<NEW_LINE>long tmp = z;<NEW_LINE>z = x;<NEW_LINE>x = tmp;<NEW_LINE>offset += 64;<NEW_LINE>length -= 64;<NEW_LINE>} while (length != 0);<NEW_LINE>return hash128to64(hash128to64(v[0], w[0]) + shiftMix(y) * K1 + z, hash128to64(v[1], w[1]) + x);<NEW_LINE>} | ] v = new long[2]; |
795,395 | public char[][] create(int n, int m) {<NEW_LINE>char[][] matrix = new char[n][m];<NEW_LINE>int r = 0;<NEW_LINE>char ch = 'X';<NEW_LINE>int high = Math.min(n, m);<NEW_LINE>// high is min of n and m. If high is odd then high is ceiling of high/2<NEW_LINE>// else high is high/2. e.g high is 5 then high becomes 3 if high is 4<NEW_LINE>// high becomes 2<NEW_LINE>high = (int) Math.ceil(high * 1.0 / 2);<NEW_LINE>while (r < high) {<NEW_LINE>for (int i = r; i < m - r; i++) {<NEW_LINE>matrix[r][i] = ch;<NEW_LINE>}<NEW_LINE>for (int i = r; i < n - r; i++) {<NEW_LINE>matrix[i][m - r - 1] = ch;<NEW_LINE>}<NEW_LINE>for (int i = m - r - 1; i >= r; i--) {<NEW_LINE>matrix[n - r <MASK><NEW_LINE>}<NEW_LINE>for (int i = n - r - 1; i >= r; i--) {<NEW_LINE>matrix[i][r] = ch;<NEW_LINE>}<NEW_LINE>if (ch == 'X') {<NEW_LINE>ch = 'O';<NEW_LINE>} else {<NEW_LINE>ch = 'X';<NEW_LINE>}<NEW_LINE>r++;<NEW_LINE>}<NEW_LINE>return matrix;<NEW_LINE>} | - 1][i] = ch; |
995,187 | protected void populateBuiltInTypes() {<NEW_LINE>int id = super.startTransaction("Populate");<NEW_LINE>try {<NEW_LINE>List<DataType> list = new ArrayList<>();<NEW_LINE>ClassFilter filter = new BuiltInDataTypeClassExclusionFilter();<NEW_LINE>List<BuiltInDataType> datatypes = ClassSearcher.getInstances(BuiltInDataType.class, filter);<NEW_LINE>for (BuiltInDataType datatype : datatypes) {<NEW_LINE>list.clear();<NEW_LINE>findDataTypes(datatype.getName(), list);<NEW_LINE>if (list.size() == 0) {<NEW_LINE>super.resolve(datatype, null);<NEW_LINE>} else if (!list.get(0).isEquivalent(datatype)) {<NEW_LINE>Msg.showError(this, null, "Invalid BuiltIn Data Type", "BuiltIn datatype name collision between " + datatype.getClass().getSimpleName() + " and " + list.get(0).getClass().getSimpleName() + ", both named '" + <MASK><NEW_LINE>} else if (list.size() != 1) {<NEW_LINE>throw new AssertException("Should be no duplicate named built-in types");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>super.endTransaction(id, true);<NEW_LINE>}<NEW_LINE>} | datatype.getName() + "'"); |
284,948 | public void run() throws IOException {<NEW_LINE>SignalHandler prevWinchHandler = terminal.handle(Signal.WINCH, this::resize);<NEW_LINE>SignalHandler prevIntHandler = terminal.handle(Signal.INT, this::interrupt);<NEW_LINE>SignalHandler prevSuspHandler = terminal.handle(Signal.TSTP, this::suspend);<NEW_LINE>Attributes attributes = terminal.enterRawMode();<NEW_LINE>terminal.puts(Capability.enter_ca_mode);<NEW_LINE>terminal.puts(Capability.keypad_xmit);<NEW_LINE>terminal.trackMouse(Terminal.MouseTracking.Any);<NEW_LINE>terminal.flush();<NEW_LINE>executor = Executors.newSingleThreadScheduledExecutor();<NEW_LINE>try {<NEW_LINE>// Create first pane<NEW_LINE>size.copy(terminal.getSize());<NEW_LINE>windows.add(new Window(this));<NEW_LINE>activeWindow = 0;<NEW_LINE>runner.accept(active().getConsole());<NEW_LINE>// Start input loop<NEW_LINE>new Thread(this::inputLoop, "Mux input loop").start();<NEW_LINE>// Redraw loop<NEW_LINE>redrawLoop();<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>throw e;<NEW_LINE>} finally {<NEW_LINE>executor.shutdown();<NEW_LINE>terminal.trackMouse(Terminal.MouseTracking.Off);<NEW_LINE>terminal.puts(Capability.keypad_local);<NEW_LINE>terminal.puts(Capability.exit_ca_mode);<NEW_LINE>terminal.flush();<NEW_LINE>terminal.setAttributes(attributes);<NEW_LINE>terminal.handle(Signal.WINCH, prevWinchHandler);<NEW_LINE>terminal.handle(Signal.INT, prevIntHandler);<NEW_LINE>terminal.<MASK><NEW_LINE>}<NEW_LINE>} | handle(Signal.TSTP, prevSuspHandler); |
1,594,631 | private static void writeObject(final Writer writer, final Object object) throws IOException {<NEW_LINE>try {<NEW_LINE>final PropertyDescriptor[] descriptors = Introspector.getBeanInfo(object.getClass()).getPropertyDescriptors();<NEW_LINE>final Map<String, Object> properties = new LinkedHashMap<String, Object>(descriptors.length + 1, 1.0f);<NEW_LINE>for (final PropertyDescriptor descriptor : descriptors) {<NEW_LINE>final Method readMethod = descriptor.getReadMethod();<NEW_LINE>if (readMethod != null) {<NEW_LINE>final String name = descriptor.getName();<NEW_LINE>if (!"class".equals(name.toLowerCase())) {<NEW_LINE>final Object value = readMethod.invoke(object);<NEW_LINE>properties.put(name, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writeMap(writer, properties);<NEW_LINE>} catch (final IllegalAccessException e) {<NEW_LINE>throw new IllegalArgumentException("Could not perform introspection on object of class " + object.getClass().getName(), e);<NEW_LINE>} catch (final InvocationTargetException e) {<NEW_LINE>throw new IllegalArgumentException("Could not perform introspection on object of class " + object.getClass().getName(), e);<NEW_LINE>} catch (final IntrospectionException e) {<NEW_LINE>throw new IllegalArgumentException("Could not perform introspection on object of class " + object.getClass(<MASK><NEW_LINE>}<NEW_LINE>} | ).getName(), e); |
1,734,187 | public void saveGraph() {<NEW_LINE>compassActivity.csvLogger.prepareLogFile();<NEW_LINE>compassActivity.csvLogger.writeMetaData(getResources().getString(R.string.compass));<NEW_LINE>compassActivity.csvLogger.writeCSVFile(CSV_HEADER);<NEW_LINE>for (CompassData compassData : compassActivity.recordedCompassData) {<NEW_LINE>compassActivity.csvLogger.writeCSVFile(new CSVDataLine().add(compassData.getTime()).add(CSVLogger.FILE_NAME_FORMAT.format(new Date(compassData.getTime()))).add(compassData.getBx()).add(compassData.getBy()).add(compassData.getBz()).add(compassData.getAxis()).add(compassData.getLat()).add(compassData.getLon()));<NEW_LINE>}<NEW_LINE>View view = rootView.findViewById(R.id.compass_card);<NEW_LINE>view.setDrawingCacheEnabled(true);<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>b.compress(Bitmap.CompressFormat.JPEG, 100, new FileOutputStream(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + CSV_DIRECTORY + File.separator + compassActivity.getSensorName() + File.separator + CSVLogger.FILE_NAME_FORMAT.format(new Date()) + "_graph.jpg"));<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | Bitmap b = view.getDrawingCache(); |
190,996 | private Map<String, Integer> assignAttrIds(int attrTypeId) {<NEW_LINE>// Attrs are special, since they can be defined within a declare-styleable. Those are sorted<NEW_LINE>// after top-level definitions.<NEW_LINE>if (!innerClasses.containsKey(ResourceType.ATTR)) {<NEW_LINE>return ImmutableMap.of();<NEW_LINE>}<NEW_LINE>Map<String, Integer> attrToId = Maps.newLinkedHashMapWithExpectedSize(innerClasses.get(ResourceType.ATTR).size());<NEW_LINE>// After assigning public IDs, we count up monotonically, so we don't need to track additional<NEW_LINE>// assignedIds to avoid collisions (use an ImmutableSet to ensure we don't add more).<NEW_LINE>Set<Integer> assignedIds = ImmutableSet.of();<NEW_LINE>Set<String> inlineAttrs = new LinkedHashSet<>();<NEW_LINE>Set<String> styleablesWithInlineAttrs = new TreeSet<>();<NEW_LINE>for (Map.Entry<String, Map<String, Boolean>> styleableAttrEntry : styleableAttrs.entrySet()) {<NEW_LINE>Map<String, Boolean> attrs = styleableAttrEntry.getValue();<NEW_LINE>for (Map.Entry<String, Boolean> attrEntry : attrs.entrySet()) {<NEW_LINE>if (attrEntry.getValue()) {<NEW_LINE>inlineAttrs.add(attrEntry.getKey());<NEW_LINE>styleablesWithInlineAttrs.add(styleableAttrEntry.getKey());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int nextId = nextFreeId<MASK><NEW_LINE>// Technically, aapt assigns based on declaration order, but the merge should have sorted<NEW_LINE>// the non-inline attributes, so assigning by sorted order is the same.<NEW_LINE>SortedMap<String, ?> sortedAttrs = innerClasses.get(ResourceType.ATTR);<NEW_LINE>for (String attr : sortedAttrs.keySet()) {<NEW_LINE>if (!inlineAttrs.contains(attr) && !attrToId.containsKey(attr)) {<NEW_LINE>attrToId.put(attr, nextId);<NEW_LINE>nextId = nextFreeId(nextId + 1, assignedIds);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String styleable : styleablesWithInlineAttrs) {<NEW_LINE>Map<String, Boolean> attrs = styleableAttrs.get(styleable);<NEW_LINE>for (Map.Entry<String, Boolean> attrEntry : attrs.entrySet()) {<NEW_LINE>if (attrEntry.getValue() && !attrToId.containsKey(attrEntry.getKey())) {<NEW_LINE>attrToId.put(attrEntry.getKey(), nextId);<NEW_LINE>nextId = nextFreeId(nextId + 1, assignedIds);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ImmutableMap.copyOf(attrToId);<NEW_LINE>} | (getInitialIdForTypeId(attrTypeId), assignedIds); |
991,999 | private void doRemoveCachePages(int internalFileId) {<NEW_LINE>final Iterator<Map.Entry<PageKey, OCachePointer>> entryIterator = writeCachePages<MASK><NEW_LINE>while (entryIterator.hasNext()) {<NEW_LINE>final Map.Entry<PageKey, OCachePointer> entry = entryIterator.next();<NEW_LINE>final PageKey pageKey = entry.getKey();<NEW_LINE>if (pageKey.fileId == internalFileId) {<NEW_LINE>final OCachePointer pagePointer = entry.getValue();<NEW_LINE>final Lock groupLock = lockManager.acquireExclusiveLock(pageKey);<NEW_LINE>try {<NEW_LINE>pagePointer.acquireExclusiveLock();<NEW_LINE>try {<NEW_LINE>pagePointer.decrementWritersReferrer();<NEW_LINE>pagePointer.setWritersListener(null);<NEW_LINE>writeCacheSize.decrementAndGet();<NEW_LINE>removeFromDirtyPages(pageKey);<NEW_LINE>} finally {<NEW_LINE>pagePointer.releaseExclusiveLock();<NEW_LINE>}<NEW_LINE>entryIterator.remove();<NEW_LINE>} finally {<NEW_LINE>groupLock.unlock();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .entrySet().iterator(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.