idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
31,318 | public String parseParamValueToString(Param param, String inputValue) throws ProposalValidationException {<NEW_LINE>switch(param.getParamType()) {<NEW_LINE>case UNDEFINED:<NEW_LINE>return Res.get("shared.na");<NEW_LINE>case BSQ:<NEW_LINE>return formatCoin(parseParamValueToCoin(param, inputValue));<NEW_LINE>case BTC:<NEW_LINE>return formatBTC(parseParamValueToCoin(param, inputValue));<NEW_LINE>case PERCENT:<NEW_LINE>return FormattingUtils.formatToPercent(ParsingUtils.parsePercentStringToDouble(inputValue));<NEW_LINE>case BLOCK:<NEW_LINE>return Integer.toString<MASK><NEW_LINE>case ADDRESS:<NEW_LINE>InputValidator.ValidationResult validationResult = new BtcAddressValidator().validate(inputValue);<NEW_LINE>if (validationResult.isValid)<NEW_LINE>return inputValue;<NEW_LINE>else<NEW_LINE>throw new ProposalValidationException(validationResult.errorMessage);<NEW_LINE>default:<NEW_LINE>log.warn("Param type {} not handled in switch case at parseParamValueToString", param.getParamType());<NEW_LINE>return Res.get("shared.na");<NEW_LINE>}<NEW_LINE>} | (parseParamValueToBlocks(param, inputValue)); |
1,630,102 | public void marshall(AwsElbLoadBalancerDetails awsElbLoadBalancerDetails, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (awsElbLoadBalancerDetails == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getAvailabilityZones(), AVAILABILITYZONES_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getBackendServerDescriptions(), BACKENDSERVERDESCRIPTIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getCanonicalHostedZoneName(), CANONICALHOSTEDZONENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getCanonicalHostedZoneNameID(), CANONICALHOSTEDZONENAMEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getCreatedTime(), CREATEDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getDnsName(), DNSNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getHealthCheck(), HEALTHCHECK_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getInstances(), INSTANCES_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getListenerDescriptions(), LISTENERDESCRIPTIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getLoadBalancerAttributes(), LOADBALANCERATTRIBUTES_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getLoadBalancerName(), LOADBALANCERNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getScheme(), SCHEME_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getSecurityGroups(), SECURITYGROUPS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getSourceSecurityGroup(), SOURCESECURITYGROUP_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getSubnets(), SUBNETS_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsElbLoadBalancerDetails.getVpcId(), VPCID_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | awsElbLoadBalancerDetails.getPolicies(), POLICIES_BINDING); |
1,841,679 | public static CoreNLPProtos.DependencyGraph toProto(SemanticGraph graph) {<NEW_LINE>CoreNLPProtos.DependencyGraph.Builder builder <MASK><NEW_LINE>// Roots<NEW_LINE>Set<Integer> rootSet = graph.getRoots().stream().map(IndexedWord::index).collect(Collectors.toCollection(IdentityHashSet::new));<NEW_LINE>// Nodes<NEW_LINE>for (IndexedWord node : graph.vertexSet()) {<NEW_LINE>// Register node<NEW_LINE>CoreNLPProtos.DependencyGraph.Node.Builder nodeBuilder = CoreNLPProtos.DependencyGraph.Node.newBuilder().setSentenceIndex(node.get(SentenceIndexAnnotation.class)).setIndex(node.index());<NEW_LINE>if (node.copyCount() > 0) {<NEW_LINE>nodeBuilder.setCopyAnnotation(node.copyCount());<NEW_LINE>}<NEW_LINE>builder.addNode(nodeBuilder.build());<NEW_LINE>// Register root<NEW_LINE>if (rootSet.contains(node.index())) {<NEW_LINE>builder.addRoot(node.index());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Edges<NEW_LINE>for (SemanticGraphEdge edge : graph.edgeIterable()) {<NEW_LINE>// Set edge<NEW_LINE>builder.addEdge(CoreNLPProtos.DependencyGraph.Edge.newBuilder().setSource(edge.getSource().index()).setTarget(edge.getTarget().index()).setDep(edge.getRelation().toString()).setIsExtra(edge.isExtra()).setSourceCopy(edge.getSource().copyCount()).setTargetCopy(edge.getTarget().copyCount()).setLanguage(toProto(edge.getRelation().getLanguage())));<NEW_LINE>}<NEW_LINE>// Return<NEW_LINE>return builder.build();<NEW_LINE>} | = CoreNLPProtos.DependencyGraph.newBuilder(); |
587,302 | public MethodsGroupBuilder methodWithExplicitJavaTypes(String methodName, List<Optional<Class<?>>> types) {<NEW_LINE>requireNonNull(methodName, "methodName is null");<NEW_LINE>List<MethodAndNativeContainerTypes> matchingMethod = Arrays.stream(clazz.getMethods()).filter(method -> methodName.equals(method.getName())).map(method -> new MethodAndNativeContainerTypes(method, types)).collect(toImmutableList());<NEW_LINE>checkState(!matchingMethod.isEmpty(), "method %s was not found in %s", methodName, clazz);<NEW_LINE>checkState(matchingMethod.size() == 1, "multiple methods %s was not found in %s", methodName, clazz);<NEW_LINE>MethodAndNativeContainerTypes methodAndNativeContainerTypes = matchingMethod.get(0);<NEW_LINE>int argumentSize = signature.getArgumentTypes().size();<NEW_LINE>checkState(types.size() == argumentSize, "not matching number of arguments from signature: %s (should have %s)", types.size(), argumentSize);<NEW_LINE>checkState(types.size() == argumentConventions.size(), "not matching number of arguments from argument properties: %s (should have %s)", types.size(), argumentConventions.size());<NEW_LINE>Iterator<InvocationArgumentConvention> argumentConventionIterator = argumentConventions.iterator();<NEW_LINE>Iterator<Optional<Class<?>>> typesIterator = types.iterator();<NEW_LINE>while (argumentConventionIterator.hasNext() && typesIterator.hasNext()) {<NEW_LINE>Optional<Class<?><MASK><NEW_LINE>InvocationArgumentConvention argumentProperty = argumentConventionIterator.next();<NEW_LINE>checkState((argumentProperty == BLOCK_POSITION) == classOptional.isPresent(), "Explicit type is not set when null convention is BLOCK_AND_POSITION");<NEW_LINE>}<NEW_LINE>methodAndNativeContainerTypesList.add(methodAndNativeContainerTypes);<NEW_LINE>return this;<NEW_LINE>} | > classOptional = typesIterator.next(); |
1,290,137 | public void verifyCertificatesSubject(ServerNames serverNames, InetSocketAddress peer, X509Certificate certificate) throws HandshakeException {<NEW_LINE>if (certificate == null) {<NEW_LINE>throw new NullPointerException("Certficate must not be null!");<NEW_LINE>}<NEW_LINE>if (serverNames == null && peer == null) {<NEW_LINE>// nothing to verify<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String literalIp = null;<NEW_LINE>String hostname = null;<NEW_LINE>if (peer != null) {<NEW_LINE><MASK><NEW_LINE>InetAddress destination = peer.getAddress();<NEW_LINE>if (destination != null) {<NEW_LINE>literalIp = destination.getHostAddress();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (serverNames != null) {<NEW_LINE>ServerName serverName = serverNames.getServerName(ServerName.NameType.HOST_NAME);<NEW_LINE>if (serverName != null) {<NEW_LINE>hostname = serverName.getNameAsString();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (hostname != null && hostname.equals(literalIp)) {<NEW_LINE>hostname = null;<NEW_LINE>}<NEW_LINE>if (hostname != null) {<NEW_LINE>if (!CertPathUtil.matchDestination(certificate, hostname)) {<NEW_LINE>String cn = CertPathUtil.getSubjectsCn(certificate);<NEW_LINE>LOGGER.debug("Certificate {} validation failed: destination doesn't match", cn);<NEW_LINE>AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.BAD_CERTIFICATE);<NEW_LINE>throw new HandshakeException("Certificate " + cn + ": Destination '" + hostname + "' doesn't match!", alert);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!CertPathUtil.matchLiteralIP(certificate, literalIp)) {<NEW_LINE>String cn = CertPathUtil.getSubjectsCn(certificate);<NEW_LINE>LOGGER.debug("Certificate {} validation failed: literal IP doesn't match", cn);<NEW_LINE>AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.BAD_CERTIFICATE);<NEW_LINE>throw new HandshakeException("Certificate " + cn + ": Literal IP " + literalIp + " doesn't match!", alert);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | hostname = StringUtil.toHostString(peer); |
915,889 | public UserStorage unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>UserStorage userStorage = new UserStorage();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Capacity", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>userStorage.setCapacity(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 userStorage;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,759,484 | private boolean isGsiTable(CdcDDLContext cdcDDLContext) throws SQLException {<NEW_LINE>String schemaName = cdcDDLContext.getSchemaName();<NEW_LINE>String tableName = cdcDDLContext.getTableName();<NEW_LINE>if (StringUtils.isNotBlank(schemaName) && StringUtils.isNotBlank(tableName)) {<NEW_LINE>try (Connection metaDbConn = MetaDbUtil.getConnection()) {<NEW_LINE>if (DbInfoManager.getInstance().isNewPartitionDb(schemaName)) {<NEW_LINE>TablePartitionAccessor tablePartitionAccessor = new TablePartitionAccessor();<NEW_LINE>tablePartitionAccessor.setConnection(metaDbConn);<NEW_LINE>List<TablePartitionRecord> partitionRecords = tablePartitionAccessor.<MASK><NEW_LINE>return !partitionRecords.isEmpty() && partitionRecords.get(0).tblType == PARTITION_TABLE_TYPE_GSI_TABLE;<NEW_LINE>} else {<NEW_LINE>TablesExtAccessor tablesExtAccessor = new TablesExtAccessor();<NEW_LINE>tablesExtAccessor.setConnection(metaDbConn);<NEW_LINE>TablesExtRecord tablesExtRecord = tablesExtAccessor.query(schemaName, tableName, false);<NEW_LINE>return tablesExtRecord != null && tablesExtRecord.tableType == GsiMetaManager.TableType.GSI.getValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getTablePartitionsByDbNameTbName(schemaName, tableName, false); |
1,828,737 | public Object execute(VirtualFrame frame) {<NEW_LINE>Object[] arguments = frame.getArguments();<NEW_LINE>VirtualFrame asyncFrame = JSArguments.getResumeExecutionContext(arguments);<NEW_LINE>PromiseCapabilityRecord promiseCapability = (<MASK><NEW_LINE>Completion resumptionValue = JSArguments.getResumeCompletion(arguments);<NEW_LINE>writeAsyncResult.executeWrite(asyncFrame, resumptionValue);<NEW_LINE>JSModuleRecord moduleRecord = (JSModuleRecord) JSArguments.getUserArgument(asyncFrame.getArguments(), 0);<NEW_LINE>try {<NEW_LINE>Object returnValue = functionBody.execute(asyncFrame);<NEW_LINE>assert promiseCapability != null;<NEW_LINE>promiseCapabilityResolve(promiseCapability, returnValue);<NEW_LINE>} catch (YieldException e) {<NEW_LINE>assert promiseCapability == null ? e.isYield() : e.isAwait();<NEW_LINE>if (e.isYield()) {<NEW_LINE>moduleRecord.setEnvironment(JSFrameUtil.castMaterializedFrame(asyncFrame));<NEW_LINE>} else {<NEW_LINE>assert e.isAwait();<NEW_LINE>// no-op: we called await, so we will resume later.<NEW_LINE>}<NEW_LINE>} catch (AbstractTruffleException e) {<NEW_LINE>if (promiseCapability != null) {<NEW_LINE>promiseCapabilityReject(promiseCapability, e);<NEW_LINE>} else {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// The result is undefined for normal completion.<NEW_LINE>return Undefined.instance;<NEW_LINE>} | PromiseCapabilityRecord) JSArguments.getResumeGeneratorOrPromiseCapability(arguments); |
566,293 | public static Set<Integer> scanSessionIds(HugeConfig config, List<String> tableDirs) {<NEW_LINE>Set<Integer> sessionIds = new HashSet<>();<NEW_LINE>String path = config.get(PaloOptions.PALO_TEMP_DIR);<NEW_LINE>File pathDir = Paths.get(path).toFile();<NEW_LINE>if (!pathDir.exists()) {<NEW_LINE>return sessionIds;<NEW_LINE>}<NEW_LINE>for (String table : tableDirs) {<NEW_LINE>File tableDir = Paths.get(path, table).toFile();<NEW_LINE>if (!tableDir.exists()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String[<MASK><NEW_LINE>if (fileNames == null || fileNames.length == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>for (String fileName : fileNames) {<NEW_LINE>int[] parts = PaloFile.parseFileName(fileName);<NEW_LINE>int sessionId = parts[0];<NEW_LINE>sessionIds.add(sessionId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sessionIds;<NEW_LINE>} | ] fileNames = tableDir.list(); |
1,807,085 | private void checkLogicalUniqueKeyDuplicate(Users users, List<RwSplitUser> rwSplitUserList) throws SQLException {<NEW_LINE>List<RwSplitUser> sourceList = users.getUser().stream().filter(user -> user instanceof RwSplitUser).map(user -> (RwSplitUser) user).collect(Collectors.toList());<NEW_LINE>for (RwSplitUser rwSplitUser : rwSplitUserList) {<NEW_LINE>boolean isExist = sourceList.stream().anyMatch(sourceUser -> StringUtil.equals(sourceUser.getName(), rwSplitUser.getName()) && StringUtil.equals(sourceUser.getTenant(), rwSplitUser.getTenant()));<NEW_LINE>if (isExist) {<NEW_LINE>String msg = String.format("Duplicate entry '%s-%s-%s'for logical unique '%s-%s-%s'", rwSplitUser.getName(), StringUtil.isEmpty(rwSplitUser.getTenant()) ? null : "tenant", rwSplitUser.getTenant(<MASK><NEW_LINE>throw new SQLException(msg, "42S22", ErrorCode.ER_DUP_ENTRY);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), COLUMN_USERNAME, COLUMN_CONN_ATTR_KEY, COLUMN_CONN_ATTR_VALUE); |
1,226,366 | void resolve() throws InjectionException {<NEW_LINE>final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();<NEW_LINE>if (isTraceOn && tc.isEntryEnabled())<NEW_LINE><MASK><NEW_LINE>Map<String, Object> props = new HashMap<String, Object>();<NEW_LINE>if (properties != null) {<NEW_LINE>int i = 0;<NEW_LINE>for (Map.Entry<String, String> entry : properties.entrySet()) {<NEW_LINE>String key = entry.getKey();<NEW_LINE>props.put(KEY_PROPERTY + "." + i + ".name", key);<NEW_LINE>props.put(KEY_PROPERTY + "." + i + ".value", entry.getValue());<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Insert all remaining attributes.<NEW_LINE>addOrRemoveProperty(props, KEY_DESCRIPTION, description);<NEW_LINE>addOrRemoveProperty(props, KEY_FROM, from);<NEW_LINE>addOrRemoveProperty(props, KEY_HOST, host);<NEW_LINE>addOrRemoveProperty(props, KEY_PASSWORD, password);<NEW_LINE>addOrRemoveProperty(props, KEY_STORE_PROTOCOL, storeProtocol);<NEW_LINE>addOrRemoveProperty(props, KEY_STORE_PROTOCOL_CLASS_NAME, storeProtocolClassName);<NEW_LINE>addOrRemoveProperty(props, KEY_TRANSPORT_PROTOCOL, transportProtocol);<NEW_LINE>addOrRemoveProperty(props, KEY_TRANSPORT_PROTOCOL_CLASS_NAME, transportProtocolClassName);<NEW_LINE>addOrRemoveProperty(props, KEY_USER, user);<NEW_LINE>setObjects(null, createDefinitionReference(null, javax.mail.Session.class.getName(), props));<NEW_LINE>if (isTraceOn && tc.isEntryEnabled())<NEW_LINE>Tr.exit(tc, "resolve");<NEW_LINE>} | Tr.entry(tc, "resolve"); |
1,135,923 | public void endActivity() {<NEW_LINE>if (Thread.currentThread() != mainThread || activityStack.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ActivityInfo oldActivity = activityStack.pop();<NEW_LINE>long endTime = timer.getRealTimeInMs();<NEW_LINE>long totalTime = (oldActivity.resumeTime > 0) ? oldActivity.ownTime + endTime - oldActivity<MASK><NEW_LINE>currentExecutionData.adjustOrPutValue(oldActivity.name, totalTime, totalTime);<NEW_LINE>long endMem = Runtime.getRuntime().freeMemory();<NEW_LINE>long totalMem = (oldActivity.startMem - endMem > 0) ? oldActivity.startMem - endMem + oldActivity.ownMem : oldActivity.ownMem;<NEW_LINE>currentAllocationData.adjustOrPutValue(oldActivity.name, totalMem, totalMem);<NEW_LINE>if (!activityStack.isEmpty()) {<NEW_LINE>ActivityInfo currentActivity = activityStack.peek();<NEW_LINE>currentActivity.resumeTime = endTime;<NEW_LINE>currentActivity.startMem = endMem;<NEW_LINE>}<NEW_LINE>} | .resumeTime : endTime - oldActivity.startTime; |
1,153,844 | private Batch fetch(List<Long> indices, int progress) throws IOException {<NEW_LINE>NDManager subManager = manager.newSubManager();<NEW_LINE>subManager.setName("dataIter fetch");<NEW_LINE>int batchSize = indices.size();<NEW_LINE>NDList[] data = new NDList[batchSize];<NEW_LINE>NDList[] labels = new NDList[batchSize];<NEW_LINE>for (int i = 0; i < batchSize; i++) {<NEW_LINE>Record record = dataset.get(subManager, indices.get(i));<NEW_LINE>data[i] = record.getData();<NEW_LINE>// apply transform<NEW_LINE>if (pipeline != null) {<NEW_LINE>data[i] = pipeline.transform(data[i]);<NEW_LINE>}<NEW_LINE>labels[<MASK><NEW_LINE>}<NEW_LINE>NDList batchData = dataBatchifier.batchify(data);<NEW_LINE>NDList batchLabels = labelBatchifier.batchify(labels);<NEW_LINE>Arrays.stream(data).forEach(NDList::close);<NEW_LINE>Arrays.stream(labels).forEach(NDList::close);<NEW_LINE>// apply label transform<NEW_LINE>if (targetPipeline != null) {<NEW_LINE>batchLabels = targetPipeline.transform(batchLabels);<NEW_LINE>}<NEW_LINE>// pin to a specific device<NEW_LINE>if (device != null) {<NEW_LINE>batchData = batchData.toDevice(device, false);<NEW_LINE>batchLabels = batchLabels.toDevice(device, false);<NEW_LINE>}<NEW_LINE>return new Batch(subManager, batchData, batchLabels, batchSize, dataBatchifier, labelBatchifier, progress, dataset.size());<NEW_LINE>} | i] = record.getLabels(); |
1,005,031 | public ListThemesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListThemesResult listThemesResult = new ListThemesResult();<NEW_LINE>listThemesResult.setStatus(context.getHttpResponse().getStatusCode());<NEW_LINE>int originalDepth = context.getCurrentDepth();<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 listThemesResult;<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("ThemeSummaryList", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listThemesResult.setThemeSummaryList(new ListUnmarshaller<ThemeSummary>(ThemeSummaryJsonUnmarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listThemesResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("RequestId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listThemesResult.setRequestId(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 listThemesResult;<NEW_LINE>} | )).unmarshall(context)); |
1,777,808 | public void validate() {<NEW_LINE>if (image() == null) {<NEW_LINE>throw LOGGER.<MASK><NEW_LINE>}<NEW_LINE>if (ports() != null) {<NEW_LINE>ports().forEach(e -> e.validate());<NEW_LINE>}<NEW_LINE>if (environmentVariables() != null) {<NEW_LINE>environmentVariables().forEach(e -> e.validate());<NEW_LINE>}<NEW_LINE>if (instanceView() != null) {<NEW_LINE>instanceView().validate();<NEW_LINE>}<NEW_LINE>if (resources() == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException("Missing required property resources in model ContainerProperties"));<NEW_LINE>} else {<NEW_LINE>resources().validate();<NEW_LINE>}<NEW_LINE>if (volumeMounts() != null) {<NEW_LINE>volumeMounts().forEach(e -> e.validate());<NEW_LINE>}<NEW_LINE>if (livenessProbe() != null) {<NEW_LINE>livenessProbe().validate();<NEW_LINE>}<NEW_LINE>if (readinessProbe() != null) {<NEW_LINE>readinessProbe().validate();<NEW_LINE>}<NEW_LINE>} | logExceptionAsError(new IllegalArgumentException("Missing required property image in model ContainerProperties")); |
502,935 | // Implementations for KotlinModulePackageVisitor.<NEW_LINE>@Override<NEW_LINE>public void visitKotlinModulePackage(KotlinModule kotlinModule, KotlinModulePackage kotlinModulePart) {<NEW_LINE>// Shrink the referenced facades.<NEW_LINE>for (int k = kotlinModulePart.referencedFileFacades.size() - 1; k >= 0; k--) {<NEW_LINE>KotlinFileFacadeKindMetadata kotlinFileFacadeKindMetadata = <MASK><NEW_LINE>if (!usageMarker.isUsed(kotlinFileFacadeKindMetadata)) {<NEW_LINE>kotlinModulePart.fileFacadeNames.remove(k);<NEW_LINE>kotlinModulePart.referencedFileFacades.remove(k);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Shrink the multi-file-part -> facade map.<NEW_LINE>List<String> partsToRemove = new ArrayList<>();<NEW_LINE>Set<String> facadesToRemove = new HashSet<>();<NEW_LINE>kotlinModulePart.multiFileClassParts.forEach((partName, facadeName) -> {<NEW_LINE>KotlinMultiFilePartKindMetadata referencedMultiFilePart = kotlinModulePart.referencedMultiFileParts.get(partName);<NEW_LINE>if (!usageMarker.isUsed(referencedMultiFilePart.ownerReferencedClass)) {<NEW_LINE>partsToRemove.add(partName);<NEW_LINE>}<NEW_LINE>if (!usageMarker.isUsed(referencedMultiFilePart.referencedFacadeClass)) {<NEW_LINE>facadesToRemove.add(facadeName);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>for (String partName : partsToRemove) {<NEW_LINE>kotlinModulePart.multiFileClassParts.remove(partName);<NEW_LINE>kotlinModulePart.referencedMultiFileParts.remove(partName);<NEW_LINE>}<NEW_LINE>for (String facadeName : facadesToRemove) {<NEW_LINE>kotlinModulePart.multiFileClassParts.values().removeIf(f -> f.equals(facadeName));<NEW_LINE>}<NEW_LINE>} | kotlinModulePart.referencedFileFacades.get(k); |
217,044 | private static TestStepConfig createFromDialog(WsdlProject project, String name) {<NEW_LINE>WsdlMockResponseStepFactory.project = project;<NEW_LINE>try {<NEW_LINE>List<Interface> interfaces = new ArrayList<Interface>();<NEW_LINE>for (Interface iface : project.getInterfaces(WsdlInterfaceFactory.WSDL_TYPE)) {<NEW_LINE>if (iface.getOperationCount() > 0) {<NEW_LINE>interfaces.add(iface);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (interfaces.isEmpty()) {<NEW_LINE>UISupport.showErrorMessage("Missing Interfaces/Operations to mock");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>dialog.setValue(CreateForm.NAME, name);<NEW_LINE>dialog.setOptions(CreateForm.INTERFACE, new ModelItemNames<Interface>(interfaces).getNames());<NEW_LINE>dialog.setOptions(CreateForm.OPERATION, new ModelItemNames<Operation>(interfaces.get(0).getOperationList()).getNames());<NEW_LINE>if (!dialog.show()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TestStepConfig testStepConfig = TestStepConfig.Factory.newInstance();<NEW_LINE>testStepConfig.setType(MOCKRESPONSE_TYPE);<NEW_LINE>testStepConfig.setName(dialog.getValue(CreateForm.NAME));<NEW_LINE>MockResponseStepConfig config = MockResponseStepConfig.Factory.newInstance();<NEW_LINE>config.setInterface(dialog.getValue(CreateForm.INTERFACE));<NEW_LINE>config.setOperation(dialog.getValue(CreateForm.OPERATION));<NEW_LINE>config.setPort(dialog.getIntValue(CreateForm.PORT, 8080));<NEW_LINE>config.setPath(dialog.getValue(CreateForm.PATH));<NEW_LINE>config.addNewResponse();<NEW_LINE>config.getResponse().addNewResponseContent();<NEW_LINE>if (dialog.getBooleanValue(CreateForm.CREATE_RESPONSE)) {<NEW_LINE>WsdlInterface iface = (WsdlInterface) project.getInterfaceByName(config.getInterface());<NEW_LINE>String response = iface.getOperationByName(config.getOperation()).createResponse(project.getSettings()<MASK><NEW_LINE>CompressedStringSupport.setString(config.getResponse().getResponseContent(), response);<NEW_LINE>}<NEW_LINE>testStepConfig.addNewConfig().set(config);<NEW_LINE>return testStepConfig;<NEW_LINE>} finally {<NEW_LINE>WsdlMockResponseStepFactory.project = null;<NEW_LINE>}<NEW_LINE>} | .getBoolean(WsdlSettings.XML_GENERATION_ALWAYS_INCLUDE_OPTIONAL_ELEMENTS)); |
1,195,402 | public void start() throws Exception {<NEW_LINE>// 1. Do prepare work<NEW_LINE>// create an instance of state manager<NEW_LINE>String statemgrClass = Context.stateManagerClass(config);<NEW_LINE><MASK><NEW_LINE>IStateManager statemgr;<NEW_LINE>try {<NEW_LINE>statemgr = ReflectionUtils.newInstance(statemgrClass);<NEW_LINE>} catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {<NEW_LINE>throw new Exception(String.format("Failed to instantiate state manager class '%s'", statemgrClass), e);<NEW_LINE>}<NEW_LINE>// Put it in a try block so that we can always clean resources<NEW_LINE>try {<NEW_LINE>// initialize the statemgr<NEW_LINE>statemgr.initialize(config);<NEW_LINE>Boolean b = statemgr.setMetricsCacheLocation(metricsCacheLocation, topologyName).get(5000, TimeUnit.MILLISECONDS);<NEW_LINE>if (b != null && b) {<NEW_LINE>LOG.info("metricsCacheLocation " + metricsCacheLocation.toString());<NEW_LINE>LOG.info("topologyName " + topologyName.toString());<NEW_LINE>LOG.info("Starting Metrics Cache HTTP Server");<NEW_LINE>metricsCacheManagerHttpServer.start();<NEW_LINE>// 2. The MetricsCacheServer would run in the main thread<NEW_LINE>// We do it in the final step since it would await the main thread<NEW_LINE>LOG.info("Starting Metrics Cache Server");<NEW_LINE>metricsCacheManagerServer.start();<NEW_LINE>metricsCacheManagerServerLoop.loop();<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Failed to set metricscahe location.");<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>// 3. Do post work basing on the result<NEW_LINE>// Currently nothing to do here<NEW_LINE>// 4. Close the resources<NEW_LINE>SysUtils.closeIgnoringExceptions(statemgr);<NEW_LINE>}<NEW_LINE>} | LOG.info("Context.stateManagerClass " + statemgrClass); |
965,327 | public static void run(HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>if (_tc.isEntryEnabled())<NEW_LINE>Tr.entry(_tc, "run", request.getRemoteHost());<NEW_LINE>ESIProcessor processor = null;<NEW_LINE>try {<NEW_LINE>processor = new ESIProcessor(request, response);<NEW_LINE>runCommon(processor);<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>if (_tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(_tc, "An exception was thrown constructing the processor or running runCommon.", ioe);<NEW_LINE>}<NEW_LINE>// must have gone down<NEW_LINE>} catch (Throwable th) {<NEW_LINE>FFDCFilter.processException(th, ESIProcessor.class.getName() + ".run()", "104");<NEW_LINE>// must have gone down<NEW_LINE>} finally {<NEW_LINE>if (processor != null)<NEW_LINE>_running.remove(processor);<NEW_LINE>}<NEW_LINE>if (_tc.isEntryEnabled())<NEW_LINE>Tr.<MASK><NEW_LINE>} | exit(_tc, "run", processor); |
1,705,994 | public void marshall(ReservedElasticsearchInstance reservedElasticsearchInstance, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (reservedElasticsearchInstance == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getReservedElasticsearchInstanceId(), RESERVEDELASTICSEARCHINSTANCEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getReservedElasticsearchInstanceOfferingId(), RESERVEDELASTICSEARCHINSTANCEOFFERINGID_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getElasticsearchInstanceType(), ELASTICSEARCHINSTANCETYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getStartTime(), STARTTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getDuration(), DURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getFixedPrice(), FIXEDPRICE_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getUsagePrice(), USAGEPRICE_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getCurrencyCode(), CURRENCYCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getElasticsearchInstanceCount(), ELASTICSEARCHINSTANCECOUNT_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getState(), STATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getPaymentOption(), PAYMENTOPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(reservedElasticsearchInstance.getRecurringCharges(), RECURRINGCHARGES_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | reservedElasticsearchInstance.getReservationName(), RESERVATIONNAME_BINDING); |
105,511 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (managedInstanceName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (databaseName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String apiVersion = "2019-06-01-preview";<NEW_LINE>context = <MASK><NEW_LINE>return service.delete(this.client.getEndpoint(), resourceGroupName, managedInstanceName, databaseName, this.client.getSubscriptionId(), apiVersion, context);<NEW_LINE>} | this.client.mergeContext(context); |
368,924 | ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, Integer page, Integer size, JsonElement jsonElement) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>ActionResult<List<Wo>> result = new ActionResult<>();<NEW_LINE>if (BooleanUtils.isTrue(business.canManageApplication(effectivePerson, null))) {<NEW_LINE>Wi wi = this.convertToWrapIn(jsonElement, Wi.class);<NEW_LINE>Predicate p = this.toFilterPredicate(effectivePerson, business, wi);<NEW_LINE>List<Wo> wos = emc.fetchDescPaging(Task.class, Wo.copier, p, page, size, Task.startTime_FIELDNAME);<NEW_LINE>result.setData(wos);<NEW_LINE>result.setCount(emc.count(Task.class, p));<NEW_LINE>} else {<NEW_LINE>result.setData(<MASK><NEW_LINE>result.setCount(0L);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | new ArrayList<Wo>()); |
717,722 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller != null) {<NEW_LINE>Card card = game.getCard(this.getTargetPointer().getFirst(game, source));<NEW_LINE>if (card != null) {<NEW_LINE>if (controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getLogName() + '?', source, game)) {<NEW_LINE>game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);<NEW_LINE>Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true), game, true, new ApprovingObject(source, game));<NEW_LINE>game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);<NEW_LINE>if (cardWasCast) {<NEW_LINE>ContinuousEffect effect = new GoblinDarkDwellersReplacementEffect(card.getId());<NEW_LINE>effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | game.addEffect(effect, source); |
433,519 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>java.awt.GridBagConstraints gridBagConstraints;<NEW_LINE>jLabel1 = new javax.swing.JLabel();<NEW_LINE>changeNameTextField = new javax.swing.JTextField();<NEW_LINE>renameCommentsCheckBox = new javax.swing.JCheckBox();<NEW_LINE>spacerLabel = new javax.swing.JLabel();<NEW_LINE>setLayout(new java.awt.GridBagLayout());<NEW_LINE>jLabel1.setLabelFor(changeNameTextField);<NEW_LINE>// NOI18N<NEW_LINE>jLabel1.setText(org.openide.util.NbBundle.getMessage(RenameClassForm.class, "LBL_NewName"));<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridx = 0;<NEW_LINE>gridBagConstraints.gridy = 0;<NEW_LINE>gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);<NEW_LINE>add(jLabel1, gridBagConstraints);<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridx = 1;<NEW_LINE>gridBagConstraints.gridy = 0;<NEW_LINE>gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;<NEW_LINE>gridBagConstraints.weightx = 1.0;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);<NEW_LINE>add(changeNameTextField, gridBagConstraints);<NEW_LINE>// NOI18N<NEW_LINE>changeNameTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(RenameClassForm.class, "ACSD_New_Name"));<NEW_LINE>// NOI18N<NEW_LINE>renameCommentsCheckBox.setText(org.openide.util.NbBundle.getMessage(RenameClassForm.class, "LBL_RenameComments"));<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridx = 0;<NEW_LINE>gridBagConstraints.gridy = 1;<NEW_LINE>gridBagConstraints.gridwidth = 2;<NEW_LINE>gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(<MASK><NEW_LINE>add(renameCommentsCheckBox, gridBagConstraints);<NEW_LINE>// NOI18N<NEW_LINE>renameCommentsCheckBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(RenameClassForm.class, "ACSD_Ren_In_Commts"));<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridx = 0;<NEW_LINE>gridBagConstraints.gridy = 2;<NEW_LINE>gridBagConstraints.weighty = 1.0;<NEW_LINE>add(spacerLabel, gridBagConstraints);<NEW_LINE>} | 5, 5, 0, 5); |
684,461 | public final Value takeExcept(ValueExcept ex) {<NEW_LINE>try {<NEW_LINE>if (ex.idx < ex.path.length) {<NEW_LINE>int tlen = this.elems.length;<NEW_LINE>Value[<MASK><NEW_LINE>Value arcVal = ex.path[ex.idx];<NEW_LINE>if (arcVal instanceof IntValue) {<NEW_LINE>int idx = ((IntValue) arcVal).val - 1;<NEW_LINE>if (0 <= idx && idx < tlen) {<NEW_LINE>for (int i = 0; i < tlen; i++) {<NEW_LINE>newElems[i] = this.elems[i];<NEW_LINE>}<NEW_LINE>ex.idx++;<NEW_LINE>newElems[idx] = this.elems[idx].takeExcept(ex);<NEW_LINE>}<NEW_LINE>return new TupleValue(newElems);<NEW_LINE>}<NEW_LINE>MP.printWarning(EC.TLC_WRONG_TUPLE_FIELD_NAME, new String[] { Values.ppr(arcVal.toString()) });<NEW_LINE>}<NEW_LINE>return ex.value;<NEW_LINE>} catch (RuntimeException | OutOfMemoryError e) {<NEW_LINE>if (hasSource()) {<NEW_LINE>throw FingerprintException.getNewHead(this, e);<NEW_LINE>} else {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] newElems = new Value[tlen]; |
523,786 | private void mapVftablesToParents(RecoveredClass recoveredClass, List<RecoveredClass> ancestorsAllowedToMap) throws CancelledException {<NEW_LINE>Map<Integer, Address> orderToVftableMap = recoveredClass.getOrderToVftableMap();<NEW_LINE>List<Integer> sortedOrder = new ArrayList<Integer>(orderToVftableMap.keySet());<NEW_LINE>Collections.sort(sortedOrder);<NEW_LINE>Map<Integer, RecoveredClass> parentOrderMap = getParentOrderMap(recoveredClass, ancestorsAllowedToMap);<NEW_LINE>if (sortedOrder.size() != parentOrderMap.size()) {<NEW_LINE>Msg.debug(this, recoveredClass.getName() + " has mismatch between vftable and parent order map sizes " + sortedOrder.size() + " vs " + parentOrderMap.size());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Iterator<Integer> orderIterator = sortedOrder.iterator();<NEW_LINE>while (orderIterator.hasNext()) {<NEW_LINE>monitor.checkCanceled();<NEW_LINE>Integer order = orderIterator.next();<NEW_LINE>Address <MASK><NEW_LINE>RecoveredClass parentClass = parentOrderMap.get(order);<NEW_LINE>recoveredClass.addVftableToBaseClassMapping(vftableAddress, parentClass);<NEW_LINE>}<NEW_LINE>} | vftableAddress = orderToVftableMap.get(order); |
1,170,096 | final InvokeScreenAutomationResult executeInvokeScreenAutomation(InvokeScreenAutomationRequest invokeScreenAutomationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(invokeScreenAutomationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<InvokeScreenAutomationRequest> request = null;<NEW_LINE>Response<InvokeScreenAutomationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new InvokeScreenAutomationRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Honeycode");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "InvokeScreenAutomation");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<InvokeScreenAutomationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new InvokeScreenAutomationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(invokeScreenAutomationRequest)); |
332,830 | static synchronized void loadInitialPlugins() {<NEW_LINE>lazyInitialization = true;<NEW_LINE>loadCorePlugin();<NEW_LINE>if (JavaWebStart.isRunningViaJavaWebstart()) {<NEW_LINE>installWebStartPlugins();<NEW_LINE>} else {<NEW_LINE>installStandardPlugins();<NEW_LINE>installUserInstalledPlugins();<NEW_LINE>}<NEW_LINE>Set<Entry<Object, Object>> entrySet = SystemProperties<MASK><NEW_LINE>for (Map.Entry<?, ?> e : entrySet) {<NEW_LINE>if (e.getKey() instanceof String && e.getValue() instanceof String && ((String) e.getKey()).startsWith("findbugs.plugin.")) {<NEW_LINE>try {<NEW_LINE>String value = (String) e.getValue();<NEW_LINE>if (value.startsWith("file:") && !value.endsWith(".jar") && !value.endsWith("/")) {<NEW_LINE>value += "/";<NEW_LINE>}<NEW_LINE>URL url = JavaWebStart.resolveRelativeToJnlpCodebase(value);<NEW_LINE>System.out.println("Loading " + e.getKey() + " from " + url);<NEW_LINE>loadInitialPlugin(url, true, false);<NEW_LINE>} catch (MalformedURLException e1) {<NEW_LINE>AnalysisContext.logError(String.format("Bad URL for plugin: %s=%s", e.getKey(), e.getValue()), e1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (Plugin.getAllPlugins().size() > 1 && JavaWebStart.isRunningViaJavaWebstart()) {<NEW_LINE>// disable security manager; plugins cause problems<NEW_LINE>// http://lopica.sourceforge.net/faq.html<NEW_LINE>// URL policyUrl =<NEW_LINE>// Thread.currentThread().getContextClassLoader().getResource("my.java.policy");<NEW_LINE>// Policy.getPolicy().refresh();<NEW_LINE>try {<NEW_LINE>System.setSecurityManager(null);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>// keep going<NEW_LINE>assert true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>finishLazyInitialization();<NEW_LINE>} | .getAllProperties().entrySet(); |
1,207,272 | private static void AddBackupSoSource(Context context, ArrayList<SoSource> soSources, int apkSoSourceFlags) throws IOException {<NEW_LINE>if ((sFlags & SOLOADER_DISABLE_BACKUP_SOSOURCE) != 0) {<NEW_LINE>sBackupSoSources = null;<NEW_LINE>// Clean up backups<NEW_LINE>final File backupDir = UnpackingSoSource.getSoStorePath(context, SO_STORE_NAME_MAIN);<NEW_LINE>try {<NEW_LINE>SysUtil.dumbDeleteRecursive(backupDir);<NEW_LINE>} catch (IOException e) {<NEW_LINE>Log.w(TAG, "Failed to delete " + backupDir.getCanonicalPath(), e);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final File mainApkDir = new File(context.getApplicationInfo().sourceDir);<NEW_LINE>ArrayList<UnpackingSoSource> <MASK><NEW_LINE>ApkSoSource mainApkSource = new ApkSoSource(context, mainApkDir, SO_STORE_NAME_MAIN, apkSoSourceFlags);<NEW_LINE>backupSources.add(mainApkSource);<NEW_LINE>if (Log.isLoggable(TAG, Log.DEBUG)) {<NEW_LINE>Log.d(TAG, "adding backup source from : " + mainApkSource.toString());<NEW_LINE>}<NEW_LINE>addBackupSoSourceFromSplitApk(context, apkSoSourceFlags, backupSources);<NEW_LINE>sBackupSoSources = backupSources.toArray(new UnpackingSoSource[backupSources.size()]);<NEW_LINE>soSources.addAll(0, backupSources);<NEW_LINE>} | backupSources = new ArrayList<>(); |
506,215 | void refreshStorageBreakdown(@NonNull Context context) {<NEW_LINE>SignalExecutors.BOUNDED.execute(() -> {<NEW_LINE>MediaDatabase.StorageBreakdown breakdown = SignalDatabase<MASK><NEW_LINE>StorageGraphView.StorageBreakdown latestStorageBreakdown = new StorageGraphView.StorageBreakdown(Arrays.asList(new StorageGraphView.Entry(ContextCompat.getColor(context, R.color.storage_color_photos), breakdown.getPhotoSize()), new StorageGraphView.Entry(ContextCompat.getColor(context, R.color.storage_color_videos), breakdown.getVideoSize()), new StorageGraphView.Entry(ContextCompat.getColor(context, R.color.storage_color_files), breakdown.getDocumentSize()), new StorageGraphView.Entry(ContextCompat.getColor(context, R.color.storage_color_audio), breakdown.getAudioSize())));<NEW_LINE>storageBreakdown.postValue(latestStorageBreakdown);<NEW_LINE>});<NEW_LINE>} | .media().getStorageBreakdown(); |
1,245,366 | private void highlightInConference(String nick) {<NEW_LINE>final Editable editable = this.binding.textinput.getText();<NEW_LINE>String oldString = editable.toString().trim();<NEW_LINE>final int pos = this.binding.textinput.getSelectionStart();<NEW_LINE>if (oldString.isEmpty() || pos == 0) {<NEW_LINE>editable.<MASK><NEW_LINE>} else {<NEW_LINE>final char before = editable.charAt(pos - 1);<NEW_LINE>final char after = editable.length() > pos ? editable.charAt(pos) : '\0';<NEW_LINE>if (before == '\n') {<NEW_LINE>editable.insert(pos, nick + ": ");<NEW_LINE>} else {<NEW_LINE>if (pos > 2 && editable.subSequence(pos - 2, pos).toString().equals(": ")) {<NEW_LINE>if (NickValidityChecker.check(conversation, Arrays.asList(editable.subSequence(0, pos - 2).toString().split(", ")))) {<NEW_LINE>editable.insert(pos - 2, ", " + nick);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>editable.insert(pos, (Character.isWhitespace(before) ? "" : " ") + nick + (Character.isWhitespace(after) ? "" : " "));<NEW_LINE>if (Character.isWhitespace(after)) {<NEW_LINE>this.binding.textinput.setSelection(this.binding.textinput.getSelectionStart() + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | insert(0, nick + ": "); |
721,436 | public StringBuffer printExpression(int tab, StringBuffer output, boolean makeShort) {<NEW_LINE>int parenthesesCount = (this.bits & ASTNode<MASK><NEW_LINE>// $NON-NLS-1$<NEW_LINE>String suffix = "";<NEW_LINE>for (int i = 0; i < parenthesesCount; i++) {<NEW_LINE>output.append('(');<NEW_LINE>suffix += ')';<NEW_LINE>}<NEW_LINE>output.append('(');<NEW_LINE>if (this.arguments != null) {<NEW_LINE>for (int i = 0; i < this.arguments.length; i++) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>if (i > 0)<NEW_LINE>output.append(", ");<NEW_LINE>this.arguments[i].print(0, output);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// $NON-NLS-1$<NEW_LINE>output.append(") -> ");<NEW_LINE>if (makeShort) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>output.append("{}");<NEW_LINE>} else {<NEW_LINE>if (this.body != null)<NEW_LINE>this.body.print(this.body instanceof Block ? tab : 0, output);<NEW_LINE>else<NEW_LINE>// $NON-NLS-1$<NEW_LINE>output.append("<@incubator>");<NEW_LINE>}<NEW_LINE>return output.append(suffix);<NEW_LINE>} | .ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT; |
1,005,023 | boolean localize(QrCode.Alignment pattern, float guessY, float guessX) {<NEW_LINE>// sample along the middle. Try to not sample the outside edges which could confuse it<NEW_LINE>for (int i = 0; i < arrayY.length; i++) {<NEW_LINE>float x = guessX - 1.5f + i * 3f / 12.0f;<NEW_LINE>float y = guessY <MASK><NEW_LINE>arrayX[i] = reader.read(guessY, x);<NEW_LINE>arrayY[i] = reader.read(y, guessX);<NEW_LINE>}<NEW_LINE>// TODO turn this into an exhaustive search of the array for best up and down point?<NEW_LINE>int downX = greatestDown(arrayX);<NEW_LINE>if (downX == -1)<NEW_LINE>return false;<NEW_LINE>int upX = greatestUp(arrayX, downX);<NEW_LINE>if (upX == -1)<NEW_LINE>return false;<NEW_LINE>int downY = greatestDown(arrayY);<NEW_LINE>if (downY == -1)<NEW_LINE>return false;<NEW_LINE>int upY = greatestUp(arrayY, downY);<NEW_LINE>if (upY == -1)<NEW_LINE>return false;<NEW_LINE>pattern.moduleFound.x = guessX - 1.5f + (downX + upX) * 3f / 24.0f;<NEW_LINE>pattern.moduleFound.y = guessY - 1.5f + (downY + upY) * 3f / 24.0f;<NEW_LINE>reader.gridToImage((float) pattern.moduleFound.y, (float) pattern.moduleFound.x, pattern.pixel);<NEW_LINE>return true;<NEW_LINE>} | - 1.5f + i * 3f / 12.0f; |
454,209 | public static PathData lineSimplifyAndCurve(List<Float> points, int oWidth, int oHeight) {<NEW_LINE>ArrayList<Point2D.Double> startingLine = new ArrayList<Point2D.Double>();<NEW_LINE>// denormalize and turn into point2d<NEW_LINE>for (int i = 0; i < points.size(); i += 2) {<NEW_LINE>startingLine.add(new Point2D.Double(denormalize(points.get(i), oWidth), denormalize(points.get(i + 1), oHeight)));<NEW_LINE>}<NEW_LINE>// fit it<NEW_LINE>BezierPath endPath = Bezier.fitBezierPath(startingLine, 1d);<NEW_LINE>// get raw path<NEW_LINE>PathData rawPath = endPath.toRawPath();<NEW_LINE>// normalize<NEW_LINE>ArrayList<Float> rtnPoints = new ArrayList<Float>();<NEW_LINE>ArrayList<Double> coords = rawPath.coords;<NEW_LINE>for (int i = 0; i < coords.size(); i += 2) {<NEW_LINE>rtnPoints.add(normalize(coords.get(i), oWidth));<NEW_LINE>rtnPoints.add(normalize(coords.get(<MASK><NEW_LINE>}<NEW_LINE>// return<NEW_LINE>rawPath.points = rtnPoints;<NEW_LINE>return rawPath;<NEW_LINE>} | i + 1), oHeight)); |
1,162,708 | public static List<BufferPage> merge(List<BufferPage> pagesToMerge, int maxPageSize) {<NEW_LINE>if (pagesToMerge == null || pagesToMerge.size() < 1) {<NEW_LINE>return pagesToMerge;<NEW_LINE>}<NEW_LINE>// NOTE: instead of constructing all Entries and then rebuilding offsetIndex and rawData,<NEW_LINE>// it could use arraycopy to copy parts of existing buffers into new ones<NEW_LINE>// it is possible to do in one pass, but rather complex as we'd need to keep track of current offset in new buffer,<NEW_LINE>// current page and offset within that page etc. In practice, this is required seldom enough to create any noticeable deficiencies.<NEW_LINE>// Just extracts all Entries from all fragmented pages into a single list, then create new full pages<NEW_LINE>int totalCount = 0;<NEW_LINE>for (BufferPage p : pagesToMerge) {<NEW_LINE>totalCount += p.numEntries();<NEW_LINE>}<NEW_LINE>Entry[] newdata = new Entry[totalCount];<NEW_LINE>totalCount = 0;<NEW_LINE>for (BufferPage p : pagesToMerge) {<NEW_LINE>for (int i = 0; i < p.numEntries(); i++) {<NEW_LINE>newdata[totalCount++] = p.getNoCopy(i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int numNewPages = newdata.length / maxPageSize;<NEW_LINE>if (newdata.length % maxPageSize > 0) {<NEW_LINE>numNewPages++;<NEW_LINE>}<NEW_LINE>List<BufferPage> newPages <MASK><NEW_LINE>for (int i = 0; i < numNewPages; i++) {<NEW_LINE>newPages.add(BufferPageUtils.buildFromEntryArray(newdata, i * maxPageSize, Math.min(newdata.length, (i + 1) * maxPageSize)));<NEW_LINE>}<NEW_LINE>return newPages;<NEW_LINE>} | = new ArrayList<>(numNewPages); |
231,391 | protected void initPinPad() {<NEW_LINE>pinDisp = (TextView) findViewById(R.id.pin_display);<NEW_LINE>addrInfoPrefix = (TextView) findViewById(R.id.pin_addr_info_prefix);<NEW_LINE>addrInfoHighlight = (TextView) findViewById(R.id.pin_addr_info_highlight);<NEW_LINE>addrInfoPostfix = (TextView) findViewById(R.id.pin_addr_info_postfix);<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbutton0)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbutton1)));<NEW_LINE>buttons.add(((Button) findViewById(<MASK><NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbutton3)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbutton4)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbutton5)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbutton6)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbutton7)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbutton8)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbutton9)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbuttonA)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbuttonB)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbuttonC)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbuttonD)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbuttonE)));<NEW_LINE>buttons.add(((Button) findViewById(R.id.pin_hexbuttonF)));<NEW_LINE>btnClear = (Button) findViewById(R.id.pin_clrhex);<NEW_LINE>btnBack = (Button) findViewById(R.id.pin_backhex);<NEW_LINE>btnBack.setText("OK");<NEW_LINE>int cnt = 0;<NEW_LINE>for (Button b : buttons) {<NEW_LINE>final int akCnt = cnt;<NEW_LINE>b.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>addDigit(Integer.toHexString(akCnt));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>cnt++;<NEW_LINE>}<NEW_LINE>btnBack.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>acceptPin();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>btnClear.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>clearDigits();<NEW_LINE>updatePinDisplay();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>updatePinDisplay();<NEW_LINE>} | R.id.pin_hexbutton2))); |
245,174 | private void writeInnerClass(Collection<FieldInitializer> initializers, Path packageDir, String fullyQualifiedOuterClass, String innerClass) throws IOException {<NEW_LINE>ClassWriter innerClassWriter = new ClassWriter(ClassWriter.COMPUTE_MAXS);<NEW_LINE>String fullyQualifiedInnerClass = <MASK><NEW_LINE>List<FieldInitializer> deferredInitializers = new ArrayList<>();<NEW_LINE>for (FieldInitializer init : initializers) {<NEW_LINE>JavaIdentifierValidator.validate(init.getFieldName(), "in class:", fullyQualifiedInnerClass, "and package:", packageDir);<NEW_LINE>if (init.writeFieldDefinition(innerClassWriter, finalFields, annotateTransitiveFields)) {<NEW_LINE>deferredInitializers.add(init);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!deferredInitializers.isEmpty()) {<NEW_LINE>writeStaticClassInit(innerClassWriter, fullyQualifiedInnerClass, deferredInitializers);<NEW_LINE>}<NEW_LINE>innerClassWriter.visitEnd();<NEW_LINE>Path innerFile = packageDir.resolve("R$" + innerClass + ".class");<NEW_LINE>Files.write(innerFile, innerClassWriter.toByteArray(), CREATE_NEW);<NEW_LINE>} | writeInnerClassHeader(fullyQualifiedOuterClass, innerClass, innerClassWriter); |
753,606 | private WillPublishBuilder fromComplete(@NotNull final Qos qos, final boolean retain, @NotNull final String topic, @NotNull final Optional<PayloadFormatIndicator> payloadFormatIndicator, @NotNull final Optional<Long> messageExpiryInterval, @NotNull final Optional<String> responseTopic, @NotNull final Optional<ByteBuffer> correlationData, @NotNull final Optional<String> contentType, @NotNull final Optional<ByteBuffer> payload, @NotNull final UserProperties userProperties, final long willDelay) {<NEW_LINE>this.qos = qos;<NEW_LINE>this.retain = retain;<NEW_LINE>this.topic = topic;<NEW_LINE>this.payloadFormatIndicator = payloadFormatIndicator.orElse(null);<NEW_LINE>this.messageExpiryInterval = messageExpiryInterval.orElse(PUBLISH.MESSAGE_EXPIRY_INTERVAL_NOT_SET);<NEW_LINE>this.responseTopic = responseTopic.orElse(null);<NEW_LINE>this.correlationData = correlationData.orElse(null);<NEW_LINE>this.contentType = contentType.orElse(null);<NEW_LINE>this.<MASK><NEW_LINE>for (final UserProperty userProperty : userProperties.asList()) {<NEW_LINE>this.userProperty(userProperty.getName(), userProperty.getValue());<NEW_LINE>}<NEW_LINE>this.willDelay = willDelay;<NEW_LINE>return this;<NEW_LINE>} | payload = payload.orElse(null); |
606,554 | private boolean isPanelValid() {<NEW_LINE>if (panelType == PanelType.IMPORT) {<NEW_LINE>if (txtFile.getText().length() == 0) {<NEW_LINE>dialogDescriptor.getNotificationLineSupport().setWarningMessage(NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.import.file.warning"));<NEW_LINE>} else if (getOptionsExportModel().getState() == OptionsExportModel.State.DISABLED) {<NEW_LINE>dialogDescriptor.getNotificationLineSupport().setWarningMessage(NbBundle.getMessage<MASK><NEW_LINE>} else {<NEW_LINE>dialogDescriptor.getNotificationLineSupport().clearMessages();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (txtFile.getText().length() == 0) {<NEW_LINE>// NOI18N<NEW_LINE>dialogDescriptor.getNotificationLineSupport().setWarningMessage(NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.file.warning"));<NEW_LINE>} else if (getOptionsExportModel().getState() == OptionsExportModel.State.DISABLED) {<NEW_LINE>dialogDescriptor.getNotificationLineSupport().setWarningMessage(NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.nooption.warning"));<NEW_LINE>} else {<NEW_LINE>String text = txtFile.getText();<NEW_LINE>File parent = text.endsWith("/") ? new File(text) : new File(text).getParentFile();<NEW_LINE>if (parent == null) {<NEW_LINE>dialogDescriptor.getNotificationLineSupport().setWarningMessage(NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.noparent.warning"));<NEW_LINE>} else {<NEW_LINE>if (parent.canWrite()) {<NEW_LINE>dialogDescriptor.getNotificationLineSupport().clearMessages();<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>dialogDescriptor.getNotificationLineSupport().setWarningMessage(NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.nowrite.warning"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | (OptionsChooserPanel.class, "OptionsChooserPanel.import.nooption.warning")); |
960,738 | public StopJobResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>StopJobResult stopJobResult = new StopJobResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return stopJobResult;<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("job", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>stopJobResult.setJob(JobJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return stopJobResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
565,907 | private static void addPipeUpgradeRecipe(ItemPipeHolder from, ItemPipeHolder to, Object additional) {<NEW_LINE>if (from == null || to == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (additional == null) {<NEW_LINE>throw new NullPointerException("additional");<NEW_LINE>}<NEW_LINE>IRecipe returnRecipe = new ShapelessOreRecipe(to.getRegistryName(), new ItemStack(from), new ItemStack(to)).setRegistryName(new ResourceLocation(to.getRegistryName() + "_undo"));<NEW_LINE>ForgeRegistries.RECIPES.register(returnRecipe);<NEW_LINE>NonNullList<Ingredient> list = NonNullList.create();<NEW_LINE>list.add(Ingredient.fromItem(from));<NEW_LINE>list.add<MASK><NEW_LINE>IRecipe upgradeRecipe = new ShapelessRecipes(to.getRegistryName().getResourcePath(), new ItemStack(to), list).setRegistryName(new ResourceLocation(to.getRegistryName() + "_colorless"));<NEW_LINE>ForgeRegistries.RECIPES.register(upgradeRecipe);<NEW_LINE>for (EnumDyeColor colour : ColourUtil.COLOURS) {<NEW_LINE>ItemStack f = new ItemStack(from, 1, colour.getMetadata() + 1);<NEW_LINE>ItemStack t = new ItemStack(to, 1, colour.getMetadata() + 1);<NEW_LINE>IRecipe returnRecipeColored = new ShapelessOreRecipe(to.getRegistryName(), f, t).setRegistryName(new ResourceLocation(to.getRegistryName() + "_" + colour.getName() + "_undo"));<NEW_LINE>ForgeRegistries.RECIPES.register(returnRecipeColored);<NEW_LINE>NonNullList<Ingredient> colorList = NonNullList.create();<NEW_LINE>colorList.add(Ingredient.fromStacks(f));<NEW_LINE>colorList.add(CraftingHelper.getIngredient(additional));<NEW_LINE>IRecipe upgradeRecipeColored = new ShapelessOreRecipe(to.getRegistryName(), colorList, t).setRegistryName(new ResourceLocation(to.getRegistryName() + "_" + colour.getName()));<NEW_LINE>ForgeRegistries.RECIPES.register(upgradeRecipeColored);<NEW_LINE>}<NEW_LINE>} | (CraftingHelper.getIngredient(additional)); |
739,782 | public void start(Target target, final OnSessionReadyListener listener) throws ChildManager.ChildNotStartedException {<NEW_LINE>this.stop();<NEW_LINE>if (mWithProxy) {<NEW_LINE>if (System.getProxy() == null) {<NEW_LINE>listener.onError(null, R.string.error_mitm_proxy);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (System.getSettings().getBoolean("PREF_HTTPS_REDIRECT", true)) {<NEW_LINE>if (System.getHttpsRedirector() == null) {<NEW_LINE>listener.onError(null, R.string.error_mitm_https_redirector);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>new Thread(System.getHttpsRedirector()).start();<NEW_LINE>}<NEW_LINE>new Thread(System.getProxy()).start();<NEW_LINE>}<NEW_LINE>if (mWithServer) {<NEW_LINE>try {<NEW_LINE>if (System.getServer() == null) {<NEW_LINE>listener.onError(null, R.string.error_mitm_resource_server);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>System.getServer().setResource(mServerFileName, mServerMimeType);<NEW_LINE>new Thread(System.getServer()).start();<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.errorLogging(e);<NEW_LINE>mWithServer = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (System.getNetwork().haveGateway()) {<NEW_LINE>mArpSpoofProcess = System.getTools().arpSpoof.spoof(target, new ArpSpoof.ArpSpoofReceiver() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(String line) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>mArpSpoofProcess = null;<NEW_LINE>}<NEW_LINE>System.setForwarding(true);<NEW_LINE>if (mWithProxy) {<NEW_LINE>System.getTools().ipTables.portRedirect(80, System.HTTP_PROXY_PORT, true);<NEW_LINE>if (System.getSettings().getBoolean("PREF_HTTPS_REDIRECT", true))<NEW_LINE>System.getTools().ipTables.portRedirect(443, System.HTTPS_REDIR_PORT, false);<NEW_LINE>}<NEW_LINE>listener.onSessionReady();<NEW_LINE>} | listener.onError(line, 0); |
1,409,848 | private void validateDataSource(DataSource ds, String user, @Sensitive String password, LinkedHashMap<String, Object> result) throws SQLException {<NEW_LINE>java.sql.Connection con = user == null ? ds.getConnection() : ds.getConnection(user, password);<NEW_LINE>try {<NEW_LINE>DatabaseMetaData metadata = con.getMetaData();<NEW_LINE>result.put("databaseProductName", metadata.getDatabaseProductName());<NEW_LINE>result.put("databaseProductVersion", metadata.getDatabaseProductVersion());<NEW_LINE>result.put("driverName", metadata.getDriverName());<NEW_LINE>result.put("driverVersion", metadata.getDriverVersion());<NEW_LINE>try {<NEW_LINE>String catalog = con.getCatalog();<NEW_LINE>if (catalog != null && catalog.length() > 0)<NEW_LINE>result.put("catalog", catalog);<NEW_LINE>} catch (SQLFeatureNotSupportedException ignore) {<NEW_LINE>}<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>if (schema != null && schema.length() > 0)<NEW_LINE>result.put("schema", schema);<NEW_LINE>} catch (SQLFeatureNotSupportedException ignore) {<NEW_LINE>}<NEW_LINE>String userName = metadata.getUserName();<NEW_LINE>if (userName != null && userName.length() > 0)<NEW_LINE>result.put(USER, userName);<NEW_LINE>try {<NEW_LINE>// TODO better ideas for timeout value?<NEW_LINE>boolean isValid = con.isValid(120);<NEW_LINE>if (!isValid)<NEW_LINE>result.put(FAILURE, "java.sql.Connection.isValid: false");<NEW_LINE>} catch (SQLFeatureNotSupportedException x) {<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>con.close();<NEW_LINE>}<NEW_LINE>} | String schema = con.getSchema(); |
475,294 | private void populateExtensions() {<NEW_LINE>for (InstanceOfferingFactory f : pluginRgty.getExtensionList(InstanceOfferingFactory.class)) {<NEW_LINE>InstanceOfferingFactory old = instanceOfferingFactories.get(f.getInstanceOfferingType().toString());<NEW_LINE>if (old != null) {<NEW_LINE>throw new CloudRuntimeException(String.format("duplicate InstanceOfferingFactory[%s, %s] for type[%s]", f.getClass().getName(), old.getClass().getName(), f.getInstanceOfferingType()));<NEW_LINE>}<NEW_LINE>instanceOfferingFactories.put(f.getInstanceOfferingType().toString(), f);<NEW_LINE>}<NEW_LINE>for (DiskOfferingFactory f : pluginRgty.getExtensionList(DiskOfferingFactory.class)) {<NEW_LINE>DiskOfferingFactory old = diskOfferingFactories.get(f.getDiskOfferingType().toString());<NEW_LINE>if (old != null) {<NEW_LINE>throw new CloudRuntimeException(String.format("duplicate DiskOfferingFactory[%s, %s] for type[%s]", f.getClass().getName(), old.getClass().getName(), f.getDiskOfferingType()));<NEW_LINE>}<NEW_LINE>diskOfferingFactories.put(f.getDiskOfferingType(<MASK><NEW_LINE>}<NEW_LINE>List<PythonApiBindingWriter> exts = pluginRgty.getExtensionList(PythonApiBindingWriter.class);<NEW_LINE>List<PythonApiBindingWriter> sortedExts = exts.stream().sorted((e1, e2) -> e1.getClass().getName().compareTo(e2.getClass().getName())).collect(Collectors.toList());<NEW_LINE>for (PythonApiBindingWriter ext : sortedExts) {<NEW_LINE>pythonApiBindingWriters.add(ext);<NEW_LINE>}<NEW_LINE>} | ).toString(), f); |
1,828,904 | public AccessTokenResponse doTokenExchange(String realm, String token, String requestedIssuer, String clientId, String clientSecret) throws Exception {<NEW_LINE>try (CloseableHttpClient client = (CloseableHttpClient) new HttpClientBuilder().disableTrustManager().build()) {<NEW_LINE>String exchangeUrl = KeycloakUriBuilder.fromUri(ServletTestUtils.getAuthServerUrlBase()).path("/auth/realms/{realm}/protocol/openid-connect/token").build(realm).toString();<NEW_LINE>HttpPost post = new HttpPost(exchangeUrl);<NEW_LINE>HashMap<String, String> parameters = new HashMap<>();<NEW_LINE>if (clientSecret != null) {<NEW_LINE>String authorization = BasicAuthHelper.createHeader(clientId, clientSecret);<NEW_LINE>post.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_FORM_URLENCODED.toString());<NEW_LINE>post.setHeader(HttpHeaders.AUTHORIZATION, authorization);<NEW_LINE>} else {<NEW_LINE>parameters.put("client_id", clientId);<NEW_LINE>}<NEW_LINE>parameters.put(OAuth2Constants.GRANT_TYPE, OAuth2Constants.TOKEN_EXCHANGE_GRANT_TYPE);<NEW_LINE>parameters.put(OAuth2Constants.SUBJECT_TOKEN, token);<NEW_LINE>parameters.put(<MASK><NEW_LINE>parameters.put(OAuth2Constants.REQUESTED_ISSUER, requestedIssuer);<NEW_LINE>post.setEntity(new StringEntity(getPostDataString(parameters)));<NEW_LINE>HttpResponse response = client.execute(post);<NEW_LINE>int statusCode = response.getStatusLine().getStatusCode();<NEW_LINE>if (statusCode == 200 || statusCode == 400) {<NEW_LINE>return JsonSerialization.readValue(EntityUtils.toString(response.getEntity()), AccessTokenResponse.class);<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Unknown error!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | OAuth2Constants.SUBJECT_TOKEN_TYPE, OAuth2Constants.ACCESS_TOKEN_TYPE); |
242,330 | private boolean runInference(Model model) {<NEW_LINE>Log.i(TAG, "runInference: ");<NEW_LINE>MSTensor inputTensor = model.getInputByTensorName("graph_input-173");<NEW_LINE>if (inputTensor.getDataType() != DataType.kNumberTypeFloat32) {<NEW_LINE>Log.e(TAG, "Input tensor data type is not float, the data type is " + inputTensor.getDataType());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Generator Random Data.<NEW_LINE>int elementNums = inputTensor.elementsNum();<NEW_LINE>float[] randomData = generateArray(elementNums);<NEW_LINE>byte[] inputData = floatArrayToByteArray(randomData);<NEW_LINE>// Set Input Data.<NEW_LINE>inputTensor.setData(inputData);<NEW_LINE>// Run Inference.<NEW_LINE>boolean ret = model.predict();<NEW_LINE>if (!ret) {<NEW_LINE><MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Get Output Tensor Data.<NEW_LINE>MSTensor outTensor = model.getOutputByTensorName("Softmax-65");<NEW_LINE>// Print out Tensor Data.<NEW_LINE>ret = printTensorData(outTensor);<NEW_LINE>if (!ret) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>outTensor = model.getOutputsByNodeName("Softmax-65").get(0);<NEW_LINE>ret = printTensorData(outTensor);<NEW_LINE>if (!ret) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>List<MSTensor> outTensors = model.getOutputs();<NEW_LINE>for (MSTensor output : outTensors) {<NEW_LINE>Log.i(TAG, "Tensor name is:" + output.tensorName());<NEW_LINE>ret = printTensorData(output);<NEW_LINE>if (!ret) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | Log.e(TAG, "MindSpore Lite run failed."); |
301,834 | final ListCoreDevicesResult executeListCoreDevices(ListCoreDevicesRequest listCoreDevicesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listCoreDevicesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListCoreDevicesRequest> request = null;<NEW_LINE>Response<ListCoreDevicesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListCoreDevicesRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "GreengrassV2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListCoreDevices");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListCoreDevicesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListCoreDevicesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(listCoreDevicesRequest)); |
911,473 | public static LinkedBuffer writeUTF8VarDelimited(final CharSequence str, final WriteSession session, LinkedBuffer lb) {<NEW_LINE>final int len = str.length();<NEW_LINE>if (len == 0) {<NEW_LINE>if (lb.offset == lb.buffer.length) {<NEW_LINE>// buffer full<NEW_LINE>lb = new LinkedBuffer(session.nextBufferSize, lb);<NEW_LINE>}<NEW_LINE>// write zero<NEW_LINE>lb.buffer[lb.offset++] = 0x00;<NEW_LINE>// update size<NEW_LINE>session.size++;<NEW_LINE>return lb;<NEW_LINE>}<NEW_LINE>if (len < ONE_BYTE_EXCLUSIVE) {<NEW_LINE>// the varint will be max 1-byte. (even if all chars are non-ascii)<NEW_LINE>return writeUTF8OneByteDelimited(str, 0, len, session, lb);<NEW_LINE>}<NEW_LINE>if (len < TWO_BYTE_EXCLUSIVE) {<NEW_LINE>// the varint will be max 2-bytes and could be 1-byte. (even if all non-ascii)<NEW_LINE>return writeUTF8VarDelimited(str, 0, len, TWO_BYTE_LOWER_LIMIT, 2, session, lb);<NEW_LINE>}<NEW_LINE>if (len < THREE_BYTE_EXCLUSIVE) {<NEW_LINE>// the varint will be max 3-bytes and could be 2-bytes. (even if all non-ascii)<NEW_LINE>return writeUTF8VarDelimited(str, 0, len, THREE_BYTE_LOWER_LIMIT, 3, session, lb);<NEW_LINE>}<NEW_LINE>if (len < FOUR_BYTE_EXCLUSIVE) {<NEW_LINE>// the varint will be max 4-bytes and could be 3-bytes. (even if all non-ascii)<NEW_LINE>return writeUTF8VarDelimited(str, 0, len, <MASK><NEW_LINE>}<NEW_LINE>// the varint will be max 5-bytes and could be 4-bytes. (even if all non-ascii)<NEW_LINE>return writeUTF8VarDelimited(str, 0, len, FIVE_BYTE_LOWER_LIMIT, 5, session, lb);<NEW_LINE>} | FOUR_BYTE_LOWER_LIMIT, 4, session, lb); |
1,648,408 | public MultiMetricsSummary merge(MultiMetricsSummary multiClassMetrics) {<NEW_LINE>if (null == multiClassMetrics) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>if (Arrays.equals(labels, multiClassMetrics.labels)) {<NEW_LINE>this.matrix.plusEqual(multiClassMetrics.matrix);<NEW_LINE>} else {<NEW_LINE>// Merge labels from two MultiMetricsSummary instances<NEW_LINE>HashSet<Object> allLabelSet = new HashSet<>();<NEW_LINE>allLabelSet.addAll(Arrays.asList(labels));<NEW_LINE>allLabelSet.addAll(Arrays.asList(multiClassMetrics.labels));<NEW_LINE>Object[<MASK><NEW_LINE>Arrays.sort(mergedLabels, Collections.reverseOrder());<NEW_LINE>int numMergedLabels = mergedLabels.length;<NEW_LINE>Map<Object, Integer> mergedLabelToIndex = IntStream.range(0, numMergedLabels).boxed().collect(Collectors.<Integer, Object, Integer>toMap(d -> mergedLabels[d], d -> d));<NEW_LINE>// Merge confusion matrix from two MultiMetricsSummary instances<NEW_LINE>LongMatrix mergedMatrix = new LongMatrix(new long[numMergedLabels][numMergedLabels]);<NEW_LINE>mergeConfusionMatrix(matrix, labels, mergedMatrix, mergedLabelToIndex);<NEW_LINE>mergeConfusionMatrix(multiClassMetrics.matrix, multiClassMetrics.labels, mergedMatrix, mergedLabelToIndex);<NEW_LINE>// Re-assign labels and matrix of this<NEW_LINE>this.labels = mergedLabels;<NEW_LINE>this.matrix = mergedMatrix;<NEW_LINE>}<NEW_LINE>this.logLoss += multiClassMetrics.logLoss;<NEW_LINE>this.total += multiClassMetrics.total;<NEW_LINE>return this;<NEW_LINE>} | ] mergedLabels = allLabelSet.toArray(); |
586,447 | private void generateRelationshipFile(org.odpi.openmetadata.fvt.opentypes.model.OmrsBeanRelationship omrsBeanRelationship, String fileName, String pkg) throws IOException {<NEW_LINE>FileWriter outputFileWriter = null;<NEW_LINE>BufferedReader reader = null;<NEW_LINE>try {<NEW_LINE>outputFileWriter = new FileWriter(fileName);<NEW_LINE>String relationshipName = omrsBeanRelationship.label;<NEW_LINE>relationshipName = GeneratorUtilities.lowercase1stLetter(relationshipName);<NEW_LINE>String uRelationshipName = GeneratorUtilities.uppercase1stLetter(relationshipName);<NEW_LINE>reader = new BufferedReader(new FileReader(RELATIONSHIP_TEMPLATE));<NEW_LINE>String line = reader.readLine();<NEW_LINE>while (line != null) {<NEW_LINE>Map<String, String> <MASK><NEW_LINE>List<OmrsBeanAttribute> attrList = omrsBeanModel.getOmrsBeanRelationshipAttributeMap().get(uRelationshipName);<NEW_LINE>replacementMap.put("uname", uRelationshipName);<NEW_LINE>replacementMap.put("description", this.omrsBeanModel.getTypeDefDescription(GeneratorUtilities.uppercase1stLetter(GeneratorUtilities.uppercase1stLetter(relationshipName))));<NEW_LINE>replacementMap.put("name", relationshipName);<NEW_LINE>replacementMap.put("package", pkg);<NEW_LINE>replacementMap.put("entityProxy1Name", omrsBeanRelationship.entityProxy1Name);<NEW_LINE>replacementMap.put("entityProxy1Type", omrsBeanRelationship.entityProxy1Type);<NEW_LINE>replacementMap.put("entityProxy2Name", omrsBeanRelationship.entityProxy2Name);<NEW_LINE>replacementMap.put("entityProxy2Type", omrsBeanRelationship.entityProxy2Type);<NEW_LINE>replacementMap.put("typeDefGuid", omrsBeanRelationship.typeDefGuid);<NEW_LINE>writeAttributesToFile(attrList, replacementMap, outputFileWriter, reader, line);<NEW_LINE>line = reader.readLine();<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>closeReaderAndFileWriter(outputFileWriter, reader);<NEW_LINE>}<NEW_LINE>} | replacementMap = new HashMap<>(); |
31,666 | private List<SDDocumentType> sortDocumentTypes(List<SDDocumentType> docList) {<NEW_LINE>Set<String> <MASK><NEW_LINE>doneNames.add(SDDocumentType.VESPA_DOCUMENT.getName());<NEW_LINE>List<SDDocumentType> doneList = new LinkedList<>();<NEW_LINE>List<SDDocumentType> prevList = null;<NEW_LINE>List<SDDocumentType> nextList = docList;<NEW_LINE>while (prevList == null || nextList.size() < prevList.size()) {<NEW_LINE>prevList = nextList;<NEW_LINE>nextList = new LinkedList<>();<NEW_LINE>for (SDDocumentType doc : prevList) {<NEW_LINE>boolean isDone = true;<NEW_LINE>for (SDDocumentType inherited : doc.getInheritedTypes()) {<NEW_LINE>if (!doneNames.contains(inherited.getName())) {<NEW_LINE>isDone = false;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isDone) {<NEW_LINE>doneNames.add(doc.getName());<NEW_LINE>doneList.add(doc);<NEW_LINE>} else {<NEW_LINE>nextList.add(doc);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!nextList.isEmpty()) {<NEW_LINE>throw new IllegalArgumentException("Could not resolve inheritance of document types " + toString(prevList) + ".");<NEW_LINE>}<NEW_LINE>return doneList;<NEW_LINE>} | doneNames = new HashSet<>(); |
948,121 | private static // - args: false <installation path> <command> <...command args><NEW_LINE>void start(String[] args) {<NEW_LINE>boolean viaInstaller = Boolean.parseBoolean(args[0]);<NEW_LINE>String installationDir;<NEW_LINE>String command;<NEW_LINE>String[] options;<NEW_LINE>if (viaInstaller) {<NEW_LINE>installationDir = "ignored";<NEW_LINE>command = "install";<NEW_LINE>options = java.util.Arrays.stream(args, 1, args.length).toArray(String[]::new);<NEW_LINE>} else {<NEW_LINE>installationDir = args[1];<NEW_LINE>if (args.length == 2) {<NEW_LINE>args = new String[] { args[0], args[1], "--help" };<NEW_LINE>}<NEW_LINE>command = args[2];<NEW_LINE>options = java.util.Arrays.stream(args, 3, args.length).toArray(String[]::new);<NEW_LINE>}<NEW_LINE>initCommandHandlers();<NEW_LINE>if (commandHandler.containsKey(command)) {<NEW_LINE>CommandHandler <MASK><NEW_LINE>if (handler != null) {<NEW_LINE>handler.handleCommand(installationDir, viaInstaller, options);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new QuitProgramException("Unknown command '" + command + "'. Please use \"supertokens --help\" to see the list of available commands", null);<NEW_LINE>}<NEW_LINE>} | handler = commandHandler.get(command); |
152,933 | public float interpolateFirstDerivative(float t) {<NEW_LINE>// Handle the boundary cases.<NEW_LINE>final int n = mT.size();<NEW_LINE>if (Float.isNaN(t)) {<NEW_LINE>return t;<NEW_LINE>}<NEW_LINE>t = MathHelper.clamp(t, mT.get(0), mT.get(n - 1));<NEW_LINE>// Find the index 'i' of the last point with smaller X.<NEW_LINE>// We know this will be within the spline due to the boundary tests.<NEW_LINE>int i = 0;<NEW_LINE>while (t > mT.get(i + 1)) {<NEW_LINE>i += 1;<NEW_LINE>}<NEW_LINE>// Perform cubic Hermite spline interpolation.<NEW_LINE>float h = mT.get(i + 1<MASK><NEW_LINE>float u = (t - mT.get(i)) / h;<NEW_LINE>return (3 * h * mM[i + 1] - 6 * mX.get(i + 1) + 3 * h * mM[i] + 6 * mX.get(i)) * u * u + (-2 * h * mM[i + 1] + 6 * mX.get(i + 1) - 4 * h * mM[i] - 6 * mX.get(i)) * u + h * mM[i];<NEW_LINE>} | ) - mT.get(i); |
1,049,153 | public DataSet<Row> buildIndex(BatchOperator in, Params params) {<NEW_LINE>Preconditions.checkArgument(params.get(VectorApproxNearestNeighborTrainParams.METRIC).equals(VectorApproxNearestNeighborTrainParams.Metric.EUCLIDEAN), "KDTree solver only supports Euclidean distance!");<NEW_LINE>EuclideanDistance distance = new EuclideanDistance();<NEW_LINE>Tuple2<DataSet<Vector>, DataSet<BaseVectorSummary>> statistics = StatisticsHelper.summaryHelper(in, null, params.get(VectorApproxNearestNeighborTrainParams.SELECTED_COL));<NEW_LINE>return in.getDataSet().rebalance().mapPartition(new RichMapPartitionFunction<Row, Row>() {<NEW_LINE><NEW_LINE>private static final long serialVersionUID = 6654757741959479783L;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mapPartition(Iterable<Row> values, Collector<Row> out) throws Exception {<NEW_LINE>BaseVectorSummary summary = (BaseVectorSummary) getRuntimeContext().getBroadcastVariable("vectorSize").get(0);<NEW_LINE>int vectorSize = summary.vectorSize();<NEW_LINE>List<FastDistanceVectorData> list = new ArrayList<>();<NEW_LINE>for (Row row : values) {<NEW_LINE>FastDistanceVectorData vector = distance.prepareVectorData(row, 1, 0);<NEW_LINE>list.add(vector);<NEW_LINE>vectorSize = vector.getVector().size();<NEW_LINE>}<NEW_LINE>if (list.size() > 0) {<NEW_LINE>FastDistanceVectorData[] vectorArray = list.toArray(new FastDistanceVectorData[0]);<NEW_LINE>KDTree tree = new KDTree(vectorArray, vectorSize, distance);<NEW_LINE>tree.buildTree();<NEW_LINE>int taskId = getRuntimeContext().getIndexOfThisSubtask();<NEW_LINE>Row row = new Row(ROW_SIZE);<NEW_LINE>row.setField(TASKID_INDEX, (long) taskId);<NEW_LINE>for (int i = 0; i < vectorArray.length; i++) {<NEW_LINE>row.setField(DATA_ID_INDEX, (long) i);<NEW_LINE>row.setField(DATA_IDNEX, vectorArray<MASK><NEW_LINE>out.collect(row);<NEW_LINE>}<NEW_LINE>row.setField(DATA_ID_INDEX, null);<NEW_LINE>row.setField(DATA_IDNEX, null);<NEW_LINE>row.setField(ROOT_IDDEX, JsonConverter.toJson(tree.getRoot()));<NEW_LINE>out.collect(row);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}).withBroadcastSet(statistics.f1, "vectorSize").mapPartition(new RichMapPartitionFunction<Row, Row>() {<NEW_LINE><NEW_LINE>private static final long serialVersionUID = 6849403933586157611L;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mapPartition(Iterable<Row> values, Collector<Row> out) throws Exception {<NEW_LINE>Params meta = null;<NEW_LINE>if (getRuntimeContext().getIndexOfThisSubtask() == 0) {<NEW_LINE>meta = params;<NEW_LINE>BaseVectorSummary summary = (BaseVectorSummary) getRuntimeContext().getBroadcastVariable("vectorSize").get(0);<NEW_LINE>int vectorSize = summary.vectorSize();<NEW_LINE>meta.set(VECTOR_SIZE, vectorSize);<NEW_LINE>}<NEW_LINE>new KDTreeModelDataConverter().save(Tuple2.of(meta, values), out);<NEW_LINE>}<NEW_LINE>}).withBroadcastSet(statistics.f1, "vectorSize");<NEW_LINE>} | [i].toString()); |
912,195 | public ExitCode run(CommandEnv commandEnv) throws ValidationException, IOException, RepoException {<NEW_LINE>ConfigFileArgs configFileArgs = commandEnv.parseConfigFileArgs(this, /*useSourceRef*/<NEW_LINE>false);<NEW_LINE>ConfigLoader configLoader = configLoaderProvider.newLoader(configFileArgs.getConfigPath(), configFileArgs.getSourceRef());<NEW_LINE>ValidationResult result = validate(commandEnv.getOptions(), configLoader, configFileArgs.getWorkflowName());<NEW_LINE>Console console = commandEnv.getOptions().get(GeneralOptions.class).console();<NEW_LINE>for (ValidationMessage message : result.getAllMessages()) {<NEW_LINE>switch(message.getLevel()) {<NEW_LINE>case WARNING:<NEW_LINE>console.warn(message.getMessage());<NEW_LINE>break;<NEW_LINE>case ERROR:<NEW_LINE>console.error(message.getMessage());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (result.hasErrors()) {<NEW_LINE>console.errorFmt("Configuration '%s' is invalid.", configLoader.location());<NEW_LINE>return ExitCode.CONFIGURATION_ERROR;<NEW_LINE>}<NEW_LINE>console.infoFmt(<MASK><NEW_LINE>return ExitCode.SUCCESS;<NEW_LINE>} | "Configuration '%s' is valid.", configLoader.location()); |
1,832,470 | public void update(int count, int creatures, int lands, int sorceries, int instants, int enchantments, int artifacts) {<NEW_LINE>if (this.lblCount != null)<NEW_LINE>this.lblCount.setText(Integer.toString(count));<NEW_LINE>if (this.lblCreatureCount != null)<NEW_LINE>this.lblCreatureCount.setText(Integer.toString(creatures));<NEW_LINE>if (this.lblLandCount != null)<NEW_LINE>this.lblLandCount.setText(Integer.toString(lands));<NEW_LINE>if (this.lblSorceryCount != null)<NEW_LINE>this.lblSorceryCount.setText<MASK><NEW_LINE>if (this.lblInstantCount != null)<NEW_LINE>this.lblInstantCount.setText(Integer.toString(instants));<NEW_LINE>if (this.lblEnchantmentCount != null)<NEW_LINE>this.lblEnchantmentCount.setText(Integer.toString(enchantments));<NEW_LINE>if (this.lblArtifactCount != null)<NEW_LINE>this.lblArtifactCount.setText(Integer.toString(artifacts));<NEW_LINE>} | (Integer.toString(sorceries)); |
1,680,400 | static Request clearRealmCache(ClearRealmCacheRequest clearRealmCacheRequest) {<NEW_LINE>RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder().addPathPartAsIs("_security/realm");<NEW_LINE>if (clearRealmCacheRequest.getRealms().isEmpty() == false) {<NEW_LINE>builder.addCommaSeparatedPathParts(clearRealmCacheRequest.getRealms().toArray(Strings.EMPTY_ARRAY));<NEW_LINE>} else {<NEW_LINE>builder.addPathPart("_all");<NEW_LINE>}<NEW_LINE>final String endpoint = builder.addPathPartAsIs("_clear_cache").build();<NEW_LINE>Request request = new <MASK><NEW_LINE>if (clearRealmCacheRequest.getUsernames().isEmpty() == false) {<NEW_LINE>RequestConverters.Params params = new RequestConverters.Params();<NEW_LINE>params.putParam("usernames", Strings.collectionToCommaDelimitedString(clearRealmCacheRequest.getUsernames()));<NEW_LINE>request.addParameters(params.asMap());<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | Request(HttpPost.METHOD_NAME, endpoint); |
129,412 | public void visitRoots(final RootVisitor visitor) {<NEW_LINE>final Deque<String> prefixStack <MASK><NEW_LINE>rootNode.visitHierarchy(0, new NodeVisitor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void visitNode(int depth, Node node) {<NEW_LINE>while (prefixStack.size() > depth) {<NEW_LINE>prefixStack.removeLast();<NEW_LINE>}<NEW_LINE>if (node.children.isEmpty()) {<NEW_LINE>String root;<NEW_LINE>if (prefixStack.isEmpty()) {<NEW_LINE>root = node.prefix;<NEW_LINE>} else {<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>for (String prefix : prefixStack) {<NEW_LINE>builder.append(prefix);<NEW_LINE>builder.append(File.separatorChar);<NEW_LINE>}<NEW_LINE>builder.append(node.prefix);<NEW_LINE>root = builder.toString();<NEW_LINE>}<NEW_LINE>visitor.visitRoot(root);<NEW_LINE>} else {<NEW_LINE>prefixStack.add(node.prefix);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | = new ArrayDeque<String>(); |
304,633 | public okhttp3.Call importTenantThemeCall(File file, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/tenant-theme";<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (file != null) {<NEW_LINE>localVarFormParams.put("file", file);<NEW_LINE>}<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames = new String[] { "OAuth2Security" };<NEW_LINE>return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | String[] localVarContentTypes = { "multipart/form-data" }; |
1,640,655 | public <E> List<E> aggregate(EntityMetadata entityMetadata, BasicDBObject mongoQuery, BasicDBList lookup, BasicDBObject aggregation, BasicDBObject orderBy, int maxResult) throws Exception {<NEW_LINE>String collectionName = entityMetadata.getTableName();<NEW_LINE>MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(entityMetadata.getPersistenceUnit());<NEW_LINE>AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(entityMetadata.getEntityClazz());<NEW_LINE>boolean hasLob = managedType.hasLobAttribute();<NEW_LINE>List<DBObject> pipeline = new LinkedList<DBObject>();<NEW_LINE>addLookupAndMatchToPipeline(lookup, mongoQuery, pipeline);<NEW_LINE>if (aggregation != null) {<NEW_LINE>pipeline.add(new BasicDBObject("$group", aggregation));<NEW_LINE>}<NEW_LINE>if (orderBy != null && aggregation != null) {<NEW_LINE>addSortToPipeline(orderBy, aggregation, hasLob, pipeline);<NEW_LINE>}<NEW_LINE>if (maxResult > 0) {<NEW_LINE>pipeline.add(new BasicDBObject("$limit", maxResult));<NEW_LINE>}<NEW_LINE>Iterable<DBObject> aggregationResults;<NEW_LINE>if (hasLob) {<NEW_LINE>// KunderaGridFS gridFS = new KunderaGridFS(mongoDb,<NEW_LINE>// collectionName);<NEW_LINE>// AggregationOutput output = gridFS.aggregate(pipeline);<NEW_LINE>// aggregationResults = output.results();<NEW_LINE>throw new KunderaException("Aggregation not supported for MongoDB with GridFS.");<NEW_LINE>} else {<NEW_LINE>AggregationOutput output = mongoDb.getCollection(collectionName).aggregate(pipeline);<NEW_LINE>aggregationResults = output.results();<NEW_LINE>}<NEW_LINE>return (List<E<MASK><NEW_LINE>} | >) extractAggregationValues(aggregationResults, aggregation); |
685,481 | private void doRegisterStore(String storeName, Scope scope, boolean b) throws SyncException {<NEW_LINE>ensureConnected();<NEW_LINE>RegisterRequestMessage rrm = new RegisterRequestMessage();<NEW_LINE>AsyncMessageHeader header = new AsyncMessageHeader();<NEW_LINE><MASK><NEW_LINE>rrm.setHeader(header);<NEW_LINE>Store store = new Store(storeName);<NEW_LINE>store.setScope(TProtocolUtil.getTScope(scope));<NEW_LINE>store.setPersist(false);<NEW_LINE>rrm.setStore(store);<NEW_LINE>SyncMessage bsm = new SyncMessage(MessageType.REGISTER_REQUEST);<NEW_LINE>bsm.setRegisterRequest(rrm);<NEW_LINE>Future<SyncReply> future = sendRequest(header.getTransactionId(), bsm);<NEW_LINE>try {<NEW_LINE>future.get(5, TimeUnit.SECONDS);<NEW_LINE>} catch (TimeoutException e) {<NEW_LINE>throw new RemoteStoreException("Timed out on operation", e);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RemoteStoreException("Error while waiting for reply", e);<NEW_LINE>}<NEW_LINE>} | header.setTransactionId(getTransactionId()); |
1,623,931 | public <T> boolean registerValidator(final Control c, boolean required, final Validator<T> validator) {<NEW_LINE>Optional.ofNullable(c).ifPresent(ctrl -> {<NEW_LINE>ctrl.getProperties().addListener(new MapChangeListener<Object, Object>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onChanged(javafx.collections.MapChangeListener.Change<? extends Object, ? extends Object> change) {<NEW_LINE>if (CTRL_REQUIRED_FLAG.equals(change.getKey())) {<NEW_LINE>redecorate();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>});<NEW_LINE>setRequired(c, required);<NEW_LINE>return ValueExtractor.getObservableValueExtractor(c).map(e -> {<NEW_LINE>ObservableValue<T> observable = (ObservableValue<T>) e.call(c);<NEW_LINE>Consumer<T> updateResults = value -> {<NEW_LINE>Platform.runLater(() -> validationResults.put(c, validator.apply(c, value)));<NEW_LINE>};<NEW_LINE>controls.add(c);<NEW_LINE>observable.addListener((o, oldValue, newValue) -> {<NEW_LINE>dataChanged.set(true);<NEW_LINE>updateResults.accept(newValue);<NEW_LINE>});<NEW_LINE>c.addEventHandler(ValidateEvent.EVENT_TYPE, event -> updateResults.accept<MASK><NEW_LINE>updateResults.accept(observable.getValue());<NEW_LINE>return e;<NEW_LINE>}).isPresent();<NEW_LINE>} | (observable.getValue())); |
1,409,760 | public void complete() {<NEW_LINE>String asmString = builder.toString().trim();<NEW_LINE>if (DEBUG_LOGGING_ASSEMBLY) {<NEW_LINE>logger.debug("complete({})", asmString.length());<NEW_LINE>}<NEW_LINE>if (asmString.length() > 0) {<NEW_LINE>IAssemblyParser parser = AssemblyUtil.getParserForArchitecture(architecture);<NEW_LINE>if (parser != null) {<NEW_LINE>if (DEBUG_LOGGING_ASSEMBLY) {<NEW_LINE>logger.debug("Using assembly parser {}", parser.getClass().getName());<NEW_LINE>}<NEW_LINE>AssemblyMethod <MASK><NEW_LINE>assemblyMethod.setNativeAddress(nativeAddress);<NEW_LINE>assemblyMethod.setEntryAddress(entryAddress);<NEW_LINE>assemblyMethods.add(assemblyMethod);<NEW_LINE>} else {<NEW_LINE>if (DEBUG_LOGGING_ASSEMBLY) {<NEW_LINE>logger.error("No assembly parser found for architecture '{}'", architecture);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>builder.delete(0, builder.length());<NEW_LINE>methodStarted = false;<NEW_LINE>methodInterrupted = false;<NEW_LINE>} | assemblyMethod = parser.parseAssembly(asmString); |
1,634,753 | public static ListQualityRulesResponse unmarshall(ListQualityRulesResponse listQualityRulesResponse, UnmarshallerContext _ctx) {<NEW_LINE>listQualityRulesResponse.setRequestId<MASK><NEW_LINE>listQualityRulesResponse.setHttpStatusCode(_ctx.integerValue("ListQualityRulesResponse.HttpStatusCode"));<NEW_LINE>listQualityRulesResponse.setErrorMessage(_ctx.stringValue("ListQualityRulesResponse.ErrorMessage"));<NEW_LINE>listQualityRulesResponse.setSuccess(_ctx.booleanValue("ListQualityRulesResponse.Success"));<NEW_LINE>listQualityRulesResponse.setErrorCode(_ctx.stringValue("ListQualityRulesResponse.ErrorCode"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageNumber(_ctx.integerValue("ListQualityRulesResponse.Data.PageNumber"));<NEW_LINE>data.setPageSize(_ctx.integerValue("ListQualityRulesResponse.Data.PageSize"));<NEW_LINE>data.setTotalCount(_ctx.longValue("ListQualityRulesResponse.Data.TotalCount"));<NEW_LINE>List<RulesItem> rules = new ArrayList<RulesItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListQualityRulesResponse.Data.Rules.Length"); i++) {<NEW_LINE>RulesItem rulesItem = new RulesItem();<NEW_LINE>rulesItem.setBlockType(_ctx.integerValue("ListQualityRulesResponse.Data.Rules[" + i + "].BlockType"));<NEW_LINE>rulesItem.setOnDutyAccountName(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].OnDutyAccountName"));<NEW_LINE>rulesItem.setProperty(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].Property"));<NEW_LINE>rulesItem.setWarningThreshold(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].WarningThreshold"));<NEW_LINE>rulesItem.setTableName(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].TableName"));<NEW_LINE>rulesItem.setOnDuty(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].OnDuty"));<NEW_LINE>rulesItem.setComment(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].Comment"));<NEW_LINE>rulesItem.setRuleCheckerRelationId(_ctx.integerValue("ListQualityRulesResponse.Data.Rules[" + i + "].RuleCheckerRelationId"));<NEW_LINE>rulesItem.setFixCheck(_ctx.booleanValue("ListQualityRulesResponse.Data.Rules[" + i + "].FixCheck"));<NEW_LINE>rulesItem.setMethodId(_ctx.integerValue("ListQualityRulesResponse.Data.Rules[" + i + "].MethodId"));<NEW_LINE>rulesItem.setTemplateName(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].TemplateName"));<NEW_LINE>rulesItem.setTrend(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].Trend"));<NEW_LINE>rulesItem.setHistoryWarningThreshold(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].HistoryWarningThreshold"));<NEW_LINE>rulesItem.setRuleType(_ctx.integerValue("ListQualityRulesResponse.Data.Rules[" + i + "].RuleType"));<NEW_LINE>rulesItem.setMatchExpression(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].MatchExpression"));<NEW_LINE>rulesItem.setProjectName(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].ProjectName"));<NEW_LINE>rulesItem.setPropertyKey(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].PropertyKey"));<NEW_LINE>rulesItem.setCriticalThreshold(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].CriticalThreshold"));<NEW_LINE>rulesItem.setHistoryCriticalThreshold(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].HistoryCriticalThreshold"));<NEW_LINE>rulesItem.setMethodName(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].MethodName"));<NEW_LINE>rulesItem.setCheckerId(_ctx.integerValue("ListQualityRulesResponse.Data.Rules[" + i + "].CheckerId"));<NEW_LINE>rulesItem.setEntityId(_ctx.integerValue("ListQualityRulesResponse.Data.Rules[" + i + "].EntityId"));<NEW_LINE>rulesItem.setExpectValue(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].ExpectValue"));<NEW_LINE>rulesItem.setTemplateId(_ctx.integerValue("ListQualityRulesResponse.Data.Rules[" + i + "].TemplateId"));<NEW_LINE>rulesItem.setId(_ctx.integerValue("ListQualityRulesResponse.Data.Rules[" + i + "].Id"));<NEW_LINE>rulesItem.setRuleName(_ctx.stringValue("ListQualityRulesResponse.Data.Rules[" + i + "].RuleName"));<NEW_LINE>rules.add(rulesItem);<NEW_LINE>}<NEW_LINE>data.setRules(rules);<NEW_LINE>listQualityRulesResponse.setData(data);<NEW_LINE>return listQualityRulesResponse;<NEW_LINE>} | (_ctx.stringValue("ListQualityRulesResponse.RequestId")); |
84,868 | public List<RouteColorizationPoint> simplify() {<NEW_LINE>if (dataList == null) {<NEW_LINE><MASK><NEW_LINE>for (int i = 0; i < latitudes.length; i++) {<NEW_LINE>dataList.add(new RouteColorizationPoint(i, latitudes[i], longitudes[i], values[i]));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<Node> nodes = new ArrayList<>();<NEW_LINE>List<Node> result = new ArrayList<>();<NEW_LINE>for (RouteColorizationPoint data : dataList) {<NEW_LINE>nodes.add(new net.osmand.osm.edit.Node(data.lat, data.lon, data.id));<NEW_LINE>}<NEW_LINE>double epsilon = Math.pow(2.0, DEFAULT_BASE - zoom);<NEW_LINE>result.add(nodes.get(0));<NEW_LINE>OsmMapUtils.simplifyDouglasPeucker(nodes, 0, nodes.size() - 1, result, epsilon);<NEW_LINE>List<RouteColorizationPoint> simplified = new ArrayList<>();<NEW_LINE>for (int i = 1; i < result.size(); i++) {<NEW_LINE>int prevId = (int) result.get(i - 1).getId();<NEW_LINE>int currentId = (int) result.get(i).getId();<NEW_LINE>List<RouteColorizationPoint> sublist = dataList.subList(prevId, currentId);<NEW_LINE>simplified.addAll(getExtremums(sublist));<NEW_LINE>}<NEW_LINE>Node lastSurvivedPoint = result.get(result.size() - 1);<NEW_LINE>simplified.add(dataList.get((int) lastSurvivedPoint.getId()));<NEW_LINE>return simplified;<NEW_LINE>} | dataList = new ArrayList<>(); |
1,126,192 | private void muxTrack(MKVMuxerTrack track) {<NEW_LINE>try {<NEW_LINE>track.trackStart = sink.position();<NEW_LINE>EbmlMaster trackEntryElem = (EbmlMaster) createByType(TrackEntry);<NEW_LINE>createLong(trackEntryElem, TrackNumber, track.trackNo);<NEW_LINE>createLong(trackEntryElem, TrackUID, track.trackNo);<NEW_LINE>if (MKVMuxerTrackType.VIDEO.equals(track.type)) {<NEW_LINE>createLong(trackEntryElem<MASK><NEW_LINE>createString(trackEntryElem, Name, "Track " + track.trackNo + " Video");<NEW_LINE>createString(trackEntryElem, CodecID, track.codecId);<NEW_LINE>// createChild(trackEntryElem, CodecPrivate, codecMeta.getCodecPrivate());<NEW_LINE>// VideoCodecMeta vcm = (VideoCodecMeta) codecMeta;<NEW_LINE>EbmlMaster trackVideoElem = (EbmlMaster) createByType(Video);<NEW_LINE>createLong(trackVideoElem, PixelWidth, track.videoMeta.getSize().getWidth());<NEW_LINE>createLong(trackVideoElem, PixelHeight, track.videoMeta.getSize().getHeight());<NEW_LINE>trackEntryElem.add(trackVideoElem);<NEW_LINE>} else {<NEW_LINE>createLong(trackEntryElem, TrackType, (byte) 0x02);<NEW_LINE>createString(trackEntryElem, Name, "Track " + track.trackNo + " Audio");<NEW_LINE>createString(trackEntryElem, CodecID, track.codecId);<NEW_LINE>// createChild(trackEntryElem, CodecPrivate, codecMeta.getCodecPrivate());<NEW_LINE>}<NEW_LINE>mkvTracks.add(trackEntryElem);<NEW_LINE>} catch (IOException ioex) {<NEW_LINE>throw new RuntimeException(ioex);<NEW_LINE>}<NEW_LINE>} | , TrackType, (byte) 0x01); |
811,997 | /*<NEW_LINE>* Setup context path to a non-empty value (typically project artifactID)<NEW_LINE>* Should be used f.e. when creating new project<NEW_LINE>*/<NEW_LINE>private static void initContextPath(Project project) {<NEW_LINE>NbMavenProject mavenProject = project.getLookup(<MASK><NEW_LINE>WebModuleProviderImpl webModuleProvider = project.getLookup().lookup(WebModuleProviderImpl.class);<NEW_LINE>if (NbMavenProject.TYPE_WAR.equals(mavenProject.getPackagingType()) == false || webModuleProvider == null) {<NEW_LINE>// We want to set context path only for Web projects<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>WebModuleImpl webModuleImpl = webModuleProvider.getModuleImpl();<NEW_LINE>String contextPath = webModuleImpl.getContextPath();<NEW_LINE>if (contextPath == null || "".equals(contextPath)) {<NEW_LINE>// NOI18N<NEW_LINE>webModuleImpl.setContextPath("/" + mavenProject.getMavenProject().getArtifactId());<NEW_LINE>}<NEW_LINE>} | ).lookup(NbMavenProject.class); |
653,704 | private EngineConnPlugin loadEngineConnPlugin(Class<? extends EngineConnPlugin> pluginClass, EngineConnPluginClassLoader enginePluginClassLoader, Map<String, Object> props) throws EngineConnPluginLoadException {<NEW_LINE>ClassLoader storeClassLoader = Thread.currentThread().getContextClassLoader();<NEW_LINE>Thread.currentThread().setContextClassLoader(enginePluginClassLoader);<NEW_LINE>try {<NEW_LINE>final Constructor<?>[] constructors = pluginClass.getConstructors();<NEW_LINE>if (constructors.length == 0) {<NEW_LINE>throw new EngineConnPluginLoadException("No public constructor in pluginClass [" + pluginClass.getName() + "]", null);<NEW_LINE>}<NEW_LINE>// Choose the first one<NEW_LINE>Constructor<?> constructor = constructors[0];<NEW_LINE>Class<?>[] parameters = constructor.getParameterTypes();<NEW_LINE>try {<NEW_LINE>if (constructor.getParameterCount() == 0) {<NEW_LINE>return (EngineConnPlugin) constructor.newInstance();<NEW_LINE>} else if (constructor.getParameterCount() == 1 && parameters[0] == Map.class) {<NEW_LINE>return (EngineConnPlugin) constructor.newInstance(props);<NEW_LINE>} else {<NEW_LINE>throw new EngineConnPluginLoadException("Illegal arguments in constructor of pluginClass [" + pluginClass.<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (e instanceof EngineConnPluginLoadException) {<NEW_LINE>throw (EngineConnPluginLoadException) e;<NEW_LINE>}<NEW_LINE>throw new EngineConnPluginLoadException("Unable to construct pluginClass [" + pluginClass.getName() + "]", null);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>Thread.currentThread().setContextClassLoader(storeClassLoader);<NEW_LINE>}<NEW_LINE>} | getName() + "]", null); |
567,565 | final GetAssociatedRoleResult executeGetAssociatedRole(GetAssociatedRoleRequest getAssociatedRoleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getAssociatedRoleRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<GetAssociatedRoleRequest> request = null;<NEW_LINE>Response<GetAssociatedRoleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetAssociatedRoleRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getAssociatedRoleRequest));<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, "Greengrass");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAssociatedRole");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetAssociatedRoleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetAssociatedRoleResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,620,302 | private TornadoInstalledCode compileTask(SchedulableTask task) {<NEW_LINE>final CompilableTask executable = (CompilableTask) task;<NEW_LINE>final ResolvedJavaMethod resolvedMethod = TornadoCoreRuntime.getTornadoRuntime().resolveMethod(executable.getMethod());<NEW_LINE>final Sketch sketch = TornadoSketcher.lookup(resolvedMethod, task.meta().getDriverIndex(), task.meta().getDeviceIndex());<NEW_LINE>// copy meta data into task<NEW_LINE>final TaskMetaData taskMeta = executable.meta();<NEW_LINE>final Access[] sketchAccess = sketch.getArgumentsAccess();<NEW_LINE>final Access[] taskAccess = taskMeta.getArgumentsAccess();<NEW_LINE>System.arraycopy(sketchAccess, 0, taskAccess, 0, sketchAccess.length);<NEW_LINE>try {<NEW_LINE>OCLProviders providers = (OCLProviders) getBackend().getProviders();<NEW_LINE>TornadoProfiler profiler = task.getProfiler();<NEW_LINE>profiler.start(ProfilerType.TASK_COMPILE_GRAAL_TIME, taskMeta.getId());<NEW_LINE>final OCLCompilationResult result = OCLCompiler.compileSketchForDevice(sketch, executable, providers, getBackend());<NEW_LINE>profiler.stop(ProfilerType.TASK_COMPILE_GRAAL_TIME, taskMeta.getId());<NEW_LINE>profiler.sum(ProfilerType.TOTAL_GRAAL_COMPILE_TIME, profiler.getTaskTimer(ProfilerType.TASK_COMPILE_GRAAL_TIME<MASK><NEW_LINE>RuntimeUtilities.maybePrintSource(result.getTargetCode());<NEW_LINE>return null;<NEW_LINE>} catch (Exception e) {<NEW_LINE>driver.fatal("unable to compile %s for device %s", task.getId(), getDeviceName());<NEW_LINE>driver.fatal("exception occured when compiling %s", ((CompilableTask) task).getMethod().getName());<NEW_LINE>driver.fatal("exception: %s", e.toString());<NEW_LINE>throw new TornadoBailoutRuntimeException("[Error During the Task Compilation] ", e);<NEW_LINE>}<NEW_LINE>} | , taskMeta.getId())); |
106,359 | private Long lookupSandboxId(WebRequest request) {<NEW_LINE>String sandboxIdStr = request.getParameter(SANDBOX_ID_VAR);<NEW_LINE>Long sandboxId = null;<NEW_LINE>if (sandboxIdStr != null) {<NEW_LINE>try {<NEW_LINE>sandboxId = Long.valueOf(sandboxIdStr);<NEW_LINE>if (LOG.isTraceEnabled()) {<NEW_LINE>LOG.trace("SandboxId found on request " + sandboxId);<NEW_LINE>}<NEW_LINE>} catch (NumberFormatException nfe) {<NEW_LINE>LOG.warn("blcSandboxId parameter could not be converted into a Long", nfe);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (BLCRequestUtils.isOKtoUseSession(request)) {<NEW_LINE>if (sandboxId == null) {<NEW_LINE>// check the session<NEW_LINE>sandboxId = (Long) request.getAttribute(SANDBOX_ID_VAR, WebRequest.SCOPE_SESSION);<NEW_LINE>if (LOG.isTraceEnabled()) {<NEW_LINE>if (sandboxId != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>request.setAttribute(SANDBOX_ID_VAR, sandboxId, WebRequest.SCOPE_SESSION);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sandboxId;<NEW_LINE>} | LOG.trace("SandboxId found in session " + sandboxId); |
1,475,011 | public static void requestSoftInputChange(KrollProxy proxy, View view) {<NEW_LINE>if (proxy == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int focusState = TiUIView.SOFT_KEYBOARD_DEFAULT_ON_FOCUS;<NEW_LINE>if (proxy.hasProperty(TiC.PROPERTY_SOFT_KEYBOARD_ON_FOCUS)) {<NEW_LINE>focusState = TiConvert.toInt(proxy<MASK><NEW_LINE>}<NEW_LINE>if (focusState > TiUIView.SOFT_KEYBOARD_DEFAULT_ON_FOCUS) {<NEW_LINE>if (focusState == TiUIView.SOFT_KEYBOARD_SHOW_ON_FOCUS) {<NEW_LINE>showSoftKeyboard(view, true);<NEW_LINE>} else if (focusState == TiUIView.SOFT_KEYBOARD_HIDE_ON_FOCUS) {<NEW_LINE>showSoftKeyboard(view, false);<NEW_LINE>} else {<NEW_LINE>Log.w(TAG, "Unknown onFocus state: " + focusState);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getProperty(TiC.PROPERTY_SOFT_KEYBOARD_ON_FOCUS)); |
1,508,596 | private void updatePartnerProductQualityRating(PartnerProductQualityRating partnerProductQualityRating, StockMoveLine stockMoveLine, boolean undo) {<NEW_LINE>BigDecimal qty = !undo ? stockMoveLine.getRealQty() : stockMoveLine.getRealQty().negate();<NEW_LINE>BigDecimal compliantArrivalProductQty = partnerProductQualityRating.getCompliantArrivalProductQty();<NEW_LINE>if (stockMoveLine.getConformitySelect() == StockMoveLineRepository.CONFORMITY_COMPLIANT) {<NEW_LINE>compliantArrivalProductQty = compliantArrivalProductQty.add(qty);<NEW_LINE>partnerProductQualityRating.setCompliantArrivalProductQty(compliantArrivalProductQty);<NEW_LINE>}<NEW_LINE>BigDecimal arrivalProductQty = partnerProductQualityRating.getArrivalProductQty().add(qty);<NEW_LINE>partnerProductQualityRating.setArrivalProductQty(arrivalProductQty);<NEW_LINE>if (arrivalProductQty.signum() > 0) {<NEW_LINE>BigDecimal qualityRating = computeQualityRating(compliantArrivalProductQty, arrivalProductQty);<NEW_LINE>partnerProductQualityRating.setQualityRating(qualityRating);<NEW_LINE>partnerProductQualityRating<MASK><NEW_LINE>} else {<NEW_LINE>partnerProductQualityRating.getPartner().removePartnerProductQualityRatingListItem(partnerProductQualityRating);<NEW_LINE>}<NEW_LINE>} | .setQualityRatingSelect(computeQualityRatingSelect(qualityRating)); |
957,053 | final GetLoggingConfigurationResult executeGetLoggingConfiguration(GetLoggingConfigurationRequest getLoggingConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getLoggingConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetLoggingConfigurationRequest> request = null;<NEW_LINE>Response<GetLoggingConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetLoggingConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getLoggingConfigurationRequest));<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, "WAF");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetLoggingConfiguration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetLoggingConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetLoggingConfigurationResultJsonUnmarshaller());<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); |
713,690 | protected void loadOutputProperties(RenderingRule rule, boolean override) {<NEW_LINE>RenderingRuleProperty[<MASK><NEW_LINE>for (int i = 0; i < properties.length; i++) {<NEW_LINE>RenderingRuleProperty rp = properties[i];<NEW_LINE>if (rp.isOutputProperty()) {<NEW_LINE>if (!isSpecified(rp) || override) {<NEW_LINE>RenderingRule rr = rule.getAttrProp(i);<NEW_LINE>if (rr != null) {<NEW_LINE>visitRule(rr, true);<NEW_LINE>if (isSpecified(storage.PROPS.R_ATTR_COLOR_VALUE)) {<NEW_LINE>values[rp.getId()] = getIntPropertyValue(storage.PROPS.R_ATTR_COLOR_VALUE);<NEW_LINE>} else if (isSpecified(storage.PROPS.R_ATTR_INT_VALUE)) {<NEW_LINE>values[rp.getId()] = getIntPropertyValue(storage.PROPS.R_ATTR_INT_VALUE);<NEW_LINE>fvalues[rp.getId()] = getFloatPropertyValue(storage.PROPS.R_ATTR_INT_VALUE);<NEW_LINE>} else if (isSpecified(storage.PROPS.R_ATTR_BOOL_VALUE)) {<NEW_LINE>values[rp.getId()] = getIntPropertyValue(storage.PROPS.R_ATTR_BOOL_VALUE);<NEW_LINE>}<NEW_LINE>} else if (rp.isFloat()) {<NEW_LINE>fvalues[rp.getId()] = rule.getFloatProp(i);<NEW_LINE>values[rp.getId()] = rule.getIntProp(i);<NEW_LINE>} else {<NEW_LINE>values[rp.getId()] = rule.getIntProp(i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] properties = rule.getProperties(); |
1,463,108 | private void appendInternalArchiveLabel(IPackageFragmentRoot root, long flags) {<NEW_LINE>IResource resource = root.getResource();<NEW_LINE>boolean rootQualified = getFlag(flags, JavaElementLabels.ROOT_QUALIFIED);<NEW_LINE>if (rootQualified) {<NEW_LINE>fBuilder.append(root.getPath().makeRelative().toString());<NEW_LINE>} else {<NEW_LINE>fBuilder.append(root.getElementName());<NEW_LINE>boolean referencedPostQualified = <MASK><NEW_LINE>if (referencedPostQualified && isReferenced(root)) {<NEW_LINE>fBuilder.append(JavaElementLabels.CONCAT_STRING);<NEW_LINE>fBuilder.append(resource.getParent().getFullPath().makeRelative().toString());<NEW_LINE>} else if (getFlag(flags, JavaElementLabels.ROOT_POST_QUALIFIED)) {<NEW_LINE>fBuilder.append(JavaElementLabels.CONCAT_STRING);<NEW_LINE>fBuilder.append(root.getParent().getPath().makeRelative().toString());<NEW_LINE>}<NEW_LINE>if (referencedPostQualified) {<NEW_LINE>try {<NEW_LINE>IClasspathEntry referencingEntry = JavaModelUtil.getClasspathEntry(root).getReferencingEntry();<NEW_LINE>if (referencingEntry != null) {<NEW_LINE>fBuilder.append(NLS.bind(" (from {0} of {1})", new Object[] { Name.CLASS_PATH.toString(), referencingEntry.getPath().lastSegment() }));<NEW_LINE>}<NEW_LINE>} catch (JavaModelException e) {<NEW_LINE>// ignore<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getFlag(flags, JavaElementLabels.REFERENCED_ROOT_POST_QUALIFIED); |
1,283,065 | private void updateDisplayName() {<NEW_LINE>// NON-NLS<NEW_LINE>String // NON-NLS<NEW_LINE>query = // NON-NLS<NEW_LINE>"SELECT count(distinct SUBSTR(blackboard_attributes.value_text,1,8)) AS BINs " + // NON-NLS<NEW_LINE>" FROM blackboard_artifacts " + " JOIN blackboard_attributes ON blackboard_artifacts.artifact_id = blackboard_attributes.artifact_id" + // NON-NLS<NEW_LINE>" WHERE blackboard_artifacts.artifact_type_id = " + BlackboardArtifact.Type.TSK_ACCOUNT.getTypeID() + // NON-NLS<NEW_LINE>" AND blackboard_attributes.attribute_type_id = " + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CARD_NUMBER.getTypeID() + // NON-NLS<NEW_LINE>getFilterByDataSourceClause() + getRejectedArtifactFilterClause();<NEW_LINE>try (SleuthkitCase.CaseDbQuery results = Case.getCurrentCaseThrows().getSleuthkitCase().executeQuery(query);<NEW_LINE>ResultSet resultSet = results.getResultSet()) {<NEW_LINE>while (resultSet.next()) {<NEW_LINE>setDisplayName(Bundle.Accounts_ByBINNode_displayName(<MASK><NEW_LINE>}<NEW_LINE>} catch (TskCoreException | SQLException | NoCurrentCaseException ex) {<NEW_LINE>// NON-NLS<NEW_LINE>LOGGER.log(Level.SEVERE, "Error querying for BINs.", ex);<NEW_LINE>}<NEW_LINE>} | resultSet.getLong("BINs"))); |
1,457,782 | public synchronized void merge() {<NEW_LINE>if (activeDialog <= 0) {<NEW_LINE>throw new RevokingStoreIllegalStateException(ACTIVE_DIALOG_POSITIVE);<NEW_LINE>}<NEW_LINE>if (activeDialog == 1 && stack.size() == 1) {<NEW_LINE>stack.pollLast();<NEW_LINE>--activeDialog;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (stack.size() < 2) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>RevokingState state = stack.peekLast();<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>List<RevokingState> list = (List<RevokingState>) stack;<NEW_LINE>RevokingState prevState = list.get(stack.size() - 2);<NEW_LINE>state.oldValues.entrySet().stream().filter(e -> !prevState.newIds.contains(e.getKey())).filter(e -> !prevState.oldValues.containsKey(e.getKey())).forEach(e -> prevState.oldValues.put(e.getKey()<MASK><NEW_LINE>prevState.newIds.addAll(state.newIds);<NEW_LINE>state.removed.entrySet().stream().filter(e -> {<NEW_LINE>boolean has = prevState.newIds.contains(e.getKey());<NEW_LINE>if (has) {<NEW_LINE>prevState.newIds.remove(e.getKey());<NEW_LINE>}<NEW_LINE>return !has;<NEW_LINE>}).filter(e -> {<NEW_LINE>boolean has = prevState.oldValues.containsKey(e.getKey());<NEW_LINE>if (has) {<NEW_LINE>prevState.removed.put(e.getKey(), prevState.oldValues.get(e.getKey()));<NEW_LINE>prevState.oldValues.remove(e.getKey());<NEW_LINE>}<NEW_LINE>return !has;<NEW_LINE>}).forEach(e -> prevState.removed.put(e.getKey(), e.getValue()));<NEW_LINE>stack.pollLast();<NEW_LINE>--activeDialog;<NEW_LINE>} | , e.getValue())); |
151,247 | protected void initView() {<NEW_LINE>illust = Shaft.sGson.fromJson(Params.EXAMPLE_ILLUST, IllustsBean.class);<NEW_LINE>baseBind.toolbar.toolbar.setNavigationOnClickListener(v -> mActivity.finish());<NEW_LINE>baseBind.toolbar.toolbar.<MASK><NEW_LINE>baseBind.showNow.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>showPreview();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>baseBind.saveNow.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>saveSettings();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>baseBind.reset.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>if (mAdapter != null) {<NEW_LINE>allItems.clear();<NEW_LINE>allItems.addAll(FileCreator.defaultFileCells());<NEW_LINE>mAdapter.notifyDataSetChanged();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>baseBind.hasP0.setChecked(Shaft.sSettings.isHasP0());<NEW_LINE>baseBind.hasP0.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {<NEW_LINE>Shaft.sSettings.setHasP0(isChecked);<NEW_LINE>Common.showToast(getString(R.string.string_428));<NEW_LINE>Local.setSettings(Shaft.sSettings);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | setTitle(R.string.string_242); |
1,244,140 | public void marshall(InfrastructureConfiguration infrastructureConfiguration, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (infrastructureConfiguration == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getArn(), ARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getInstanceTypes(), INSTANCETYPES_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getInstanceProfileName(), INSTANCEPROFILENAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getSecurityGroupIds(), SECURITYGROUPIDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getSubnetId(), SUBNETID_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getLogging(), LOGGING_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getKeyPair(), KEYPAIR_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getTerminateInstanceOnFailure(), TERMINATEINSTANCEONFAILURE_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getSnsTopicArn(), SNSTOPICARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getDateCreated(), DATECREATED_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getDateUpdated(), DATEUPDATED_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getResourceTags(), RESOURCETAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getInstanceMetadataOptions(), INSTANCEMETADATAOPTIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(infrastructureConfiguration.getTags(), TAGS_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); |
515,625 | private void initializeConfigRepository(ConfigRepoConfig repo) {<NEW_LINE><MASK><NEW_LINE>Material material = new Materials(new MaterialConfigs(materialConfig)).first();<NEW_LINE>MaterialInstance materialInstance = this.materialRepository.findMaterialInstance(materialConfig);<NEW_LINE>if (materialInstance != null) {<NEW_LINE>File folder = materialRepository.folderFor(material);<NEW_LINE>MaterialRevisions latestModification = materialRepository.findLatestModification(material);<NEW_LINE>Modification modification = latestModification.firstModifiedMaterialRevision().getLatestModification();<NEW_LINE>try {<NEW_LINE>LOGGER.debug("[Config Repository Initializer] Initializing config repository '{}'. Loading the GoCD configuration from last fetched modification '{}'.", repo.getId(), modification.getRevision());<NEW_LINE>goConfigRepoConfigDataSource.onCheckoutComplete(materialConfig, folder, modification);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error(String.format("[Config Repository Initializer] an error occurred while initializing '%s' config repository.", repo.getId()), e);<NEW_LINE>// Do nothing when error occurs while initializing the config repository.<NEW_LINE>// The config repo initialization may fail due to config repo errors (config errors, or rules violation errors)<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOGGER.debug("[Config Repository Initializer] Skipped initializing config repository '{}'. Could not find material repository under flyweight folder.", repo.getId());<NEW_LINE>}<NEW_LINE>} | MaterialConfig materialConfig = repo.getRepo(); |
1,463,907 | private static boolean verifyConditions(HintContext ctx, ExpressionTree cond, boolean equalsToNull) {<NEW_LINE>switch(cond.getKind()) {<NEW_LINE>case PARENTHESIZED:<NEW_LINE>return verifyConditions(ctx, ((ParenthesizedTree) cond).getExpression(), equalsToNull);<NEW_LINE>case NOT_EQUAL_TO:<NEW_LINE>return !equalsToNull && hasNull(ctx, (BinaryTree) cond);<NEW_LINE>case EQUAL_TO:<NEW_LINE>return equalsToNull && hasNull(ctx, (BinaryTree) cond);<NEW_LINE>case CONDITIONAL_OR:<NEW_LINE>case OR:<NEW_LINE>return equalsToNull && verifyConditions(ctx, ((BinaryTree) cond).getLeftOperand(), equalsToNull) && verifyConditions(ctx, ((BinaryTree) cond).getRightOperand(), equalsToNull);<NEW_LINE>case CONDITIONAL_AND:<NEW_LINE>case AND:<NEW_LINE>return !equalsToNull && verifyConditions(ctx, ((BinaryTree) cond).getLeftOperand(), equalsToNull) && verifyConditions(ctx, ((BinaryTree) cond<MASK><NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ).getRightOperand(), equalsToNull); |
52,954 | public BufferedImage filter(BufferedImage src, BufferedImage dst) {<NEW_LINE>int width = src.getWidth();<NEW_LINE>int height = src.getHeight();<NEW_LINE>if (dst == null) {<NEW_LINE>dst = createCompatibleDestImage(src, null);<NEW_LINE>}<NEW_LINE>int[] inPixels <MASK><NEW_LINE>int[] outPixels = new int[width * height];<NEW_LINE>getRGB(src, 0, 0, width, height, inPixels);<NEW_LINE>if (premultiplyAlpha) {<NEW_LINE>premultiply(inPixels, 0, inPixels.length);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < iterations; i++) {<NEW_LINE>blur(inPixels, outPixels, width, height, hRadius);<NEW_LINE>blur(outPixels, inPixels, height, width, vRadius);<NEW_LINE>}<NEW_LINE>blurFractional(inPixels, outPixels, width, height, hRadius);<NEW_LINE>blurFractional(outPixels, inPixels, height, width, vRadius);<NEW_LINE>if (premultiplyAlpha) {<NEW_LINE>unpremultiply(inPixels, 0, inPixels.length);<NEW_LINE>}<NEW_LINE>setRGB(dst, 0, 0, width, height, inPixels);<NEW_LINE>return dst;<NEW_LINE>} | = new int[width * height]; |
435,525 | public void receiveResponse(HttpClientResponse clientResponse) {<NEW_LINE>int sc = clientResponse.statusCode();<NEW_LINE>int maxRedirects = request.followRedirects ? client.getOptions().getMaxRedirects() : 0;<NEW_LINE>this.clientResponse = clientResponse;<NEW_LINE>if (redirects < maxRedirects && sc >= 300 && sc < 400) {<NEW_LINE>redirects++;<NEW_LINE>Future<RequestOptions> next = client.<MASK><NEW_LINE>if (next != null) {<NEW_LINE>if (redirectedLocations.isEmpty()) {<NEW_LINE>redirectedLocations = new ArrayList<>();<NEW_LINE>}<NEW_LINE>redirectedLocations.add(clientResponse.getHeader(HttpHeaders.LOCATION));<NEW_LINE>next.onComplete(ar -> {<NEW_LINE>if (ar.succeeded()) {<NEW_LINE>RequestOptions options = ar.result();<NEW_LINE>requestOptions = options;<NEW_LINE>fire(ClientPhase.FOLLOW_REDIRECT);<NEW_LINE>} else {<NEW_LINE>fail(ar.cause());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.clientResponse = clientResponse;<NEW_LINE>fire(ClientPhase.RECEIVE_RESPONSE);<NEW_LINE>} | redirectHandler().apply(clientResponse); |
904,403 | public void onItemClick(AdapterView<?> parent, View view, int position, long id) {<NEW_LINE>String address = <MASK><NEW_LINE>final Target t = System.getTargetByAddress(address);<NEW_LINE>if (t == null)<NEW_LINE>return;<NEW_LINE>new ConfirmDialog(getString(R.string.mitm_ss_select_target_title), String.format(getString(R.string.mitm_ss_select_target_prompt), address), Sniffer.this, new ConfirmDialog.ConfirmDialogListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onConfirm() {<NEW_LINE>System.setCurrentTarget(t);<NEW_LINE>setStoppedState();<NEW_LINE>Toast.makeText(Sniffer.this, getString(R.string.selected_) + System.getCurrentTarget(), Toast.LENGTH_SHORT).show();<NEW_LINE>startActivity(new Intent(Sniffer.this, ActionActivity.class));<NEW_LINE>overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCancel() {<NEW_LINE>}<NEW_LINE>}).show();<NEW_LINE>} | mAdapter.getByPosition(position).mAddress; |
820,964 | public void saveSettings(DBPDataSourceContainer dataSource) {<NEW_LINE>DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration();<NEW_LINE>final Set<String> properties = metaURL == null ? Collections.emptySet<MASK><NEW_LINE>if (hostText != null && properties.contains(JDBCConstants.PROP_HOST)) {<NEW_LINE>connectionInfo.setHostName(hostText.getText().trim());<NEW_LINE>}<NEW_LINE>if (portText != null && properties.contains(JDBCConstants.PROP_PORT)) {<NEW_LINE>connectionInfo.setHostPort(portText.getText().trim());<NEW_LINE>}<NEW_LINE>if (serverText != null && properties.contains(JDBCConstants.PROP_SERVER)) {<NEW_LINE>connectionInfo.setServerName(serverText.getText().trim());<NEW_LINE>}<NEW_LINE>if (dbText != null && properties.contains(JDBCConstants.PROP_DATABASE)) {<NEW_LINE>connectionInfo.setDatabaseName(dbText.getText().trim());<NEW_LINE>}<NEW_LINE>if (pathText != null && (properties.contains(JDBCConstants.PROP_FOLDER) || properties.contains(JDBCConstants.PROP_FILE))) {<NEW_LINE>connectionInfo.setDatabaseName(pathText.getText().trim());<NEW_LINE>}<NEW_LINE>super.saveSettings(dataSource);<NEW_LINE>if (isCustom) {<NEW_LINE>if (urlText != null) {<NEW_LINE>connectionInfo.setUrl(urlText.getText().trim());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (urlText != null && connectionInfo.getUrl() != null) {<NEW_LINE>urlText.setText(connectionInfo.getUrl());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | () : metaURL.getAvailableProperties(); |
974,184 | public InferenceExecutionConfig unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>InferenceExecutionConfig inferenceExecutionConfig = new InferenceExecutionConfig();<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 null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Mode", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>inferenceExecutionConfig.setMode(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 inferenceExecutionConfig;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
631,814 | public ListPolicyAttachmentsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListPolicyAttachmentsResult listPolicyAttachmentsResult = new ListPolicyAttachmentsResult();<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 listPolicyAttachmentsResult;<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("ObjectIdentifiers", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listPolicyAttachmentsResult.setObjectIdentifiers(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listPolicyAttachmentsResult.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 listPolicyAttachmentsResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
923,006 | private void discardRowsOutsideOf(int optimalFirstRow, int optimalLastRow) {<NEW_LINE>int firstDiscarded = -1, lastDiscarded = -1;<NEW_LINE>boolean cont = true;<NEW_LINE>while (cont && scrollBody.getLastRendered() > optimalFirstRow && scrollBody.getFirstRendered() < optimalFirstRow) {<NEW_LINE>if (firstDiscarded == -1) {<NEW_LINE>firstDiscarded = scrollBody.getFirstRendered();<NEW_LINE>}<NEW_LINE>// removing row from start<NEW_LINE>cont = scrollBody.unlinkRow(true);<NEW_LINE>}<NEW_LINE>if (firstDiscarded != -1) {<NEW_LINE>lastDiscarded = scrollBody.getFirstRendered() - 1;<NEW_LINE>debug("Discarded rows " + firstDiscarded + "-" + lastDiscarded);<NEW_LINE>}<NEW_LINE>firstDiscarded = lastDiscarded = -1;<NEW_LINE>cont = true;<NEW_LINE>while (cont && scrollBody.getLastRendered() > optimalLastRow) {<NEW_LINE>if (lastDiscarded == -1) {<NEW_LINE>lastDiscarded = scrollBody.getLastRendered();<NEW_LINE>}<NEW_LINE>// removing row from the end<NEW_LINE>cont = scrollBody.unlinkRow(false);<NEW_LINE>}<NEW_LINE>if (lastDiscarded != -1) {<NEW_LINE>firstDiscarded = scrollBody.getLastRendered() + 1;<NEW_LINE>debug("Discarded rows " + firstDiscarded + "-" + lastDiscarded);<NEW_LINE>}<NEW_LINE>debug("Now in cache: " + scrollBody.getFirstRendered() + <MASK><NEW_LINE>} | "-" + scrollBody.getLastRendered()); |
1,373,731 | public static QueryMigrateRegionListResponse unmarshall(QueryMigrateRegionListResponse queryMigrateRegionListResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryMigrateRegionListResponse.setRequestId(_ctx.stringValue("QueryMigrateRegionListResponse.RequestId"));<NEW_LINE>queryMigrateRegionListResponse.setCode(_ctx.integerValue("QueryMigrateRegionListResponse.Code"));<NEW_LINE>queryMigrateRegionListResponse.setMessage<MASK><NEW_LINE>List<RegionEntity> regionEntityList = new ArrayList<RegionEntity>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryMigrateRegionListResponse.RegionEntityList.Length"); i++) {<NEW_LINE>RegionEntity regionEntity = new RegionEntity();<NEW_LINE>regionEntity.setRegionNo(_ctx.stringValue("QueryMigrateRegionListResponse.RegionEntityList[" + i + "].RegionNo"));<NEW_LINE>regionEntity.setRegionName(_ctx.stringValue("QueryMigrateRegionListResponse.RegionEntityList[" + i + "].RegionName"));<NEW_LINE>regionEntityList.add(regionEntity);<NEW_LINE>}<NEW_LINE>queryMigrateRegionListResponse.setRegionEntityList(regionEntityList);<NEW_LINE>return queryMigrateRegionListResponse;<NEW_LINE>} | (_ctx.stringValue("QueryMigrateRegionListResponse.Message")); |
1,236,332 | public void initializeForModule(ModuleBinding module) {<NEW_LINE>initializeHeader(null, ClassFileConstants.AccModule);<NEW_LINE>int classNameIndex = this.constantPool.literalIndexForType(TypeConstants.MODULE_INFO_NAME);<NEW_LINE>this.contents[this.contentsOffset++] = (byte) (classNameIndex >> 8);<NEW_LINE>this.contents[this.contentsOffset++] = (byte) classNameIndex;<NEW_LINE>this.codeStream.maxFieldCount = 0;<NEW_LINE>// superclass:<NEW_LINE>this.contents[this.contentsOffset++] = 0;<NEW_LINE>this.contents[this.contentsOffset++] = 0;<NEW_LINE>// superInterfacesCount<NEW_LINE>this.contents[this.contentsOffset++] = 0;<NEW_LINE>this.contents[this.contentsOffset++] = 0;<NEW_LINE>// fieldsCount<NEW_LINE>this.contents[this.contentsOffset++] = 0;<NEW_LINE>this.contents<MASK><NEW_LINE>// methodsCount<NEW_LINE>this.contents[this.contentsOffset++] = 0;<NEW_LINE>this.contents[this.contentsOffset++] = 0;<NEW_LINE>} | [this.contentsOffset++] = 0; |
1,355,757 | public Request<RemoveRoleFromDBInstanceRequest> marshall(RemoveRoleFromDBInstanceRequest removeRoleFromDBInstanceRequest) {<NEW_LINE>if (removeRoleFromDBInstanceRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<RemoveRoleFromDBInstanceRequest> request = new DefaultRequest<RemoveRoleFromDBInstanceRequest>(removeRoleFromDBInstanceRequest, "AmazonRDS");<NEW_LINE>request.addParameter("Action", "RemoveRoleFromDBInstance");<NEW_LINE>request.addParameter("Version", "2014-10-31");<NEW_LINE><MASK><NEW_LINE>if (removeRoleFromDBInstanceRequest.getDBInstanceIdentifier() != null) {<NEW_LINE>request.addParameter("DBInstanceIdentifier", StringUtils.fromString(removeRoleFromDBInstanceRequest.getDBInstanceIdentifier()));<NEW_LINE>}<NEW_LINE>if (removeRoleFromDBInstanceRequest.getRoleArn() != null) {<NEW_LINE>request.addParameter("RoleArn", StringUtils.fromString(removeRoleFromDBInstanceRequest.getRoleArn()));<NEW_LINE>}<NEW_LINE>if (removeRoleFromDBInstanceRequest.getFeatureName() != null) {<NEW_LINE>request.addParameter("FeatureName", StringUtils.fromString(removeRoleFromDBInstanceRequest.getFeatureName()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | request.setHttpMethod(HttpMethodName.POST); |
1,010,737 | public PutEventsConfigurationResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>PutEventsConfigurationResult putEventsConfigurationResult = new PutEventsConfigurationResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return putEventsConfigurationResult;<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("EventsConfiguration", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>putEventsConfigurationResult.setEventsConfiguration(EventsConfigurationJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return putEventsConfigurationResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
944,705 | private Node createNodeDelegateImpl() {<NEW_LINE>try {<NEW_LINE>if (!getPrimaryFile().getFileSystem().isDefault()) {<NEW_LINE>return new DataNode(this, Children.LEAF);<NEW_LINE>}<NEW_LINE>} catch (FileStateInvalidException ex) {<NEW_LINE>err.log(Level.WARNING, null, ex);<NEW_LINE>return new DataNode(this, Children.LEAF);<NEW_LINE>}<NEW_LINE>if (getPrimaryFile().hasExt(XML_EXT)) {<NEW_LINE>// if lookup does not contain any InstanceCookie then the object<NEW_LINE>// is considered as unregognized<NEW_LINE>if (null == getCookieFromEP(InstanceCookie.class)) {<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE>Node n = getCookieFromEP(Node.class);<NEW_LINE>if (n != null) {<NEW_LINE>return new CookieAdjustingFilter(n);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Instances of Node or Node.Handle should be used as is.<NEW_LINE>try {<NEW_LINE>if (instanceOf(Node.class)) {<NEW_LINE>Node n = (Node) instanceCreate();<NEW_LINE>if (n != null) {<NEW_LINE>// #161888 robustness<NEW_LINE>return new CookieAdjustingFilter(n);<NEW_LINE>}<NEW_LINE>} else if (instanceOf(Node.Handle.class)) {<NEW_LINE>Node.Handle h = (Node.Handle) instanceCreate();<NEW_LINE>if (h != null) {<NEW_LINE>return new CookieAdjustingFilter(h.getNode());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>err.log(Level.WARNING, null, ex);<NEW_LINE>} catch (ClassNotFoundException ex) {<NEW_LINE>err.log(Level.WARNING, null, ex);<NEW_LINE>}<NEW_LINE>return new InstanceNode(this);<NEW_LINE>} | new CookieAdjustingFilter(new UnrecognizedSettingNode()); |
1,166,826 | public boolean visit(MySqlCharExpr x) {<NEW_LINE>String mysqlCharset = x.getCharset();<NEW_LINE>String mysqlCollate = x.getCollate();<NEW_LINE>boolean isHex = x.isHex();<NEW_LINE>if (this.parameterized && mysqlCharset != null) {<NEW_LINE>print('?');<NEW_LINE>incrementReplaceCunt();<NEW_LINE>if (this.parameters != null) {<NEW_LINE>String text;<NEW_LINE>if (CharsetName.of(mysqlCharset) == CharsetName.BINARY) {<NEW_LINE>// store in latin1<NEW_LINE>text = new String(x.getBinary(), StandardCharsets.ISO_8859_1);<NEW_LINE>} else {<NEW_LINE>text = x.getText();<NEW_LINE>}<NEW_LINE>Charset sqlCharset = CharsetName.convertStrToJavaCharset(mysqlCharset);<NEW_LINE>if (sqlCharset == null) {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_PARSER, "unsupported mysql character set: " + mysqlCharset);<NEW_LINE>} else {<NEW_LINE>SqlCollation sqlCollation = new SqlCollation(sqlCharset, mysqlCollate, SqlCollation.Coercibility.EXPLICIT);<NEW_LINE>if (isHex) {<NEW_LINE>CharsetName charsetName = CharsetName.of(sqlCharset);<NEW_LINE>if (charsetName != CharsetName.BINARY) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>NlsString value = new NlsString(text, mysqlCharset, sqlCollation);<NEW_LINE>this.parameters.add(value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>return super.visit(x);<NEW_LINE>}<NEW_LINE>} | text = charsetName.toUTF16String(text); |
1,211,909 | public static //<NEW_LINE>int loadProgram(String vertShaderSrc, String fragShaderSrc) {<NEW_LINE>int vertexShader;<NEW_LINE>int fragmentShader;<NEW_LINE>int programObject;<NEW_LINE>int[] linked = new int[1];<NEW_LINE>// Load the vertex/fragment shaders<NEW_LINE>vertexShader = loadShader(GLES30.GL_VERTEX_SHADER, vertShaderSrc);<NEW_LINE>if (vertexShader == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>fragmentShader = loadShader(GLES30.GL_FRAGMENT_SHADER, fragShaderSrc);<NEW_LINE>if (fragmentShader == 0) {<NEW_LINE>GLES30.glDeleteShader(vertexShader);<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>// Create the program object<NEW_LINE>programObject = GLES30.glCreateProgram();<NEW_LINE>if (programObject == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>GLES30.glAttachShader(programObject, vertexShader);<NEW_LINE><MASK><NEW_LINE>// Link the program<NEW_LINE>GLES30.glLinkProgram(programObject);<NEW_LINE>// Check the link status<NEW_LINE>GLES30.glGetProgramiv(programObject, GLES30.GL_LINK_STATUS, linked, 0);<NEW_LINE>if (linked[0] == 0) {<NEW_LINE>Log.e("ESShader", "Error linking program:");<NEW_LINE>Log.e("ESShader", GLES30.glGetProgramInfoLog(programObject));<NEW_LINE>GLES30.glDeleteProgram(programObject);<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>// Free up no longer needed shader resources<NEW_LINE>GLES30.glDeleteShader(vertexShader);<NEW_LINE>GLES30.glDeleteShader(fragmentShader);<NEW_LINE>return programObject;<NEW_LINE>} | GLES30.glAttachShader(programObject, fragmentShader); |
1,421,942 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {<NEW_LINE>if (mAdjustViewBounds) {<NEW_LINE>ViewGroup.LayoutParams layoutParams = getLayoutParams();<NEW_LINE>if (layoutParams.width == WRAP_CONTENT && layoutParams.height == WRAP_CONTENT) {<NEW_LINE>throw new CameraException("android:adjustViewBounds=true while both layout_width and layout_height are setView to wrap_content - only 1 is allowed.");<NEW_LINE>} else if (layoutParams.width == WRAP_CONTENT) {<NEW_LINE>int width = 0;<NEW_LINE>int height = MeasureSpec.getSize(heightMeasureSpec);<NEW_LINE>if (mAspectRatio > 0) {<NEW_LINE>width = (int) (height * mAspectRatio);<NEW_LINE>widthMeasureSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);<NEW_LINE>} else if (mCameraPreview != null && mCameraPreview.getSurfaceSize().area() > 0) {<NEW_LINE>CameraSize previewSize = mCameraPreview.getSurfaceSize();<NEW_LINE>width = (int) (((float) height / (float) previewSize.getHeight()) * previewSize.getWidth());<NEW_LINE>widthMeasureSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);<NEW_LINE>}<NEW_LINE>} else if (layoutParams.height == WRAP_CONTENT) {<NEW_LINE>int width = MeasureSpec.getSize(widthMeasureSpec);<NEW_LINE>int height = 0;<NEW_LINE>if (mAspectRatio > 0) {<NEW_LINE>height = (int) (width * mAspectRatio);<NEW_LINE>heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);<NEW_LINE>} else if (mCameraPreview != null && mCameraPreview.getSurfaceSize().area() > 0) {<NEW_LINE>CameraSize previewSize = mCameraPreview.getSurfaceSize();<NEW_LINE>height = (int) (((float) width / (float) previewSize.getWidth()) * previewSize.getHeight());<NEW_LINE>heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
355,006 | private void recreateConfigDriveIso(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest) throws ResourceUnavailableException {<NEW_LINE>if (nic.isDefaultNic() && _networkModel.getUserDataUpdateProvider(network).getProvider().equals(Provider.ConfigDrive)) {<NEW_LINE>DiskTO diskToUse = null;<NEW_LINE>for (DiskTO disk : vm.getDisks()) {<NEW_LINE>if (disk.getType() == Volume.Type.ISO && disk.getPath() != null && disk.getPath().contains("configdrive")) {<NEW_LINE>diskToUse = disk;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final UserVmVO userVm = _userVmDao.findById(vm.getId());<NEW_LINE>if (userVm != null) {<NEW_LINE>final boolean isWindows = isWindows(userVm.getGuestOSId());<NEW_LINE>List<String[]> vmData = _networkModel.generateVmData(userVm.getUserData(), _serviceOfferingDao.findById(userVm.getServiceOfferingId()).getName(), userVm.getDataCenterId(), userVm.getInstanceName(), vm.getHostName(), vm.getId(), vm.getUuid(), nic.getMacAddress(), userVm.getDetail("SSH.PublicKey"), (String) vm.getParameter(VirtualMachineProfile.Param.VmPassword), isWindows, VirtualMachineManager.getHypervisorHostname(dest.getHost() != null ? dest.getHost()<MASK><NEW_LINE>vm.setVmData(vmData);<NEW_LINE>vm.setConfigDriveLabel(VirtualMachineManager.VmConfigDriveLabel.value());<NEW_LINE>createConfigDriveIso(vm, dest, diskToUse);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getName() : "")); |
1,172,078 | protected void buildTreeAndRestoreState(@Nonnull final XStackFrame stackFrame) {<NEW_LINE>XSourcePosition position = stackFrame.getSourcePosition();<NEW_LINE>XDebuggerTree tree = getTree();<NEW_LINE>tree.setSourcePosition(position);<NEW_LINE>createNewRootNode(stackFrame);<NEW_LINE>final Project project = tree.getProject();<NEW_LINE>project.putUserData(XVariablesView.DEBUG_VARIABLES, new XVariablesView.InlineVariablesInfo());<NEW_LINE>project.putUserData(XVariablesView.DEBUG_VARIABLES_TIMESTAMPS, new ObjectLongHashMap<>());<NEW_LINE>clearInlays(tree);<NEW_LINE><MASK><NEW_LINE>if (myFrameEqualityObject != null && newEqualityObject != null && myFrameEqualityObject.equals(newEqualityObject) && myTreeState != null) {<NEW_LINE>disposeTreeRestorer();<NEW_LINE>myTreeRestorer = myTreeState.restoreState(tree);<NEW_LINE>}<NEW_LINE>if (position != null && XDebuggerSettingsManager.getInstance().getDataViewSettings().isValueTooltipAutoShowOnSelection()) {<NEW_LINE>registerInlineEvaluator(stackFrame, position, project);<NEW_LINE>}<NEW_LINE>} | Object newEqualityObject = stackFrame.getEqualityObject(); |
1,038,040 | private final ILookupData call0(final INamePairIterator data) {<NEW_LINE>final Stopwatch duration = Stopwatch.createStarted();<NEW_LINE>if (!data.isValid()) {<NEW_LINE>this.validationKey = null;<NEW_LINE>values.clear();<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>this.validationKey = MLookup.createValidationKey(validationCtx, <MASK><NEW_LINE>// check<NEW_LINE>if (Thread.interrupted()) {<NEW_LINE>log.warn("{}: Loader interrupted", threadName);<NEW_LINE>this.wasInterrupted = true;<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>// Reset<NEW_LINE>values.clear();<NEW_LINE>hasInactiveValues = false;<NEW_LINE>allLoaded = true;<NEW_LINE>final INamePairPredicate postQueryFilter = lookupInfo.getValidationRule().getPostQueryFilter();<NEW_LINE>for (NamePair item = data.next(); item != null; item = data.next()) {<NEW_LINE>final int rows = values.size();<NEW_LINE>if (rows >= MLookup.MAX_ROWS) {<NEW_LINE>final String errmsg = lookupInfo.getKeyColumnFQ() + ": Loader - Too many records. Please consider changing it to Search reference or use a (better) validation rule." + "\n Fetched Rows: " + rows + "\n Max rows allowed: " + MLookup.MAX_ROWS;<NEW_LINE>log.warn(errmsg);<NEW_LINE>allLoaded = false;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// check for interrupted every 20 rows<NEW_LINE>if (rows % 20 == 0 && Thread.interrupted()) {<NEW_LINE>this.wasInterrupted = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (!data.wasActive()) {<NEW_LINE>hasInactiveValues = true;<NEW_LINE>}<NEW_LINE>if (!postQueryFilter.accept(validationCtx, item)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>values.put(item.getID(), item);<NEW_LINE>}<NEW_LINE>duration.stop();<NEW_LINE>if (log.isTraceEnabled()) {<NEW_LINE>final int size = values.size();<NEW_LINE>log.trace(// + " ID=" + m_info.AD_Column_ID + " " +<NEW_LINE>lookupInfo.getKeyColumnFQ() + ": " + " - Loader complete #" + size + " - all=" + allLoaded + " - " + duration);<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | lookupInfo, data.getValidationKey()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.