idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,787,001 | Job load() {<NEW_LINE>try {<NEW_LINE>Class<?> currClass = Class.forName(className);<NEW_LINE>Constructor<?> cons = currClass.getDeclaredConstructor(null);<NEW_LINE>cons.setAccessible(true);<NEW_LINE>Object obj = cons.newInstance();<NEW_LINE>do {<NEW_LINE>for (Field f : currClass.getDeclaredFields()) {<NEW_LINE>if (f.isAnnotationPresent(JobContext.class)) {<NEW_LINE>f.setAccessible(true);<NEW_LINE>if (!args.containsKey(f.getName())) {<NEW_LINE>String err = String.format("%s.%s is marked as JobContext, however, we cannot find it in previous saved context. DB corrupted? %s binary changed?", currClass.getCanonicalName(), f.getName(), currClass.getCanonicalName());<NEW_LINE>throw new IllegalArgumentException(err);<NEW_LINE>}<NEW_LINE>Object val = args.get(f.getName());<NEW_LINE>f.set(obj, val);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>currClass = currClass.getSuperclass();<NEW_LINE>} while (currClass != Object.class && currClass != null);<NEW_LINE>return (Job) obj;<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>throw new CloudRuntimeException(String.format<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new CloudRuntimeException("Unable to load " + className + " from previous saved context", e);<NEW_LINE>}<NEW_LINE>} | ("Job %s must have a constructor with zero-argument", className), e); |
931,049 | public void propertyChanged(String key, Object oldValue, Object newValue, KrollProxy proxy) {<NEW_LINE>if (key.equals(TiC.PROPERTY_SWIPEABLE)) {<NEW_LINE>this.swipeable = TiConvert.toBoolean(newValue);<NEW_LINE>} else if (key.equals(TiC.PROPERTY_SMOOTH_SCROLL_ON_TAB_CLICK)) {<NEW_LINE>this.smoothScrollOnTabClick = TiConvert.toBoolean(newValue);<NEW_LINE>} else if (key.equals(TiC.PROPERTY_AUTO_TAB_TITLE)) {<NEW_LINE>this.<MASK><NEW_LINE>} else if (key.equals(TiC.PROPERTY_TABS_BACKGROUND_COLOR)) {<NEW_LINE>for (TiUITab tabView : tabs) {<NEW_LINE>updateTabBackgroundDrawable(tabs.indexOf(tabView));<NEW_LINE>}<NEW_LINE>setBackgroundColor(TiColorHelper.parseColor(newValue.toString(), proxy.getActivity()));<NEW_LINE>} else if (key.equals(TiC.PROPERTY_TABS_BACKGROUND_SELECTED_COLOR)) {<NEW_LINE>for (TiUITab tabView : tabs) {<NEW_LINE>updateTabBackgroundDrawable(tabs.indexOf(tabView));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>super.propertyChanged(key, oldValue, newValue, proxy);<NEW_LINE>}<NEW_LINE>} | autoTabTitle = TiConvert.toBoolean(newValue); |
481,824 | public static void main(String[] args) {<NEW_LINE>var //<NEW_LINE>printVersion = // Streams either one element (the args-array) or zero elements<NEW_LINE>Optional.ofNullable(args).//<NEW_LINE>stream().//<NEW_LINE>flatMap(Arrays::stream).anyMatch(arg -> "-v".equals(arg) || "--version".equals(arg));<NEW_LINE>if (printVersion) {<NEW_LINE>var appVer = System.getProperty("cryptomator.appVersion", "SNAPSHOT");<NEW_LINE>var buildNumber = <MASK><NEW_LINE>// Reduce noise for parsers by using System.out directly<NEW_LINE>System.out.printf("Cryptomator version %s (build %s)%n", appVer, buildNumber);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int exitCode = CRYPTOMATOR_COMPONENT.application().run(args);<NEW_LINE>LOG.info("Exit {}", exitCode);<NEW_LINE>// end remaining non-daemon threads.<NEW_LINE>System.exit(exitCode);<NEW_LINE>} | System.getProperty("cryptomator.buildNumber", "SNAPSHOT"); |
578,936 | static public MultiFileReadingProgress createMultiFileReadingProgress(final ImportingJob job, List<ObjectNode> fileRecords) {<NEW_LINE>long totalSize = 0;<NEW_LINE>for (ObjectNode fileRecord : fileRecords) {<NEW_LINE>File file = <MASK><NEW_LINE>totalSize += file.length();<NEW_LINE>}<NEW_LINE>final long totalSize2 = totalSize;<NEW_LINE>return new MultiFileReadingProgress() {<NEW_LINE><NEW_LINE>long totalBytesRead = 0;<NEW_LINE><NEW_LINE>void setProgress(String fileSource, long bytesRead) {<NEW_LINE>job.setProgress(totalSize2 == 0 ? -1 : (int) (100 * (totalBytesRead + bytesRead) / totalSize2), "Reading " + fileSource);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void startFile(String fileSource) {<NEW_LINE>setProgress(fileSource, 0);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void readingFile(String fileSource, long bytesRead) {<NEW_LINE>setProgress(fileSource, bytesRead);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void endFile(String fileSource, long bytesRead) {<NEW_LINE>totalBytesRead += bytesRead;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | ImportingUtilities.getFile(job, fileRecord); |
348,640 | private String format(JSError error, boolean warning) {<NEW_LINE>SourceExcerptProvider source = getSource();<NEW_LINE>String sourceName = error.getSourceName();<NEW_LINE>int lineNumber = error.getLineNumber();<NEW_LINE>int charno = error.getCharno();<NEW_LINE>// Format the non-reverse-mapped position.<NEW_LINE>StringBuilder b = new StringBuilder();<NEW_LINE>StringBuilder boldLine = new StringBuilder();<NEW_LINE>OriginalMapping mapping = source == null ? null : source.getSourceMapping(error.getSourceName(), error.getLineNumber(), error.getCharno());<NEW_LINE>// Check if we can reverse-map the source.<NEW_LINE>if (includeLocation) {<NEW_LINE>if (mapping != null) {<NEW_LINE>appendPosition(b, sourceName, lineNumber, charno);<NEW_LINE>sourceName = mapping.getOriginalFile();<NEW_LINE>lineNumber = mapping.getLineNumber();<NEW_LINE>charno = mapping.getColumnPosition();<NEW_LINE>b.append("\nOriginally at:\n");<NEW_LINE>}<NEW_LINE>appendPosition(<MASK><NEW_LINE>}<NEW_LINE>if (includeLevel) {<NEW_LINE>boldLine.append(getLevelName(warning ? CheckLevel.WARNING : CheckLevel.ERROR));<NEW_LINE>boldLine.append(" - [");<NEW_LINE>boldLine.append(error.getType().key);<NEW_LINE>boldLine.append("] ");<NEW_LINE>}<NEW_LINE>boldLine.append(error.getDescription());<NEW_LINE>b.append(maybeEmbolden(boldLine.toString()));<NEW_LINE>b.append('\n');<NEW_LINE>// For reverse-mapped sources, fall back to a single line excerpt because the excerpt length<NEW_LINE>// cannot be reliably mapped.<NEW_LINE>String sourceExcerptWithPosition = getExcerptWithPosition(error, sourceName, lineNumber, charno, mapping != null ? LINE : defaultFormat);<NEW_LINE>if (sourceExcerptWithPosition != null) {<NEW_LINE>b.append(sourceExcerptWithPosition);<NEW_LINE>}<NEW_LINE>return b.toString();<NEW_LINE>} | boldLine, sourceName, lineNumber, charno); |
1,635,329 | ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>Business business = new Business(emc);<NEW_LINE>Mapping mapping = emc.flag(flag, Mapping.class);<NEW_LINE>if (null == mapping) {<NEW_LINE>throw new ExceptionEntityNotExist(flag, Mapping.class);<NEW_LINE>}<NEW_LINE>if (BooleanUtils.isNotTrue(mapping.getEnable())) {<NEW_LINE>throw new ExceptionDisable(mapping.getName());<NEW_LINE>}<NEW_LINE>Application application = emc.flag(mapping.getApplication(), Application.class);<NEW_LINE>if (null == application) {<NEW_LINE>throw new ExceptionEntityNotExist(mapping.getApplication(), Application.class);<NEW_LINE>}<NEW_LINE>if (!business.editable(effectivePerson, application)) {<NEW_LINE>throw new ExceptionAccessDenied(effectivePerson.getDistinguishedName());<NEW_LINE>}<NEW_LINE>if (!ThisApplication.mappingExecuteQueue.contains(mapping.getId())) {<NEW_LINE>ThisApplication.mappingExecuteQueue.<MASK><NEW_LINE>} else {<NEW_LINE>throw new ExceptionAlreadyAddQueue();<NEW_LINE>}<NEW_LINE>Wo wo = new Wo();<NEW_LINE>wo.setValue(true);<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | send(mapping.getId()); |
95,003 | public static UUID createHashicorpCAConfig(UUID customerUUID, String label, String storagePath, HashicorpVaultConfigParams hcVaultParams) throws Exception {<NEW_LINE>if (Strings.isNullOrEmpty(hcVaultParams.vaultAddr) || Strings.isNullOrEmpty(hcVaultParams.vaultToken) || Strings.isNullOrEmpty(hcVaultParams.engine) || Strings.isNullOrEmpty(hcVaultParams.mountPath) || Strings.isNullOrEmpty(hcVaultParams.role)) {<NEW_LINE>String message = String.format("Hashicorp Vault parameters provided are not valid - %s", hcVaultParams);<NEW_LINE>throw new PlatformServiceException(BAD_REQUEST, message);<NEW_LINE>}<NEW_LINE>UUID certConfigUUID = UUID.randomUUID();<NEW_LINE>VaultPKI pkiObjValidator = VaultPKI.validateVaultConfigParams(hcVaultParams);<NEW_LINE>Pair<String, String> paths = pkiObjValidator.dumpCACertBundle(storagePath, customerUUID, certConfigUUID);<NEW_LINE>Pair<Date, Date> dates = CertificateHelper.extractDatesFromCertBundle(CertificateHelper.convertStringToX509CertList(FileUtils.readFileToString(new File(paths<MASK><NEW_LINE>hcVaultParams.vaultToken = maskCertConfigData(customerUUID, hcVaultParams.vaultToken);<NEW_LINE>CertificateInfo cert = CertificateInfo.create(certConfigUUID, customerUUID, label, dates.getLeft(), dates.getRight(), paths.getLeft(), hcVaultParams);<NEW_LINE>log.info("Created Root CA for universe {}.", label);<NEW_LINE>if (!CertificateInfo.isCertificateValid(certConfigUUID)) {<NEW_LINE>String errMsg = String.format("The certificate %s needs info. Update the cert and retry.", label);<NEW_LINE>log.error(errMsg);<NEW_LINE>throw new PlatformServiceException(BAD_REQUEST, errMsg);<NEW_LINE>}<NEW_LINE>List<Object> ttlInfo = pkiObjValidator.getTTL();<NEW_LINE>hcVaultParams.ttl = (long) ttlInfo.get(0);<NEW_LINE>hcVaultParams.ttlExpiry = (long) ttlInfo.get(1);<NEW_LINE>CertificateInfo rootCertConfigInfo = CertificateInfo.get(certConfigUUID);<NEW_LINE>rootCertConfigInfo.update(dates.getLeft(), dates.getRight(), paths.getLeft(), hcVaultParams);<NEW_LINE>return cert.uuid;<NEW_LINE>} | .getLeft())))); |
464,160 | public static ImportNacosConfigResponse unmarshall(ImportNacosConfigResponse importNacosConfigResponse, UnmarshallerContext _ctx) {<NEW_LINE>importNacosConfigResponse.setRequestId(_ctx.stringValue("ImportNacosConfigResponse.RequestId"));<NEW_LINE>importNacosConfigResponse.setHttpStatusCode(_ctx.integerValue("ImportNacosConfigResponse.HttpStatusCode"));<NEW_LINE>importNacosConfigResponse.setSuccess(_ctx.booleanValue("ImportNacosConfigResponse.Success"));<NEW_LINE>importNacosConfigResponse.setErrorCode(_ctx.stringValue("ImportNacosConfigResponse.ErrorCode"));<NEW_LINE>importNacosConfigResponse.setCode(_ctx.integerValue("ImportNacosConfigResponse.Code"));<NEW_LINE>importNacosConfigResponse.setMessage(_ctx.stringValue("ImportNacosConfigResponse.Message"));<NEW_LINE>importNacosConfigResponse.setDynamicMessage(_ctx.stringValue("ImportNacosConfigResponse.DynamicMessage"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setSuccCount(_ctx.integerValue("ImportNacosConfigResponse.Data.SuccCount"));<NEW_LINE>data.setSkipCount(_ctx.integerValue("ImportNacosConfigResponse.Data.SkipCount"));<NEW_LINE>List<SkipDataItem> skipData = new ArrayList<SkipDataItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ImportNacosConfigResponse.Data.SkipData.Length"); i++) {<NEW_LINE>SkipDataItem skipDataItem = new SkipDataItem();<NEW_LINE>skipDataItem.setDataId(_ctx.stringValue<MASK><NEW_LINE>skipDataItem.setGroup(_ctx.stringValue("ImportNacosConfigResponse.Data.SkipData[" + i + "].Group"));<NEW_LINE>skipData.add(skipDataItem);<NEW_LINE>}<NEW_LINE>data.setSkipData(skipData);<NEW_LINE>List<FailDataItem> failData = new ArrayList<FailDataItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ImportNacosConfigResponse.Data.FailData.Length"); i++) {<NEW_LINE>FailDataItem failDataItem = new FailDataItem();<NEW_LINE>failDataItem.setDataId(_ctx.stringValue("ImportNacosConfigResponse.Data.FailData[" + i + "].DataId"));<NEW_LINE>failDataItem.setGroup(_ctx.stringValue("ImportNacosConfigResponse.Data.FailData[" + i + "].Group"));<NEW_LINE>failData.add(failDataItem);<NEW_LINE>}<NEW_LINE>data.setFailData(failData);<NEW_LINE>importNacosConfigResponse.setData(data);<NEW_LINE>return importNacosConfigResponse;<NEW_LINE>} | ("ImportNacosConfigResponse.Data.SkipData[" + i + "].DataId")); |
88,691 | public static void main(String[] args) {<NEW_LINE><MASK><NEW_LINE>connector.forProjectDirectory(new File("../sample"));<NEW_LINE>ProjectConnection connection = null;<NEW_LINE>try {<NEW_LINE>connection = connector.connect();<NEW_LINE>ModelBuilder<StsToolingModel> customModelBuilder = connection.model(StsToolingModel.class);<NEW_LINE>customModelBuilder.withArguments("--init-script", "/Users/aboyko/Documents/runtime-STS/.metadata/.plugins/org.springframework.ide.eclipse.buildship30/gradle-plugin/init.gradle");<NEW_LINE>StsToolingModel model = customModelBuilder.get();<NEW_LINE>System.out.println("Group=" + model.group() + " artifact=" + model.artifact() + " version=" + model.version());<NEW_LINE>assert model.version() != null;<NEW_LINE>} finally {<NEW_LINE>if (connection != null) {<NEW_LINE>connection.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | GradleConnector connector = GradleConnector.newConnector(); |
1,158,026 | public Object intercept(@Origin Method method, @AllArguments Object[] params) {<NEW_LINE>if (!methodMetadataMap.containsKey(method)) {<NEW_LINE>methodMetadataMap.put(method, new ReactiveGrpcMethodMetadata(method, group, service, version));<NEW_LINE>}<NEW_LINE>ReactiveGrpcMethodMetadata methodMetadata = methodMetadataMap.get(method);<NEW_LINE>if (methodMetadata.getRpcType().equals(ReactiveGrpcMethodMetadata.UNARY)) {<NEW_LINE>Mono<GeneratedMessageV3> monoParam = (Mono<GeneratedMessageV3>) params[0];<NEW_LINE>return monoParam.map(param -> ByteBufPayload.create(Unpooled.wrappedBuffer(param.toByteArray()), methodMetadata.getCompositeMetadataByteBuf().retainedDuplicate())).flatMap(requestPayload -> rsocketRpc(rsocket, requestPayload, methodMetadata.getInferredClassForReturn()).timeout(this.timeout));<NEW_LINE>} else if (methodMetadata.getRpcType().equals(ReactiveGrpcMethodMetadata.SERVER_STREAMING)) {<NEW_LINE>Mono<GeneratedMessageV3> monoParam = (Mono<GeneratedMessageV3>) params[0];<NEW_LINE>return monoParam.map(param -> ByteBufPayload.create(Unpooled.wrappedBuffer(param.toByteArray()), methodMetadata.getCompositeMetadataByteBuf().retainedDuplicate())).flatMapMany(requestPayload -> rsocketStream(rsocket, requestPayload, methodMetadata.getInferredClassForReturn()));<NEW_LINE>} else if (methodMetadata.getRpcType().equals(ReactiveGrpcMethodMetadata.CLIENT_STREAMING)) {<NEW_LINE>Payload routePayload = ByteBufPayload.create(Unpooled.EMPTY_BUFFER, methodMetadata.getCompositeMetadataByteBuf().retainedDuplicate());<NEW_LINE>Flux<Payload> paramsPayloadFlux = ((Flux<GeneratedMessageV3>) params[0]).map(param -> ByteBufPayload.create(Unpooled.wrappedBuffer(param.toByteArray()), PayloadUtils.getCompositeMetaDataWithEncoding().retainedDuplicate()));<NEW_LINE>return rsocketChannel(rsocket, paramsPayloadFlux.startWith(routePayload), methodMetadata.getInferredClassForReturn()).last();<NEW_LINE>} else if (methodMetadata.getRpcType().equals(ReactiveGrpcMethodMetadata.BIDIRECTIONAL_STREAMING)) {<NEW_LINE>Payload routePayload = ByteBufPayload.create(Unpooled.EMPTY_BUFFER, methodMetadata.getCompositeMetadataByteBuf().retainedDuplicate());<NEW_LINE>Flux<Payload> paramsPayloadFlux = ((Flux<GeneratedMessageV3>) params[0]).map(param -> ByteBufPayload.create(Unpooled.wrappedBuffer(param.toByteArray()), PayloadUtils.getCompositeMetaDataWithEncoding<MASK><NEW_LINE>return rsocketChannel(rsocket, paramsPayloadFlux.startWith(routePayload), methodMetadata.getInferredClassForReturn());<NEW_LINE>}<NEW_LINE>return Mono.error(new Exception(RsocketErrorCode.message("RST-611301")));<NEW_LINE>} | ().retainedDuplicate())); |
415,752 | public static DescribeConfigOptionsResponse unmarshall(DescribeConfigOptionsResponse describeConfigOptionsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeConfigOptionsResponse.setRequestId(_ctx.stringValue("DescribeConfigOptionsResponse.RequestId"));<NEW_LINE>describeConfigOptionsResponse.setCode(_ctx.stringValue("DescribeConfigOptionsResponse.Code"));<NEW_LINE>describeConfigOptionsResponse.setMessage(_ctx.stringValue("DescribeConfigOptionsResponse.Message"));<NEW_LINE>StackConfigOption stackConfigOption = new StackConfigOption();<NEW_LINE>stackConfigOption.setStackId(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.StackId"));<NEW_LINE>stackConfigOption.setStackName(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.StackName"));<NEW_LINE>List<ConfigOption> configOptions = new ArrayList<ConfigOption>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions.Length"); i++) {<NEW_LINE>ConfigOption configOption = new ConfigOption();<NEW_LINE>configOption.setPathName(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].PathName"));<NEW_LINE>configOption.setOptionName(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].OptionName"));<NEW_LINE>configOption.setValueType(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].ValueType"));<NEW_LINE>configOption.setDefaultValue(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].DefaultValue"));<NEW_LINE>configOption.setChangeSeverity(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].ChangeSeverity"));<NEW_LINE>configOption.setOptionDescription(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].OptionDescription"));<NEW_LINE>configOption.setMaxLength(_ctx.integerValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].MaxLength"));<NEW_LINE>configOption.setMaxValue(_ctx.longValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].MaxValue"));<NEW_LINE>configOption.setMinValue(_ctx.longValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].MinValue"));<NEW_LINE>configOption.setRegexPattern(_ctx.stringValue<MASK><NEW_LINE>configOption.setRegexDesc(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].RegexDesc"));<NEW_LINE>configOption.setOptionLabel(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].OptionLabel"));<NEW_LINE>configOption.setMinLength(_ctx.integerValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].MinLength"));<NEW_LINE>configOption.setEditorType(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].EditorType"));<NEW_LINE>configOption.setValueOptions(_ctx.stringValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].ValueOptions"));<NEW_LINE>configOption.setHiddenOption(_ctx.booleanValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].HiddenOption"));<NEW_LINE>configOption.setReadonlyOption(_ctx.booleanValue("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].ReadonlyOption"));<NEW_LINE>configOptions.add(configOption);<NEW_LINE>}<NEW_LINE>stackConfigOption.setConfigOptions(configOptions);<NEW_LINE>describeConfigOptionsResponse.setStackConfigOption(stackConfigOption);<NEW_LINE>return describeConfigOptionsResponse;<NEW_LINE>} | ("DescribeConfigOptionsResponse.StackConfigOption.ConfigOptions[" + i + "].RegexPattern")); |
386,809 | public void run() {<NEW_LINE>for (; ; ) {<NEW_LINE>try {<NEW_LINE>if (isDetach()) {<NEW_LINE>LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(2000));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>UshardInterface.SubscribeKvPrefixInput input = UshardInterface.SubscribeKvPrefixInput.newBuilder().setIndex(0).setDuration(60).setKeyPrefix(ClusterPathUtil.BASE_PATH).build();<NEW_LINE>stub.withDeadlineAfter(GRPC_SUBTIMEOUT, TimeUnit.SECONDS).subscribeKvPrefix(input);<NEW_LINE>firstReturnToCluster();<NEW_LINE>return;<NEW_LINE>} catch (DetachedException e) {<NEW_LINE>LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(2000));<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (isDetach()) {<NEW_LINE>LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(2000));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>LOGGER.warn("error in ucore nodes watch,try for another time", e);<NEW_LINE>Channel channel = ManagedChannelBuilder.forAddress("127.0.0.1", ClusterConfig.getInstance().getClusterPort()).usePlaintext(true).build();<NEW_LINE>UshardSender.this.setStubIfPossible(DbleClusterGrpc.newBlockingStub(channel).withDeadlineAfter(GENERAL_GRPC_TIMEOUT, TimeUnit.SECONDS));<NEW_LINE>LockSupport.parkNanos(TimeUnit<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .MILLISECONDS.toNanos(2000)); |
557,510 | public TupleList evaluateList(Evaluator evaluator) {<NEW_LINE>// Use a native evaluator, if more efficient.<NEW_LINE>// TODO: Figure this out at compile time.<NEW_LINE><MASK><NEW_LINE>NativeEvaluator nativeEvaluator = schemaReader.getNativeSetEvaluator(call.getFunDef(), call.getArgs(), evaluator, this);<NEW_LINE>if (nativeEvaluator != null) {<NEW_LINE>return (TupleList) nativeEvaluator.execute(ResultStyle.LIST);<NEW_LINE>}<NEW_LINE>int n = integerCalc.evaluateInteger(evaluator);<NEW_LINE>if (n == 0 || n == mondrian.olap.fun.FunUtil.IntegerNull) {<NEW_LINE>return TupleCollections.emptyList(arity);<NEW_LINE>}<NEW_LINE>TupleList list = listCalc.evaluateList(evaluator);<NEW_LINE>assert list.getArity() == arity;<NEW_LINE>if (list.isEmpty()) {<NEW_LINE>return list;<NEW_LINE>}<NEW_LINE>if (orderCalc == null) {<NEW_LINE>// REVIEW: Why require "instanceof AbstractList"?<NEW_LINE>if (list instanceof AbstractList && list.size() <= n) {<NEW_LINE>return list;<NEW_LINE>} else if (top) {<NEW_LINE>return list.subList(0, n);<NEW_LINE>} else {<NEW_LINE>return list.subList(list.size() - n, list.size());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return partiallySortList(evaluator, list, hasHighCardDimension(list), Math.min(n, list.size()));<NEW_LINE>} | SchemaReader schemaReader = evaluator.getSchemaReader(); |
665 | public static void main(String[] args) {<NEW_LINE>Exercise36_Neighbors neighbors = new Exercise36_Neighbors();<NEW_LINE>EdgeWeightedDigraph edgeWeightedDigraph1 = new EdgeWeightedDigraph(4);<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(0, 1, 20));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(0, 2, 5));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(2, 1, 1));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(1, 3, 10));<NEW_LINE>int maxDistance1 = 20;<NEW_LINE>DijkstraSPMaxDistance dijkstraSPMaxDistance1 = neighbors.new DijkstraSPMaxDistance(edgeWeightedDigraph1, 0, maxDistance1);<NEW_LINE>StdOut.println("Vertices within distance 20 from digraph 1:");<NEW_LINE>for (int vertex : dijkstraSPMaxDistance1.verticesWithinMaxDistance().keys()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>StdOut.println("\nExpected: 0 1 2 3");<NEW_LINE>EdgeWeightedDigraph edgeWeightedDigraph2 = new EdgeWeightedDigraph(8);<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(0, 1, 5));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(1, 3, 2));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(3, 5, 3));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(5, 6, 1));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(0, 2, 9));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(2, 3, 2));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(2, 4, 3));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(4, 7, 1));<NEW_LINE>int maxDistance2 = 10;<NEW_LINE>DijkstraSPMaxDistance dijkstraSPMaxDistance2 = neighbors.new DijkstraSPMaxDistance(edgeWeightedDigraph2, 0, maxDistance2);<NEW_LINE>StdOut.println("\nVertices within distance 10 from digraph 2:");<NEW_LINE>for (int vertex : dijkstraSPMaxDistance2.verticesWithinMaxDistance().keys()) {<NEW_LINE>StdOut.print(vertex + " ");<NEW_LINE>}<NEW_LINE>StdOut.println("\nExpected: 0 1 2 3 5");<NEW_LINE>} | StdOut.print(vertex + " "); |
133,144 | public static MavenCoordinate fromM2Url(URI m2Url) throws IOException {<NEW_LINE>if (!"m2".equals(m2Url.getScheme())) {<NEW_LINE>throw new IOException("Only m2 URL is supported: " + m2Url);<NEW_LINE>}<NEW_LINE>if (!m2Url.getRawPath().startsWith("/")) {<NEW_LINE>throw new IOException("Invalid m2 URL. Expected format m2:/group:name:version:extension:classifier (classifier is optional)");<NEW_LINE>}<NEW_LINE>String[] coordinates = m2Url.getRawPath().substring<MASK><NEW_LINE>if (coordinates.length < 4) {<NEW_LINE>throw new IOException("Invalid m2 URL. Expected format m2:/group:name:version:extension:classifier (classifier is optional)");<NEW_LINE>}<NEW_LINE>for (int i = 0; i < coordinates.length; i++) {<NEW_LINE>coordinates[i] = URLDecoder.decode(coordinates[i], "UTF-8");<NEW_LINE>}<NEW_LINE>String group = coordinates[0];<NEW_LINE>String artifact = coordinates[1];<NEW_LINE>String version = coordinates[2];<NEW_LINE>String extension = coordinates[3];<NEW_LINE>String classifier = "";<NEW_LINE>if (coordinates.length > 4) {<NEW_LINE>classifier = coordinates[4];<NEW_LINE>}<NEW_LINE>return new MavenCoordinate(group, artifact, version, extension, classifier);<NEW_LINE>} | (1).split(":"); |
1,263,757 | public static Stream<Object> loadJson(Object urlOrBinary, Map<String, Object> headers, String payload, String path, boolean failOnError, String compressionAlgo, List<String> options) {<NEW_LINE>try {<NEW_LINE>if (urlOrBinary instanceof String) {<NEW_LINE>String url = (String) urlOrBinary;<NEW_LINE>urlOrBinary = Util.getLoadUrlByConfigFile("json", url, "url").orElse(url);<NEW_LINE>}<NEW_LINE>InputStream input = FileUtils.inputStreamFor(urlOrBinary, headers, payload, compressionAlgo);<NEW_LINE>JsonParser parser = OBJECT_MAPPER.<MASK><NEW_LINE>MappingIterator<Object> it = OBJECT_MAPPER.readValues(parser, Object.class);<NEW_LINE>Stream<Object> stream = StreamSupport.stream(Spliterators.spliteratorUnknownSize(it, 0), false);<NEW_LINE>return StringUtils.isBlank(path) ? stream : stream.map((value) -> JsonPath.parse(value, getJsonPathConfig(options)).read(path));<NEW_LINE>} catch (IOException e) {<NEW_LINE>if (!failOnError) {<NEW_LINE>return Stream.of();<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getFactory().createParser(input); |
597,172 | protected ConditionEvaluationResult evaluate(EnabledIfSystemProperty annotation) {<NEW_LINE>String name = annotation.named().trim();<NEW_LINE>String regex = annotation.matches();<NEW_LINE>Preconditions.notBlank(name, () -> "The 'named' attribute must not be blank in " + annotation);<NEW_LINE>Preconditions.notBlank(regex, () -> "The 'matches' attribute must not be blank in " + annotation);<NEW_LINE>String actual = System.getProperty(name);<NEW_LINE>// Nothing to match against?<NEW_LINE>if (actual == null) {<NEW_LINE>return disabled(format("System property [%s] does not exist", name<MASK><NEW_LINE>}<NEW_LINE>if (actual.matches(regex)) {<NEW_LINE>return enabled(format("System property [%s] with value [%s] matches regular expression [%s]", name, actual, regex));<NEW_LINE>}<NEW_LINE>return disabled(format("System property [%s] with value [%s] does not match regular expression [%s]", name, actual, regex), annotation.disabledReason());<NEW_LINE>} | ), annotation.disabledReason()); |
83,504 | private void addResponse(String responseCode, Response response, Operation operation, RestMethod method) {<NEW_LINE>List<String> produces = operation.getProduces();<NEW_LINE>if (produces == null || produces.isEmpty()) {<NEW_LINE>operation.setProduces(swagger.getProduces());<NEW_LINE>produces = operation.getProduces();<NEW_LINE>}<NEW_LINE>if (produces == null || produces.isEmpty()) {<NEW_LINE>RestRepresentation representation = method.addNewRepresentation(RestRepresentation.Type.RESPONSE);<NEW_LINE>List<String> statusList = new ArrayList<>();<NEW_LINE>if (!responseCode.equals("default")) {<NEW_LINE>statusList.add(responseCode);<NEW_LINE>}<NEW_LINE>representation.setStatus(statusList);<NEW_LINE>representation.setMediaType(defaultMediaType);<NEW_LINE>// just take the first example<NEW_LINE>Map<String, Object> responseExamples = response.getExamples();<NEW_LINE>if (responseExamples != null && !responseExamples.isEmpty()) {<NEW_LINE>representation.setMediaType(responseExamples.keySet().iterator().next());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>produces.forEach(mediaType -> {<NEW_LINE>RestRepresentation representation = method.<MASK><NEW_LINE>representation.setMediaType(mediaType);<NEW_LINE>List<String> statusList = new ArrayList<>();<NEW_LINE>if (!responseCode.equals("default")) {<NEW_LINE>statusList.add(responseCode);<NEW_LINE>}<NEW_LINE>representation.setStatus(statusList);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | addNewRepresentation(RestRepresentation.Type.RESPONSE); |
497,571 | public boolean relocate(CompoundTag root, Point3i offset) {<NEW_LINE>CompoundTag level = Helper.tagFromCompound(root, "Level");<NEW_LINE>if (level == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// adjust or set chunk position<NEW_LINE>level.putInt("xPos", level.getInt("xPos") + offset.blockToChunk().getX());<NEW_LINE>level.putInt("zPos", level.getInt("zPos") + offset.blockToChunk().getZ());<NEW_LINE>// adjust entity positions<NEW_LINE>ListTag<CompoundTag> entities = Helper.tagFromCompound(level, "Entities");<NEW_LINE>if (entities != null) {<NEW_LINE>entities.forEach(v -> applyOffsetToEntity(v, offset));<NEW_LINE>}<NEW_LINE>// adjust tile entity positions<NEW_LINE>ListTag<CompoundTag> tileEntities = Helper.tagFromCompound(level, "TileEntities");<NEW_LINE>if (tileEntities != null) {<NEW_LINE>tileEntities.forEach(v -> applyOffsetToTileEntity(v, offset));<NEW_LINE>}<NEW_LINE>// adjust tile ticks<NEW_LINE>ListTag<CompoundTag> tileTicks = Helper.tagFromCompound(level, "TileTicks");<NEW_LINE>if (tileTicks != null) {<NEW_LINE>tileTicks.forEach(v -> applyOffsetToTick(v, offset));<NEW_LINE>}<NEW_LINE>// adjust liquid ticks<NEW_LINE>ListTag<CompoundTag> liquidTicks = Helper.tagFromCompound(level, "LiquidTicks");<NEW_LINE>if (liquidTicks != null) {<NEW_LINE>liquidTicks.forEach(v -> applyOffsetToTick(v, offset));<NEW_LINE>}<NEW_LINE>// adjust structures<NEW_LINE>CompoundTag structures = Helper.tagFromCompound(level, "Structures");<NEW_LINE>if (structures != null) {<NEW_LINE>applyOffsetToStructures(structures, offset);<NEW_LINE>}<NEW_LINE>// Lights<NEW_LINE>Helper.applyOffsetToListOfShortTagLists(level, "Lights", offset.blockToSection());<NEW_LINE>// LiquidsToBeTicked<NEW_LINE>Helper.applyOffsetToListOfShortTagLists(level, "LiquidsToBeTicked", offset.blockToSection());<NEW_LINE>// ToBeTicked<NEW_LINE>Helper.applyOffsetToListOfShortTagLists(level, "ToBeTicked", offset.blockToSection());<NEW_LINE>// PostProcessing<NEW_LINE>Helper.applyOffsetToListOfShortTagLists(level, <MASK><NEW_LINE>// adjust sections vertically<NEW_LINE>ListTag<CompoundTag> sections = Helper.tagFromLevelFromRoot(root, "Sections");<NEW_LINE>if (sections != null) {<NEW_LINE>ListTag<CompoundTag> newSections = new ListTag<>(CompoundTag.class);<NEW_LINE>for (CompoundTag section : sections) {<NEW_LINE>if (applyOffsetToSection(section, offset.blockToSection(), 0, 15)) {<NEW_LINE>newSections.add(section);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | "PostProcessing", offset.blockToSection()); |
488,743 | protected void restoreState(IProject project) {<NEW_LINE>TreeViewer viewer = getCommonViewer();<NEW_LINE>Control control = viewer.getControl();<NEW_LINE>if (control == null || control.isDisposed()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>IContainer container = ResourcesPlugin<MASK><NEW_LINE>List<String> expansions = projectExpansions.get(project);<NEW_LINE>List<String> selections = projectSelections.get(project);<NEW_LINE>control.setRedraw(false);<NEW_LINE>// FIXME Reconstruct filter into IResource<NEW_LINE>String filter = projectFilters.get(project);<NEW_LINE>if (filter == null || filter.length() == 0) {<NEW_LINE>if (currentFilter != null) {<NEW_LINE>clearFilter();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>IResource filterResource = project.getWorkspace().getRoot().getFileForLocation(Path.fromPortableString(filter));<NEW_LINE>setFilter(filterResource);<NEW_LINE>}<NEW_LINE>if (selections != null) {<NEW_LINE>List<IResource> elements = new ArrayList<IResource>();<NEW_LINE>for (String selectionPath : selections) {<NEW_LINE>IResource element = container.findMember(selectionPath);<NEW_LINE>if (element != null) {<NEW_LINE>elements.add(element);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>viewer.setSelection(new StructuredSelection(elements), true);<NEW_LINE>}<NEW_LINE>if (expansions != null) {<NEW_LINE>List<IResource> elements = new ArrayList<IResource>();<NEW_LINE>for (String expansionPath : expansions) {<NEW_LINE>IResource element = container.findMember(expansionPath);<NEW_LINE>if (element != null) {<NEW_LINE>elements.add(element);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>viewer.setExpandedElements(elements.toArray());<NEW_LINE>}<NEW_LINE>control.setRedraw(true);<NEW_LINE>} | .getWorkspace().getRoot(); |
60,616 | private void extractFFmpeg() {<NEW_LINE>ZipInputStream zipIn = null;<NEW_LINE>OutputStream out = null;<NEW_LINE>wnd2 = new FFmpegExtractorWnd(this);<NEW_LINE>wnd2.setVisible(true);<NEW_LINE>try {<NEW_LINE>String versionFile = null;<NEW_LINE>File input = new File(Config.getInstance().getTemporaryFolder(), tmpFile);<NEW_LINE>zipIn = new ZipInputStream(new FileInputStream(input));<NEW_LINE>while (true) {<NEW_LINE><MASK><NEW_LINE>if (ent == null)<NEW_LINE>break;<NEW_LINE>String name = ent.getName();<NEW_LINE>if (name.endsWith(".version")) {<NEW_LINE>versionFile = name;<NEW_LINE>}<NEW_LINE>File outFile = new File(Config.getInstance().getDataFolder(), name);<NEW_LINE>out = new FileOutputStream(outFile);<NEW_LINE>byte[] buf = new byte[8192];<NEW_LINE>while (true) {<NEW_LINE>int x = zipIn.read(buf);<NEW_LINE>if (x == -1)<NEW_LINE>break;<NEW_LINE>out.write(buf, 0, x);<NEW_LINE>}<NEW_LINE>out.close();<NEW_LINE>out = null;<NEW_LINE>outFile.setExecutable(true);<NEW_LINE>}<NEW_LINE>// remove old x.version files if exists<NEW_LINE>try {<NEW_LINE>if (Config.getInstance().getDataFolder() != null) {<NEW_LINE>File[] files = new File(Config.getInstance().getDataFolder()).listFiles();<NEW_LINE>if (files != null) {<NEW_LINE>for (File f : files) {<NEW_LINE>if (f.getName().endsWith(".version") && (!f.getName().equals(versionFile))) {<NEW_LINE>f.delete();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.log(e);<NEW_LINE>}<NEW_LINE>input.delete();<NEW_LINE>wnd2.dispose();<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.log(e);<NEW_LINE>} finally {<NEW_LINE>try {<NEW_LINE>zipIn.close();<NEW_LINE>if (out != null)<NEW_LINE>out.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.log(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ZipEntry ent = zipIn.getNextEntry(); |
341,559 | public static void registerType(final ModelBuilder modelBuilder) {<NEW_LINE>final ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(BpmnShape.class, BPMNDI_ELEMENT_BPMN_SHAPE).namespaceUri(BPMNDI_NS).extendsType(LabeledShape.class).instanceProvider(new ModelTypeInstanceProvider<BpmnShape>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public BpmnShape newInstance(final ModelTypeInstanceContext instanceContext) {<NEW_LINE>return new BpmnShapeImpl(instanceContext);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>bpmnElementAttribute = typeBuilder.stringAttribute(BPMNDI_ATTRIBUTE_BPMN_ELEMENT).qNameAttributeReference(BaseElement.class).build();<NEW_LINE>isHorizontalAttribute = typeBuilder.booleanAttribute(BPMNDI_ATTRIBUTE_IS_HORIZONTAL).build();<NEW_LINE>isExpandedAttribute = typeBuilder.booleanAttribute(BPMNDI_ATTRIBUTE_IS_EXPANDED).build();<NEW_LINE>isMarkerVisibleAttribute = typeBuilder.booleanAttribute(BPMNDI_ATTRIBUTE_IS_MARKER_VISIBLE).build();<NEW_LINE>isMessageVisibleAttribute = typeBuilder.booleanAttribute(BPMNDI_ATTRIBUTE_IS_MESSAGE_VISIBLE).build();<NEW_LINE>participantBandKindAttribute = typeBuilder.enumAttribute(BPMNDI_ATTRIBUTE_PARTICIPANT_BAND_KIND, ParticipantBandKind.class).build();<NEW_LINE>choreographyActivityShapeAttribute = typeBuilder.stringAttribute(BPMNDI_ATTRIBUTE_CHOREOGRAPHY_ACTIVITY_SHAPE).qNameAttributeReference(BpmnShape.class).build();<NEW_LINE>final <MASK><NEW_LINE>bpmnLabelChild = sequenceBuilder.element(BpmnLabel.class).build();<NEW_LINE>typeBuilder.build();<NEW_LINE>} | SequenceBuilder sequenceBuilder = typeBuilder.sequence(); |
533,841 | private int resolveConstructorArguments(String beanName, RootBeanDefinition mbd, BeanWrapper bw, ConstructorArgumentValues cargs, ConstructorArgumentValues resolvedValues) {<NEW_LINE>TypeConverter customConverter = this.beanFactory.getCustomTypeConverter();<NEW_LINE>TypeConverter converter = (customConverter != null ? customConverter : bw);<NEW_LINE>BeanDefinitionValueResolver valueResolver = new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter);<NEW_LINE>int minNrOfArgs = cargs.getArgumentCount();<NEW_LINE>for (Map.Entry<Integer, ConstructorArgumentValues.ValueHolder> entry : cargs.getIndexedArgumentValues().entrySet()) {<NEW_LINE>int index = entry.getKey();<NEW_LINE>if (index < 0) {<NEW_LINE>throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Invalid constructor argument index: " + index);<NEW_LINE>}<NEW_LINE>if (index + 1 > minNrOfArgs) {<NEW_LINE>minNrOfArgs = index + 1;<NEW_LINE>}<NEW_LINE>ConstructorArgumentValues.ValueHolder valueHolder = entry.getValue();<NEW_LINE>if (valueHolder.isConverted()) {<NEW_LINE>resolvedValues.addIndexedArgumentValue(index, valueHolder);<NEW_LINE>} else {<NEW_LINE>Object resolvedValue = valueResolver.resolveValueIfNecessary("constructor argument", valueHolder.getValue());<NEW_LINE>ConstructorArgumentValues.ValueHolder resolvedValueHolder = new ConstructorArgumentValues.ValueHolder(resolvedValue, valueHolder.getType(), valueHolder.getName());<NEW_LINE>resolvedValueHolder.setSource(valueHolder);<NEW_LINE>resolvedValues.addIndexedArgumentValue(index, resolvedValueHolder);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (ConstructorArgumentValues.ValueHolder valueHolder : cargs.getGenericArgumentValues()) {<NEW_LINE>if (valueHolder.isConverted()) {<NEW_LINE>resolvedValues.addGenericArgumentValue(valueHolder);<NEW_LINE>} else {<NEW_LINE>Object resolvedValue = valueResolver.resolveValueIfNecessary(<MASK><NEW_LINE>ConstructorArgumentValues.ValueHolder resolvedValueHolder = new ConstructorArgumentValues.ValueHolder(resolvedValue, valueHolder.getType(), valueHolder.getName());<NEW_LINE>resolvedValueHolder.setSource(valueHolder);<NEW_LINE>resolvedValues.addGenericArgumentValue(resolvedValueHolder);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return minNrOfArgs;<NEW_LINE>} | "constructor argument", valueHolder.getValue()); |
951,179 | public boolean checkTrigger(GameEvent event, Game game) {<NEW_LINE>if (!event.getPlayerId().equals(this.getControllerId())) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// activated ability<NEW_LINE>if (event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) {<NEW_LINE>StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());<NEW_LINE>if (stackAbility != null && stackAbility.getStackAbility() instanceof LoyaltyAbility) {<NEW_LINE>this.getEffects().clear();<NEW_LINE>this.addEffect(new RepeatedReverberationEffect().setTargetPointer(new FixedTarget(event.<MASK><NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// spell<NEW_LINE>if (event.getType() == GameEvent.EventType.SPELL_CAST) {<NEW_LINE>Spell spell = game.getStack().getSpell(event.getTargetId());<NEW_LINE>if (spell != null && spell.isInstantOrSorcery(game)) {<NEW_LINE>this.getEffects().clear();<NEW_LINE>this.addEffect(new CopyTargetSpellEffect(true).setTargetPointer(new FixedTarget(event.getTargetId(), game)));<NEW_LINE>this.addEffect(new CopyTargetSpellEffect(true).setTargetPointer(new FixedTarget(event.getTargetId(), game)));<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | getTargetId(), game))); |
1,008,968 | private Map<String, Object> createContextAsMap(final ReportContext reportContext) {<NEW_LINE>final Collection<ProcessInfoParameter> processInfoParams = reportContext.getProcessInfoParameters();<NEW_LINE>if (processInfoParams.isEmpty()) {<NEW_LINE>return ImmutableMap.of();<NEW_LINE>}<NEW_LINE>final TreeMap<String, Object> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);<NEW_LINE>map.put("AD_Process_ID", reportContext.getAD_Process_ID());<NEW_LINE>map.put("AD_PInstance_ID", PInstanceId.toRepoId(reportContext.getPinstanceId()));<NEW_LINE>map.put("AD_Table_ID", reportContext.getAD_Table_ID());<NEW_LINE>map.put("Record_ID", reportContext.getRecord_ID());<NEW_LINE>map.put("AD_Language", reportContext.getAD_Language());<NEW_LINE>map.put("OutputType", reportContext.getOutputType());<NEW_LINE>for (final ProcessInfoParameter param : processInfoParams) {<NEW_LINE>final String parameterName = param.getParameterName();<NEW_LINE>map.put(parameterName, param.getParameter());<NEW_LINE>map.put(parameterName + "_Info", param.getInfo());<NEW_LINE>map.put(parameterName + "_From", param.getParameter());<NEW_LINE>map.put(parameterName + "_From_Info", param.getInfo());<NEW_LINE>map.put(parameterName + "_To", param.getParameter_To());<NEW_LINE>map.put(parameterName + <MASK><NEW_LINE>}<NEW_LINE>return Collections.unmodifiableMap(map);<NEW_LINE>} | "_To_Info", param.getInfo_To()); |
233,742 | public void writeAdditionalFiles(GoSettings settings, Model model, SymbolProvider symbolProvider, GoDelegator goDelegator) {<NEW_LINE>ServiceShape service = settings.getService(model);<NEW_LINE>// generate code specific to service client<NEW_LINE>goDelegator.useShapeWriter(service, writer -> {<NEW_LINE>generateEndpointCacheResolver(model, writer, service);<NEW_LINE>generateEndpointDiscoveryOptions(model, writer, service);<NEW_LINE>generateEnableEndpointDiscoveryResolver(model, writer, service);<NEW_LINE>generateEndpointDiscoveryHandler(<MASK><NEW_LINE>});<NEW_LINE>// generate code specific to the operation<NEW_LINE>for (OperationShape operation : TopDownIndex.of(model).getContainedOperations(service)) {<NEW_LINE>goDelegator.useShapeWriter(operation, writer -> {<NEW_LINE>generateAddDiscoverEndpointMiddleware(model, symbolProvider, writer, service, operation);<NEW_LINE>generateFetchDiscoveredEndpointFunction(model, symbolProvider, writer, service, operation);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | model, symbolProvider, writer, service); |
265,620 | private Loader createLoader(URL url, int index, File file, boolean processRecursively) throws IOException {<NEW_LINE>if (file.isDirectory()) {<NEW_LINE>return new FileLoader(url, index, this);<NEW_LINE>}<NEW_LINE>if (file.isFile()) {<NEW_LINE>JarLoader loader;<NEW_LINE>if (myURLsWithProtectionDomain.contains(url)) {<NEW_LINE>loader = new SecureJarLoader(url, index, this);<NEW_LINE>} else {<NEW_LINE>loader = new JarLoader(url, index, this);<NEW_LINE>}<NEW_LINE>if (processRecursively) {<NEW_LINE>String[] referencedJars = loadManifestClasspath(loader);<NEW_LINE>if (referencedJars != null) {<NEW_LINE>long s2 = ourLogTiming <MASK><NEW_LINE>List<URL> urls = new ArrayList<URL>(referencedJars.length);<NEW_LINE>for (String referencedJar : referencedJars) {<NEW_LINE>try {<NEW_LINE>urls.add(UrlClassLoader.internProtocol(new URI(referencedJar).toURL()));<NEW_LINE>} catch (Exception e) {<NEW_LINE>LoggerRt.getInstance(ClassPath.class).warn("url: " + url + " / " + referencedJar, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>push(urls);<NEW_LINE>if (ourLogTiming) {<NEW_LINE>System.out.println("Loaded all " + referencedJars.length + " urls " + (System.nanoTime() - s2) / 1000000 + "ms");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return loader;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ? System.nanoTime() : 0; |
1,598,523 | public Object functionTemplateGetFunction(Object realm, Object templateObj) {<NEW_LINE>JSRealm jsRealm = (JSRealm) realm;<NEW_LINE>JSContext jsContext = jsRealm.getContext();<NEW_LINE>FunctionTemplate template = (FunctionTemplate) templateObj;<NEW_LINE>if (template.getFunctionObject(jsRealm) == null) {<NEW_LINE>CompilerDirectives.transferToInterpreterAndInvalidate();<NEW_LINE>JSDynamicObject obj = functionTemplateCreateCallback(jsContext, jsRealm, template);<NEW_LINE>objectTemplateInstantiate(jsRealm, template.getFunctionObjectTemplate(), obj);<NEW_LINE><MASK><NEW_LINE>if (prototypeTemplate != null) {<NEW_LINE>JSDynamicObject proto = JSOrdinary.create(jsContext, jsRealm);<NEW_LINE>objectTemplateInstantiate(jsRealm, prototypeTemplate, proto);<NEW_LINE>JSObjectUtil.putConstructorProperty(jsContext, proto, obj);<NEW_LINE>JSObject.set(obj, JSObject.PROTOTYPE, proto);<NEW_LINE>FunctionTemplate parentTemplate = template.getParent();<NEW_LINE>if (parentTemplate != null) {<NEW_LINE>JSDynamicObject parentFunction = (JSDynamicObject) functionTemplateGetFunction(realm, parentTemplate);<NEW_LINE>JSDynamicObject parentProto = (JSDynamicObject) JSObject.get(parentFunction, JSObject.PROTOTYPE);<NEW_LINE>JSObject.setPrototype(proto, parentProto);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (template.hasReadOnlyPrototype()) {<NEW_LINE>PropertyDescriptor desc = PropertyDescriptor.createEmpty();<NEW_LINE>desc.setWritable(false);<NEW_LINE>JSObject.defineOwnProperty(obj, JSObject.PROTOTYPE, desc);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return template.getFunctionObject(jsRealm);<NEW_LINE>} | ObjectTemplate prototypeTemplate = template.getPrototypeTemplate(); |
603,575 | public void write(final java.nio.ByteBuffer buf) {<NEW_LINE>try {<NEW_LINE>int startPositionMark = buf.position();<NEW_LINE>buf.position(buf.position() + 1);<NEW_LINE>int unknownsCounter = 0;<NEW_LINE>if (unknownFields == null)<NEW_LINE>unknownsCounter = Integer.MAX_VALUE;<NEW_LINE>{<NEW_LINE>com.wowd.wobly.WoblyUtils.Buffers.putVInt(buf, this.player.ordinal());<NEW_LINE>}<NEW_LINE>{<NEW_LINE>buf.putLong(this.size);<NEW_LINE>}<NEW_LINE>{<NEW_LINE>buf.putLong(this.duration);<NEW_LINE>}<NEW_LINE>{<NEW_LINE>com.wowd.wobly.WoblyUtils.Buffers.putStringUTF8(buf, this.format, true);<NEW_LINE>}<NEW_LINE>{<NEW_LINE>buf.putInt(this.height);<NEW_LINE>}<NEW_LINE>{<NEW_LINE>buf.putInt(this.width);<NEW_LINE>}<NEW_LINE>{<NEW_LINE>com.wowd.wobly.WoblyUtils.Buffers.putStringUTF8(buf, this.uri, true);<NEW_LINE>}<NEW_LINE>unknownsCounter = writeUnknownsUpTo(unknownsCounter, 0, buf);<NEW_LINE>if (this.title != null) {<NEW_LINE>buf<MASK><NEW_LINE>com.wowd.wobly.WoblyUtils.Buffers.putStringUTF8(buf, this.title, true);<NEW_LINE>}<NEW_LINE>unknownsCounter = writeUnknownsUpTo(unknownsCounter, 1, buf);<NEW_LINE>if (this.bitrate != 0) {<NEW_LINE>buf.put((byte) 10);<NEW_LINE>buf.putInt(this.bitrate);<NEW_LINE>}<NEW_LINE>unknownsCounter = writeUnknownsUpTo(unknownsCounter, 2, buf);<NEW_LINE>if ((this.persons != null) && (this.persons.size() > 0)) {<NEW_LINE>buf.put((byte) 22);<NEW_LINE>int startFieldMark = buf.position();<NEW_LINE>buf.position(buf.position() + 4);<NEW_LINE>com.wowd.wobly.WoblyUtils.Buffers.putVInt(buf, this.persons.size());<NEW_LINE>for (String v1 : this.persons) {<NEW_LINE>com.wowd.wobly.WoblyUtils.Buffers.putStringUTF8(buf, v1, true);<NEW_LINE>}<NEW_LINE>buf.putInt(startFieldMark, buf.position() - startFieldMark - 4);<NEW_LINE>}<NEW_LINE>unknownsCounter = writeUnknownsUpTo(unknownsCounter, 3, buf);<NEW_LINE>if (this.copyright != null) {<NEW_LINE>buf.put((byte) 31);<NEW_LINE>com.wowd.wobly.WoblyUtils.Buffers.putStringUTF8(buf, this.copyright, true);<NEW_LINE>}<NEW_LINE>writeUnknownsUpTo(unknownsCounter, Integer.MAX_VALUE, buf);<NEW_LINE>com.wowd.wobly.WoblyUtils.Buffers.appendVariableSize(buf, startPositionMark);<NEW_LINE>} catch (com.wowd.wobly.exceptions.WoblyWriteException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (java.lang.Throwable t) {<NEW_LINE>throw new com.wowd.wobly.exceptions.WoblyWriteException(t);<NEW_LINE>}<NEW_LINE>} | .put((byte) 7); |
162,015 | /*<NEW_LINE>* Transform SentenceSentiment's opinion mining to output that user can use.<NEW_LINE>*/<NEW_LINE>private static IterableStream<SentenceOpinion> toSentenceOpinionList(com.azure.ai.textanalytics.implementation.models.SentenceSentiment sentenceSentiment, List<DocumentSentiment> documentSentimentList) {<NEW_LINE>// If include opinion mining indicator is false, the service return null for the target list.<NEW_LINE>final List<SentenceTarget> sentenceTargets = sentenceSentiment.getTargets();<NEW_LINE>if (sentenceTargets == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final List<SentenceOpinion> sentenceOpinions = new ArrayList<>();<NEW_LINE>sentenceTargets.forEach(sentenceTarget -> {<NEW_LINE>final List<AssessmentSentiment> assessmentSentiments = new ArrayList<>();<NEW_LINE>sentenceTarget.getRelations().forEach(targetRelation -> {<NEW_LINE>final TargetRelationType targetRelationType = targetRelation.getRelationType();<NEW_LINE>final String opinionPointer = targetRelation.getRef();<NEW_LINE>if (TargetRelationType.ASSESSMENT == targetRelationType) {<NEW_LINE>assessmentSentiments.add(toAssessmentSentiment(findSentimentAssessment(opinionPointer, documentSentimentList)));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>final TargetSentiment targetSentiment = new TargetSentiment();<NEW_LINE>TargetSentimentPropertiesHelper.setText(targetSentiment, sentenceTarget.getText());<NEW_LINE>TargetSentimentPropertiesHelper.setSentiment(targetSentiment, TextSentiment.fromString(sentenceTarget.getSentiment().toString()));<NEW_LINE>TargetSentimentPropertiesHelper.setConfidenceScores(targetSentiment, toSentimentConfidenceScores<MASK><NEW_LINE>TargetSentimentPropertiesHelper.setOffset(targetSentiment, sentenceTarget.getOffset());<NEW_LINE>TargetSentimentPropertiesHelper.setLength(targetSentiment, sentenceTarget.getLength());<NEW_LINE>final SentenceOpinion sentenceOpinion = new SentenceOpinion();<NEW_LINE>SentenceOpinionPropertiesHelper.setTarget(sentenceOpinion, targetSentiment);<NEW_LINE>SentenceOpinionPropertiesHelper.setAssessments(sentenceOpinion, new IterableStream<>(assessmentSentiments));<NEW_LINE>sentenceOpinions.add(sentenceOpinion);<NEW_LINE>});<NEW_LINE>return new IterableStream<>(sentenceOpinions);<NEW_LINE>} | (sentenceTarget.getConfidenceScores())); |
134,021 | public TraceState build() {<NEW_LINE>if (numEntries == 0) {<NEW_LINE>return empty();<NEW_LINE>}<NEW_LINE>if (reversedEntries.size() == 2) {<NEW_LINE>return ArrayBasedTraceState.create(<MASK><NEW_LINE>}<NEW_LINE>String[] entries = new String[numEntries * 2];<NEW_LINE>int pos = 0;<NEW_LINE>for (int i = reversedEntries.size() - 2; i >= 0; i -= 2) {<NEW_LINE>String key = reversedEntries.get(i);<NEW_LINE>String value = reversedEntries.get(i + 1);<NEW_LINE>if (value != null) {<NEW_LINE>entries[pos++] = key;<NEW_LINE>entries[pos++] = value;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// TODO(anuraaga): We may consider removing AutoValue which prevents us from storing the array<NEW_LINE>// directly as it would be a bit more performant, though not hugely.<NEW_LINE>return ArrayBasedTraceState.create(Arrays.asList(entries));<NEW_LINE>} | new ArrayList<>(reversedEntries)); |
662,100 | public void activateClusterStateVersion(int clusterStateVersion, NodeInfo node, Waiter<ActivateClusterStateVersionRequest> externalWaiter) {<NEW_LINE>var waiter = new RPCActivateClusterStateVersionWaiter(externalWaiter);<NEW_LINE>Target connection = getConnection(node);<NEW_LINE>if (!connection.isValid()) {<NEW_LINE>log.log(Level.FINE, () -> String.format("Connection to '%s' could not be created.", node.getRpcAddress()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>var req = new Request(ACTIVATE_CLUSTER_STATE_VERSION_RPC_METHOD_NAME);<NEW_LINE>req.parameters().<MASK><NEW_LINE>log.log(Level.FINE, () -> String.format("Sending '%s' RPC to %s for state version %d", req.methodName(), node.getRpcAddress(), clusterStateVersion));<NEW_LINE>var activationRequest = new RPCActivateClusterStateVersionRequest(node, req, clusterStateVersion);<NEW_LINE>waiter.setRequest(activationRequest);<NEW_LINE>connection.invokeAsync(req, 60, waiter);<NEW_LINE>node.setClusterStateVersionActivationSent(clusterStateVersion);<NEW_LINE>} | add(new Int32Value(clusterStateVersion)); |
576,771 | public IPage<Job> findJobs(QueryRequest request, Job job) {<NEW_LINE>LambdaQueryWrapper<Job> queryWrapper = new LambdaQueryWrapper<>();<NEW_LINE>if (StringUtils.isNotBlank(job.getBeanName())) {<NEW_LINE>queryWrapper.eq(Job::getBeanName, job.getBeanName());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotBlank(job.getMethodName())) {<NEW_LINE>queryWrapper.eq(Job::<MASK><NEW_LINE>}<NEW_LINE>if (StringUtils.isNotBlank(job.getParams())) {<NEW_LINE>queryWrapper.like(Job::getParams, job.getParams());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotBlank(job.getRemark())) {<NEW_LINE>queryWrapper.like(Job::getRemark, job.getRemark());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotBlank(job.getStatus())) {<NEW_LINE>queryWrapper.eq(Job::getStatus, job.getStatus());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotBlank(job.getCreateTimeFrom()) && StringUtils.isNotBlank(job.getCreateTimeTo())) {<NEW_LINE>queryWrapper.ge(Job::getCreateTime, job.getCreateTimeFrom()).le(Job::getCreateTime, job.getCreateTimeTo());<NEW_LINE>}<NEW_LINE>Page<Job> page = new Page<>(request.getPageNum(), request.getPageSize());<NEW_LINE>SortUtil.handlePageSort(request, page, "createTime", FebsConstant.ORDER_DESC, true);<NEW_LINE>return page(page, queryWrapper);<NEW_LINE>} | getMethodName, job.getMethodName()); |
1,158,580 | public PartitionGetResult partitionGet(PartitionGetParam partParam) {<NEW_LINE>if (partParam instanceof PartitionGetRowsParam) {<NEW_LINE>PartitionGetRowsParam param = (PartitionGetRowsParam) partParam;<NEW_LINE>PartitionKey pkey = param.getPartKey();<NEW_LINE>pkey = psContext.getMatrixMetaManager().getMatrixMeta(pkey.getMatrixId()).getPartitionMeta(pkey.getPartitionId()).getPartitionKey();<NEW_LINE>List<Integer> reqCols = param.getRowIndexes();<NEW_LINE>int start = reqCols.get(0);<NEW_LINE>int end = reqCols.get(1);<NEW_LINE>MatrixStorageManager manager = psContext.getMatrixStorageManager();<NEW_LINE>Map<Integer, <MASK><NEW_LINE>for (int col = start; col < end; col++) cks.put(col, new Int2IntOpenHashMap());<NEW_LINE>int rowOffset = pkey.getStartRow();<NEW_LINE>int rowLength = pkey.getEndRow();<NEW_LINE>for (int r = rowOffset; r < rowLength; r++) {<NEW_LINE>ServerRow row = manager.getRow(pkey, r);<NEW_LINE>if (row instanceof ServerIntIntRow) {<NEW_LINE>for (int col = start; col < end; col++) {<NEW_LINE>Int2IntOpenHashMap map = cks.get(col);<NEW_LINE>int k = ((ServerIntIntRow) row).get(col);<NEW_LINE>if (k > 0)<NEW_LINE>map.put(row.getRowId(), k);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new PartColumnResult(cks);<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | Int2IntOpenHashMap> cks = new HashMap(); |
776,589 | public boolean apply(Game game, Ability source) {<NEW_LINE>int highestNumber = 0;<NEW_LINE>int number = 0;<NEW_LINE>Permanent menacingOgre = game.getPermanent(source.getSourceId());<NEW_LINE>String message = "Choose a number.";<NEW_LINE>Map<Player, Integer> numberChosen = new HashMap<>();<NEW_LINE>// players choose numbers<NEW_LINE>for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null) {<NEW_LINE>number = player.getAmount(0, 1000, message, game);<NEW_LINE>numberChosen.put(player, number);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// get highest number<NEW_LINE>for (Player player : numberChosen.keySet()) {<NEW_LINE>if (highestNumber < numberChosen.get(player)) {<NEW_LINE>highestNumber = numberChosen.get(player);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// reveal numbers to players and follow through with effect<NEW_LINE>for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null) {<NEW_LINE>game.informPlayers(player.getLogName() + " chose number " + numberChosen.get(player));<NEW_LINE>if (numberChosen.get(player) >= highestNumber) {<NEW_LINE>player.loseLife(<MASK><NEW_LINE>if (player.getId().equals(source.getControllerId()) && menacingOgre != null) {<NEW_LINE>menacingOgre.addCounters(CounterType.P1P1.createInstance(2), source.getControllerId(), source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | highestNumber, game, source, false); |
377,738 | public NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageName, String moduleName, String qualifiedBinaryFileName, boolean asBinaryOnly) {<NEW_LINE>if (!isPackage(qualifiedPackageName, moduleName))<NEW_LINE>// most common case<NEW_LINE>return null;<NEW_LINE>try {<NEW_LINE>// TODO: Check if any conversion needed for path separator<NEW_LINE>ClassFileReader reader = null;<NEW_LINE>byte[] content = null;<NEW_LINE>// $NON-NLS-1$ //$NON-NLS-2$<NEW_LINE>qualifiedBinaryFileName = qualifiedBinaryFileName.replace(".class", ".sig");<NEW_LINE>if (this.subReleases != null && this.subReleases.length > 0) {<NEW_LINE>for (String rel : this.subReleases) {<NEW_LINE>Path p = this.<MASK><NEW_LINE>if (Files.exists(p)) {<NEW_LINE>content = JRTUtil.safeReadBytes(p);<NEW_LINE>if (content != null)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>content = JRTUtil.safeReadBytes(this.fs.getPath(this.releaseInHex, qualifiedBinaryFileName));<NEW_LINE>}<NEW_LINE>if (content != null) {<NEW_LINE>reader = new ClassFileReader(content, qualifiedBinaryFileName.toCharArray());<NEW_LINE>char[] modName = moduleName != null ? moduleName.toCharArray() : null;<NEW_LINE>return new NameEnvironmentAnswer(reader, fetchAccessRestriction(qualifiedBinaryFileName), modName);<NEW_LINE>}<NEW_LINE>} catch (ClassFormatException e) {<NEW_LINE>// Continue<NEW_LINE>} catch (IOException e) {<NEW_LINE>// continue<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | fs.getPath(rel, qualifiedBinaryFileName); |
1,064,248 | final DeleteVolumeResult executeDeleteVolume(DeleteVolumeRequest deleteVolumeRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteVolumeRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteVolumeRequest> request = null;<NEW_LINE>Response<DeleteVolumeResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteVolumeRequestMarshaller().marshall(super.beforeMarshalling(deleteVolumeRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteVolume");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeleteVolumeResult> responseHandler = new StaxResponseHandler<DeleteVolumeResult>(new DeleteVolumeResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
384,528 | public // may be useful when troubleshooting heap corruption<NEW_LINE>void printLog(int count) {<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>int pos = (this.insertionPosition - count + i) % this.buffer0.length;<NEW_LINE>byte opcode = this.operation[pos];<NEW_LINE>switch(opcode) {<NEW_LINE>case FREE_OPERATION:<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.printf("FREE_OPERATION(address=%x, size=%d)\n", this.buffer0[pos], this.buffer1[pos]);<NEW_LINE>break;<NEW_LINE>case MALLOC_OPERATION:<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.printf("MALLOC_OPERATION(address=%x, size=%d)\n", this.buffer0[pos], this.buffer1[pos]);<NEW_LINE>break;<NEW_LINE>case WRITE_OPERATION:<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.printf("WRITE_OPERATION(address=%x, size=%d)\n", this.buffer0[pos]<MASK><NEW_LINE>break;<NEW_LINE>case PUSH_OPERATION:<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.printf("PUSH_OPERATION(tag=%s)\n", activeTags.get(this.buffer1[pos]));<NEW_LINE>break;<NEW_LINE>case POP_OPERATION:<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.printf("POP_OPERATION(tag=%s)\n", activeTags.get(this.buffer1[pos]));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>// $NON-NLS-1$<NEW_LINE>System.out.printf("UNKNOWN(opcode=%d, arg0=%d, arg1=%d)\n", opcode, this.buffer0[pos], this.buffer1[pos]);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , this.buffer1[pos]); |
1,122,777 | private void updateRedisMaster() throws ResourceNotFoundException {<NEW_LINE>List<RedisTbl> <MASK><NEW_LINE>MigrationCluster migrationCluster = getHolder();<NEW_LINE>RedisService redisService = migrationCluster.getRedisService();<NEW_LINE>String fromDc = migrationCluster.fromDc();<NEW_LINE>String destDc = migrationCluster.destDc();<NEW_LINE>String clusterName = migrationCluster.clusterName();<NEW_LINE>List<RedisTbl> prevDcRedises = redisService.findAllRedisesByDcClusterName(fromDc, clusterName);<NEW_LINE>for (RedisTbl redis : prevDcRedises) {<NEW_LINE>if (redis.isMaster()) {<NEW_LINE>redis.setMaster(false);<NEW_LINE>toUpdate.add(redis);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<RedisTbl> newDcRedises = redisService.findAllRedisesByDcClusterName(destDc, clusterName);<NEW_LINE>for (InetSocketAddress newMasterAddress : getNewMasters()) {<NEW_LINE>for (RedisTbl redis : newDcRedises) {<NEW_LINE>if (redis.getRedisIp().equals(newMasterAddress.getHostString()) && redis.getRedisPort() == newMasterAddress.getPort()) {<NEW_LINE>redis.setMaster(true);<NEW_LINE>toUpdate.add(redis);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.info("[UpdateMaster]{}", toUpdate);<NEW_LINE>migrationCluster.getRedisService().updateBatchMaster(toUpdate);<NEW_LINE>} | toUpdate = new LinkedList<>(); |
1,280,906 | protected RemoteOperationResult<ArrayList<RemoteFile>> run(OwnCloudClient client) {<NEW_LINE><MASK><NEW_LINE>OwnCloudVersion serverVersion = null;<NEW_LINE>// get 'fresh data' from the database<NEW_LINE>OCFile tempFile = getStorageManager().getFileByPath(mLocalFolder.getRemotePath());<NEW_LINE>if (tempFile != null) {<NEW_LINE>mLocalFolder = tempFile;<NEW_LINE>} else {<NEW_LINE>Timber.w("File with path: " + mLocalFolder.getRemotePath() + " and account " + mAccount.name + " could not be retrieved from database " + "for account : " + getStorageManager().getAccount().name + " Let's try to synchronize it anyway");<NEW_LINE>}<NEW_LINE>// only in root folder: sync server version and user profile<NEW_LINE>if (OCFile.ROOT_PATH.equals(mLocalFolder.getRemotePath()) && syncVersionAndProfileEnabled) {<NEW_LINE>serverVersion = syncCapabilitiesAndGetServerVersion();<NEW_LINE>syncUserProfile();<NEW_LINE>}<NEW_LINE>// sync list of files, and contents of available offline files & folders<NEW_LINE>SynchronizeFolderOperation syncOp = new SynchronizeFolderOperation(mContext, mLocalFolder.getRemotePath(), mAccount, System.currentTimeMillis(), false, false, false);<NEW_LINE>result = syncOp.execute(client, getStorageManager());<NEW_LINE>sendLocalBroadcast(EVENT_SINGLE_FOLDER_CONTENTS_SYNCED, mLocalFolder.getRemotePath(), serverVersion, result);<NEW_LINE>if (result.isSuccess()) {<NEW_LINE>// share result is ignored<NEW_LINE>updateShareIconsInFiles(client);<NEW_LINE>}<NEW_LINE>sendLocalBroadcast(EVENT_SINGLE_FOLDER_SHARES_SYNCED, mLocalFolder.getRemotePath(), serverVersion, result);<NEW_LINE>return result;<NEW_LINE>} | RemoteOperationResult<ArrayList<RemoteFile>> result; |
1,377,215 | Entry<K, V> removeMapping(Object o) {<NEW_LINE>if (!(o instanceof Map.Entry)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Entry<K, V>[] tab = getTable();<NEW_LINE>Map.Entry<K, V> entry = (Map.Entry) o;<NEW_LINE>Object k = maskNull(entry.getKey());<NEW_LINE>int h = <MASK><NEW_LINE>int i = indexFor(h, tab.length);<NEW_LINE>Entry<K, V> prev = tab[i];<NEW_LINE>Entry<K, V> e = prev;<NEW_LINE>while (e != null) {<NEW_LINE>Entry<K, V> next = e.next;<NEW_LINE>if (h == e.hash && e.equals(entry)) {<NEW_LINE>modCount++;<NEW_LINE>size--;<NEW_LINE>if (prev == e) {<NEW_LINE>tab[i] = next;<NEW_LINE>} else {<NEW_LINE>prev.next = next;<NEW_LINE>}<NEW_LINE>return e;<NEW_LINE>}<NEW_LINE>prev = e;<NEW_LINE>e = next;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | hash(k.hashCode()); |
1,675,106 | private Map<String, RequestParameter> validateHeaderParams(RoutingContext routingContext) throws ValidationException {<NEW_LINE>// Validation process validate only params that are registered in the validation -> extra params are allowed<NEW_LINE>Map<String, RequestParameter> parsedParams = new HashMap<>();<NEW_LINE>MultiMap headersParams = routingContext.request().headers();<NEW_LINE>for (ParameterValidationRule rule : headerParamsRules.values()) {<NEW_LINE>String name = rule.getName();<NEW_LINE>if (headersParams.contains(name)) {<NEW_LINE>List<String> p = headersParams.getAll(name);<NEW_LINE>if (p.size() != 0) {<NEW_LINE>RequestParameter parsedParam = rule.validateArrayParam(p);<NEW_LINE>if (parsedParams.containsKey(parsedParam.getName()))<NEW_LINE>parsedParam = parsedParam.merge(parsedParams.get(parsedParam.getName()));<NEW_LINE>parsedParams.put(<MASK><NEW_LINE>} else {<NEW_LINE>throw ValidationException.ValidationExceptionFactory.generateNotMatchValidationException(name + " can't be empty");<NEW_LINE>}<NEW_LINE>} else if (rule.parameterTypeValidator().getDefault() != null) {<NEW_LINE>RequestParameter parsedParam = new RequestParameterImpl(name, rule.parameterTypeValidator().getDefault());<NEW_LINE>if (parsedParams.containsKey(parsedParam.getName()))<NEW_LINE>parsedParam = parsedParam.merge(parsedParams.get(parsedParam.getName()));<NEW_LINE>parsedParams.put(parsedParam.getName(), parsedParam);<NEW_LINE>} else if (!rule.isOptional())<NEW_LINE>throw ValidationException.ValidationExceptionFactory.generateNotFoundValidationException(name, ParameterLocation.HEADER);<NEW_LINE>}<NEW_LINE>return parsedParams;<NEW_LINE>} | parsedParam.getName(), parsedParam); |
938,732 | private Map<String, Object> toD3Format(Iterator<Map<String, Object>> result) {<NEW_LINE>List<Map<String, Object>> nodes = new ArrayList<>();<NEW_LINE>List<Map<String, Object>> rels = new ArrayList<>();<NEW_LINE>int i = 0;<NEW_LINE>while (result.hasNext()) {<NEW_LINE>Map<String, Object> row = result.next();<NEW_LINE>nodes.add(map("title", row.get("movie"), "label", "movie"));<NEW_LINE>int target = i;<NEW_LINE>i++;<NEW_LINE>for (Object name : (Collection) row.get("cast")) {<NEW_LINE>Map<String, Object> actor = map("title", name, "label", "actor");<NEW_LINE>int source = nodes.indexOf(actor);<NEW_LINE>if (source == -1) {<NEW_LINE>nodes.add(actor);<NEW_LINE>source = i++;<NEW_LINE>}<NEW_LINE>rels.add(map("source", source, "target", target));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return map(<MASK><NEW_LINE>} | "nodes", nodes, "links", rels); |
376,674 | public final void handleRequest(RESTRequest request, RESTResponse response) throws IOException {<NEW_LINE>if (!"GET".equals(request.getMethod())) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(this, tc, "Request method was " + request.getMethod() + " but the validation endpoint is restricted to GET requests only.");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>// Method Not Allowed<NEW_LINE>response.sendError(405);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Throw 404 for /ibm/api/validation with an empty string element.<NEW_LINE>if (request.getPath().startsWith("/validation//")) {<NEW_LINE>response.sendError(404, Tr.formatMessage(tc, request.getLocale(), "CWWKO1553_HANDLER_NOT_FOUND", request.getContextPath() + request.getPath()));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>super.handleRequest(request, response);<NEW_LINE>} | response.setResponseHeader("Accept", "GET"); |
1,706,644 | private void enforceVersioning(DocumentFile dir, int versionsToKeep) {<NEW_LINE>Log.i(TAG, String.format("Scanning directory %s for backup files", Uri.decode(dir.getUri().toString())));<NEW_LINE>List<BackupFile> files = new ArrayList<>();<NEW_LINE>for (DocumentFile docFile : dir.listFiles()) {<NEW_LINE>if (docFile.isFile() && !docFile.isVirtual()) {<NEW_LINE>try {<NEW_LINE>files.add(new BackupFile(docFile));<NEW_LINE>} catch (ParseException ignored) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Log.i(TAG, String.format("Found %d backup files, keeping the %d most recent", files.size(), versionsToKeep));<NEW_LINE>Collections.sort(files, new FileComparator());<NEW_LINE>if (files.size() > versionsToKeep) {<NEW_LINE>for (BackupFile file : files.subList(0, files.size() - versionsToKeep)) {<NEW_LINE>Log.i(TAG, String.format("Deleting %s", file.getFile().getName()));<NEW_LINE>if (!file.getFile().delete()) {<NEW_LINE>Log.e(TAG, String.format("Unable to delete %s", file.getFile<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().getName())); |
42,091 | private void removeDeportedCells() {<NEW_LINE>ArrayList<GridRow> rowToRemove = new ArrayList<>();<NEW_LINE>for (Entry<GridRow, Set<CellView>> entry : gridViewSkin.deportedCells.entrySet()) {<NEW_LINE>ArrayList<CellView> <MASK><NEW_LINE>for (CellView cell : entry.getValue()) {<NEW_LINE>// If we're not editing and the TableRow of the cell is not contained anymore, we remove.<NEW_LINE>if (!cell.isEditing() && !getCells().contains(cell.getTableRow())) {<NEW_LINE>entry.getKey().removeCell(cell);<NEW_LINE>toRemove.add(cell);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>entry.getValue().removeAll(toRemove);<NEW_LINE>if (entry.getValue().isEmpty()) {<NEW_LINE>rowToRemove.add(entry.getKey());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (GridRow row : rowToRemove) {<NEW_LINE>gridViewSkin.deportedCells.remove(row);<NEW_LINE>}<NEW_LINE>} | toRemove = new ArrayList<>(); |
831,473 | private static Bitmap blur(Bitmap bitmap, Context context, float blurRadius) {<NEW_LINE>Point previewSize = scaleKeepingAspectRatio(new Point(bitmap.getWidth(), bitmap<MASK><NEW_LINE>Point blurSize = scaleKeepingAspectRatio(new Point(previewSize.x / 2, previewSize.y / 2), MAX_BLUR_DIMENSION);<NEW_LINE>Bitmap small = BitmapUtil.createScaledBitmap(bitmap, blurSize.x, blurSize.y);<NEW_LINE>Log.d(TAG, "Bitmap: " + bitmap.getWidth() + "x" + bitmap.getHeight() + ", Blur: " + blurSize.x + "x" + blurSize.y);<NEW_LINE>RenderScript rs = RenderScript.create(context);<NEW_LINE>Allocation input = Allocation.createFromBitmap(rs, small);<NEW_LINE>Allocation output = Allocation.createTyped(rs, input.getType());<NEW_LINE>ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));<NEW_LINE>script.setRadius(blurRadius);<NEW_LINE>script.setInput(input);<NEW_LINE>script.forEach(output);<NEW_LINE>Bitmap blurred = Bitmap.createBitmap(small.getWidth(), small.getHeight(), small.getConfig());<NEW_LINE>output.copyTo(blurred);<NEW_LINE>return blurred;<NEW_LINE>} | .getHeight()), PREVIEW_DIMENSION_LIMIT); |
1,038,880 | protected void fillTable(Listbox cb) {<NEW_LINE>ValueNamePair select = null;<NEW_LINE>String sql = "SELECT AD_Table_ID, TableName FROM AD_Table t " + "WHERE EXISTS (SELECT * FROM AD_Column c" + " WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='Posted')" + " AND IsView='N'";<NEW_LINE>try {<NEW_LINE>PreparedStatement pstmt = DB.prepareStatement(sql, null);<NEW_LINE>ResultSet rs = pstmt.executeQuery();<NEW_LINE>while (rs.next()) {<NEW_LINE>int id = rs.getInt(1);<NEW_LINE>String tableName = rs.getString(2);<NEW_LINE>String name = Msg.translate(Env.getCtx(), tableName + "_ID");<NEW_LINE>ValueNamePair pp = new ValueNamePair(tableName, name);<NEW_LINE>cb.appendItem(pp.getName(), pp);<NEW_LINE>tableInfo.put(<MASK><NEW_LINE>if (id == AD_Table_ID)<NEW_LINE>select = pp;<NEW_LINE>}<NEW_LINE>rs.close();<NEW_LINE>pstmt.close();<NEW_LINE>} catch (SQLException e) {<NEW_LINE>log.log(Level.SEVERE, sql, e);<NEW_LINE>}<NEW_LINE>if (select != null)<NEW_LINE>// cb.setSelectedItem(select);<NEW_LINE>;<NEW_LINE>} | tableName, new Integer(id)); |
1,837,622 | private // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>java.awt.GridBagConstraints gridBagConstraints;<NEW_LINE>enlargeLabel = new javax.swing.JLabel();<NEW_LINE>enlargeText = new javax.swing.JTextField();<NEW_LINE>decreasingLabel = new javax.swing.JLabel();<NEW_LINE>decreaseText = new javax.swing.JTextField();<NEW_LINE>setLayout(new java.awt.GridBagLayout());<NEW_LINE>enlargeLabel.setLabelFor(enlargeText);<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(enlargeLabel, NbBundle.getBundle(CustomZoomPanel.class).getString("LBL_EnlargeFactor"));<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);<NEW_LINE>add(enlargeLabel, gridBagConstraints);<NEW_LINE>enlargeText.setDocument(new WholeNumberDocument());<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;<NEW_LINE>gridBagConstraints.weightx = 1.0;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(12, 11, 0, 11);<NEW_LINE>add(enlargeText, gridBagConstraints);<NEW_LINE>decreasingLabel.setLabelFor(decreaseText);<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(decreasingLabel, NbBundle.getBundle(CustomZoomPanel.class).getString("LBL_DecreaseFactor"));<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridx = 0;<NEW_LINE>gridBagConstraints.gridy = 1;<NEW_LINE>gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(5, 12, 11, 0);<NEW_LINE>add(decreasingLabel, gridBagConstraints);<NEW_LINE>decreaseText.setDocument(new WholeNumberDocument());<NEW_LINE>gridBagConstraints = new java.awt.GridBagConstraints();<NEW_LINE>gridBagConstraints.gridx = 1;<NEW_LINE>gridBagConstraints.gridy = 1;<NEW_LINE>gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;<NEW_LINE>gridBagConstraints.weightx = 1.0;<NEW_LINE>gridBagConstraints.insets = new java.awt.Insets(<MASK><NEW_LINE>add(decreaseText, gridBagConstraints);<NEW_LINE>} | 5, 11, 11, 11); |
1,535,323 | private void migrateAlarmsToMetadata() {<NEW_LINE>Context context = ContextManager.getContext();<NEW_LINE>if (!checkIfDatabaseExists(context, AlarmDatabase.NAME))<NEW_LINE>return;<NEW_LINE>AlarmDatabase alarmsDatabase = new AlarmDatabase();<NEW_LINE>DatabaseDao<TransitionalAlarm> dao = new DatabaseDao<TransitionalAlarm>(TransitionalAlarm.class, alarmsDatabase);<NEW_LINE>TodorooCursor<TransitionalAlarm> cursor = dao.query(Query.select(TransitionalAlarm.PROPERTIES));<NEW_LINE>try {<NEW_LINE>if (cursor.getCount() == 0)<NEW_LINE>return;<NEW_LINE>Metadata metadata = new Metadata();<NEW_LINE>metadata.setValue(Metadata.KEY, AlarmFields.METADATA_KEY);<NEW_LINE>for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {<NEW_LINE>long task = cursor.get(TransitionalAlarm.TASK);<NEW_LINE>long time = cursor.get(TransitionalAlarm.TIME);<NEW_LINE>metadata.setValue(Metadata.TASK, task);<NEW_LINE>metadata.setValue(AlarmFields.TIME, time);<NEW_LINE>metadata.setValue(<MASK><NEW_LINE>metadataDao.createNew(metadata);<NEW_LINE>metadata.clearValue(Metadata.ID);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>cursor.close();<NEW_LINE>alarmsDatabase.close();<NEW_LINE>}<NEW_LINE>} | AlarmFields.TYPE, AlarmFields.TYPE_SINGLE); |
411,592 | private static Row toRow(FilterDifference difference, SpecifierContext currentContext, SpecifierContext referenceContext) {<NEW_LINE>Row.TypedRowBuilder ret = Row.builder(metadata().toColumnMap());<NEW_LINE>String hostname = difference.getHostname();<NEW_LINE><MASK><NEW_LINE>ret.put(COL_NODE, new Node(hostname)).put(COL_FILTER_NAME, filtername);<NEW_LINE>if (difference.getCurrentIndex() == null) {<NEW_LINE>ret.put(COL_CURRENT_LINE, END_OF_ACL).put(COL_CURRENT_ACTION, LineAction.DENY).put(COL_CURRENT_NAME, "");<NEW_LINE>} else {<NEW_LINE>int index = difference.getCurrentIndex();<NEW_LINE>AclLine line = currentContext.getConfigs().get(hostname).getIpAccessLists().get(filtername).getLines().get(index);<NEW_LINE>ret.put(COL_CURRENT_LINE, index).put(COL_CURRENT_ACTION, ActionGetter.getLineBehavior(line)).put(COL_CURRENT_NAME, line.getName());<NEW_LINE>}<NEW_LINE>if (difference.getReferenceIndex() == null) {<NEW_LINE>ret.put(COL_REFERENCE_LINE, END_OF_ACL).put(COL_REFERENCE_NAME, "");<NEW_LINE>} else {<NEW_LINE>int index = difference.getReferenceIndex();<NEW_LINE>AclLine line = referenceContext.getConfigs().get(hostname).getIpAccessLists().get(filtername).getLines().get(index);<NEW_LINE>ret.put(COL_REFERENCE_LINE, index).put(COL_REFERENCE_NAME, line.getName());<NEW_LINE>}<NEW_LINE>return ret.build();<NEW_LINE>} | String filtername = difference.getFilterName(); |
695,669 | public <Q> boolean visit(EditorContext<Q> ctx) {<NEW_LINE>Q toSet = ctx.getFromModel();<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>AbstractEditorDelegate<Q, ?> delegate = (AbstractEditorDelegate<Q, ?>) ctx.getEditorDelegate();<NEW_LINE>if (delegate != null) {<NEW_LINE>delegate.setObject<MASK><NEW_LINE>delegate.setDirty(false);<NEW_LINE>}<NEW_LINE>ValueAwareEditor<Q> asValue = ctx.asValueAwareEditor();<NEW_LINE>if (asValue != null) {<NEW_LINE>// Call setValue for ValueAware, non-leaf editors<NEW_LINE>asValue.setValue(toSet);<NEW_LINE>} else {<NEW_LINE>LeafValueEditor<Q> asLeaf = ctx.asLeafValueEditor();<NEW_LINE>if (asLeaf != null) {<NEW_LINE>// Call setvalue for LeafValueEditors.<NEW_LINE>asLeaf.setValue(toSet);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CompositeEditor's setValue should create sub-editors and attach them to<NEW_LINE>// the EditorChain, which will traverse them. Returning true here for a<NEW_LINE>// CompositeEditor would then traverse it twice. See issue 7038.<NEW_LINE>return ctx.asCompositeEditor() == null;<NEW_LINE>} | (delegate.ensureMutable(toSet)); |
663,659 | public void onCreate(Bundle icicle) {<NEW_LINE>Logger.D(TAG, "onCreate+");<NEW_LINE>super.onCreate(icicle);<NEW_LINE>requestWindowFeature(Window.FEATURE_NO_TITLE);<NEW_LINE>setContentView(RhoExtManager.getResourceId("layout", "signature"));<NEW_LINE>Bundle extras <MASK><NEW_LINE>imageFormat = extras.getString(com.rho.signature.Signature.INTENT_EXTRA_PREFIX + "imageFormat");<NEW_LINE>filePath = extras.getString(com.rho.signature.Signature.INTENT_EXTRA_PREFIX + "filePath");<NEW_LINE>penColor = extras.getInt(com.rho.signature.Signature.INTENT_EXTRA_PREFIX + "penColor");<NEW_LINE>penWidth = extras.getInt(com.rho.signature.Signature.INTENT_EXTRA_PREFIX + "penWidth");<NEW_LINE>bgColor = extras.getInt(com.rho.signature.Signature.INTENT_EXTRA_PREFIX + "bgColor");<NEW_LINE>singletonId = extras.getInt(com.rho.signature.Signature.INTENT_EXTRA_PREFIX + "singletonId");<NEW_LINE>surfaceView = (SignatureView) findViewById(RhoExtManager.getResourceId("id", "signature_view"));<NEW_LINE>cancelButton = (ImageButton) findViewById(RhoExtManager.getResourceId("id", "sig_cancelButton"));<NEW_LINE>clearButton = (ImageButton) findViewById(RhoExtManager.getResourceId("id", "sig_clearButton"));<NEW_LINE>okButton = (ImageButton) findViewById(RhoExtManager.getResourceId("id", "sig_okButton"));<NEW_LINE>surfaceHolder = surfaceView.getHolder();<NEW_LINE>surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_NORMAL);<NEW_LINE>surfaceView.setSingletonId(singletonId);<NEW_LINE>cancelButton.setOnClickListener(this);<NEW_LINE>clearButton.setOnClickListener(this);<NEW_LINE>okButton.setOnClickListener(this);<NEW_LINE>surfaceView.setupView(penColor, penWidth, bgColor, false);<NEW_LINE>surfaceView.invalidate();<NEW_LINE>resultReceiver = (ResultReceiver) getIntent().getParcelableExtra(com.rho.signature.Signature.INTENT_EXTRA_PREFIX + "resultReceiver");<NEW_LINE>isOnCreateCall = true;<NEW_LINE>if (BaseActivity.getScreenAutoRotateMode()) {<NEW_LINE>this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);<NEW_LINE>}<NEW_LINE>Logger.D(TAG, "onCreate-");<NEW_LINE>} | = getIntent().getExtras(); |
956,259 | public boolean internalInvertedFilterRow(Project project, int rowIndex, Row row) {<NEW_LINE>Cell cell = _cellIndex < 0 ? null : row.getCell(_cellIndex);<NEW_LINE>Properties bindings = ExpressionUtils.createBindings(project);<NEW_LINE>ExpressionUtils.bind(bindings, row, rowIndex, _columnName, cell);<NEW_LINE>Object <MASK><NEW_LINE>if (value != null) {<NEW_LINE>if (value.getClass().isArray()) {<NEW_LINE>Object[] a = (Object[]) value;<NEW_LINE>for (Object v : a) {<NEW_LINE>if (testValue(v)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} else if (value instanceof Collection<?>) {<NEW_LINE>for (Object v : ExpressionUtils.toObjectCollection(value)) {<NEW_LINE>if (testValue(v)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} else if (value instanceof ArrayNode) {<NEW_LINE>ArrayNode a = (ArrayNode) value;<NEW_LINE>int l = a.size();<NEW_LINE>for (int i = 0; i < l; i++) {<NEW_LINE>if (testValue(JsonValueConverter.convert(a.get(i)))) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// else, fall through<NEW_LINE>}<NEW_LINE>return !testValue(value);<NEW_LINE>} | value = _evaluable.evaluate(bindings); |
1,530,754 | private CToolchain.Builder createBaseArmeabiToolchain(boolean thumb, CppConfiguration.Tool... excludedTools) {<NEW_LINE>String toolchainName = "arm-linux-androideabi-4.9";<NEW_LINE>String targetPlatform = "arm-linux-androideabi";<NEW_LINE>CToolchain.Builder toolchain = // Compiler flags<NEW_LINE>CToolchain.newBuilder().setTargetSystemName(targetPlatform).setCompiler("gcc-4.9").addAllToolPath(ndkPaths.createToolpaths(toolchainName, targetPlatform, excludedTools)).addAllCxxBuiltinIncludeDirectory(ndkPaths.createGccToolchainBuiltinIncludeDirectories(toolchainName, targetPlatform, "4.9")).setBuiltinSysroot(ndkPaths.createBuiltinSysroot("arm")).addCompilerFlag("-fstack-protector-strong").addCompilerFlag("-fpic").addCompilerFlag("-ffunction-sections").addCompilerFlag("-funwind-tables").addCompilerFlag("-no-canonical-prefixes").addCompilerFlag(// Linker flags<NEW_LINE>"-fno-canonical-system-headers").addLinkerFlag("-no-canonical-prefixes");<NEW_LINE>if (thumb) {<NEW_LINE>toolchain.addCompilationModeFlags(CompilationModeFlags.newBuilder().setMode(CompilationMode.OPT).addCompilerFlag("-mthumb").addCompilerFlag("-Os").addCompilerFlag("-g").addCompilerFlag("-DNDEBUG").addCompilerFlag("-fomit-frame-pointer").addCompilerFlag("-fno-strict-aliasing").addCompilerFlag("-finline-limit=64"));<NEW_LINE>toolchain.addCompilationModeFlags(CompilationModeFlags.newBuilder().setMode(CompilationMode.DBG).addCompilerFlag("-g").addCompilerFlag("-fno-strict-aliasing").addCompilerFlag("-finline-limit=64").addCompilerFlag("-O0").addCompilerFlag("-UNDEBUG").addCompilerFlag("-marm").addCompilerFlag("-fno-omit-frame-pointer"));<NEW_LINE>} else {<NEW_LINE>toolchain.addCompilationModeFlags(CompilationModeFlags.newBuilder().setMode(CompilationMode.OPT).addCompilerFlag("-O2").addCompilerFlag("-g").addCompilerFlag("-DNDEBUG").addCompilerFlag("-fomit-frame-pointer").addCompilerFlag("-fstrict-aliasing").addCompilerFlag("-funswitch-loops").addCompilerFlag("-finline-limit=300"));<NEW_LINE>toolchain.addCompilationModeFlags(CompilationModeFlags.newBuilder().setMode(CompilationMode.DBG).addCompilerFlag("-g").addCompilerFlag("-funswitch-loops").addCompilerFlag("-finline-limit=300").addCompilerFlag("-O0").addCompilerFlag("-UNDEBUG").addCompilerFlag(<MASK><NEW_LINE>}<NEW_LINE>return toolchain;<NEW_LINE>} | "-fno-omit-frame-pointer").addCompilerFlag("-fno-strict-aliasing")); |
1,145,395 | public void playTuneinStation(Command command) {<NEW_LINE>if (command instanceof StringType) {<NEW_LINE>String stationId = command.toString();<NEW_LINE>List<MASK><NEW_LINE>SonosMusicService tuneinService = null;<NEW_LINE>// search for the TuneIn music service based on its name<NEW_LINE>if (allServices != null) {<NEW_LINE>for (SonosMusicService service : allServices) {<NEW_LINE>if (service.getName().equals("TuneIn")) {<NEW_LINE>tuneinService = service;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// set the URI of the group coordinator<NEW_LINE>if (tuneinService != null) {<NEW_LINE>try {<NEW_LINE>ZonePlayerHandler coordinator = getCoordinatorHandler();<NEW_LINE>SonosEntry entry = new SonosEntry("", "TuneIn station", "", "", "", "", "object.item.audioItem.audioBroadcast", String.format(TUNEIN_URI, stationId, tuneinService.getId()));<NEW_LINE>entry.setDesc("SA_RINCON" + tuneinService.getType().toString() + "_");<NEW_LINE>coordinator.setCurrentURI(entry);<NEW_LINE>coordinator.play();<NEW_LINE>} catch (IllegalStateException e) {<NEW_LINE>logger.debug("Cannot play TuneIn station {} ({})", stationId, e.getMessage());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.debug("TuneIn service not found");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | <SonosMusicService> allServices = getAvailableMusicServices(); |
1,162,372 | static IllegalStateException ensureVersionCompatibility(Version remoteVersion, Version currentVersion, boolean isHandshake) {<NEW_LINE>// for handshakes we are compatible with N-2 since otherwise we can't figure out our initial version<NEW_LINE>// since we are compatible with N-1 and N+1 so we always send our minCompatVersion as the initial version in the<NEW_LINE>// handshake. This looks odd but it's required to establish the connection correctly we check for real compatibility<NEW_LINE>// once the connection is established<NEW_LINE>final Version compatibilityVersion = isHandshake ? currentVersion.minimumCompatibilityVersion() : currentVersion;<NEW_LINE>if (remoteVersion.isCompatible(compatibilityVersion) == false) {<NEW_LINE>final Version minCompatibilityVersion = isHandshake ? compatibilityVersion : compatibilityVersion.minimumCompatibilityVersion();<NEW_LINE>String msg = "Received " + (<MASK><NEW_LINE>return new IllegalStateException(msg + remoteVersion + "] minimal compatible version is: [" + minCompatibilityVersion + "]");<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | isHandshake ? "handshake " : "") + "message from unsupported version: ["; |
877,773 | public static FileMeta createMetaIfNeed(String path, final boolean isSearhcBook) {<NEW_LINE>FileMeta fileMeta = AppDB.get().getOrCreate(path);<NEW_LINE>LOG.d("BooksService-createMetaIfNeed", path, fileMeta.getState());<NEW_LINE>try {<NEW_LINE>if (FileMetaCore.STATE_FULL != fileMeta.getState()) {<NEW_LINE>EbookMeta ebookMeta = FileMetaCore.get().getEbookMeta(<MASK><NEW_LINE>FileMetaCore.get().upadteBasicMeta(fileMeta, new File(path));<NEW_LINE>FileMetaCore.get().udpateFullMeta(fileMeta, ebookMeta);<NEW_LINE>if (isSearhcBook) {<NEW_LINE>fileMeta.setIsSearchBook(isSearhcBook);<NEW_LINE>}<NEW_LINE>AppDB.get().update(fileMeta);<NEW_LINE>LOG.d("BooksService checkOrCreateMetaInfo", "UPDATE", path);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.e(e);<NEW_LINE>}<NEW_LINE>return fileMeta;<NEW_LINE>} | path, CacheDir.ZipApp, true); |
995,026 | private List<Comparator> loadDefaultComparators() {<NEW_LINE>String PKG = "no.priv.garshol.duke.comparators.";<NEW_LINE>String[] compnames = new String[] { "DiceCoefficientComparator", "DifferentComparator", "ExactComparator", "JaroWinkler", "JaroWinklerTokenized", "Levenshtein", "NumericComparator", "PersonNameComparator", "SoundexComparator", "WeightedLevenshtein", "NorphoneComparator", "MetaphoneComparator", "QGramComparator", "GeopositionComparator", "LongestCommonSubstring" };<NEW_LINE>List<Comparator> comparators <MASK><NEW_LINE>for (int ix = 0; ix < compnames.length; ix++) comparators.add((Comparator) ObjectUtils.instantiate(PKG + compnames[ix]));<NEW_LINE>return comparators;<NEW_LINE>} | = new ArrayList<Comparator>(); |
202,171 | public MultiCurrencyAmount currencyExposure(ResolvedFxNdf ndf, RatesProvider provider) {<NEW_LINE>if (provider.getValuationDate().isAfter(ndf.getPaymentDate())) {<NEW_LINE>return MultiCurrencyAmount.empty();<NEW_LINE>}<NEW_LINE>Currency ccySettle = ndf.getSettlementCurrency();<NEW_LINE>CurrencyAmount notionalSettle = ndf.getSettlementCurrencyNotional();<NEW_LINE>double dfSettle = provider.discountFactor(ccySettle, ndf.getPaymentDate());<NEW_LINE>Currency ccyOther = ndf.getNonDeliverableCurrency();<NEW_LINE>double agreedRate = ndf.getAgreedFxRate(<MASK><NEW_LINE>double dfOther = provider.discountFactor(ccyOther, ndf.getPaymentDate());<NEW_LINE>return MultiCurrencyAmount.of(notionalSettle.multipliedBy(dfSettle)).plus(CurrencyAmount.of(ccyOther, -notionalSettle.getAmount() * agreedRate * dfOther));<NEW_LINE>} | ).fxRate(ccySettle, ccyOther); |
1,769,867 | public void render(TileTank tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {<NEW_LINE>FluidStackInterp forRender = tile.getFluidForRender(partialTicks);<NEW_LINE>if (forRender == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Minecraft.getMinecraft().mcProfiler.startSection("bc");<NEW_LINE>Minecraft.getMinecraft().mcProfiler.startSection("tank");<NEW_LINE>// gl state setup<NEW_LINE>RenderHelper.disableStandardItemLighting();<NEW_LINE>Minecraft.getMinecraft().getTextureManager(<MASK><NEW_LINE>GlStateManager.enableBlend();<NEW_LINE>GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);<NEW_LINE>// buffer setup<NEW_LINE>try (AutoTessellator tess = RenderUtil.getThreadLocalUnusedTessellator()) {<NEW_LINE>BufferBuilder bb = tess.tessellator.getBuffer();<NEW_LINE>bb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);<NEW_LINE>bb.setTranslation(x, y, z);<NEW_LINE>boolean[] sideRender = { true, true, true, true, true, true };<NEW_LINE>boolean connectedUp = isFullyConnected(tile, EnumFacing.UP, partialTicks);<NEW_LINE>boolean connectedDown = isFullyConnected(tile, EnumFacing.DOWN, partialTicks);<NEW_LINE>sideRender[EnumFacing.DOWN.ordinal()] = !connectedDown;<NEW_LINE>sideRender[EnumFacing.UP.ordinal()] = !connectedUp;<NEW_LINE>Vec3d min = connectedDown ? MIN_CONNECTED : MIN;<NEW_LINE>Vec3d max = connectedUp ? MAX_CONNECTED : MAX;<NEW_LINE>FluidStack fluid = forRender.fluid;<NEW_LINE>int blocklight = fluid.getFluid().getLuminosity(fluid);<NEW_LINE>int combinedLight = tile.getWorld().getCombinedLight(tile.getPos(), blocklight);<NEW_LINE>FluidRenderer.vertex.lighti(combinedLight);<NEW_LINE>FluidRenderer.renderFluid(FluidSpriteType.STILL, fluid, forRender.amount, tile.tank.getCapacity(), min, max, bb, sideRender);<NEW_LINE>// buffer finish<NEW_LINE>bb.setTranslation(0, 0, 0);<NEW_LINE>tess.tessellator.draw();<NEW_LINE>}<NEW_LINE>// gl state finish<NEW_LINE>RenderHelper.enableStandardItemLighting();<NEW_LINE>Minecraft.getMinecraft().mcProfiler.endSection();<NEW_LINE>Minecraft.getMinecraft().mcProfiler.endSection();<NEW_LINE>} | ).bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); |
1,611,771 | protected void calcAsync() {<NEW_LINE>ExUtil.asyncRun(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>Map<Integer, ServiceSummary> summaryMap = new HashMap<Integer, ServiceSummary>();<NEW_LINE>Map<Integer, List<Integer>> loadTextMap = new HashMap<Integer<MASK><NEW_LINE>LongEnumer longEnumer = dataMap.keys();<NEW_LINE>while (longEnumer.hasMoreElements()) {<NEW_LINE>XLogData d = dataMap.get(longEnumer.nextLong());<NEW_LINE>long time = d.p.endTime;<NEW_LINE>if (d.filter_ok && time >= stime && time <= etime && !ObjectSelectManager.getInstance().isUnselectedObject(d.p.objHash)) {<NEW_LINE>ServiceSummary summary = summaryMap.get(d.p.service);<NEW_LINE>if (summary == null) {<NEW_LINE>summary = new ServiceSummary(d.p.service);<NEW_LINE>summaryMap.put(d.p.service, summary);<NEW_LINE>List<Integer> loadTextList = loadTextMap.get(d.serverId);<NEW_LINE>if (loadTextList == null) {<NEW_LINE>loadTextList = new ArrayList<Integer>();<NEW_LINE>loadTextMap.put(d.serverId, loadTextList);<NEW_LINE>}<NEW_LINE>loadTextList.add(d.p.service);<NEW_LINE>}<NEW_LINE>summary.count++;<NEW_LINE>summary.sumTime += d.p.elapsed;<NEW_LINE>if (d.p.elapsed > summary.maxTime) {<NEW_LINE>summary.maxTime = d.p.elapsed;<NEW_LINE>}<NEW_LINE>if (d.p.error != 0) {<NEW_LINE>summary.error++;<NEW_LINE>}<NEW_LINE>summary.cpu += d.p.cpu;<NEW_LINE>summary.memory += d.p.kbytes;<NEW_LINE>summary.sqltime += d.p.sqlTime;<NEW_LINE>summary.apicalltime += d.p.apicallTime;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Integer serverId : loadTextMap.keySet()) {<NEW_LINE>TextProxy.service.load(DateUtil.yyyymmdd(etime), loadTextMap.get(serverId), serverId);<NEW_LINE>}<NEW_LINE>final TopN<ServiceSummary> stn = new TopN<ServiceSummary>(10000, DIRECTION.DESC);<NEW_LINE>for (ServiceSummary so : summaryMap.values()) {<NEW_LINE>stn.add(so);<NEW_LINE>}<NEW_LINE>ExUtil.exec(viewer.getTable(), new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>rangeLabel.setText(DateUtil.format(stime, "yyyy-MM-dd HH:mm:ss") + " ~ " + DateUtil.format(etime, "HH:mm:ss") + " (" + stn.size() + ")");<NEW_LINE>viewer.setInput(stn.getList());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | , List<Integer>>(); |
1,330,766 | public static Object fieldValueObject(HollowObjectTypeDataAccess typeAccess, int ordinal, int fieldPosition) {<NEW_LINE>HollowObjectSchema schema = typeAccess.getSchema();<NEW_LINE>switch(schema.getFieldType(fieldPosition)) {<NEW_LINE>case BOOLEAN:<NEW_LINE>return typeAccess.readBoolean(ordinal, fieldPosition);<NEW_LINE>case BYTES:<NEW_LINE>return typeAccess.readBytes(ordinal, fieldPosition);<NEW_LINE>case STRING:<NEW_LINE>return <MASK><NEW_LINE>case DOUBLE:<NEW_LINE>double d = typeAccess.readDouble(ordinal, fieldPosition);<NEW_LINE>return Double.isNaN(d) ? null : Double.valueOf(d);<NEW_LINE>case FLOAT:<NEW_LINE>float f = typeAccess.readFloat(ordinal, fieldPosition);<NEW_LINE>return Float.isNaN(f) ? null : Float.valueOf(f);<NEW_LINE>case INT:<NEW_LINE>int i = typeAccess.readInt(ordinal, fieldPosition);<NEW_LINE>if (i == Integer.MIN_VALUE)<NEW_LINE>return null;<NEW_LINE>return Integer.valueOf(i);<NEW_LINE>case LONG:<NEW_LINE>long l = typeAccess.readLong(ordinal, fieldPosition);<NEW_LINE>if (l == Long.MIN_VALUE)<NEW_LINE>return null;<NEW_LINE>return Long.valueOf(l);<NEW_LINE>case REFERENCE:<NEW_LINE>int refOrdinal = typeAccess.readOrdinal(ordinal, fieldPosition);<NEW_LINE>if (refOrdinal < 0)<NEW_LINE>return null;<NEW_LINE>return Integer.valueOf(refOrdinal);<NEW_LINE>default:<NEW_LINE>}<NEW_LINE>throw new IllegalStateException("Can't handle fieldType=" + schema.getFieldType(fieldPosition) + " for schema=" + schema.getName() + ", fieldPosition=" + fieldPosition);<NEW_LINE>} | typeAccess.readString(ordinal, fieldPosition); |
1,372,901 | public List<Entity> search(String entityType, String searchStr, boolean searchAll, boolean returnSubType) throws Exception {<NEW_LINE>if (doc == null)<NEW_LINE>load();<NEW_LINE><MASK><NEW_LINE>xpath.setNamespaceContext(new WIMNamespaceContext());<NEW_LINE>if (returnSubType) {<NEW_LINE>// append entity types<NEW_LINE>}<NEW_LINE>String xpathString = "//*[@type='wim:" + entityType + "' and " + searchStr + "]";<NEW_LINE>// System.out.println(xpathString);<NEW_LINE>XPathExpression expr = xpath.compile(xpathString);<NEW_LINE>Object result = expr.evaluate(doc, XPathConstants.NODESET);<NEW_LINE>NodeList nodes = (NodeList) result;<NEW_LINE>// System.out.println("Found = " + nodes.getLength());<NEW_LINE>ArrayList<Entity> results = new ArrayList<Entity>();<NEW_LINE>for (int i = 0; i < nodes.getLength(); i++) {<NEW_LINE>// System.out.println(nodes.item(i).getChildNodes().item(11).getFirstChild().getNodeValue());<NEW_LINE>Entity entity = convertToDataObject(entityType, nodes.item(i));<NEW_LINE>results.add(entity);<NEW_LINE>if (!searchAll)<NEW_LINE>return results;<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | XPath xpath = xPathFactory.newXPath(); |
541,435 | private ValidationTaskResult validatePrincipalLogin() {<NEW_LINE>String principal = mConf.getOrDefault(mPrincipalProperty, "");<NEW_LINE>String keytab = mConf.getOrDefault(mKeytabProperty, "");<NEW_LINE>if (principal.isEmpty() || keytab.isEmpty()) {<NEW_LINE>mMsg.append(String.format("Failed to find Kerberos principal and keytab. " + "Found %s=%s and %s=%s.%n", mPrincipalProperty.toString(), principal, mKeytabProperty, keytab));<NEW_LINE>mAdvice.append(String.format("Please configure Alluxio to connect with secure HDFS " + "following %s%n", DOC_LINK));<NEW_LINE>return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), mMsg.toString(), mAdvice.toString());<NEW_LINE>}<NEW_LINE>// Check whether can login with specified principal and keytab<NEW_LINE>Matcher matchPrincipal = PRINCIPAL_PATTERN.matcher(principal);<NEW_LINE>if (!matchPrincipal.matches()) {<NEW_LINE>mMsg.append(String.format("Principal %s is not in the right format.%n", principal));<NEW_LINE>mAdvice.append(String.format("Please fix principal %s=%s.%n", mPrincipalProperty.toString(), principal));<NEW_LINE>return new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), mMsg.toString(), mAdvice.toString());<NEW_LINE>}<NEW_LINE>String primary = matchPrincipal.group("primary");<NEW_LINE>String instance = matchPrincipal.group("instance");<NEW_LINE>String realm = matchPrincipal.group("realm");<NEW_LINE>// Login with principal and keytab<NEW_LINE>String[] command = new String[] { "kinit", "-kt", keytab, principal };<NEW_LINE>try {<NEW_LINE>String output = ShellUtils.execCommand(command);<NEW_LINE>mMsg.append(String.format("Command %s finished with output: %s%n", Arrays.toString(command), output));<NEW_LINE>return new ValidationTaskResult(ValidationUtils.State.OK, getName(), mMsg.toString(), mAdvice.toString());<NEW_LINE>} catch (IOException e) {<NEW_LINE>mMsg.append(String.format<MASK><NEW_LINE>mMsg.append(ValidationUtils.getErrorInfo(e));<NEW_LINE>mMsg.append(String.format("Primary is %s, instance is %s and realm is %s.%n", primary, instance, realm));<NEW_LINE>ValidationTaskResult result = new ValidationTaskResult(ValidationUtils.State.FAILED, getName(), mMsg.toString(), mAdvice.toString());<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | ("Kerberos login failed for %s with keytab %s.%n", principal, keytab)); |
606,979 | public Optional<ResponseInfoBean> readUserResponseInfo(final SessionLabel sessionLabel, final UserIdentity userIdentity, final ChaiUser theUser) throws ChaiUnavailableException, PwmUnrecoverableException {<NEW_LINE>final DomainConfig config = pwmDomain.getConfig();<NEW_LINE>LOGGER.trace(sessionLabel, () -> "beginning read of user response sequence");<NEW_LINE>final List<DataStorageMethod> readPreferences = config.getCrReadPreference();<NEW_LINE>final String debugMsg = "will attempt to read the following storage methods: " + JsonFactory.get().serializeCollection(readPreferences) + " for response info for user " + theUser.getEntryDN();<NEW_LINE>LOGGER.debug(sessionLabel, () -> debugMsg);<NEW_LINE>final String userGUID;<NEW_LINE>if (readPreferences.contains(DataStorageMethod.DB) || readPreferences.contains(DataStorageMethod.LOCALDB)) {<NEW_LINE>userGUID = LdapOperationsHelper.readLdapGuidValue(pwmDomain, sessionLabel, userIdentity, false);<NEW_LINE>} else {<NEW_LINE>userGUID = null;<NEW_LINE>}<NEW_LINE>for (final DataStorageMethod storageMethod : readPreferences) {<NEW_LINE>final Optional<ResponseInfoBean> readResponses;<NEW_LINE>LOGGER.trace(sessionLabel<MASK><NEW_LINE>readResponses = operatorMap.get(storageMethod).readResponseInfo(sessionLabel, theUser, userIdentity, userGUID);<NEW_LINE>if (readResponses.isPresent()) {<NEW_LINE>LOGGER.debug(sessionLabel, () -> "returning response info read via method " + storageMethod + " for user " + theUser.getEntryDN());<NEW_LINE>return readResponses;<NEW_LINE>} else {<NEW_LINE>LOGGER.trace(sessionLabel, () -> "no responses info read using method " + storageMethod);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOGGER.debug(sessionLabel, () -> "no response info found for user " + theUser.getEntryDN());<NEW_LINE>return Optional.empty();<NEW_LINE>} | , () -> "attempting read of response info via storage method: " + storageMethod); |
37,225 | private void toggleImageBackground() {<NEW_LINE>if (getFile() != null && (MIME_TYPE_PNG.equalsIgnoreCase(getFile().getMimeType()) || MIME_TYPE_SVG.equalsIgnoreCase(getFile().getMimeType())) && getActivity() != null && getActivity() instanceof PreviewImageActivity) {<NEW_LINE>PreviewImageActivity previewImageActivity = (PreviewImageActivity) getActivity();<NEW_LINE>if (binding.image.getDrawable() instanceof LayerDrawable) {<NEW_LINE>LayerDrawable layerDrawable = (LayerDrawable) binding.image.getDrawable();<NEW_LINE>Drawable layerOne;<NEW_LINE>if (previewImageActivity.isSystemUIVisible()) {<NEW_LINE>layerOne = ResourcesCompat.getDrawable(getResources(), R.color.bg_default, null);<NEW_LINE>} else {<NEW_LINE>layerOne = ResourcesCompat.getDrawable(getResources(), <MASK><NEW_LINE>}<NEW_LINE>layerDrawable.setDrawableByLayerId(layerDrawable.getId(0), layerOne);<NEW_LINE>binding.image.setImageDrawable(layerDrawable);<NEW_LINE>binding.image.invalidate();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | R.drawable.backrepeat, null); |
433,514 | public V remove(long key) {<NEW_LINE>if (key == 0) {<NEW_LINE>if (!hasZeroValue)<NEW_LINE>return null;<NEW_LINE>hasZeroValue = false;<NEW_LINE>V oldValue = zeroValue;<NEW_LINE>zeroValue = null;<NEW_LINE>size--;<NEW_LINE>return oldValue;<NEW_LINE>}<NEW_LINE>int i = locateKey(key);<NEW_LINE>if (i < 0)<NEW_LINE>return null;<NEW_LINE>long[] keyTable = this.keyTable;<NEW_LINE>V[] valueTable = this.valueTable;<NEW_LINE>V oldValue = valueTable[i];<NEW_LINE>int mask = this.mask, next = i + 1 & mask;<NEW_LINE>while ((key = keyTable[next]) != 0) {<NEW_LINE>int placement = place(key);<NEW_LINE>if ((next - placement & mask) > (i - placement & mask)) {<NEW_LINE>keyTable[i] = key;<NEW_LINE>valueTable<MASK><NEW_LINE>i = next;<NEW_LINE>}<NEW_LINE>next = next + 1 & mask;<NEW_LINE>}<NEW_LINE>keyTable[i] = 0;<NEW_LINE>valueTable[i] = null;<NEW_LINE>size--;<NEW_LINE>return oldValue;<NEW_LINE>} | [i] = valueTable[next]; |
401,337 | public void merge(ProspectiveOperation op) {<NEW_LINE>if (this.opType == OperationType.FILTER) {<NEW_LINE>this.opType = op.opType;<NEW_LINE>IfTree ifTree = this.treeMaker.If(((IfTree) this.correspondingTree).getCondition(), (StatementTree) op.correspondingTree, null);<NEW_LINE>this.correspondingTree = ifTree;<NEW_LINE>} else {<NEW_LINE>this.opType = op.opType;<NEW_LINE>List<StatementTree> statements = new ArrayList<StatementTree>();<NEW_LINE>if (this.correspondingTree.getKind() == Tree.Kind.BLOCK) {<NEW_LINE>statements.addAll(((BlockTree) this.correspondingTree).getStatements());<NEW_LINE>} else {<NEW_LINE>statements.add(castToStatementTree(this.correspondingTree));<NEW_LINE>}<NEW_LINE>if (op.correspondingTree.getKind() == Tree.Kind.BLOCK) {<NEW_LINE>statements.addAll(((BlockTree) op<MASK><NEW_LINE>} else {<NEW_LINE>statements.add(castToStatementTree(op.correspondingTree));<NEW_LINE>}<NEW_LINE>HashSet<Name> futureAvailable = new HashSet<Name>();<NEW_LINE>HashSet<Name> futureNeeded = new HashSet<Name>();<NEW_LINE>futureAvailable.addAll(this.getAvailableVariables());<NEW_LINE>futureAvailable.addAll(op.getAvailableVariables());<NEW_LINE>futureNeeded.addAll(op.getNeededVariables());<NEW_LINE>futureNeeded.removeAll(this.getAvailableVariables());<NEW_LINE>futureNeeded.addAll(this.getNeededVariables());<NEW_LINE>this.neededVariables = futureNeeded;<NEW_LINE>this.availableVariables = futureAvailable;<NEW_LINE>this.correspondingTree = this.treeMaker.Block(statements, false);<NEW_LINE>}<NEW_LINE>} | .correspondingTree).getStatements()); |
683,678 | public void onError(java.lang.Exception e) {<NEW_LINE>byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;<NEW_LINE>org.apache.thrift.TSerializable msg;<NEW_LINE>Log_result result = new Log_result();<NEW_LINE>if (e instanceof org.apache.thrift.transport.TTransportException) {<NEW_LINE><MASK><NEW_LINE>fb.close();<NEW_LINE>return;<NEW_LINE>} else if (e instanceof org.apache.thrift.TApplicationException) {<NEW_LINE>_LOGGER.error("TApplicationException inside handler", e);<NEW_LINE>msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;<NEW_LINE>msg = (org.apache.thrift.TApplicationException) e;<NEW_LINE>} else {<NEW_LINE>_LOGGER.error("Exception inside handler", e);<NEW_LINE>msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;<NEW_LINE>msg = new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>fcall.sendResponse(fb, msg, msgType, seqid);<NEW_LINE>} catch (java.lang.Exception ex) {<NEW_LINE>_LOGGER.error("Exception writing to internal frame buffer", ex);<NEW_LINE>fb.close();<NEW_LINE>}<NEW_LINE>} | _LOGGER.error("TTransportException inside handler", e); |
1,459,371 | public ActionResult useOnEntity(ItemStack itemstack, PlayerEntity entityhuman, LivingEntity entityliving, Hand enumhand) {<NEW_LINE>if (!(entityliving instanceof SheepEntity))<NEW_LINE>return ActionResult.PASS;<NEW_LINE>SheepEntity entitysheep = (SheepEntity) entityliving;<NEW_LINE>if (entitysheep.isAlive() && !entitysheep.isSheared() && entitysheep.getColor() != this.color) {<NEW_LINE>if (!entityhuman.world.isClient) {<NEW_LINE>byte bColor = (byte) this.color.getId();<NEW_LINE>SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) ((IMixinEntity) entitysheep).getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor));<NEW_LINE>Bukkit.getServer().getPluginManager().callEvent(event);<NEW_LINE>if (event.isCancelled())<NEW_LINE>return ActionResult.PASS;<NEW_LINE>entitysheep.setColor(DyeColor.byId((byte) event.getColor().getWoolData()));<NEW_LINE>itemstack.decrement(1);<NEW_LINE>}<NEW_LINE>return ActionResult.<MASK><NEW_LINE>}<NEW_LINE>return ActionResult.PASS;<NEW_LINE>} | success(entityhuman.world.isClient); |
514,030 | public char[] shortReadableName(boolean showGenerics) {<NEW_LINE>StringBuilder nameBuffer = new StringBuilder(10);<NEW_LINE>if (isMemberType()) {<NEW_LINE>nameBuffer.append(CharOperation.concat(enclosingType().shortReadableName(showGenerics && !isStatic())<MASK><NEW_LINE>} else {<NEW_LINE>nameBuffer.append(this.type.sourceName);<NEW_LINE>}<NEW_LINE>if (showGenerics) {<NEW_LINE>if (this.arguments != null && this.arguments.length > 0) {<NEW_LINE>// empty arguments array happens when PTB has been created just to capture type annotations<NEW_LINE>nameBuffer.append('<');<NEW_LINE>for (int i = 0, length = this.arguments.length; i < length; i++) {<NEW_LINE>if (i > 0)<NEW_LINE>nameBuffer.append(',');<NEW_LINE>nameBuffer.append(this.arguments[i].shortReadableName());<NEW_LINE>}<NEW_LINE>nameBuffer.append('>');<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int nameLength = nameBuffer.length();<NEW_LINE>char[] shortReadableName = new char[nameLength];<NEW_LINE>nameBuffer.getChars(0, nameLength, shortReadableName, 0);<NEW_LINE>return shortReadableName;<NEW_LINE>} | , this.sourceName, '.')); |
1,733,518 | public void updateMusicFolder(MusicFolder musicFolder) {<NEW_LINE>Triple<List<MusicFolder>, List<MusicFolder>, List<MusicFolder>> overlaps = getMusicFolderPathOverlaps(musicFolder, getAllMusicFolders(true, true, true).stream().filter(f -> !f.getId().equals(musicFolder.getId())).collect(toList()));<NEW_LINE>MusicFolder existing = getAllMusicFolders(true, true).stream().filter(f -> f.getId().equals(musicFolder.getId())).<MASK><NEW_LINE>if (existing != null && !existing.getPath().equals(musicFolder.getPath()) && (!overlaps.getLeft().isEmpty() || !overlaps.getMiddle().isEmpty() || !overlaps.getRight().isEmpty())) {<NEW_LINE>throw new IllegalArgumentException("Music folder with path " + musicFolder.getPath() + " overlaps with existing music folder path(s) (" + logMusicFolderOverlap(overlaps) + ") and can therefore not be updated.");<NEW_LINE>}<NEW_LINE>musicFolderDao.updateMusicFolder(musicFolder);<NEW_LINE>clearMusicFolderCache();<NEW_LINE>} | findAny().orElse(null); |
45,791 | public void newRevision(BimServerClientInterface bimServerClientInterface, long poid, long roid, String userToken, long soid, SObjectType settings) throws ServerException, UserException {<NEW_LINE>try {<NEW_LINE>Long topicId = bimServerClientInterface.getRegistry().registerProgressOnRevisionTopic(SProgressTopicType.RUNNING_SERVICE, poid, roid, "Running " + name);<NEW_LINE>RunningService runningService = new RunningService(topicId, bimServerClientInterface, pluginConfiguration, bimServerClientInterface.getAuthInterface().getLoggedInUser().getUsername());<NEW_LINE>try {<NEW_LINE>SLongActionState state = new SLongActionState();<NEW_LINE>state.setProgress(getProgressType() == ProgressType.KNOWN ? 0 : -1);<NEW_LINE>state.setTitle(name);<NEW_LINE>state.setState(SActionState.STARTED);<NEW_LINE>state.setStart(runningService.getStartDate());<NEW_LINE>bimServerClientInterface.getRegistry().updateProgressTopic(topicId, state);<NEW_LINE>AbstractService.this.newRevision(runningService, bimServerClientInterface, poid, roid, userToken, soid, settings);<NEW_LINE>state = new SLongActionState();<NEW_LINE>state.setProgress(100);<NEW_LINE>state.setTitle(name);<NEW_LINE>state.setState(SActionState.FINISHED);<NEW_LINE>state.<MASK><NEW_LINE>state.setEnd(new Date());<NEW_LINE>bimServerClientInterface.getRegistry().updateProgressTopic(topicId, state);<NEW_LINE>} catch (BimServerClientException e) {<NEW_LINE>LOGGER.error("", e);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("", e);<NEW_LINE>} finally {<NEW_LINE>bimServerClientInterface.getRegistry().unregisterProgressTopic(topicId);<NEW_LINE>}<NEW_LINE>} catch (PublicInterfaceNotFoundException e) {<NEW_LINE>LOGGER.error("", e);<NEW_LINE>}<NEW_LINE>} | setStart(runningService.getStartDate()); |
1,426,196 | public ResultStream doGet(final SortOrder sortOrder, int pageSize, int page) throws FrameworkException {<NEW_LINE>final List<GraphObjectMap> resultList = new LinkedList<>();<NEW_LINE>final GraphObjectMap info = new GraphObjectMap();<NEW_LINE>info.setProperty(new GenericProperty("modules"), VersionHelper.getModules());<NEW_LINE>info.setProperty(new GenericProperty("components"), VersionHelper.getComponents());<NEW_LINE>info.setProperty(new StringProperty("classPath"), VersionHelper.getClassPath());<NEW_LINE>info.setProperty(new StringProperty("instanceName"), VersionHelper.getInstanceName());<NEW_LINE>info.setProperty(new StringProperty("instanceStage"), VersionHelper.getInstanceStage());<NEW_LINE>info.setProperty(new ArrayProperty("mainMenu", String.class), VersionHelper.getMenuEntries());<NEW_LINE>final LicenseManager licenseManager = Services.getInstance().getLicenseManager();<NEW_LINE>if (licenseManager != null) {<NEW_LINE>info.setProperty(new StringProperty("edition"), licenseManager.getEdition());<NEW_LINE>info.setProperty(new StringProperty("licensee"), licenseManager.getLicensee());<NEW_LINE>info.setProperty(new StringProperty("hostId"), licenseManager.getHardwareFingerprint());<NEW_LINE>info.setProperty(new DateProperty("startDate"), licenseManager.getStartDate());<NEW_LINE>info.setProperty(new DateProperty("endDate"), licenseManager.getEndDate());<NEW_LINE>} else {<NEW_LINE>info.setProperty(new StringProperty("edition"), "Community");<NEW_LINE>info.setProperty(new StringProperty("licensee"), "Unlicensed");<NEW_LINE>}<NEW_LINE>info.setProperty(new GenericProperty("databaseService"), Services.getInstance().getDatabaseService().<MASK><NEW_LINE>info.setProperty(new GenericProperty("resultCountSoftLimit"), Settings.ResultCountSoftLimit.getValue());<NEW_LINE>info.setProperty(new StringProperty("availableReleasesUrl"), Settings.ReleasesIndexUrl.getValue());<NEW_LINE>info.setProperty(new StringProperty("availableSnapshotsUrl"), Settings.SnapshotsIndexUrl.getValue());<NEW_LINE>info.setProperty(new StringProperty("maintenanceModeActive"), Settings.MaintenanceModeEnabled.getValue());<NEW_LINE>info.setProperty(new StringProperty("legacyRequestParameters"), Settings.RequestParameterLegacyMode.getValue());<NEW_LINE>resultList.add(info);<NEW_LINE>return new PagingIterable("/" + getUriPart(), resultList);<NEW_LINE>} | getClass().getSimpleName()); |
790,163 | public CompletableFuture<?> start() {<NEW_LINE>LOG.info("Starting JSON-RPC service on {}:{}", config.getHost(), config.getPort());<NEW_LINE>LOG.debug("max number of active connections {}", maxActiveConnections);<NEW_LINE>this.tracer = GlobalOpenTelemetry.getTracer("org.hyperledger.besu.jsonrpc", "1.0.0");<NEW_LINE>final CompletableFuture<?> resultFuture = new CompletableFuture<>();<NEW_LINE>try {<NEW_LINE>// Create the HTTP server and a router object.<NEW_LINE>httpServer = <MASK><NEW_LINE>httpServer.connectionHandler(connectionHandler());<NEW_LINE>httpServer.requestHandler(buildRouter()).listen(res -> {<NEW_LINE>if (!res.failed()) {<NEW_LINE>resultFuture.complete(null);<NEW_LINE>config.setPort(httpServer.actualPort());<NEW_LINE>LOG.info("JSON-RPC service started and listening on {}:{}{}", config.getHost(), config.getPort(), tlsLogMessage());<NEW_LINE>natService.ifNatEnvironment(NatMethod.UPNP, natManager -> ((UpnpNatManager) natManager).requestPortForward(config.getPort(), NetworkProtocol.TCP, NatServiceType.JSON_RPC));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>httpServer = null;<NEW_LINE>resultFuture.completeExceptionally(getFailureException(res.cause()));<NEW_LINE>});<NEW_LINE>} catch (final JsonRpcServiceException tlsException) {<NEW_LINE>httpServer = null;<NEW_LINE>resultFuture.completeExceptionally(tlsException);<NEW_LINE>} catch (final VertxException listenException) {<NEW_LINE>httpServer = null;<NEW_LINE>resultFuture.completeExceptionally(new JsonRpcServiceException(String.format("Ethereum JSON-RPC listener failed to start: %s", ExceptionUtils.rootCause(listenException).getMessage())));<NEW_LINE>}<NEW_LINE>return resultFuture;<NEW_LINE>} | vertx.createHttpServer(getHttpServerOptions()); |
304,859 | private void executeButtonActionPerformed(ActionEvent evt) {<NEW_LINE>// run the query, and show the results.<NEW_LINE>try {<NEW_LINE>if (connection == null) {<NEW_LINE>JOptionPane.showMessageDialog(this, getResourceConverter().getString("queryPanel.noConnection.alert", "No Mondrian connection. Select a Schema to connect."), getResourceConverter().getString("common.alertDialog.title", "Alert"), JOptionPane.WARNING_MESSAGE);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// common.alertDialog.title<NEW_LINE>Query q = connection.parseQuery(queryTextPane.getText());<NEW_LINE>Result r = connection.execute(q);<NEW_LINE>// document = DomBuilder.build(getResult());<NEW_LINE>java.io.StringWriter sw = new java.io.StringWriter();<NEW_LINE>java.io.PrintWriter pw = new java.io.PrintWriter(sw);<NEW_LINE>r.print(pw);<NEW_LINE>resultTextPane.setText(sw.<MASK><NEW_LINE>} catch (Exception ex) {<NEW_LINE>ByteArrayOutputStream os = new ByteArrayOutputStream();<NEW_LINE>PrintStream p = new PrintStream(os);<NEW_LINE>Throwable e = ex;<NEW_LINE>while (e != null) {<NEW_LINE>p.println(e.getLocalizedMessage());<NEW_LINE>LOGGER.error("", e);<NEW_LINE>Throwable prev = e;<NEW_LINE>e = e.getCause();<NEW_LINE>if (e == prev) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>p.println();<NEW_LINE>}<NEW_LINE>resultTextPane.setText(os.toString());<NEW_LINE>}<NEW_LINE>} | getBuffer().toString()); |
65,650 | final AttachPolicyResult executeAttachPolicy(AttachPolicyRequest attachPolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(attachPolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<AttachPolicyRequest> request = null;<NEW_LINE>Response<AttachPolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AttachPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(attachPolicyRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AttachPolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<AttachPolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new AttachPolicyResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,789,633 | public static EPCompiled read(File file) throws IOException {<NEW_LINE>JarFile jarFile = new JarFile(file);<NEW_LINE>Attributes attributes = jarFile.getManifest().getMainAttributes();<NEW_LINE>String compilerVersion = getAttribute(attributes, MANIFEST_COMPILER_VERSION);<NEW_LINE>if (compilerVersion == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>String moduleProvider = getAttribute(attributes, MANIFEST_MODULEPROVIDERCLASSNAME);<NEW_LINE>String queryProvider = getAttribute(attributes, MANIFEST_QUERYPROVIDERCLASSNAME);<NEW_LINE>if (moduleProvider == null && queryProvider == null) {<NEW_LINE>throw new IOException("Manifest is missing both " + MANIFEST_MODULEPROVIDERCLASSNAME + " and " + MANIFEST_QUERYPROVIDERCLASSNAME);<NEW_LINE>}<NEW_LINE>String targetHAStr = getAttribute(attributes, MANIFEST_TARGETHA);<NEW_LINE>boolean targetHA = targetHAStr != null && Boolean.parseBoolean(targetHAStr);<NEW_LINE>Map<String, byte[]> classes = new HashMap<>();<NEW_LINE>try {<NEW_LINE>Enumeration<JarEntry> entries = jarFile.entries();<NEW_LINE>while (entries.hasMoreElements()) {<NEW_LINE>read(jarFile, entries.nextElement(), classes);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>jarFile.close();<NEW_LINE>}<NEW_LINE>return new EPCompiled(classes, new EPCompiledManifest(compilerVersion, moduleProvider, queryProvider, targetHA));<NEW_LINE>} | throw new IOException("Manifest is missing " + MANIFEST_COMPILER_VERSION); |
872,610 | public static void toJSON(OutputWriter jsonWriter, Stage stage) {<NEW_LINE>jsonWriter.add("name", stage.getName());<NEW_LINE>jsonWriter.add("counter", stage.getCounter());<NEW_LINE>jsonWriter.add("approval_type", stage.getApprovalType());<NEW_LINE>jsonWriter.add("approved_by", stage.getApprovedBy());<NEW_LINE>jsonWriter.add("scheduled_at", stage.<MASK><NEW_LINE>jsonWriter.add("last_transitioned_time", stage.getLastTransitionedTime().getTime());<NEW_LINE>if (stage.getResult() != null) {<NEW_LINE>jsonWriter.add("result", stage.getResult().toString());<NEW_LINE>if (stage.getResult() == StageResult.Cancelled) {<NEW_LINE>jsonWriter.add("cancelled_by", stage.getCancelledBy() == null ? "GoCD" : stage.getCancelledBy());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (stage.getRerunOfCounter() == null) {<NEW_LINE>jsonWriter.add("rerun_of_counter", (String) null);<NEW_LINE>} else {<NEW_LINE>jsonWriter.add("rerun_of_counter", stage.getRerunOfCounter());<NEW_LINE>}<NEW_LINE>jsonWriter.add("fetch_materials", stage.shouldFetchMaterials());<NEW_LINE>jsonWriter.add("clean_working_directory", stage.shouldCleanWorkingDir());<NEW_LINE>jsonWriter.add("artifacts_deleted", stage.isArtifactsDeleted());<NEW_LINE>if (stage.getIdentifier() != null) {<NEW_LINE>jsonWriter.add("pipeline_name", stage.getIdentifier().getPipelineName());<NEW_LINE>jsonWriter.add("pipeline_counter", stage.getIdentifier().getPipelineCounter());<NEW_LINE>}<NEW_LINE>jsonWriter.addChildList("jobs", jobsWriter -> stage.getJobInstances().forEach(jobInstance -> jobsWriter.addChild(jobInstanceWriter -> JobInstanceRepresenter.toJSON(jobInstanceWriter, jobInstance))));<NEW_LINE>} | getCreatedTime().getTime()); |
1,143,637 | public void handle(ActionEvent event) {<NEW_LINE>Alert alert = new Alert(Alert.AlertType.INFORMATION);<NEW_LINE>Text text1 = new Text("Channel maps are used by trunking systems to define the transmit frequency " + "used for each channel number. A channel map is required so that the frequency for each call " + "channel can be calculated correctly");<NEW_LINE>text1.setWrappingWidth(300);<NEW_LINE>Text text2 = new Text("A channel map contains one or more channel ranges. Each range has a first " + "and last channel number and the channel numbers for each range do NOT overlap. Each range " + "also has a base frequency and a step or channel size");<NEW_LINE>text2.setWrappingWidth(300);<NEW_LINE>Text text3 = new Text("The frequency for each channel number is calculated as: base frequency + " + "(last - first * stepSize)");<NEW_LINE>text3.setWrappingWidth(300);<NEW_LINE>VBox vbox = new VBox();<NEW_LINE>vbox.setPadding(new Insets(10, 10, 10, 10));<NEW_LINE>vbox.setSpacing(10);<NEW_LINE>vbox.getChildren().addAll(text1, text2, text3);<NEW_LINE>alert.getDialogPane().setContent(vbox);<NEW_LINE>alert.setTitle("Channel Map Help");<NEW_LINE>alert.setHeaderText("Channel Map Help");<NEW_LINE>alert.initOwner(((Node) getHelpButton()).getScene().getWindow());<NEW_LINE>// Workaround for JavaFX KDE on Linux bug in FX 10/11: https://bugs.openjdk.java.net/browse/JDK-8179073<NEW_LINE>alert.setResizable(true);<NEW_LINE>alert.onShownProperty().addListener(e -> {<NEW_LINE>Platform.runLater(() <MASK><NEW_LINE>});<NEW_LINE>alert.showAndWait();<NEW_LINE>} | -> alert.setResizable(false)); |
1,166,810 | final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TagResourceRequest> request = null;<NEW_LINE>Response<TagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));<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, "CodeGuru Reviewer");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
979,932 | public static DescribeMonitorGroupInstanceAttributeResponse unmarshall(DescribeMonitorGroupInstanceAttributeResponse describeMonitorGroupInstanceAttributeResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeMonitorGroupInstanceAttributeResponse.setRequestId(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.RequestId"));<NEW_LINE>describeMonitorGroupInstanceAttributeResponse.setSuccess(_ctx.booleanValue("DescribeMonitorGroupInstanceAttributeResponse.Success"));<NEW_LINE>describeMonitorGroupInstanceAttributeResponse.setCode(_ctx.integerValue("DescribeMonitorGroupInstanceAttributeResponse.Code"));<NEW_LINE>describeMonitorGroupInstanceAttributeResponse.setMessage(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Message"));<NEW_LINE>describeMonitorGroupInstanceAttributeResponse.setPageNumber(_ctx.integerValue("DescribeMonitorGroupInstanceAttributeResponse.PageNumber"));<NEW_LINE>describeMonitorGroupInstanceAttributeResponse.setPageSize(_ctx.integerValue("DescribeMonitorGroupInstanceAttributeResponse.PageSize"));<NEW_LINE>describeMonitorGroupInstanceAttributeResponse.setTotal(_ctx.integerValue("DescribeMonitorGroupInstanceAttributeResponse.Total"));<NEW_LINE>List<Resource> resources = new ArrayList<Resource>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeMonitorGroupInstanceAttributeResponse.Resources.Length"); i++) {<NEW_LINE>Resource resource = new Resource();<NEW_LINE>resource.setInstanceName(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].InstanceName"));<NEW_LINE>resource.setDimension(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].Dimension"));<NEW_LINE>resource.setCategory(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].Category"));<NEW_LINE>resource.setInstanceId(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].InstanceId"));<NEW_LINE>resource.setNetworkType(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].NetworkType"));<NEW_LINE>resource.setDesc(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].Desc"));<NEW_LINE>Region region = new Region();<NEW_LINE>region.setAvailabilityZone(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].Region.AvailabilityZone"));<NEW_LINE>region.setRegionId(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].Region.RegionId"));<NEW_LINE>resource.setRegion(region);<NEW_LINE>Vpc vpc = new Vpc();<NEW_LINE>vpc.setVswitchInstanceId(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].Vpc.VswitchInstanceId"));<NEW_LINE>vpc.setVpcInstanceId(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].Vpc.VpcInstanceId"));<NEW_LINE>resource.setVpc(vpc);<NEW_LINE>List<Tag> tags = new ArrayList<Tag>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].Tags.Length"); j++) {<NEW_LINE>Tag tag = new Tag();<NEW_LINE>tag.setKey(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i <MASK><NEW_LINE>tag.setValue(_ctx.stringValue("DescribeMonitorGroupInstanceAttributeResponse.Resources[" + i + "].Tags[" + j + "].Value"));<NEW_LINE>tags.add(tag);<NEW_LINE>}<NEW_LINE>resource.setTags(tags);<NEW_LINE>resources.add(resource);<NEW_LINE>}<NEW_LINE>describeMonitorGroupInstanceAttributeResponse.setResources(resources);<NEW_LINE>return describeMonitorGroupInstanceAttributeResponse;<NEW_LINE>} | + "].Tags[" + j + "].Key")); |
1,791,748 | private void detectStaticFactory(ClassDescriptor desc, List<Method> allMethods) {<NEW_LINE>for (Method method : allMethods) {<NEW_LINE>if (!Modifier.isStatic(method.getModifiers())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>JsonCreator jsonCreator = getJsonCreator(method.getAnnotations());<NEW_LINE>if (jsonCreator == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>desc.ctor.staticMethodName = method.getName();<NEW_LINE>desc.ctor.staticFactory = method;<NEW_LINE>desc.ctor.ctor = null;<NEW_LINE>Annotation[][] annotations = method.getParameterAnnotations();<NEW_LINE>String[] paramNames = getParamNames(method, annotations.length);<NEW_LINE>for (int i = 0; i < annotations.length; i++) {<NEW_LINE>Annotation[] paramAnnotations = annotations[i];<NEW_LINE>JsonProperty jsonProperty = getJsonProperty(paramAnnotations);<NEW_LINE>Binding binding = new Binding(desc.classInfo, desc.lookup, method.getGenericParameterTypes()[i]);<NEW_LINE>if (jsonProperty != null) {<NEW_LINE>updateBindingWithJsonProperty(binding, jsonProperty);<NEW_LINE>}<NEW_LINE>if (binding.name == null || binding.name.length() == 0) {<NEW_LINE>binding.name = paramNames[i];<NEW_LINE>}<NEW_LINE>binding.fromNames = new <MASK><NEW_LINE>binding.toNames = new String[] { binding.name };<NEW_LINE>binding.annotations = paramAnnotations;<NEW_LINE>desc.ctor.parameters.add(binding);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String[] { binding.name }; |
818,566 | public static void main(String[] args) throws InterruptedException {<NEW_LINE>// Create Siddhi Manager<NEW_LINE>SiddhiManager siddhiManager = new SiddhiManager();<NEW_LINE>// Siddhi Application<NEW_LINE>String siddhiApp = "" + "define stream StockEventStream (symbol string, price float, volume long); " + " " + "@info(name = 'query1') " + "from StockEventStream#window.time(5 sec) " + "select symbol, sum(price) as price, sum(volume) as volume " + "group by symbol " + "insert into AggregateStockStream ;";<NEW_LINE>// Generate runtime<NEW_LINE>SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp);<NEW_LINE>// Add callback to retrieve output events from stream<NEW_LINE>siddhiAppRuntime.addCallback("AggregateStockStream", new StreamCallback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void receive(Event[] events) {<NEW_LINE>EventPrinter.print(events);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// Retrieve input handler to push events into Siddhi<NEW_LINE>InputHandler inputHandler = siddhiAppRuntime.getInputHandler("StockEventStream");<NEW_LINE>// Start event processing<NEW_LINE>siddhiAppRuntime.start();<NEW_LINE>// Send events to Siddhi<NEW_LINE>inputHandler.send(new Object[] { "IBM", 100f, 100L });<NEW_LINE>Thread.sleep(1000);<NEW_LINE>inputHandler.send(new Object[] { "IBM", 200f, 300L });<NEW_LINE>inputHandler.send(new Object[] { "WSO2", 60f, 200L });<NEW_LINE>Thread.sleep(1000);<NEW_LINE>inputHandler.send(new Object[] { "WSO2", 70f, 400L });<NEW_LINE>inputHandler.send(new Object[] { "GOOG", 50f, 30L });<NEW_LINE>Thread.sleep(1000);<NEW_LINE>inputHandler.send(new Object[] <MASK><NEW_LINE>Thread.sleep(2000);<NEW_LINE>inputHandler.send(new Object[] { "WSO2", 70f, 50L });<NEW_LINE>Thread.sleep(2000);<NEW_LINE>inputHandler.send(new Object[] { "WSO2", 80f, 400L });<NEW_LINE>inputHandler.send(new Object[] { "GOOG", 60f, 30L });<NEW_LINE>Thread.sleep(1000);<NEW_LINE>// Shutdown the runtime<NEW_LINE>siddhiAppRuntime.shutdown();<NEW_LINE>// Shutdown Siddhi Manager<NEW_LINE>siddhiManager.shutdown();<NEW_LINE>} | { "IBM", 200f, 400L }); |
949,511 | private void printModuleInstantiation(HDLNodeBuildIn node, int num, File root) throws IOException, HDLException {<NEW_LINE>String entityName = node.getHdlEntityName();<NEW_LINE>final String label = node.getElementAttributes().getLabel();<NEW_LINE>if (label != null && label.length() > 0)<NEW_LINE>out.print("// ").println(label.replace('\n', ' '));<NEW_LINE>out.print(entityName).print(" ");<NEW_LINE>if (!(node instanceof HDLNodeCustom)) {<NEW_LINE>library.getVerilogElement(node).writeGenericMap(out, node, root);<NEW_LINE>}<NEW_LINE>// entityName can have an space at the end if the identifier is escaped<NEW_LINE>String instanceName = entityName.trim() + "_i" + num;<NEW_LINE>out.print(instanceName + " ").println("(");<NEW_LINE>out.inc();<NEW_LINE>Separator sep <MASK><NEW_LINE>for (HDLNodeBuildIn.InputAssignment i : node) {<NEW_LINE>sep.check();<NEW_LINE>out.print(".").print(i.getTargetName()).print("( ");<NEW_LINE>printExpression(i.getExpression());<NEW_LINE>out.print(" )");<NEW_LINE>}<NEW_LINE>for (HDLPort o : node.getOutputs()) if (o.getNet() != null) {<NEW_LINE>sep.check();<NEW_LINE>out.print(".").print(o.getName()).print("( ").print(o.getNet().getName()).print(" )");<NEW_LINE>}<NEW_LINE>for (HDLPort o : node.getInOutputs()) if (o.getNet() != null) {<NEW_LINE>sep.check();<NEW_LINE>out.print(".").print(o.getName()).print("( ").print(o.getNet().getName()).print(" )");<NEW_LINE>}<NEW_LINE>out.dec();<NEW_LINE>out.println().println(");");<NEW_LINE>} | = new Separator(out, ",\n"); |
961,470 | /* (non-Javadoc)<NEW_LINE>* @see TableRowCore#refresh(boolean, boolean)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public List<TableCellCore> refresh(boolean bDoGraphics, boolean bVisible) {<NEW_LINE>// If this were called from a plugin, we'd have to refresh the sorted column<NEW_LINE>// even if we weren't visible<NEW_LINE>List<TableCellCore> list = Collections.EMPTY_LIST;<NEW_LINE>if (bDisposed) {<NEW_LINE>return list;<NEW_LINE>}<NEW_LINE>if (!bVisible) {<NEW_LINE>if (!bSetNotUpToDateLastRefresh) {<NEW_LINE>setUpToDate(false);<NEW_LINE>bSetNotUpToDateLastRefresh = true;<NEW_LINE>}<NEW_LINE>return list;<NEW_LINE>}<NEW_LINE>bSetNotUpToDateLastRefresh = false;<NEW_LINE>// System.out.println(SystemTime.getCurrentTime() + "refresh " + getIndex() + ";vis=" + bVisible + " via " + Debug.getCompressedStackTrace(8));<NEW_LINE>tv.invokeRefreshListeners(this);<NEW_LINE>// Make a copy of cells so we don't lock while refreshing<NEW_LINE>Collection<TableCellCore> lTableCells = null;<NEW_LINE>synchronized (lock) {<NEW_LINE>if (mTableCells != null) {<NEW_LINE>lTableCells = new ArrayList<>(mTableCells.values());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (lTableCells != null) {<NEW_LINE>for (TableCellCore cell : lTableCells) {<NEW_LINE>if (cell == null || cell.isDisposed()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>TableColumn column = cell.getTableColumn();<NEW_LINE>// System.out.println(column);<NEW_LINE>if (!tv.hasSortColumn(column) && !tv.isColumnVisible(column)) {<NEW_LINE>// System.out.println("skip " + column);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>boolean cellVisible = bVisible && cell.isShown();<NEW_LINE>boolean changed = cell.<MASK><NEW_LINE>if (changed) {<NEW_LINE>if (list == Collections.EMPTY_LIST) {<NEW_LINE>list = new ArrayList<>(lTableCells.size());<NEW_LINE>}<NEW_LINE>list.add(cell);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// System.out.println();<NEW_LINE>return list;<NEW_LINE>} | refresh(bDoGraphics, bVisible, cellVisible); |
1,134,856 | private List<GHResponse> enrichDirectRoutesTime(List<GHResponse> routes) {<NEW_LINE>List<GHResponse> graphhopperRoutes = new ArrayList<>();<NEW_LINE>List<GHResponse> directRoutes = new ArrayList<>();<NEW_LINE>long graphHopperTravelTime = 0;<NEW_LINE>double graphHopperTravelDistance = 0;<NEW_LINE>double averageTravelTimePerMeter;<NEW_LINE>for (GHResponse ghResponse : routes) {<NEW_LINE>if (!ghResponse.getHints().has("skipped_segment")) {<NEW_LINE>graphHopperTravelDistance += ghResponse.getBest().getDistance();<NEW_LINE>graphHopperTravelTime += ghResponse<MASK><NEW_LINE>graphhopperRoutes.add(ghResponse);<NEW_LINE>} else {<NEW_LINE>directRoutes.add(ghResponse);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (graphhopperRoutes.isEmpty() || directRoutes.isEmpty()) {<NEW_LINE>return routes;<NEW_LINE>}<NEW_LINE>if (graphHopperTravelDistance == 0) {<NEW_LINE>return routes;<NEW_LINE>}<NEW_LINE>averageTravelTimePerMeter = graphHopperTravelTime / graphHopperTravelDistance;<NEW_LINE>for (GHResponse ghResponse : routes) {<NEW_LINE>if (ghResponse.getHints().has("skipped_segment")) {<NEW_LINE>double directRouteDistance = ghResponse.getBest().getDistance();<NEW_LINE>ghResponse.getBest().setTime(Math.round(directRouteDistance * averageTravelTimePerMeter));<NEW_LINE>double directRouteInstructionDistance = ghResponse.getBest().getInstructions().get(0).getDistance();<NEW_LINE>ghResponse.getBest().getInstructions().get(0).setTime(Math.round(directRouteInstructionDistance * averageTravelTimePerMeter));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return routes;<NEW_LINE>} | .getBest().getTime(); |
914,122 | final PutPermissionResult executePutPermission(PutPermissionRequest putPermissionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putPermissionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutPermissionRequest> request = null;<NEW_LINE>Response<PutPermissionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutPermissionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putPermissionRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EventBridge");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutPermission");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutPermissionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutPermissionResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,014,360 | public Object execute(CommandLine commandLine) throws Exception {<NEW_LINE>String file = commandLine.getValue(Options.FILE_OPTION);<NEW_LINE>String projectName = commandLine.getValue(Options.PROJECT_OPTION);<NEW_LINE>// only refresh the file.<NEW_LINE>if (!commandLine.hasOption(Options.VALIDATE_OPTION)) {<NEW_LINE>// getting the file will refresh it.<NEW_LINE>ProjectUtils.getFile(projectName, file);<NEW_LINE>// validate the src file.<NEW_LINE>} else {<NEW_LINE>// JavaScriptUtils refreshes the file when getting it.<NEW_LINE>IJavaScriptUnit src = JavaScriptUtils.getJavaScriptUnit(projectName, file);<NEW_LINE>IJavaScriptUnit workingCopy = src.getWorkingCopy(null);<NEW_LINE>ProblemRequestor requestor = new ProblemRequestor();<NEW_LINE>try {<NEW_LINE>workingCopy.discardWorkingCopy();<NEW_LINE>// deprecated, so do what the non-deprecated version does, just using<NEW_LINE>// our ProblemRequestor instead of the working copy owner.<NEW_LINE>// workingCopy.becomeWorkingCopy(requestor, null);<NEW_LINE>BecomeWorkingCopyOperation operation = new BecomeWorkingCopyOperation((org.eclipse.wst.jsdt.internal.core.CompilationUnit) workingCopy, requestor);<NEW_LINE>operation.runOperation(null);<NEW_LINE>} finally {<NEW_LINE>workingCopy.discardWorkingCopy();<NEW_LINE>}<NEW_LINE>List<IProblem> problems = requestor.getProblems();<NEW_LINE>ArrayList<Error> errors = new ArrayList<Error>();<NEW_LINE>String filename = src.getResource().getLocation().toOSString();<NEW_LINE>FileOffsets offsets = FileOffsets.compile(filename);<NEW_LINE>for (IProblem problem : problems) {<NEW_LINE>int[] lineColumn = offsets.offsetToLineColumn(problem.getSourceStart());<NEW_LINE>// one day vim might support ability to mark the offending text.<NEW_LINE>errors.add(new Error(problem.getMessage(), filename, lineColumn[0], lineColumn[1]<MASK><NEW_LINE>}<NEW_LINE>return errors;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | , problem.isWarning())); |
759,786 | public static void init(BiConsumer<Block, RenderType> consumer) {<NEW_LINE>consumer.accept(ModBlocks.defaultAltar, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.forestAltar, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.<MASK><NEW_LINE>consumer.accept(ModBlocks.mountainAltar, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.fungalAltar, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.swampAltar, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.desertAltar, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.taigaAltar, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.mesaAltar, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.mossyAltar, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.ghostRail, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.solidVines, RenderType.cutout());<NEW_LINE>consumer.accept(ModBlocks.corporeaCrystalCube, RenderType.translucent());<NEW_LINE>consumer.accept(ModBlocks.manaGlass, RenderType.translucent());<NEW_LINE>consumer.accept(ModFluffBlocks.managlassPane, RenderType.translucent());<NEW_LINE>consumer.accept(ModBlocks.elfGlass, RenderType.translucent());<NEW_LINE>consumer.accept(ModFluffBlocks.alfglassPane, RenderType.translucent());<NEW_LINE>consumer.accept(ModBlocks.bifrost, RenderType.translucent());<NEW_LINE>consumer.accept(ModFluffBlocks.bifrostPane, RenderType.translucent());<NEW_LINE>consumer.accept(ModBlocks.bifrostPerm, RenderType.translucent());<NEW_LINE>consumer.accept(ModBlocks.prism, RenderType.translucent());<NEW_LINE>consumer.accept(ModBlocks.starfield, RenderType.cutoutMipped());<NEW_LINE>consumer.accept(ModBlocks.abstrusePlatform, RenderType.translucent());<NEW_LINE>consumer.accept(ModBlocks.infrangiblePlatform, RenderType.translucent());<NEW_LINE>consumer.accept(ModBlocks.spectralPlatform, RenderType.translucent());<NEW_LINE>Registry.BLOCK.stream().filter(b -> Registry.BLOCK.getKey(b).getNamespace().equals(LibMisc.MOD_ID)).forEach(b -> {<NEW_LINE>if (b instanceof BlockFloatingFlower || b instanceof FlowerBlock || b instanceof TallFlowerBlock || b instanceof BlockModMushroom) {<NEW_LINE>consumer.accept(b, RenderType.cutout());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | plainsAltar, RenderType.cutout()); |
677,300 | public boolean moveToDefaultDirectory() throws IOException {<NEW_LINE>Optional<Path> targetDirectory = databaseContext.getFirstExistingFileDir(filePreferences);<NEW_LINE>if (targetDirectory.isEmpty()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Optional<Path> oldFile = <MASK><NEW_LINE>if (oldFile.isEmpty()) {<NEW_LINE>// Could not find file<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>String targetDirectoryName = "";<NEW_LINE>if (!filePreferences.getFileDirectoryPattern().isEmpty()) {<NEW_LINE>targetDirectoryName = FileUtil.createDirNameFromPattern(databaseContext.getDatabase(), entry, filePreferences.getFileDirectoryPattern());<NEW_LINE>}<NEW_LINE>Path targetPath = targetDirectory.get().resolve(targetDirectoryName).resolve(oldFile.get().getFileName());<NEW_LINE>if (Files.exists(targetPath)) {<NEW_LINE>// We do not overwrite already existing files<NEW_LINE>LOGGER.debug("The file {} would have been moved to {}. However, there exists already a file with that name so we do nothing.", oldFile.get(), targetPath);<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>// Make sure sub-directories exist<NEW_LINE>Files.createDirectories(targetPath.getParent());<NEW_LINE>}<NEW_LINE>// Move<NEW_LINE>Files.move(oldFile.get(), targetPath);<NEW_LINE>// Update path<NEW_LINE>fileEntry.setLink(relativize(targetPath));<NEW_LINE>return true;<NEW_LINE>} | fileEntry.findIn(databaseContext, filePreferences); |
884,686 | final public int removeAll(final byte[] key) {<NEW_LINE>if (!isOverflowDirectory())<NEW_LINE>throw new UnsupportedOperationException("Only valid if page is an overflow directory");<NEW_LINE>if (isReadOnly()) {<NEW_LINE>DirectoryPage copy = (<MASK><NEW_LINE>return copy.removeAll(key);<NEW_LINE>}<NEW_LINE>// call removeAll on each child, then htree.remove on existing child store<NEW_LINE>int ret = 0;<NEW_LINE>for (int i = 0; i < childRefs.length; i++) {<NEW_LINE>AbstractPage tmp = deref(i);<NEW_LINE>if (tmp == null && data.getChildAddr(i) != IRawStore.NULL) {<NEW_LINE>tmp = getChild(i);<NEW_LINE>}<NEW_LINE>if (tmp == null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>ret += tmp.removeAll(key);<NEW_LINE>}<NEW_LINE>// Now remove all childAddrs IFF there is a persistent identity<NEW_LINE>for (int i = 0; i < childRefs.length; i++) {<NEW_LINE>final long addr = data.getChildAddr(i);<NEW_LINE>if (addr != IRawStore.NULL)<NEW_LINE>htree.deleteNodeOrLeaf(addr);<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>} | DirectoryPage) copyOnWrite(getIdentity()); |
863,668 | private Object sortList(Object valueList, TSDataType dataType, Integer[] index) {<NEW_LINE>switch(dataType) {<NEW_LINE>case BOOLEAN:<NEW_LINE>boolean[] boolValues = (boolean[]) valueList;<NEW_LINE>boolean[] sortedValues = new boolean[boolValues.length];<NEW_LINE>for (int i = 0; i < index.length; i++) {<NEW_LINE>sortedValues[i] = boolValues[index[i]];<NEW_LINE>}<NEW_LINE>return sortedValues;<NEW_LINE>case INT32:<NEW_LINE>int[] intValues = (int[]) valueList;<NEW_LINE>int[] sortedIntValues = new int[intValues.length];<NEW_LINE>for (int i = 0; i < index.length; i++) {<NEW_LINE>sortedIntValues[i] = intValues[index[i]];<NEW_LINE>}<NEW_LINE>return sortedIntValues;<NEW_LINE>case INT64:<NEW_LINE>long[] longValues = (long[]) valueList;<NEW_LINE>long[] sortedLongValues = new long[longValues.length];<NEW_LINE>for (int i = 0; i < index.length; i++) {<NEW_LINE>sortedLongValues[i] = longValues[index[i]];<NEW_LINE>}<NEW_LINE>return sortedLongValues;<NEW_LINE>case FLOAT:<NEW_LINE>float[] floatValues = (float[]) valueList;<NEW_LINE>float[] sortedFloatValues = new float[floatValues.length];<NEW_LINE>for (int i = 0; i < index.length; i++) {<NEW_LINE>sortedFloatValues[i] = floatValues[index[i]];<NEW_LINE>}<NEW_LINE>return sortedFloatValues;<NEW_LINE>case DOUBLE:<NEW_LINE>double[] doubleValues = (double[]) valueList;<NEW_LINE>double[] sortedDoubleValues = new double[doubleValues.length];<NEW_LINE>for (int i = 0; i < index.length; i++) {<NEW_LINE>sortedDoubleValues[i] = doubleValues[index[i]];<NEW_LINE>}<NEW_LINE>return sortedDoubleValues;<NEW_LINE>case TEXT:<NEW_LINE>Binary[] binaryValues = (Binary[]) valueList;<NEW_LINE>Binary[] sortedBinaryValues = new Binary[binaryValues.length];<NEW_LINE>for (int i = 0; i < index.length; i++) {<NEW_LINE>sortedBinaryValues[i] = binaryValues[index[i]];<NEW_LINE>}<NEW_LINE>return sortedBinaryValues;<NEW_LINE>default:<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new UnSupportedDataTypeException(MSG_UNSUPPORTED_DATA_TYPE + dataType); |
294,226 | public void draw(Graphics g, int trackPosition) {<NEW_LINE>// only draw spinners shortly before start time<NEW_LINE>int timeDiff = hitObject.getTime() - trackPosition;<NEW_LINE>final <MASK><NEW_LINE>if (timeDiff - fadeInTime > 0)<NEW_LINE>return;<NEW_LINE>boolean spinnerComplete = (rotations >= rotationsNeeded);<NEW_LINE>float alpha = Utils.clamp(1 - (float) timeDiff / fadeInTime, 0f, 1f);<NEW_LINE>// darken screen<NEW_LINE>if (Options.getSkin().isSpinnerFadePlayfield()) {<NEW_LINE>float oldAlpha = Colors.BLACK_ALPHA.a;<NEW_LINE>if (timeDiff > 0)<NEW_LINE>Colors.BLACK_ALPHA.a *= alpha;<NEW_LINE>g.setColor(Colors.BLACK_ALPHA);<NEW_LINE>g.fillRect(0, 0, width, height);<NEW_LINE>Colors.BLACK_ALPHA.a = oldAlpha;<NEW_LINE>}<NEW_LINE>// rpm<NEW_LINE>Image rpmImg = GameImage.SPINNER_RPM.getImage();<NEW_LINE>rpmImg.setAlpha(alpha);<NEW_LINE>rpmImg.drawCentered(width / 2f, height - rpmImg.getHeight() / 2f);<NEW_LINE>if (timeDiff < 0)<NEW_LINE>data.drawSymbolString(Integer.toString(drawnRPM), (width + rpmImg.getWidth() * 0.95f) / 2f, height - data.getScoreSymbolImage('0').getHeight() * 1.025f, 1f, 1f, true);<NEW_LINE>// spinner meter (subimage)<NEW_LINE>Image spinnerMetre = GameImage.SPINNER_METRE.getImage();<NEW_LINE>int spinnerMetreY = (spinnerComplete) ? 0 : (int) (spinnerMetre.getHeight() * (1 - (rotations / rotationsNeeded)));<NEW_LINE>Image spinnerMetreSub = spinnerMetre.getSubImage(0, spinnerMetreY, spinnerMetre.getWidth(), spinnerMetre.getHeight() - spinnerMetreY);<NEW_LINE>spinnerMetreSub.setAlpha(alpha);<NEW_LINE>spinnerMetreSub.draw(0, height - spinnerMetreSub.getHeight());<NEW_LINE>// main spinner elements<NEW_LINE>GameImage.SPINNER_CIRCLE.getImage().setAlpha(alpha);<NEW_LINE>GameImage.SPINNER_CIRCLE.getImage().setRotation(drawRotation * 360f);<NEW_LINE>GameImage.SPINNER_CIRCLE.getImage().drawCentered(width / 2, height / 2);<NEW_LINE>if (!GameMod.HIDDEN.isActive()) {<NEW_LINE>float approachScale = 1 - Utils.clamp(((float) timeDiff / (hitObject.getTime() - hitObject.getEndTime())), 0f, 1f);<NEW_LINE>Image approachCircleScaled = GameImage.SPINNER_APPROACHCIRCLE.getImage().getScaledCopy(approachScale);<NEW_LINE>approachCircleScaled.setAlpha(alpha);<NEW_LINE>approachCircleScaled.drawCentered(width / 2, height / 2);<NEW_LINE>}<NEW_LINE>GameImage.SPINNER_SPIN.getImage().setAlpha(alpha);<NEW_LINE>GameImage.SPINNER_SPIN.getImage().drawCentered(width / 2, height * 3 / 4);<NEW_LINE>if (spinnerComplete) {<NEW_LINE>GameImage.SPINNER_CLEAR.getImage().drawCentered(width / 2, height / 4);<NEW_LINE>int extraRotations = (int) (rotations - rotationsNeeded);<NEW_LINE>if (extraRotations > 0)<NEW_LINE>data.drawSymbolNumber(extraRotations * 1000, width / 2, height * 2 / 3, 1f, 1f);<NEW_LINE>}<NEW_LINE>} | int fadeInTime = game.getFadeInTime(); |
1,368,663 | // @GuardedBy("AWT")<NEW_LINE>private void ensureNodesFilled() {<NEW_LINE>if (currentSubsequentNodes.size() < DESIRED_PREPARED_NODES_COUNT) {<NEW_LINE>final long currentRequest = stateId;<NEW_LINE>final Node from;<NEW_LINE>if (currentSubsequentNodes.isEmpty()) {<NEW_LINE>Node[] selected = this.comp.getExplorerManager().getSelectedNodes();<NEW_LINE>if (selected.length > 0) {<NEW_LINE>from = selected[0];<NEW_LINE>} else {<NEW_LINE>from = this.comp<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>from = currentSubsequentNodes.get(currentSubsequentNodes.size() - 1);<NEW_LINE>}<NEW_LINE>if (from == null) {<NEW_LINE>while (currentSubsequentNodes.size() < DESIRED_PREPARED_NODES_COUNT) {<NEW_LINE>currentSubsequentNodes.add(null);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>WORKER.post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>final Node next = findSubsequentNode(from);<NEW_LINE>SwingUtilities.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (currentRequest != stateId)<NEW_LINE>return;<NEW_LINE>currentSubsequentNodes.add(next);<NEW_LINE>ensureNodesFilled();<NEW_LINE>updateEnabled();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | .getExplorerManager().getRootContext(); |
214,397 | public List<String> suggestForWord(String word, String leftContext, String rightContext, NgramLanguageModel lm) {<NEW_LINE>List<String> unRanked = getUnrankedSuggestions(word);<NEW_LINE>if (lm == null) {<NEW_LINE>Log.warn("No language model provided. Returning unraked results.");<NEW_LINE>return unRanked;<NEW_LINE>}<NEW_LINE>if (lm.getOrder() < 2) {<NEW_LINE>Log.warn("Language model order is 1. For context ranking it should be at least 2. " + "Unigram ranking will be applied.");<NEW_LINE>return suggestForWord(word, lm);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>List<ScoredItem<String>> results = new ArrayList<>(unRanked.size());<NEW_LINE>for (String str : unRanked) {<NEW_LINE>if (leftContext == null) {<NEW_LINE>leftContext = vocabulary.getSentenceStart();<NEW_LINE>} else {<NEW_LINE>leftContext = normalizeForLm(leftContext);<NEW_LINE>}<NEW_LINE>if (rightContext == null) {<NEW_LINE>rightContext = vocabulary.getSentenceEnd();<NEW_LINE>} else {<NEW_LINE>rightContext = normalizeForLm(rightContext);<NEW_LINE>}<NEW_LINE>String w = normalizeForLm(str);<NEW_LINE>int wordIndex = vocabulary.indexOf(w);<NEW_LINE>int leftIndex = vocabulary.indexOf(leftContext);<NEW_LINE>int rightIndex = vocabulary.indexOf(rightContext);<NEW_LINE>float score;<NEW_LINE>if (lm.getOrder() == 2) {<NEW_LINE>score = lm.getProbability(leftIndex, wordIndex) + lm.getProbability(wordIndex, rightIndex);<NEW_LINE>} else {<NEW_LINE>score = lm.getProbability(leftIndex, wordIndex, rightIndex);<NEW_LINE>}<NEW_LINE>results.add(new ScoredItem<>(str, score));<NEW_LINE>}<NEW_LINE>results.sort(ScoredItem.STRING_COMP_DESCENDING);<NEW_LINE>return results.stream().map(s -> s.item).collect(Collectors.toList());<NEW_LINE>} | LmVocabulary vocabulary = lm.getVocabulary(); |
1,084,766 | public void importKey() {<NEW_LINE>KeyAsyncClient keyAsyncClient = createAsyncClient();<NEW_LINE>JsonWebKey jsonWebKeyToImport = new JsonWebKey();<NEW_LINE>// BEGIN: com.azure.security.keyvault.keys.KeyAsyncClient.importKey#String-JsonWebKey<NEW_LINE>keyAsyncClient.importKey("keyName", jsonWebKeyToImport).subscribe(keyVaultKey -> System.out.printf("Imported key with name: %s and id: %s%n", keyVaultKey.getName()<MASK><NEW_LINE>// END: com.azure.security.keyvault.keys.KeyAsyncClient.importKey#String-JsonWebKey<NEW_LINE>// BEGIN: com.azure.security.keyvault.keys.KeyAsyncClient.importKey#ImportKeyOptions<NEW_LINE>ImportKeyOptions options = new ImportKeyOptions("keyName", jsonWebKeyToImport).setHardwareProtected(false);<NEW_LINE>keyAsyncClient.importKey(options).subscribe(keyVaultKey -> System.out.printf("Imported key with name: %s and id: %s%n", keyVaultKey.getName(), keyVaultKey.getId()));<NEW_LINE>// END: com.azure.security.keyvault.keys.KeyAsyncClient.importKey#ImportKeyOptions<NEW_LINE>// BEGIN: com.azure.security.keyvault.keys.KeyAsyncClient.importKeyWithResponse#ImportKeyOptions<NEW_LINE>ImportKeyOptions importKeyOptions = new ImportKeyOptions("keyName", jsonWebKeyToImport).setHardwareProtected(false);<NEW_LINE>keyAsyncClient.importKeyWithResponse(importKeyOptions).subscribe(response -> System.out.printf("Imported key with name: %s and id: %s%n", response.getValue().getName(), response.getValue().getId()));<NEW_LINE>// END: com.azure.security.keyvault.keys.KeyAsyncClient.importKeyWithResponse#ImportKeyOptions<NEW_LINE>} | , keyVaultKey.getId())); |
1,378,613 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {<NEW_LINE>inflater = UiUtilities.getInflater(app, nightMode);<NEW_LINE>View root = inflater.inflate(R.layout.fragment_import_duplicates, container, false);<NEW_LINE>Toolbar toolbar = root.findViewById(R.id.toolbar);<NEW_LINE>setupToolbar(toolbar);<NEW_LINE>ComplexButton replaceAllBtn = root.findViewById(R.id.replace_all_btn);<NEW_LINE>ComplexButton keepBothBtn = root.findViewById(R.id.keep_both_btn);<NEW_LINE>buttonsContainer = root.findViewById(R.id.buttons_container);<NEW_LINE>nestedScroll = root.findViewById(R.id.nested_scroll);<NEW_LINE>description = root.findViewById(R.id.description);<NEW_LINE>progressBar = root.findViewById(R.id.progress_bar);<NEW_LINE>toolbarLayout = root.findViewById(R.id.toolbar_layout);<NEW_LINE>keepBothBtn.setIcon(getPaintedContentIcon(R.drawable.ic_action_keep_both, nightMode ? getResources().getColor(R.color.icon_color_active_dark) : getResources().getColor(R.color.icon_color_active_light)));<NEW_LINE>replaceAllBtn.setIcon(getPaintedContentIcon(R.drawable.ic_action_replace, ColorUtilities.<MASK><NEW_LINE>keepBothBtn.setOnClickListener(v -> importItems(false));<NEW_LINE>replaceAllBtn.setOnClickListener(v -> importItems(true));<NEW_LINE>list = root.findViewById(R.id.list);<NEW_LINE>ViewCompat.setNestedScrollingEnabled(list, false);<NEW_LINE>ViewTreeObserver treeObserver = buttonsContainer.getViewTreeObserver();<NEW_LINE>treeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onGlobalLayout() {<NEW_LINE>if (buttonsContainer != null) {<NEW_LINE>ViewTreeObserver vts = buttonsContainer.getViewTreeObserver();<NEW_LINE>int height = buttonsContainer.getMeasuredHeight();<NEW_LINE>nestedScroll.setPadding(0, 0, 0, height);<NEW_LINE>vts.removeOnGlobalLayoutListener(this);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>AndroidUtils.addStatusBarPadding21v(app, root);<NEW_LINE>return root;<NEW_LINE>} | getActiveButtonsAndLinksTextColor(app, nightMode))); |
499,297 | private <T> Stream<Class<T>> prepareClass(Stream<String> types, Object key, @SuppressWarnings("unused") Class<T> witness) {<NEW_LINE>List<Class<?>> l = typesCache.get(key);<NEW_LINE>if (l != null) {<NEW_LINE>return l.stream().map(x -> (Class<T>) x);<NEW_LINE>}<NEW_LINE>List<Class<T>> list = new ArrayList<>();<NEW_LINE>try {<NEW_LINE>Iterator<String<MASK><NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>list.add((Class<T>) Class.forName(iterator.next()));<NEW_LINE>}<NEW_LINE>List<Class<?>> listToCache = new ArrayList<>(list);<NEW_LINE>typesCache.computeIfAbsent(key, x -> listToCache);<NEW_LINE>return list.stream();<NEW_LINE>} catch (ClassNotFoundException | IllegalArgumentException | SecurityException e) {<NEW_LINE>LOGGER.error("Instantiation failed", e);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | > iterator = types.iterator(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.