idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,347,742 | public boolean execute(@Nonnull PsiFileSystemItem element) {<NEW_LINE>if (!filter.shouldShow(element)) {<NEW_LINE>// skip<NEW_LINE>} else if (element instanceof PsiDirectory) {<NEW_LINE>result.add(new PsiDirectoryNode(project, (PsiDirectory) element, settings, filter) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Collection<AbstractTreeNode> getChildrenImpl() {<NEW_LINE>// noinspection ConstantConditions<NEW_LINE>return getDirectoryChildrenImpl(getProject(), getValue(), getSettings(), getFilter());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else if (element instanceof PsiFile) {<NEW_LINE>result.add(new PsiFileNode(project, (PsiFile) element, settings) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Comparable<ExtensionSortKey> getTypeSortKey() {<NEW_LINE>PsiFile value = getValue();<NEW_LINE>Language language = value == null ? null : value.getLanguage();<NEW_LINE>LanguageFileType fileType = language == null ? null : language.getAssociatedFileType();<NEW_LINE>return fileType == null ? null : new <MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | ExtensionSortKey(fileType.getDefaultExtension()); |
1,797,638 | // TODO separate out ours and users models possibly regression vs classification<NEW_LINE>private void addInferenceIngestUsage(GetTrainedModelsStatsAction.Response statsResponse, Map<String, Object> inferenceUsage) {<NEW_LINE>int pipelineCount = 0;<NEW_LINE>StatsAccumulator docCountStats = new StatsAccumulator();<NEW_LINE>StatsAccumulator timeStats = new StatsAccumulator();<NEW_LINE>StatsAccumulator failureStats = new StatsAccumulator();<NEW_LINE>for (GetTrainedModelsStatsAction.Response.TrainedModelStats modelStats : statsResponse.getResources().results()) {<NEW_LINE>pipelineCount += modelStats.getPipelineCount();<NEW_LINE>modelStats.getIngestStats().getProcessorStats().values().stream().flatMap(List::stream).forEach(processorStat -> {<NEW_LINE>if (processorStat.getName().equals(InferenceProcessor.TYPE)) {<NEW_LINE>docCountStats.add(processorStat.getStats().getIngestCount());<NEW_LINE>timeStats.add(processorStat.getStats().getIngestTimeInMillis());<NEW_LINE>failureStats.add(processorStat.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>Map<String, Object> ingestUsage = Maps.newMapWithExpectedSize(6);<NEW_LINE>ingestUsage.put("pipelines", createCountUsageEntry(pipelineCount));<NEW_LINE>ingestUsage.put("num_docs_processed", getMinMaxSumAsLongsFromStats(docCountStats));<NEW_LINE>ingestUsage.put("time_ms", getMinMaxSumAsLongsFromStats(timeStats));<NEW_LINE>ingestUsage.put("num_failures", getMinMaxSumAsLongsFromStats(failureStats));<NEW_LINE>inferenceUsage.put("ingest_processors", Collections.singletonMap(MachineLearningFeatureSetUsage.ALL, ingestUsage));<NEW_LINE>} | getStats().getIngestFailedCount()); |
1,666,495 | private long[] createMethods(ClassDescriptor desc, List<MethodResolution> overloads) {<NEW_LINE>int n = overloads.size();<NEW_LINE>long[] overloadPtrs = new long[overloads.size()];<NEW_LINE>for (MethodResolution ov : overloads) {<NEW_LINE>Method method = (Method) ov.executable;<NEW_LINE>// We may already have built a methodoverload for this<NEW_LINE>Class<?> decl = method.getDeclaringClass();<NEW_LINE>if (method.getDeclaringClass() != desc.cls) {<NEW_LINE>this.populateMembers(decl);<NEW_LINE>ov.ptr = this.classMap.get<MASK><NEW_LINE>if (ov.ptr == 0) {<NEW_LINE>if (audit != null)<NEW_LINE>audit.failFindMethod(desc, method);<NEW_LINE>throw new RuntimeException("Fail");<NEW_LINE>}<NEW_LINE>overloadPtrs[--n] = ov.ptr;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Determine what takes precedence<NEW_LINE>int i = 0;<NEW_LINE>long[] precedencePtrs = new long[ov.children.size()];<NEW_LINE>for (MethodResolution ch : ov.children) {<NEW_LINE>precedencePtrs[i++] = ch.ptr;<NEW_LINE>}<NEW_LINE>int modifiers = method.getModifiers() & 0xffff;<NEW_LINE>if (isBeanMutator(method))<NEW_LINE>modifiers |= ModifierCode.BEAN_MUTATOR.value;<NEW_LINE>if (isBeanAccessor(method))<NEW_LINE>modifiers |= ModifierCode.BEAN_ACCESSOR.value;<NEW_LINE>if (isCallerSensitive(method))<NEW_LINE>modifiers |= ModifierCode.CALLER_SENSITIVE.value;<NEW_LINE>ov.ptr = typeFactory.defineMethod(context, desc.classPtr, method.toString(), method, precedencePtrs, modifiers);<NEW_LINE>overloadPtrs[--n] = ov.ptr;<NEW_LINE>desc.methods[desc.methodCounter] = ov.ptr;<NEW_LINE>desc.methodIndex[desc.methodCounter] = method;<NEW_LINE>desc.methodCounter++;<NEW_LINE>}<NEW_LINE>return overloadPtrs;<NEW_LINE>} | (decl).getMethod(method); |
983,869 | // keep reading. the caller will decide when to end<NEW_LINE>@Override<NEW_LINE>public int read(byte[] b, int off, int len) throws IOException {<NEW_LINE>if (b == null) {<NEW_LINE>throw new NullPointerException();<NEW_LINE>} else if (off < 0 || len < 0 || len > b.length - off) {<NEW_LINE>throw new IndexOutOfBoundsException();<NEW_LINE>} else if (len == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>int totalRead = 0;<NEW_LINE>if (buffer != null && buffer.remaining() > 0) {<NEW_LINE>int bytesToRead = Math.min(buffer.remaining(), len);<NEW_LINE>buffer.<MASK><NEW_LINE>totalRead += bytesToRead;<NEW_LINE>}<NEW_LINE>if (stream != null) {<NEW_LINE>if (streamRead < streamLength && (len - totalRead) > 0) {<NEW_LINE>long bytesToRead = Math.min(streamLength - streamRead, len - totalRead);<NEW_LINE>int readFromStream = stream.read(b, off + totalRead, (int) bytesToRead);<NEW_LINE>streamRead += readFromStream;<NEW_LINE>totalRead += readFromStream;<NEW_LINE>}<NEW_LINE>if (streamRead == streamLength) {<NEW_LINE>if (crc.position() == 0) {<NEW_LINE>crc.putLong(stream.getValue());<NEW_LINE>crc.flip();<NEW_LINE>}<NEW_LINE>int bytesToRead = Math.min(crc.remaining(), len - totalRead);<NEW_LINE>crc.get(b, off + totalRead, bytesToRead);<NEW_LINE>totalRead += bytesToRead;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return totalRead > 0 ? totalRead : -1;<NEW_LINE>} | get(b, off, bytesToRead); |
1,086,838 | private void addPlayerData(Map<String, Object> dataJson, TablePlayer player) {<NEW_LINE>String name = player.getName().orElse(player.getPlayerUUID().toString());<NEW_LINE>String url = (playersPage ? "./player/" : "../player/") + Html.encodeToURL(player.getPlayerUUID().toString());<NEW_LINE>int loginTimes = player.getSessionCount().orElse(0);<NEW_LINE>long activePlaytime = player.getActivePlaytime().orElse(-1L);<NEW_LINE>long registered = player.getRegistered().orElse(-1L);<NEW_LINE>long lastSeen = player.getLastSeen().orElse(-1L);<NEW_LINE>ActivityIndex activityIndex = player.getCurrentActivityIndex().orElseGet(() -> new ActivityIndex(0.0, 0));<NEW_LINE>boolean isBanned = player.isBanned();<NEW_LINE>String activityString = activityIndex.getFormattedValue(decimalFormatter) + (isBanned ? " (<b>" + locale.get(HtmlLang.LABEL_BANNED) + "</b>)" : " (" + activityIndex.getGroup() + ")");<NEW_LINE>String geolocation = player.getGeolocation().orElse("-");<NEW_LINE>Html link = openPlayerPageInNewTab <MASK><NEW_LINE>putDataEntry(dataJson, link.create(url, StringUtils.replace(StringEscapeUtils.escapeHtml4(name), "\\", "\\\\")), "name");<NEW_LINE>putDataEntry(dataJson, activityIndex.getValue(), activityString, "index");<NEW_LINE>putDataEntry(dataJson, activePlaytime, numberFormatters.get(FormatType.TIME_MILLISECONDS).apply(activePlaytime), "activePlaytime");<NEW_LINE>putDataEntry(dataJson, loginTimes, "sessions");<NEW_LINE>putDataEntry(dataJson, registered, numberFormatters.get(FormatType.DATE_YEAR).apply(registered), "registered");<NEW_LINE>putDataEntry(dataJson, lastSeen, numberFormatters.get(FormatType.DATE_YEAR).apply(lastSeen), "seen");<NEW_LINE>putDataEntry(dataJson, geolocation, "geolocation");<NEW_LINE>} | ? Html.LINK_EXTERNAL : Html.LINK; |
1,394,651 | public boolean revertSnapshot(SnapshotInfo snapshotInfo) {<NEW_LINE>VolumeInfo volumeInfo = snapshotInfo.getBaseVolume();<NEW_LINE>verifyFormat(volumeInfo);<NEW_LINE>verifyDiskTypeAndHypervisor(volumeInfo);<NEW_LINE>verifySnapshotType(snapshotInfo);<NEW_LINE>SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findBySnapshot(snapshotInfo.<MASK><NEW_LINE>if (snapshotStore != null) {<NEW_LINE>long snapshotStoragePoolId = snapshotStore.getDataStoreId();<NEW_LINE>if (!volumeInfo.getPoolId().equals(snapshotStoragePoolId)) {<NEW_LINE>String errMsg = "Storage pool mismatch";<NEW_LINE>s_logger.error(errMsg);<NEW_LINE>throw new CloudRuntimeException(errMsg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean storageSystemSupportsCapability = storageSystemSupportsCapability(volumeInfo.getPoolId(), DataStoreCapabilities.CAN_REVERT_VOLUME_TO_SNAPSHOT.toString());<NEW_LINE>if (!storageSystemSupportsCapability) {<NEW_LINE>String errMsg = "Storage pool revert capability not supported";<NEW_LINE>s_logger.error(errMsg);<NEW_LINE>throw new CloudRuntimeException(errMsg);<NEW_LINE>}<NEW_LINE>executeRevertSnapshot(snapshotInfo, volumeInfo);<NEW_LINE>return true;<NEW_LINE>} | getId(), DataStoreRole.Primary); |
1,295,742 | private static void migrate(Context context) throws IOException, RemoteException {<NEW_LINE>int first = 0;<NEW_LINE>String format = context.getString(R.string.msg_migrating);<NEW_LINE>List<ApplicationInfo> listApp = context.getPackageManager().getInstalledApplications(0);<NEW_LINE>// Start migrate<NEW_LINE>PrivacyProvider.migrateLegacy(context);<NEW_LINE>// Migrate global settings<NEW_LINE>PrivacyManager.setSettingList(PrivacyProvider<MASK><NEW_LINE>PrivacyProvider.finishMigrateSettings(0);<NEW_LINE>// Migrate application settings/restrictions<NEW_LINE>for (int i = 1; i <= listApp.size(); i++) {<NEW_LINE>int uid = listApp.get(i - 1).uid;<NEW_LINE>// Settings<NEW_LINE>List<PSetting> listSetting = PrivacyProvider.migrateSettings(context, uid);<NEW_LINE>PrivacyManager.setSettingList(listSetting);<NEW_LINE>PrivacyProvider.finishMigrateSettings(uid);<NEW_LINE>// Restrictions<NEW_LINE>List<PRestriction> listRestriction = PrivacyProvider.migrateRestrictions(context, uid);<NEW_LINE>PrivacyManager.setRestrictionList(listRestriction);<NEW_LINE>PrivacyProvider.finishMigrateRestrictions(uid);<NEW_LINE>if (first == 0)<NEW_LINE>if (listSetting.size() > 0 || listRestriction.size() > 0)<NEW_LINE>first = i;<NEW_LINE>if (first > 0 && first < listApp.size())<NEW_LINE>notifyProgress(context, Util.NOTIFY_MIGRATE, format, 100 * (i - first) / (listApp.size() - first));<NEW_LINE>}<NEW_LINE>if (first == 0)<NEW_LINE>Util.log(null, Log.WARN, "Nothing to migrate");<NEW_LINE>// Complete migration<NEW_LINE>int userId = Util.getUserId(Process.myUid());<NEW_LINE>PrivacyService.getClient().setSetting(new PSetting(userId, "", PrivacyManager.cSettingMigrated, Boolean.toString(true)));<NEW_LINE>} | .migrateSettings(context, 0)); |
270,874 | public static ListVirtualHostsResponse unmarshall(ListVirtualHostsResponse listVirtualHostsResponse, UnmarshallerContext _ctx) {<NEW_LINE>listVirtualHostsResponse.setRequestId(_ctx.stringValue("ListVirtualHostsResponse.RequestId"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setNextToken(_ctx.stringValue("ListVirtualHostsResponse.Data.NextToken"));<NEW_LINE>data.setMaxResults(_ctx.integerValue("ListVirtualHostsResponse.Data.MaxResults"));<NEW_LINE>List<VhostVO> virtualHosts = new ArrayList<VhostVO>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListVirtualHostsResponse.Data.VirtualHosts.Length"); i++) {<NEW_LINE>VhostVO vhostVO = new VhostVO();<NEW_LINE>vhostVO.setName(_ctx.stringValue<MASK><NEW_LINE>virtualHosts.add(vhostVO);<NEW_LINE>}<NEW_LINE>data.setVirtualHosts(virtualHosts);<NEW_LINE>listVirtualHostsResponse.setData(data);<NEW_LINE>return listVirtualHostsResponse;<NEW_LINE>} | ("ListVirtualHostsResponse.Data.VirtualHosts[" + i + "].Name")); |
625,489 | private void parseBytes(byte[] weightBytes) {<NEW_LINE>// 10 ~ 99<NEW_LINE>int bodyage = (int) (weightBytes[17]);<NEW_LINE>// kg<NEW_LINE>float weight = (float) (((weightBytes[2] & 0xFF) << 8) | (weightBytes[3] & 0xFF)) / 100.0f;<NEW_LINE>// %<NEW_LINE>float fat = (float) (((weightBytes[4] & 0xFF) << 8) | (weightBytes[<MASK><NEW_LINE>// %<NEW_LINE>float water = (float) (((weightBytes[8] & 0xFF) << 8) | (weightBytes[9] & 0xFF)) / 10.0f;<NEW_LINE>// %<NEW_LINE>float muscle = (float) (((weightBytes[10] & 0xFF) << 8) | (weightBytes[11] & 0xFF)) / 10.0f;<NEW_LINE>// %<NEW_LINE>float bone = (float) (((weightBytes[12] & 0xFF) << 8) | (weightBytes[13] & 0xFF)) / 10.0f;<NEW_LINE>// kcal<NEW_LINE>float calorie = (float) (((weightBytes[14] & 0xFF) << 8) | (weightBytes[15] & 0xFF));<NEW_LINE>ScaleMeasurement scaleBtData = new ScaleMeasurement();<NEW_LINE>scaleBtData.setWeight(weight);<NEW_LINE>scaleBtData.setFat(fat);<NEW_LINE>scaleBtData.setMuscle(muscle);<NEW_LINE>scaleBtData.setWater(water);<NEW_LINE>scaleBtData.setBone(bone);<NEW_LINE>scaleBtData.setDateTime(new Date());<NEW_LINE>addScaleMeasurement(scaleBtData);<NEW_LINE>} | 5] & 0xFF)) / 10.0f; |
1,363,684 | protected void handleBadRequest(String message, HttpServletResponse resp) throws IOException {<NEW_LINE>log.debug("handleBadRequest {}", message);<NEW_LINE>// resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);<NEW_LINE>// resp.setHeader("Connection", "Keep-Alive");<NEW_LINE>// resp.setHeader("Cache-Control", "no-cache");<NEW_LINE>// resp.setContentType("text/plain");<NEW_LINE>// resp.setContentLength(message.length());<NEW_LINE>// resp.getWriter().write(message);<NEW_LINE>// resp.flushBuffer();<NEW_LINE>// create and send a rejected status<NEW_LINE>Status status = new Status(StatusCodes.NC_CONNECT_REJECTED, Status.ERROR, message);<NEW_LINE>PendingCall call = new PendingCall(null, "onStatus", new Object[] { status });<NEW_LINE>Invoke event = new Invoke();<NEW_LINE>event.setCall(call);<NEW_LINE>Header header = new Header();<NEW_LINE>Packet packet = new Packet(header, event);<NEW_LINE>header.setDataType(event.getDataType());<NEW_LINE>// create dummy connection if local is empty<NEW_LINE>RTMPConnection conn = (RTMPConnection) Red5.getConnectionLocal();<NEW_LINE>if (conn == null) {<NEW_LINE>try {<NEW_LINE>conn = ((RTMPConnManager) manager<MASK><NEW_LINE>Red5.setConnectionLocal(conn);<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// encode the data<NEW_LINE>RTMPProtocolEncoder encoder = new RTMPProtocolEncoder();<NEW_LINE>IoBuffer out = encoder.encodePacket(packet);<NEW_LINE>// send the response<NEW_LINE>returnMessage(null, out, resp);<NEW_LINE>// clear local<NEW_LINE>Red5.setConnectionLocal(null);<NEW_LINE>} | ).createConnectionInstance(RTMPTConnection.class); |
658,108 | protected PackageBinding findPackage(char[] name, ModuleBinding module) {<NEW_LINE>char[][] subpackageCompoundName = CharOperation.arrayConcat(this.compoundName, name);<NEW_LINE>Set<PackageBinding> candidates = new HashSet<>();<NEW_LINE>for (ModuleBinding candidateModule : this.declaringModules) {<NEW_LINE>PackageBinding candidate = candidateModule.getVisiblePackage(subpackageCompoundName);<NEW_LINE>if (candidate != null && candidate != LookupEnvironment.TheNotFoundPackage && ((candidate.tagBits & TagBits.HasMissingType) == 0)) {<NEW_LINE>candidates.add(candidate);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int count = candidates.size();<NEW_LINE>PackageBinding result = null;<NEW_LINE>if (count == 1) {<NEW_LINE>result = candidates.iterator().next();<NEW_LINE>} else if (count > 1) {<NEW_LINE>Iterator<PackageBinding> iterator = candidates.iterator();<NEW_LINE>SplitPackageBinding split = new SplitPackageBinding(iterator.next(), this.enclosingModule);<NEW_LINE>while (iterator.hasNext()) split.<MASK><NEW_LINE>result = split;<NEW_LINE>}<NEW_LINE>if (result == null)<NEW_LINE>addNotFoundPackage(name);<NEW_LINE>else<NEW_LINE>addPackage(result, module);<NEW_LINE>return result;<NEW_LINE>} | add(iterator.next()); |
309,513 | private void generate(final Instant start, final Instant end, final ResourceId resourceId) {<NEW_LINE>if (start == null || end == null || resourceId == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ResourceType resourceType = getResourceType(resourceId);<NEW_LINE>final TemporalUnit durationUnit = resourceType.getDurationUnit();<NEW_LINE>final String rowKey_DailyCapacity = Msg.translate(Env.getCtx(), "DailyCapacity");<NEW_LINE>final String rowKey_ActualLoad = Msg.translate(Env.getCtx(), "ActualLoad");<NEW_LINE>final DateFormat formatter = DisplayType.getDateFormat(DisplayType.DateTime, Env.getLanguage(Env.getCtx()));<NEW_LINE>final I_S_Resource resource = resourcesRepo.getById(resourceId);<NEW_LINE><MASK><NEW_LINE>final BigDecimal dailyCapacityBD = DurationUtils.toBigDecimal(dailyCapacity, durationUnit);<NEW_LINE>dataset = new DefaultCategoryDataset();<NEW_LINE>final HashMap<DefaultMutableTreeNode, String> names = new HashMap<>();<NEW_LINE>final DefaultMutableTreeNode root = new DefaultMutableTreeNode(resource);<NEW_LINE>names.put(root, getTreeNodeRepresentation(null, root, resource));<NEW_LINE>Instant dateTime = start;<NEW_LINE>while (end.isAfter(dateTime)) {<NEW_LINE>final String columnKey = formatter.format(TimeUtil.asDate(dateTime));<NEW_LINE>names.putAll(addTreeNodes(dateTime, root, resource));<NEW_LINE>if (isAvailable(resource, dateTime)) {<NEW_LINE>final BigDecimal actualLoadBD = BigDecimal.valueOf(calculateLoad(dateTime, resourceId).get(durationUnit));<NEW_LINE>dataset.addValue(dailyCapacityBD, rowKey_DailyCapacity, columnKey);<NEW_LINE>dataset.addValue(actualLoadBD, rowKey_ActualLoad, columnKey);<NEW_LINE>} else {<NEW_LINE>dataset.addValue(BigDecimal.ZERO, rowKey_DailyCapacity, columnKey);<NEW_LINE>dataset.addValue(BigDecimal.ZERO, rowKey_ActualLoad, columnKey);<NEW_LINE>}<NEW_LINE>// TODO: teo_sarca: increment should be more general, not only days<NEW_LINE>dateTime = dateTime.plus(1, ChronoUnit.DAYS);<NEW_LINE>}<NEW_LINE>tree = new JTree(root);<NEW_LINE>tree.setCellRenderer(new DiagramTreeCellRenderer(names));<NEW_LINE>} | final Duration dailyCapacity = getDailyCapacity(resource); |
832,178 | private void addState(String checkName, String actionName, String arg, boolean finalized) {<NEW_LINE>context.nodeSubtype.addMethod(MethodSpec.methodBuilder(checkName).addStatement("return (getKeyReference() == $L)", arg).addModifiers(context.publicFinalModifiers()).returns(boolean<MASK><NEW_LINE>var action = MethodSpec.methodBuilder(actionName).addModifiers(context.publicFinalModifiers());<NEW_LINE>if (valueStrength() == Strength.STRONG) {<NEW_LINE>// Set the value to null only when dead, as otherwise the explicit removal of an expired async<NEW_LINE>// value will be notified as explicit rather than expired due to the isComputingAsync() check<NEW_LINE>if (finalized) {<NEW_LINE>action.addStatement("$L.set(this, null)", varHandleName("value"));<NEW_LINE>}<NEW_LINE>action.addStatement("$L.set(this, $N)", varHandleName("key"), arg);<NEW_LINE>} else {<NEW_LINE>action.addStatement("$1T valueRef = ($1T) $2L.get(this)", valueReferenceType(), varHandleName("value"));<NEW_LINE>if (keyStrength() != Strength.STRONG) {<NEW_LINE>action.addStatement("$1T keyRef = ($1T) valueRef.getKeyReference()", referenceKeyType);<NEW_LINE>action.addStatement("keyRef.clear()");<NEW_LINE>}<NEW_LINE>action.addStatement("valueRef.setKeyReference($N)", arg);<NEW_LINE>action.addStatement("valueRef.clear()");<NEW_LINE>}<NEW_LINE>context.nodeSubtype.addMethod(action.build());<NEW_LINE>} | .class).build()); |
996,100 | private Optional<OspfProcess> toOspfProcess(VirtualRouter vr, Vrf vrf) {<NEW_LINE>OspfVr ospf = vr.getOspf();<NEW_LINE>if (ospf == null || !ospf.isEnable()) {<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>// Router ID is ensured to be present by the CLI/UI<NEW_LINE>if (ospf.getRouterId() == null) {<NEW_LINE>_w.redFlag(String.format("Virtual-router %s ospf has no router-id; disabling it.", vr.getName()));<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>OspfProcess.Builder ospfProcessBuilder = OspfProcess.builder();<NEW_LINE>ospfProcessBuilder.setRouterId(ospf.getRouterId());<NEW_LINE>String processId = String.format(<MASK><NEW_LINE>ospfProcessBuilder.setProcessId(processId).setAreas(ospf.getAreas().values().stream().map(area -> toOspfArea(area, vrf, processId)).collect(ImmutableSortedMap.toImmutableSortedMap(Comparator.naturalOrder(), OspfArea::getAreaNumber, Function.identity())));<NEW_LINE>// Setting reference bandwidth to an arbitrary value to avoid builder crash<NEW_LINE>ospfProcessBuilder.setReferenceBandwidth(1D);<NEW_LINE>return Optional.of(ospfProcessBuilder.build());<NEW_LINE>} | "~OSPF_PROCESS_%s", ospf.getRouterId()); |
1,361,339 | public List<MySQLServerVH> fetchMySQLServerDetails(SubscriptionVH subscription) {<NEW_LINE>List<MySQLServerVH> mySqlServerList = new ArrayList<MySQLServerVH>();<NEW_LINE>String accessToken = azureCredentialProvider.getToken(subscription.getTenant());<NEW_LINE>String url = String.format(apiUrlTemplate, URLEncoder.encode(subscription.getSubscriptionId()));<NEW_LINE>try {<NEW_LINE>String response = CommonUtils.doHttpGet(url, "Bearer", accessToken);<NEW_LINE>JsonObject responseObj = new JsonParser().parse(response).getAsJsonObject();<NEW_LINE>JsonArray sqlServerObjects = responseObj.getAsJsonArray("value");<NEW_LINE>for (JsonElement sqlServerObjectElement : sqlServerObjects) {<NEW_LINE>MySQLServerVH mySQLServerVH = new MySQLServerVH();<NEW_LINE>mySQLServerVH.setSubscription(subscription.getSubscriptionId());<NEW_LINE>mySQLServerVH.setSubscriptionName(subscription.getSubscriptionName());<NEW_LINE>JsonObject sqlServerObject = sqlServerObjectElement.getAsJsonObject();<NEW_LINE>JsonObject properties = sqlServerObject.getAsJsonObject("properties");<NEW_LINE>JsonObject sku = sqlServerObject.getAsJsonObject("sku");<NEW_LINE>mySQLServerVH.setId(sqlServerObject.get("id").getAsString());<NEW_LINE>mySQLServerVH.setLocation(sqlServerObject.get("location").getAsString());<NEW_LINE>mySQLServerVH.setName(sqlServerObject.get("name").getAsString());<NEW_LINE>mySQLServerVH.setType(sqlServerObject.get("type").getAsString());<NEW_LINE>if (sku != null) {<NEW_LINE>HashMap<String, Object> skuMap = new Gson().fromJson(sku.toString(), HashMap.class);<NEW_LINE>mySQLServerVH.setSkuMap(skuMap);<NEW_LINE>}<NEW_LINE>if (properties != null) {<NEW_LINE>HashMap<String, Object> propertiesMap = new Gson().fromJson(properties.<MASK><NEW_LINE>mySQLServerVH.setPropertiesMap(propertiesMap);<NEW_LINE>}<NEW_LINE>mySqlServerList.add(mySQLServerVH);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error("Error Collecting mysqlserver", e);<NEW_LINE>}<NEW_LINE>log.info("Target Type : {} Total: {} ", "MySQL Server", mySqlServerList.size());<NEW_LINE>return mySqlServerList;<NEW_LINE>} | toString(), HashMap.class); |
1,031,555 | protected BeanDefinitionBuilder buildBeanDefinition(Element element, ParserContext parserContext) {<NEW_LINE>BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(AmqpChannelFactoryBean.class);<NEW_LINE>String messageDriven = element.getAttribute("message-driven");<NEW_LINE>if (StringUtils.hasText(messageDriven)) {<NEW_LINE>builder.addConstructorArgValue(messageDriven);<NEW_LINE>}<NEW_LINE>String connectionFactory = element.getAttribute("connection-factory");<NEW_LINE>if (!StringUtils.hasText(connectionFactory)) {<NEW_LINE>connectionFactory = "rabbitConnectionFactory";<NEW_LINE>}<NEW_LINE>builder.addPropertyReference("connectionFactory", connectionFactory);<NEW_LINE>builder.addPropertyValue("pubSub", "publish-subscribe-channel".equals(element.getLocalName()));<NEW_LINE>populateConsumersPerQueueIfAny(element, parserContext, builder);<NEW_LINE>String[] valuesToPopulate = { "max-subscribers", "acknowledge-mode", "auto-startup", "channel-transacted", "template-channel-transacted", "concurrent-consumers", "encoding", "expose-listener-channel", "phase", "prefetch-count", "queue-name", "receive-timeout", "recovery-interval", "missing-queues-fatal", "shutdown-timeout", "tx-size", "default-delivery-mode", "extract-payload", "headers-last" };<NEW_LINE>for (String attribute : valuesToPopulate) {<NEW_LINE>IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, attribute);<NEW_LINE>}<NEW_LINE>String[] referencesToPopulate = { "advice-chain", "amqp-admin", "error-handler", "exchange", "message-converter", "message-properties-converter", "task-executor", "transaction-attribute", "transaction-manager", "outbound-header-mapper", "inbound-header-mapper" };<NEW_LINE>for (String attribute : referencesToPopulate) {<NEW_LINE>IntegrationNamespaceUtils.<MASK><NEW_LINE>}<NEW_LINE>return builder;<NEW_LINE>} | setReferenceIfAttributeDefined(builder, element, attribute); |
556,038 | public SdkType unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SdkType sdkType = new SdkType();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("id", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sdkType.setId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("friendlyName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sdkType.setFriendlyName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("description", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sdkType.setDescription(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("configurationProperties", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sdkType.setConfigurationProperties(new ListUnmarshaller<SdkConfigurationProperty>(SdkConfigurationPropertyJsonUnmarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return sdkType;<NEW_LINE>} | )).unmarshall(context)); |
1,294 | private void pushNALInternal() {<NEW_LINE>if (isStopped()) {<NEW_LINE>Utils.logi(TAG, () -> "decodeLoop Stopped. mStopped==true.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (mAvailableInputs.size() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>NAL nal = mNalQueue.peek();<NEW_LINE>if (nal == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long presentationTime = System.nanoTime() / 1000;<NEW_LINE>boolean consumed;<NEW_LINE>if (nal.type == NAL_TYPE_SPS) {<NEW_LINE>// (VPS + )SPS + PPS<NEW_LINE>Utils.frameLog(nal.frameIndex, () -> "Feed codec config. Size=" + nal.length);<NEW_LINE>mWaitNextIDR = false;<NEW_LINE>consumed = pushInputBuffer(nal, 0, MediaCodec.BUFFER_FLAG_CODEC_CONFIG);<NEW_LINE>} else if (nal.type == NAL_TYPE_IDR) {<NEW_LINE>// IDR-Frame<NEW_LINE>Utils.frameLog(nal.frameIndex, () -> "Feed IDR-Frame. Size=" + nal.length + " PresentationTime=" + presentationTime);<NEW_LINE>setWaitingNextIDR(false);<NEW_LINE>DecoderInput(nal.frameIndex);<NEW_LINE>consumed = pushInputBuffer(nal, presentationTime, 0);<NEW_LINE>} else {<NEW_LINE>// PFrame<NEW_LINE>DecoderInput(nal.frameIndex);<NEW_LINE>if (mWaitNextIDR) {<NEW_LINE>// Ignore P-Frame until next I-Frame<NEW_LINE>Utils.frameLog(nal.frameIndex, () -> "Ignoring P-Frame");<NEW_LINE>consumed = true;<NEW_LINE>} else {<NEW_LINE>// P-Frame<NEW_LINE>Utils.frameLog(nal.frameIndex, () -> "Feed P-Frame. Size=" + <MASK><NEW_LINE>consumed = pushInputBuffer(nal, presentationTime, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (consumed) {<NEW_LINE>mNalQueue.remove();<NEW_LINE>}<NEW_LINE>} | nal.length + " PresentationTime=" + presentationTime); |
957,754 | public void buildHandleConfig() {<NEW_LINE>PipelineConfiguration pipelineConfig = getPipelineConfig();<NEW_LINE>HandleConfiguration handleConfig = getHandleConfig();<NEW_LINE>if (null == handleConfig || null == handleConfig.getJobShardingDataNodes()) {<NEW_LINE>RuleAlteredJobConfigurationPreparer preparer = RequiredSPIRegistry.getRegisteredService(RuleAlteredJobConfigurationPreparer.class);<NEW_LINE>handleConfig = preparer.createHandleConfiguration(pipelineConfig, getWorkflowConfig());<NEW_LINE>this.handleConfig = handleConfig;<NEW_LINE>}<NEW_LINE>if (null == handleConfig.getJobId()) {<NEW_LINE>handleConfig.setJobId(generateJobId());<NEW_LINE>}<NEW_LINE>if (Strings.isNullOrEmpty(handleConfig.getSourceDatabaseType())) {<NEW_LINE>PipelineDataSourceConfiguration sourceDataSourceConfig = PipelineDataSourceConfigurationFactory.newInstance(pipelineConfig.getSource().getType(), pipelineConfig.getSource().getParameter());<NEW_LINE>handleConfig.setSourceDatabaseType(sourceDataSourceConfig.getDatabaseType().getName());<NEW_LINE>}<NEW_LINE>if (Strings.isNullOrEmpty(handleConfig.getTargetDatabaseType())) {<NEW_LINE>PipelineDataSourceConfiguration targetDataSourceConfig = PipelineDataSourceConfigurationFactory.newInstance(pipelineConfig.getTarget().getType(), pipelineConfig.<MASK><NEW_LINE>handleConfig.setTargetDatabaseType(targetDataSourceConfig.getDatabaseType().getName());<NEW_LINE>}<NEW_LINE>if (null == handleConfig.getJobShardingItem()) {<NEW_LINE>handleConfig.setJobShardingItem(0);<NEW_LINE>}<NEW_LINE>} | getTarget().getParameter()); |
1,327,848 | private List<Wo> list(Business business, Wi wi, List<Identity> identityList) throws Exception {<NEW_LINE>List<Wo> wos = new ArrayList<>();<NEW_LINE>if (StringUtils.isBlank(wi.getKey()) && (ListTools.isEmpty(wi.getUnitList()) || ListTools.isEmpty(identityList))) {<NEW_LINE>return wos;<NEW_LINE>}<NEW_LINE>EntityManager em = business.entityManagerContainer().get(Person.class);<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<String> cq = cb.createQuery(String.class);<NEW_LINE>Root<Person> root = cq.from(Person.class);<NEW_LINE>Predicate p = cb.conjunction();<NEW_LINE>if (StringUtils.isNotBlank(wi.getKey())) {<NEW_LINE>String str = StringUtils.lowerCase(StringTools.escapeSqlLikeKey(wi.getKey()));<NEW_LINE>p = cb.like(cb.lower(root.get(Person_.name)), "%" + str + "%", StringTools.SQL_ESCAPE_CHAR);<NEW_LINE>p = cb.or(p, cb.like(cb.lower(root.get(Person_.unique)), "%" + str + "%", StringTools.SQL_ESCAPE_CHAR));<NEW_LINE>p = cb.or(p, cb.like(cb.lower(root.get(Person_.pinyin)), str + "%", StringTools.SQL_ESCAPE_CHAR));<NEW_LINE>p = cb.or(p, cb.like(cb.lower(root.get(Person_.pinyinInitial)), str + "%", StringTools.SQL_ESCAPE_CHAR));<NEW_LINE>p = cb.or(p, cb.like(cb.lower(root.get(Person_.mobile)), str + "%", StringTools.SQL_ESCAPE_CHAR));<NEW_LINE>p = cb.or(p, cb.like(cb.lower(root.get(Person_.distinguishedName)), str + "%", StringTools.SQL_ESCAPE_CHAR));<NEW_LINE>}<NEW_LINE>Map<String, Integer> <MASK><NEW_LINE>if (ListTools.isNotEmpty(identityList)) {<NEW_LINE>for (Identity identity : identityList) {<NEW_LINE>map.put(identity.getPerson(), identity.getOrderNumber());<NEW_LINE>}<NEW_LINE>p = cb.and(p, cb.isMember(root.get(Person_.id), cb.literal(map.keySet())));<NEW_LINE>}<NEW_LINE>List<String> list = em.createQuery(cq.select(root.get(Person_.id)).where(p)).getResultList().stream().distinct().collect(Collectors.toList());<NEW_LINE>for (Person o : business.person().pick(list)) {<NEW_LINE>if (!map.isEmpty()) {<NEW_LINE>o.setOrderNumber(map.get(o.getId()));<NEW_LINE>}<NEW_LINE>wos.add(this.convert(business, o, Wo.class));<NEW_LINE>}<NEW_LINE>wos = wos.stream().sorted(Comparator.comparing(Wo::getOrderNumber, Comparator.nullsLast(Integer::compareTo)).thenComparing(Comparator.comparing(Wo::getName, Comparator.nullsFirst(String::compareTo)).reversed())).collect(Collectors.toList());<NEW_LINE>return wos;<NEW_LINE>} | map = new HashMap<>(); |
365,179 | private Mono<Response<Flux<ByteBuffer>>> redeployWithResponseAsync(String resourceGroupName, String labName, String name, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (labName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (name == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.redeploy(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, labName, name, this.client.getApiVersion(), accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); |
489,008 | static Map<String, Object> split(final StructuredTextNode thisNode, final Map<String, Object> parameters) throws FrameworkException {<NEW_LINE>final App app = StructrApp.getInstance(thisNode.getSecurityContext());<NEW_LINE>final Integer pos = integerOrDefault(parameters.get("position"), null);<NEW_LINE>if (pos != null) {<NEW_LINE>final <MASK><NEW_LINE>if (pos <= 0 || pos >= content.length()) {<NEW_LINE>throw new FrameworkException(422, "Invalid parameters for split() method, parameter 'position' is out of range.");<NEW_LINE>} else {<NEW_LINE>String part1 = content.substring(0, pos);<NEW_LINE>String part2 = content.substring(pos);<NEW_LINE>if (booleanOrDefault(parameters.get("trim"), true)) {<NEW_LINE>part1 = part1.trim();<NEW_LINE>part2 = part2.trim();<NEW_LINE>}<NEW_LINE>thisNode.setContent(part1);<NEW_LINE>// create new node<NEW_LINE>final StructuredTextNode newNode = app.create(thisNode.getClass());<NEW_LINE>newNode.setContent(part2);<NEW_LINE>// link into parent/child structure<NEW_LINE>final StructuredTextNode parent = thisNode.treeGetParent();<NEW_LINE>if (parent != null) {<NEW_LINE>parent.treeInsertAfter(newNode, thisNode);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new FrameworkException(422, "Invalid parameters for split() method, missing parameter 'position'. Usage: split(position, [trim=true])");<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | String content = thisNode.getContent(); |
1,395,950 | public Iterator<Entry<E, Double>> iterator() {<NEW_LINE>return new Iterator<Entry<E, Double>>() {<NEW_LINE><NEW_LINE>final Iterator<Entry<E, MutableDouble>> inner = map.entrySet().iterator();<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean hasNext() {<NEW_LINE>return inner.hasNext();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Entry<E, Double> next() {<NEW_LINE>return new Entry<E, Double>() {<NEW_LINE><NEW_LINE>final Entry<E, MutableDouble> e = inner.next();<NEW_LINE><NEW_LINE>public double getDoubleValue() {<NEW_LINE>return e.getValue().doubleValue();<NEW_LINE>}<NEW_LINE><NEW_LINE>public double setValue(double value) {<NEW_LINE>final double old = e<MASK><NEW_LINE>e.getValue().set(value);<NEW_LINE>totalCount = totalCount - old + value;<NEW_LINE>return old;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public E getKey() {<NEW_LINE>return e.getKey();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Double getValue() {<NEW_LINE>return getDoubleValue();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Double setValue(Double value) {<NEW_LINE>return setValue(value.doubleValue());<NEW_LINE>}<NEW_LINE>};<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void remove() {<NEW_LINE>throw new UnsupportedOperationException();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | .getValue().doubleValue(); |
1,074,719 | public void show(KrollDict options) {<NEW_LINE>if (this.dialogWrapper == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MaterialAlertDialogBuilder builder = getBuilder();<NEW_LINE>if (builder == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AlertDialog dialog = (AlertDialog) dialogWrapper.getDialog();<NEW_LINE>if (dialog == null) {<NEW_LINE>if (dialogWrapper.getActivity() == null) {<NEW_LINE>TiBaseActivity dialogActivity = (TiBaseActivity) getCurrentActivity();<NEW_LINE>dialogWrapper.setActivity(new <MASK><NEW_LINE>}<NEW_LINE>processProperties(proxy.getProperties());<NEW_LINE>builder.setOnCancelListener(new OnCancelListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCancel(DialogInterface dlg) {<NEW_LINE>int cancelIndex = (proxy.hasProperty(TiC.PROPERTY_CANCEL)) ? TiConvert.toInt(proxy.getProperty(TiC.PROPERTY_CANCEL)) : -1;<NEW_LINE>Log.d(TAG, "onCancelListener called. Sending index: " + cancelIndex, Log.DEBUG_MODE);<NEW_LINE>// In case wew cancel the Dialog we should not overwrite the selectedIndex<NEW_LINE>handleEvent(cancelIndex, false);<NEW_LINE>hide(null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>dialog = builder.create();<NEW_LINE>dialog.setCanceledOnTouchOutside(proxy.getProperties().optBoolean(TiC.PROPERTY_CANCELED_ON_TOUCH_OUTSIDE, true));<NEW_LINE>dialog.setCancelable(!proxy.getProperties().optBoolean(TiC.PROPERTY_BUTTON_CLICK_REQUIRED, false));<NEW_LINE>// Initially apply accessibility properties here, the first time<NEW_LINE>// the dialog actually becomes available. After this, propertyChanged<NEW_LINE>// can also be used.<NEW_LINE>ListView listView = dialog.getListView();<NEW_LINE>if (listView != null) {<NEW_LINE>int importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO;<NEW_LINE>if (proxy != null) {<NEW_LINE>listView.setContentDescription(composeContentDescription());<NEW_LINE>Object propertyValue = proxy.getProperty(TiC.PROPERTY_ACCESSIBILITY_HIDDEN);<NEW_LINE>if (propertyValue != null && TiConvert.toBoolean(propertyValue)) {<NEW_LINE>importance = ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_NO;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ViewCompat.setImportantForAccessibility(listView, importance);<NEW_LINE>}<NEW_LINE>dialogWrapper.setDialog(dialog);<NEW_LINE>this.builder = null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Activity dialogActivity = dialogWrapper.getActivity();<NEW_LINE>if (dialogActivity != null && !dialogActivity.isFinishing() && !dialogActivity.isDestroyed()) {<NEW_LINE>if (dialogActivity instanceof TiBaseActivity) {<NEW_LINE>// add dialog to its activity so we can clean it up later to prevent memory leak.<NEW_LINE>((TiBaseActivity) dialogActivity).addDialog(dialogWrapper);<NEW_LINE>dialog.show();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>dialog = null;<NEW_LINE>Log.w(TAG, "Dialog activity is destroyed, unable to show dialog with message: " + TiConvert.toString(proxy.getProperty(TiC.PROPERTY_MESSAGE)));<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>Log.w(TAG, "Context must have gone away: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>} | WeakReference<TiBaseActivity>(dialogActivity)); |
716,227 | private List<RexNode> gatherOrderExprs(LogicalView logicalView, SqlNodeList orderBy, RexBuilder rexBuilder, SqlSelect ast) {<NEW_LINE>SqlValidatorImpl validator = getValidatorForScope(ast);<NEW_LINE>final List<RexNode> <MASK><NEW_LINE>final List<SqlNode> orderExprList = new ArrayList<>();<NEW_LINE>for (SqlNode orderByItem : orderBy) {<NEW_LINE>RelFieldCollation relFieldCollation = buildOrderItem((SqlSelect) logicalView.getNativeSqlNode(), orderByItem, orderExprList, Direction.ASCENDING, NullDirection.UNSPECIFIED, validator);<NEW_LINE>RexNode rexNode = RexInputRef.of(relFieldCollation.getFieldIndex(), logicalView.getRowType());<NEW_LINE>if (relFieldCollation.direction == Direction.DESCENDING) {<NEW_LINE>rexNode = rexBuilder.makeCall(SqlStdOperatorTable.DESC, rexNode);<NEW_LINE>}<NEW_LINE>switch(relFieldCollation.nullDirection) {<NEW_LINE>case LAST:<NEW_LINE>rexNode = rexBuilder.makeCall(SqlStdOperatorTable.NULLS_LAST, rexNode);<NEW_LINE>break;<NEW_LINE>case FIRST:<NEW_LINE>rexNode = rexBuilder.makeCall(SqlStdOperatorTable.NULLS_FIRST, rexNode);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>}<NEW_LINE>orderByExps.add(rexNode);<NEW_LINE>}<NEW_LINE>// end of for<NEW_LINE>return orderByExps;<NEW_LINE>} | orderByExps = new ArrayList<>(); |
1,281,116 | protected void testProxyConnections() {<NEW_LINE>Proxy proxy = validateProxyConfigFields();<NEW_LINE>if (proxy == null) {<NEW_LINE>appendStatusMessage(R.string.proxy_test_aborted);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>mProxyManager.saveProxyInfoToPrefs(proxy, true);<NEW_LINE>mProxyManager.configureSystemProxy();<NEW_LINE>String[] testUrls = mContext.getString(R.string.proxy_test_urls).split("\n");<NEW_LINE>OkHttpClient okHttpClient = OkHttpHelpers.createOkHttpClient();<NEW_LINE>for (String urlString : testUrls) {<NEW_LINE>int serialNo = ++mNumTests;<NEW_LINE>Request request = new Request.Builder().url(urlString).build();<NEW_LINE>appendStatusMessage(R.string.proxy_test_start, serialNo, urlString);<NEW_LINE>Call call = okHttpClient.newCall(request);<NEW_LINE>call.enqueue(new Callback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(Call call, IOException e) {<NEW_LINE>if (call.isCanceled())<NEW_LINE>mProxyTestHandler.post(() -> appendStatusMessage(R.string.proxy_test_cancelled, serialNo));<NEW_LINE>else<NEW_LINE>mProxyTestHandler.post(() -> appendStatusMessage(R.string.proxy_test_error, serialNo, e));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onResponse(Call call, Response response) {<NEW_LINE>String protocol = response.protocol()<MASK><NEW_LINE>int code = response.code();<NEW_LINE>String status = response.message();<NEW_LINE>mProxyTestHandler.post(() -> appendStatusMessage(R.string.proxy_test_status, serialNo, protocol, code, status.isEmpty() ? "OK" : status));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>mUrlTests.add(call);<NEW_LINE>}<NEW_LINE>} | .toString().toUpperCase(); |
807,389 | public static void main(String[] args) throws Exception {<NEW_LINE>// String s = new String(FileUtil.readAll(new File("d:/tmp/sample-query2.sql")), "EUC_KR");<NEW_LINE>// new<NEW_LINE>String s = "select aa_1 ,( a - b) as b from tab";<NEW_LINE>// String(FileUtil.readAll(new<NEW_LINE>// File("d:/tmp/sample-query2.sql")),"EUC_KR");<NEW_LINE><MASK><NEW_LINE>EscapeLiteralSQL ec = new EscapeLiteralSQL(s).process();<NEW_LINE>long etime = System.currentTimeMillis();<NEW_LINE>// FileUtil.save("d:/tmp/sample-query2.out", ec.parsedSql.toString().getBytes());<NEW_LINE>System.out.println("SQL Orgin: " + s);<NEW_LINE>System.out.println("SQL Parsed: " + ec.getParsedSql());<NEW_LINE>System.out.println("PARAM: " + ec.param);<NEW_LINE>s = "select 1 / 2 from dual";<NEW_LINE>ec = new EscapeLiteralSQL(s).process();<NEW_LINE>System.out.println("SQL Orgin: " + s);<NEW_LINE>System.out.println("SQL Parsed: " + ec.getParsedSql());<NEW_LINE>System.out.println("PARAM: " + ec.param);<NEW_LINE>s = "select 1/2 from dual";<NEW_LINE>ec = new EscapeLiteralSQL(s).process();<NEW_LINE>System.out.println("SQL Orgin: " + s);<NEW_LINE>System.out.println("SQL Parsed: " + ec.getParsedSql());<NEW_LINE>System.out.println("PARAM: " + ec.param);<NEW_LINE>s = "select 1/2 /* 3/4 3 / 4*/ from dual";<NEW_LINE>ec = new EscapeLiteralSQL(s).process();<NEW_LINE>System.out.println("SQL Orgin: " + s);<NEW_LINE>System.out.println("SQL Parsed: " + ec.getParsedSql());<NEW_LINE>System.out.println("PARAM: " + ec.param);<NEW_LINE>} | long time = System.currentTimeMillis(); |
1,341,829 | public static DescribeEmgNoticeResponse unmarshall(DescribeEmgNoticeResponse describeEmgNoticeResponse, UnmarshallerContext context) {<NEW_LINE>describeEmgNoticeResponse.setRequestId(context.stringValue("DescribeEmgNoticeResponse.RequestId"));<NEW_LINE>describeEmgNoticeResponse.setTotalCount(context.integerValue("DescribeEmgNoticeResponse.TotalCount"));<NEW_LINE>List<EmgVulGroup> emgVulGroupList = new ArrayList<EmgVulGroup>();<NEW_LINE>for (int i = 0; i < context.lengthValue("DescribeEmgNoticeResponse.EmgVulGroupList.Length"); i++) {<NEW_LINE>EmgVulGroup emgVulGroup = new EmgVulGroup();<NEW_LINE>emgVulGroup.setAliasName(context.stringValue("DescribeEmgNoticeResponse.EmgVulGroupList[" + i + "].AliasName"));<NEW_LINE>emgVulGroup.setName(context.stringValue("DescribeEmgNoticeResponse.EmgVulGroupList[" + i + "].Name"));<NEW_LINE>emgVulGroup.setGmtPublish(context.longValue("DescribeEmgNoticeResponse.EmgVulGroupList[" + i + "].GmtPublish"));<NEW_LINE>emgVulGroup.setDescription(context.stringValue("DescribeEmgNoticeResponse.EmgVulGroupList[" + i + "].Description"));<NEW_LINE>emgVulGroup.setType(context.stringValue<MASK><NEW_LINE>emgVulGroup.setStatus(context.integerValue("DescribeEmgNoticeResponse.EmgVulGroupList[" + i + "].Status"));<NEW_LINE>emgVulGroupList.add(emgVulGroup);<NEW_LINE>}<NEW_LINE>describeEmgNoticeResponse.setEmgVulGroupList(emgVulGroupList);<NEW_LINE>return describeEmgNoticeResponse;<NEW_LINE>} | ("DescribeEmgNoticeResponse.EmgVulGroupList[" + i + "].Type")); |
1,629,966 | public void drawU(UGraphic ug) {<NEW_LINE>final URectangle rect = new URectangle(width, height).rounded(5).ignoreForCompressionOnX();<NEW_LINE>if (UseStyle.useBetaStyle()) {<NEW_LINE>final Style style = getSignature().getMergedStyle(skinParam().getCurrentStyleBuilder());<NEW_LINE>final double shadowing = style.value(<MASK><NEW_LINE>rect.setDeltaShadow(shadowing);<NEW_LINE>colorBar = style.value(PName.BackGroundColor).asColor(skinParam().getThemeStyle(), getIHtmlColorSet());<NEW_LINE>} else {<NEW_LINE>if (skinParam().shadowing(null))<NEW_LINE>rect.setDeltaShadow(3);<NEW_LINE>}<NEW_LINE>ug.apply(colorBar).apply(colorBar.bg()).draw(rect);<NEW_LINE>final Dimension2D dimLabel = label.calculateDimension(ug.getStringBounder());<NEW_LINE>label.drawU(ug.apply(new UTranslate(width + labelMargin, -dimLabel.getHeight() / 2)));<NEW_LINE>} | PName.Shadowing).asDouble(); |
266,780 | public static boolean canCastToJson(Type type) {<NEW_LINE>if (type instanceof UnknownType || type instanceof BooleanType || type instanceof TinyintType || type instanceof SmallintType || type instanceof IntegerType || type instanceof BigintType || type instanceof RealType || type instanceof DoubleType || type instanceof DecimalType || type instanceof VarcharType || type instanceof JsonType || type instanceof TimestampType || type instanceof DateType) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (type instanceof ArrayType) {<NEW_LINE>return canCastToJson(((ArrayType<MASK><NEW_LINE>}<NEW_LINE>if (type instanceof MapType) {<NEW_LINE>MapType mapType = (MapType) type;<NEW_LINE>return (mapType.getKeyType() instanceof UnknownType || isValidJsonObjectKeyType(mapType.getKeyType())) && canCastToJson(mapType.getValueType());<NEW_LINE>}<NEW_LINE>if (type instanceof RowType) {<NEW_LINE>return type.getTypeParameters().stream().allMatch(JsonUtil::canCastToJson);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ) type).getElementType()); |
1,091,241 | public static DescribeSynchronizationObjectModifyStatusResponse unmarshall(DescribeSynchronizationObjectModifyStatusResponse describeSynchronizationObjectModifyStatusResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setRequestId(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.RequestId"));<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setStatus(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.Status"));<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setErrorMessage(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.ErrorMessage"));<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setErrCode(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.ErrCode"));<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setSuccess(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.Success"));<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setErrMessage(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.ErrMessage"));<NEW_LINE>DataInitializationStatus dataInitializationStatus = new DataInitializationStatus();<NEW_LINE>dataInitializationStatus.setStatus(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.DataInitializationStatus.Status"));<NEW_LINE>dataInitializationStatus.setPercent(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.DataInitializationStatus.Percent"));<NEW_LINE>dataInitializationStatus.setErrorMessage(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.DataInitializationStatus.ErrorMessage"));<NEW_LINE>dataInitializationStatus.setProgress(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.DataInitializationStatus.Progress"));<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setDataInitializationStatus(dataInitializationStatus);<NEW_LINE>DataSynchronizationStatus dataSynchronizationStatus = new DataSynchronizationStatus();<NEW_LINE>dataSynchronizationStatus.setStatus(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.DataSynchronizationStatus.Status"));<NEW_LINE>dataSynchronizationStatus.setDelay(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.DataSynchronizationStatus.Delay"));<NEW_LINE>dataSynchronizationStatus.setPercent(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.DataSynchronizationStatus.Percent"));<NEW_LINE>dataSynchronizationStatus.setErrorMessage(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.DataSynchronizationStatus.ErrorMessage"));<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setDataSynchronizationStatus(dataSynchronizationStatus);<NEW_LINE>PrecheckStatus precheckStatus = new PrecheckStatus();<NEW_LINE>precheckStatus.setStatus<MASK><NEW_LINE>precheckStatus.setPercent(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.PrecheckStatus.Percent"));<NEW_LINE>List<CheckItem> detail = new ArrayList<CheckItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeSynchronizationObjectModifyStatusResponse.PrecheckStatus.Detail.Length"); i++) {<NEW_LINE>CheckItem checkItem = new CheckItem();<NEW_LINE>checkItem.setCheckStatus(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.PrecheckStatus.Detail[" + i + "].CheckStatus"));<NEW_LINE>checkItem.setErrorMessage(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.PrecheckStatus.Detail[" + i + "].ErrorMessage"));<NEW_LINE>checkItem.setItemName(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.PrecheckStatus.Detail[" + i + "].ItemName"));<NEW_LINE>checkItem.setRepairMethod(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.PrecheckStatus.Detail[" + i + "].RepairMethod"));<NEW_LINE>detail.add(checkItem);<NEW_LINE>}<NEW_LINE>precheckStatus.setDetail(detail);<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setPrecheckStatus(precheckStatus);<NEW_LINE>StructureInitializationStatus structureInitializationStatus = new StructureInitializationStatus();<NEW_LINE>structureInitializationStatus.setStatus(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.StructureInitializationStatus.Status"));<NEW_LINE>structureInitializationStatus.setPercent(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.StructureInitializationStatus.Percent"));<NEW_LINE>structureInitializationStatus.setErrorMessage(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.StructureInitializationStatus.ErrorMessage"));<NEW_LINE>structureInitializationStatus.setProgress(_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.StructureInitializationStatus.Progress"));<NEW_LINE>describeSynchronizationObjectModifyStatusResponse.setStructureInitializationStatus(structureInitializationStatus);<NEW_LINE>return describeSynchronizationObjectModifyStatusResponse;<NEW_LINE>} | (_ctx.stringValue("DescribeSynchronizationObjectModifyStatusResponse.PrecheckStatus.Status")); |
920,057 | private void replaceImportsAndIncludes(XmlObject xmlObject, Map<String, String> urlToFileMap, String baseUrl) throws Exception {<NEW_LINE>XmlObject[] wsdlImports = xmlObject.selectPath("declare namespace s='http://schemas.xmlsoap.org/wsdl/' .//s:import/@location");<NEW_LINE>for (int i = 0; i < wsdlImports.length; i++) {<NEW_LINE>SimpleValue wsdlImport = ((SimpleValue) wsdlImports[i]);<NEW_LINE>replaceLocation(urlToFileMap, baseUrl, wsdlImport);<NEW_LINE>}<NEW_LINE>XmlObject[] schemaImports = xmlObject.selectPath("declare namespace s='http://www.w3.org/2001/XMLSchema' .//s:import/@schemaLocation");<NEW_LINE>for (int i = 0; i < schemaImports.length; i++) {<NEW_LINE>SimpleValue schemaImport = (<MASK><NEW_LINE>replaceLocation(urlToFileMap, baseUrl, schemaImport);<NEW_LINE>}<NEW_LINE>XmlObject[] schemaIncludes = xmlObject.selectPath("declare namespace s='http://www.w3.org/2001/XMLSchema' .//s:include/@schemaLocation");<NEW_LINE>for (int i = 0; i < schemaIncludes.length; i++) {<NEW_LINE>SimpleValue schemaInclude = ((SimpleValue) schemaIncludes[i]);<NEW_LINE>replaceLocation(urlToFileMap, baseUrl, schemaInclude);<NEW_LINE>}<NEW_LINE>XmlObject[] wadlImports = xmlObject.selectPath("declare namespace s='" + Constants.WADL10_NS + "' .//s:grammars/s:include/@href");<NEW_LINE>for (int i = 0; i < wadlImports.length; i++) {<NEW_LINE>SimpleValue wadlImport = ((SimpleValue) wadlImports[i]);<NEW_LINE>replaceLocation(urlToFileMap, baseUrl, wadlImport);<NEW_LINE>}<NEW_LINE>wadlImports = xmlObject.selectPath("declare namespace s='" + Constants.WADL11_NS + "' .//s:grammars/s:include/@href");<NEW_LINE>for (int i = 0; i < wadlImports.length; i++) {<NEW_LINE>SimpleValue wadlImport = ((SimpleValue) wadlImports[i]);<NEW_LINE>replaceLocation(urlToFileMap, baseUrl, wadlImport);<NEW_LINE>}<NEW_LINE>} | (SimpleValue) schemaImports[i]); |
1,063,132 | public static boolean isAdvancedViewOnly(DownloadManager dm) {<NEW_LINE>Boolean oisUpdate = (Boolean) dm.getUserData("isAdvancedViewOnly");<NEW_LINE>if (oisUpdate != null) {<NEW_LINE>return oisUpdate.booleanValue();<NEW_LINE>}<NEW_LINE>boolean advanced_view = true;<NEW_LINE>if (!dm.getDownloadState().getFlag(DownloadManagerState.FLAG_LOW_NOISE)) {<NEW_LINE>TOTorrent torrent = dm.getTorrent();<NEW_LINE>if (torrent == null) {<NEW_LINE>advanced_view = false;<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>if (announceURL != null) {<NEW_LINE>String host = announceURL.getHost();<NEW_LINE>if (!(host.endsWith(AELITIS_HOST_CORE) || host.endsWith(VUZE_HOST_CORE))) {<NEW_LINE>advanced_view = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (advanced_view) {<NEW_LINE>TOTorrentAnnounceURLSet[] sets = torrent.getAnnounceURLGroup().getAnnounceURLSets();<NEW_LINE>for (int i = 0; i < sets.length; i++) {<NEW_LINE>URL[] urls = sets[i].getAnnounceURLs();<NEW_LINE>for (int j = 0; j < urls.length; j++) {<NEW_LINE>String host = urls[j].getHost();<NEW_LINE>if (!(host.endsWith(AELITIS_HOST_CORE) || host.endsWith(VUZE_HOST_CORE))) {<NEW_LINE>advanced_view = false;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>dm.setUserData("isAdvancedViewOnly", Boolean.valueOf(advanced_view));<NEW_LINE>return advanced_view;<NEW_LINE>} | URL announceURL = torrent.getAnnounceURL(); |
1,201,929 | public static QueryUserGroupListByParentIdResponse unmarshall(QueryUserGroupListByParentIdResponse queryUserGroupListByParentIdResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryUserGroupListByParentIdResponse.setRequestId(_ctx.stringValue("QueryUserGroupListByParentIdResponse.RequestId"));<NEW_LINE>queryUserGroupListByParentIdResponse.setSuccess(_ctx.booleanValue("QueryUserGroupListByParentIdResponse.Success"));<NEW_LINE>List<Data> result = new ArrayList<Data>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryUserGroupListByParentIdResponse.Result.Length"); i++) {<NEW_LINE>Data data = new Data();<NEW_LINE>data.setIdentifiedPath(_ctx.stringValue("QueryUserGroupListByParentIdResponse.Result[" + i + "].IdentifiedPath"));<NEW_LINE>data.setModifiedTime(_ctx.stringValue<MASK><NEW_LINE>data.setCreateUser(_ctx.stringValue("QueryUserGroupListByParentIdResponse.Result[" + i + "].CreateUser"));<NEW_LINE>data.setCreateTime(_ctx.stringValue("QueryUserGroupListByParentIdResponse.Result[" + i + "].CreateTime"));<NEW_LINE>data.setUserGroupId(_ctx.stringValue("QueryUserGroupListByParentIdResponse.Result[" + i + "].UserGroupId"));<NEW_LINE>data.setUserGroupName(_ctx.stringValue("QueryUserGroupListByParentIdResponse.Result[" + i + "].UserGroupName"));<NEW_LINE>data.setModifyUser(_ctx.stringValue("QueryUserGroupListByParentIdResponse.Result[" + i + "].ModifyUser"));<NEW_LINE>data.setParentUserGroupId(_ctx.stringValue("QueryUserGroupListByParentIdResponse.Result[" + i + "].ParentUserGroupId"));<NEW_LINE>data.setUserGroupDescription(_ctx.stringValue("QueryUserGroupListByParentIdResponse.Result[" + i + "].UserGroupDescription"));<NEW_LINE>result.add(data);<NEW_LINE>}<NEW_LINE>queryUserGroupListByParentIdResponse.setResult(result);<NEW_LINE>return queryUserGroupListByParentIdResponse;<NEW_LINE>} | ("QueryUserGroupListByParentIdResponse.Result[" + i + "].ModifiedTime")); |
756,872 | private void execute0(Throwable[] death, EObject result) throws ErlangHalt, ThreadDeath, Pausable {<NEW_LINE>try {<NEW_LINE>result = execute1();<NEW_LINE>} catch (NotImplemented e) {<NEW_LINE>log.log(Level.SEVERE, "[fail] exiting " + self_handle(), e);<NEW_LINE>result = e.reason();<NEW_LINE>death[0] = e;<NEW_LINE>} catch (ErlangException e) {<NEW_LINE>log.log(Level.FINE, "[erl] exiting " + self_handle(), e);<NEW_LINE>last_exception = e;<NEW_LINE>result = e.reason();<NEW_LINE>death[0] = e;<NEW_LINE>} catch (ErlangExitSignal e) {<NEW_LINE>log.log(Level.FINE, <MASK><NEW_LINE>result = e.reason();<NEW_LINE>death[0] = e;<NEW_LINE>} catch (ErlangHalt e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Throwable e) {<NEW_LINE>log.log(Level.SEVERE, "[java] exiting " + self_handle() + " with: ", e);<NEW_LINE>ESeq erl_trace = ErlangError.decodeTrace(e.getStackTrace());<NEW_LINE>ETuple java_ex = ETuple.make(am_java_exception, EString.fromString(ERT.describe_exception(e)));<NEW_LINE>result = ETuple.make(java_ex, erl_trace);<NEW_LINE>death[0] = e;<NEW_LINE>} finally {<NEW_LINE>set_state_to_done_and_wait_for_stability();<NEW_LINE>}<NEW_LINE>if (result != am_normal && monitors.isEmpty() && has_no_links() && !(death[0] instanceof ErlangExitSignal)) {<NEW_LINE>EFun fun = EModuleManager.resolve(new FunID(am_error_logger, am_info_report, 1));<NEW_LINE>String msg = "Process " + self_handle() + " exited abnormally without links/monitors\n" + "exit reason was: " + result + "\n" + (death[0] == null ? "" : ERT.describe_exception(death[0]));<NEW_LINE>try {<NEW_LINE>fun.invoke(this, new EObject[] { EString.fromString(msg) });<NEW_LINE>} catch (ErlangHalt e) {<NEW_LINE>throw e;<NEW_LINE>} catch (ThreadDeath e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Throwable e) {<NEW_LINE>System.err.println(msg);<NEW_LINE>e.printStackTrace();<NEW_LINE>// ignore //<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// System.err.println("task "+this+" exited with "+result);<NEW_LINE>do_proc_termination(result);<NEW_LINE>} | "[signal] exiting " + self_handle(), e); |
1,146,380 | public Animator createAnimator(final ViewGroup root, TransitionValues valuesStart, final TransitionValues valuesEnd) {<NEW_LINE>Animator bounds = super.createAnimator(root, valuesStart, valuesEnd);<NEW_LINE>if (valuesStart == null || valuesEnd == null || bounds == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Integer colorStart = (Integer) valuesStart.values.get(PROPERTY_COLOR);<NEW_LINE>Integer radiusStart = (Integer) valuesStart.values.get(PROPERTY_RADIUS);<NEW_LINE>Integer colorEnd = (Integer) valuesEnd.values.get(PROPERTY_COLOR);<NEW_LINE>Integer radiusEnd = (Integer) <MASK><NEW_LINE>if (colorStart == null || radiusStart == null || colorEnd == null || radiusEnd == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>MorphDrawable background = new MorphDrawable(colorStart, radiusStart);<NEW_LINE>valuesEnd.view.setBackground(background);<NEW_LINE>Animator color = ObjectAnimator.ofArgb(background, MorphDrawable.COLOR, colorEnd);<NEW_LINE>Animator corners = ObjectAnimator.ofFloat(background, MorphDrawable.RADIUS, radiusEnd);<NEW_LINE>TimeInterpolator interpolator = AnimationUtils.loadInterpolator(root.getContext(), android.R.interpolator.fast_out_slow_in);<NEW_LINE>if (valuesEnd.view instanceof ViewGroup) {<NEW_LINE>ViewGroup viewGroup = (ViewGroup) valuesEnd.view;<NEW_LINE>float offset = viewGroup.getHeight() / 3f;<NEW_LINE>for (int i = 0; i < viewGroup.getChildCount(); i++) {<NEW_LINE>View child = viewGroup.getChildAt(i);<NEW_LINE>child.setTranslationY(offset);<NEW_LINE>child.setAlpha(0f);<NEW_LINE>child.animate().alpha(1f).translationY(0f).setDuration(DURATION_HALF).setStartDelay(DURATION_HALF).setInterpolator(interpolator);<NEW_LINE>offset *= 1.8f;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>AnimatorSet transition = new AnimatorSet();<NEW_LINE>transition.playTogether(bounds, corners, color);<NEW_LINE>transition.setDuration(DURATION);<NEW_LINE>transition.setInterpolator(interpolator);<NEW_LINE>return transition;<NEW_LINE>} | valuesEnd.values.get(PROPERTY_RADIUS); |
1,392,867 | public void saveAction(SaveActionParam data) throws RuntimeException {<NEW_LINE>log.info("----get save action params data: {}", data);<NEW_LINE>log.info("----get empid: {}", data.getEmpId());<NEW_LINE>ActionDO actionDO = new ActionDO();<NEW_LINE>actionDO.setUuid(UUID.randomUUID().toString());<NEW_LINE>actionDO.setStatus(data.getStatus());<NEW_LINE>actionDO.<MASK><NEW_LINE>actionDO.setStartTime(data.getCreateTime());<NEW_LINE>actionDO.setEndTime(data.getCreateTime());<NEW_LINE>actionDO.setExecData(data.getExecData().toJSONString());<NEW_LINE>actionDO.setActionMetaData(data.getActionMeta().toJSONString());<NEW_LINE>actionDO.setActionLabel(data.getActionLabel());<NEW_LINE>actionDO.setActionId(data.getActionId());<NEW_LINE>actionDO.setActionName(data.getActionName());<NEW_LINE>actionDO.setEmpId(data.getEmpId());<NEW_LINE>actionDO.setAppCode(data.getAppCode());<NEW_LINE>actionDO.setElementId(data.getElementId());<NEW_LINE>actionDO.setActionType(data.getActionType());<NEW_LINE>actionDO.setEntityType(data.getEntityType());<NEW_LINE>actionDO.setEntityValue(data.getEntityValue());<NEW_LINE>actionDO.setProcessor(data.getProcessorInfo().toJSONString());<NEW_LINE>actionDO.setNode(data.getNode());<NEW_LINE>// if (data.getRole() == null || data.getRole().isEmpty()) {<NEW_LINE>// orderService.createOrder(actionDO);<NEW_LINE>// }<NEW_LINE>// else {<NEW_LINE>// orderService.createOrder(actionDO, data.getRole());<NEW_LINE>// }<NEW_LINE>actionDAO.insert(actionDO);<NEW_LINE>} | setCreateTime(data.getCreateTime()); |
170,234 | void update(int pos, int offsetDelta, int base, int entry) {<NEW_LINE>int oldPos = position;<NEW_LINE>position = oldPos + offsetDelta + (oldPos == 0 ? 0 : 1);<NEW_LINE>int newDelta = offsetDelta;<NEW_LINE>if (where == position)<NEW_LINE>newDelta = offsetDelta - gap;<NEW_LINE>else if (where == oldPos)<NEW_LINE>newDelta = offsetDelta + gap;<NEW_LINE>else<NEW_LINE>return;<NEW_LINE>if (offsetDelta < 64)<NEW_LINE>if (newDelta < 64)<NEW_LINE>info[pos] = (byte) (newDelta + base);<NEW_LINE>else {<NEW_LINE>byte[] newinfo = insertGap(info, pos, 2);<NEW_LINE>newinfo[pos] = (byte) entry;<NEW_LINE>ByteArray.write16bit(newDelta, newinfo, pos + 1);<NEW_LINE>updatedInfo = newinfo;<NEW_LINE>}<NEW_LINE>else if (newDelta < 64) {<NEW_LINE>byte[] newinfo = deleteGap(info, pos, 2);<NEW_LINE>newinfo[pos] = <MASK><NEW_LINE>updatedInfo = newinfo;<NEW_LINE>} else<NEW_LINE>ByteArray.write16bit(newDelta, info, pos + 1);<NEW_LINE>} | (byte) (newDelta + base); |
407,764 | public Texture2D readSampler(int samplerIndex, Texture2D texture) throws IOException {<NEW_LINE>if (samplers == null) {<NEW_LINE>throw new AssetLoadException("No samplers defined");<NEW_LINE>}<NEW_LINE>JsonObject sampler = samplers.<MASK><NEW_LINE>Texture.MagFilter magFilter = getMagFilter(getAsInteger(sampler, "magFilter"));<NEW_LINE>Texture.MinFilter minFilter = getMinFilter(getAsInteger(sampler, "minFilter"));<NEW_LINE>Texture.WrapMode wrapS = getWrapMode(getAsInteger(sampler, "wrapS"));<NEW_LINE>Texture.WrapMode wrapT = getWrapMode(getAsInteger(sampler, "wrapT"));<NEW_LINE>if (magFilter != null) {<NEW_LINE>texture.setMagFilter(magFilter);<NEW_LINE>}<NEW_LINE>if (minFilter != null) {<NEW_LINE>texture.setMinFilter(minFilter);<NEW_LINE>}<NEW_LINE>texture.setWrap(Texture.WrapAxis.S, wrapS);<NEW_LINE>texture.setWrap(Texture.WrapAxis.T, wrapT);<NEW_LINE>texture = customContentManager.readExtensionAndExtras("texture.sampler", sampler, texture);<NEW_LINE>return texture;<NEW_LINE>} | get(samplerIndex).getAsJsonObject(); |
1,797,390 | void onWaypointTransition(@NonNull WaypointModel waypointModel, @NonNull final Location location, final int transition, @NonNull final String trigger) {<NEW_LINE>Timber.v("geofence %s/%s transition:%s, trigger:%s", waypointModel.getTst(), waypointModel.getDescription(), transition == Geofence.GEOFENCE_TRANSITION_ENTER ? "enter" : "exit", trigger);<NEW_LINE>if (ignoreLowAccuracy(location)) {<NEW_LINE>Timber.d("ignoring transition: low accuracy ");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Don't send transition if the region is already triggered<NEW_LINE>// If the region status is unknown, send transition only if the device is inside<NEW_LINE>if (((transition == waypointModel.getLastTransition()) || (waypointModel.isUnknown() && transition == Geofence.GEOFENCE_TRANSITION_EXIT))) {<NEW_LINE>Timber.d("ignoring initial or duplicate transition: %s", waypointModel.getDescription());<NEW_LINE>waypointModel.setLastTransition(transition);<NEW_LINE>waypointsRepo.update(waypointModel, false);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>waypointModel.setLastTransition(transition);<NEW_LINE>waypointModel.setLastTriggeredNow();<NEW_LINE><MASK><NEW_LINE>if (preferences.getMonitoring() == MONITORING_QUIET) {<NEW_LINE>Timber.v("message suppressed by monitoring settings: %s", preferences.getMonitoring());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>publishTransitionMessage(waypointModel, location, transition, trigger);<NEW_LINE>if (trigger.equals(MessageTransition.TRIGGER_CIRCULAR)) {<NEW_LINE>publishLocationMessage(MessageLocation.REPORT_TYPE_CIRCULAR);<NEW_LINE>}<NEW_LINE>} | waypointsRepo.update(waypointModel, false); |
1,533,417 | private void createEditorNode() {<NEW_LINE>EventHandler<KeyEvent> keyEventsHandler = t -> {<NEW_LINE>if (t.getCode() == KeyCode.ENTER) {<NEW_LINE>commitHelper(false);<NEW_LINE>} else if (t.getCode() == KeyCode.ESCAPE) {<NEW_LINE>cancelEdit();<NEW_LINE>} else if (t.getCode() == KeyCode.TAB) {<NEW_LINE>commitHelper(false);<NEW_LINE>editNext(!t.isShiftDown());<NEW_LINE>}<NEW_LINE>};<NEW_LINE>ChangeListener<Boolean> focusChangeListener = (observable, oldValue, newValue) -> {<NEW_LINE>// This focus listener fires at the end of cell editing when focus is lost<NEW_LINE>// and when enter is pressed (because that causes the text field to lose focus).<NEW_LINE>// The problem is that if enter is pressed then cancelEdit is called before this<NEW_LINE>// listener runs and therefore the text field has been cleaned up. If the<NEW_LINE>// text field is null we don't commit the edit. This has the useful side effect<NEW_LINE>// of stopping the double commit.<NEW_LINE>if (editorNode != null && !newValue) {<NEW_LINE>commitHelper(true);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>editorNode = builder.createNode(<MASK><NEW_LINE>} | getValue(), keyEventsHandler, focusChangeListener); |
328,485 | private Mono<Response<MoveCollectionInner>> createWithResponseAsync(String resourceGroupName, String moveCollectionName, MoveCollectionInner body, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (moveCollectionName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter moveCollectionName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (body != null) {<NEW_LINE>body.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, moveCollectionName, this.client.getApiVersion(), body, accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); |
1,222,325 | @Consumes(MediaType.APPLICATION_JSON)<NEW_LINE>@Produces(MediaType.APPLICATION_JSON)<NEW_LINE>@ApiOperation(value = "Adds a project to a notification rule", response = NotificationRule.class)<NEW_LINE>@ApiResponses(value = { @ApiResponse(code = 304, message = "The rule already has the specified project assigned"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 404, message = "The notification rule or project could not be found") })<NEW_LINE>@PermissionRequired(Permissions.Constants.SYSTEM_CONFIGURATION)<NEW_LINE>public Response addProjectToRule(@ApiParam(value = "The UUID of the rule to add a project to", required = true) @PathParam("ruleUuid") String ruleUuid, @ApiParam(value = "The UUID of the project to add to the rule", required = true) @PathParam("projectUuid") String projectUuid) {<NEW_LINE>try (QueryManager qm = new QueryManager()) {<NEW_LINE>final NotificationRule rule = qm.getObjectByUuid(NotificationRule.class, ruleUuid);<NEW_LINE>if (rule == null) {<NEW_LINE>return Response.status(Response.Status.NOT_FOUND).entity("The notification rule could not be found.").build();<NEW_LINE>}<NEW_LINE>if (rule.getScope() != NotificationScope.PORTFOLIO) {<NEW_LINE>return Response.status(Response.Status.NOT_ACCEPTABLE).entity("Project limitations are only possible on notification rules with PORTFOLIO scope.").build();<NEW_LINE>}<NEW_LINE>final Project project = qm.getObjectByUuid(Project.class, projectUuid);<NEW_LINE>if (project == null) {<NEW_LINE>return Response.status(Response.Status.NOT_FOUND).entity("The project could not be found.").build();<NEW_LINE>}<NEW_LINE>final List<Project> projects = rule.getProjects();<NEW_LINE>if (projects != null && !projects.contains(project)) {<NEW_LINE>rule.getProjects().add(project);<NEW_LINE>qm.persist(rule);<NEW_LINE>return Response.ok(rule).build();<NEW_LINE>}<NEW_LINE>return Response.status(Response.<MASK><NEW_LINE>}<NEW_LINE>} | Status.NOT_MODIFIED).build(); |
1,334,437 | public static int maskArray(@Sensitive byte[] ba, int start, int end, int resume, @Sensitive byte[] masks) {<NEW_LINE>// start is the first valid byte in the array to mask.<NEW_LINE>// end is that last valid byte in the array to mask.<NEW_LINE>// resume holds where we left off masking<NEW_LINE>int i = start;<NEW_LINE>int index0 = (0 + resume) % 4;<NEW_LINE>int index1 = (1 + resume) % 4;<NEW_LINE>int index2 = (2 + resume) % 4;<NEW_LINE>int index3 = (3 + resume) % 4;<NEW_LINE>while (end - i >= 3) {<NEW_LINE>ba[i] = (byte) (ba[i] ^ masks[index0]);<NEW_LINE>i++;<NEW_LINE>ba[i] = (byte) (ba[i] ^ masks[index1]);<NEW_LINE>i++;<NEW_LINE>ba[i] = (byte) (ba[i] ^ masks[index2]);<NEW_LINE>i++;<NEW_LINE>ba[i] = (byte) (ba[<MASK><NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>// 0 -3 bytes left in the array to mask<NEW_LINE>if (i <= end) {<NEW_LINE>ba[i] = (byte) (ba[i] ^ masks[index0]);<NEW_LINE>resume++;<NEW_LINE>i++;<NEW_LINE>if (i <= end) {<NEW_LINE>ba[i] = (byte) (ba[i] ^ masks[index1]);<NEW_LINE>resume++;<NEW_LINE>i++;<NEW_LINE>if (i <= end) {<NEW_LINE>ba[i] = (byte) (ba[i] ^ masks[index2]);<NEW_LINE>resume++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return resume % 4;<NEW_LINE>} | i] ^ masks[index3]); |
922,879 | final DisassociateMemberFromGroupResult executeDisassociateMemberFromGroup(DisassociateMemberFromGroupRequest disassociateMemberFromGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateMemberFromGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisassociateMemberFromGroupRequest> request = null;<NEW_LINE>Response<DisassociateMemberFromGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateMemberFromGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(disassociateMemberFromGroupRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateMemberFromGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateMemberFromGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisassociateMemberFromGroupResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "WorkMail"); |
428,208 | public static void validateSSLOptions(OptionSet options, OptionParser parser, ArgumentAcceptingOptionSpec<String> sslEnabledDatacentersOpt, ArgumentAcceptingOptionSpec<String> sslKeystorePathOpt, ArgumentAcceptingOptionSpec<String> sslKeystoreTypeOpt, ArgumentAcceptingOptionSpec<String> sslTruststorePathOpt, ArgumentAcceptingOptionSpec<String> sslKeystorePasswordOpt, ArgumentAcceptingOptionSpec<String> sslKeyPasswordOpt, ArgumentAcceptingOptionSpec<String> sslTruststorePasswordOpt) throws Exception {<NEW_LINE>String <MASK><NEW_LINE>if (sslEnabledDatacenters.length() != 0) {<NEW_LINE>ArrayList<OptionSpec<?>> listOpt = new ArrayList<OptionSpec<?>>();<NEW_LINE>listOpt.add(sslKeystorePathOpt);<NEW_LINE>listOpt.add(sslKeystoreTypeOpt);<NEW_LINE>listOpt.add(sslKeystorePasswordOpt);<NEW_LINE>listOpt.add(sslKeyPasswordOpt);<NEW_LINE>listOpt.add(sslTruststorePathOpt);<NEW_LINE>listOpt.add(sslTruststorePasswordOpt);<NEW_LINE>for (OptionSpec opt : listOpt) {<NEW_LINE>if (!options.has(opt)) {<NEW_LINE>System.err.println("If sslEnabledDatacenters is not empty, missing required argument \"" + opt + "\"");<NEW_LINE>parser.printHelpOn(System.err);<NEW_LINE>throw new Exception("Lack of SSL arguments " + opt);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | sslEnabledDatacenters = options.valueOf(sslEnabledDatacentersOpt); |
403,532 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>env.compileDeploy("@Name('context') @public create context SegmentedByString partition by theString from SupportBean", path);<NEW_LINE>String[] fields = new String[] { "val0", "val1" };<NEW_LINE>env.<MASK><NEW_LINE>env.addListener("s0");<NEW_LINE>env.sendEventBean(new SupportBean("G1", 10));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 10, null });<NEW_LINE>env.milestone(0);<NEW_LINE>env.sendEventBean(new SupportBean("G2", 20));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 20, null });<NEW_LINE>env.milestone(1);<NEW_LINE>env.sendEventBean(new SupportBean("G1", 11));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { 11, 10 });<NEW_LINE>env.undeployModuleContaining("s0");<NEW_LINE>env.undeployAll();<NEW_LINE>} | compileDeploy("@Name('s0') context SegmentedByString " + "select intPrimitive as val0, prior(1, intPrimitive) as val1 from SupportBean", path); |
1,533,159 | public boolean visit(Assignment node) {<NEW_LINE>Expression leftHandSide = node.getLeftHandSide();<NEW_LINE>if (!considerBinding(resolveBinding(leftHandSide), leftHandSide)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>checkParent(node);<NEW_LINE>Expression rightHandSide = node.getRightHandSide();<NEW_LINE>if (!fIsFieldFinal) {<NEW_LINE>// Write access.<NEW_LINE>AST ast = node.getAST();<NEW_LINE>MethodInvocation invocation = ast.newMethodInvocation();<NEW_LINE>invocation.setName(ast.newSimpleName(fSetter));<NEW_LINE>fReferencingSetter = true;<NEW_LINE>Expression receiver = getReceiver(leftHandSide);<NEW_LINE>if (receiver != null) {<NEW_LINE>invocation.setExpression((Expression) fRewriter.createCopyTarget(receiver));<NEW_LINE>}<NEW_LINE>List<Expression> arguments = invocation.arguments();<NEW_LINE>if (node.getOperator() == Assignment.Operator.ASSIGN) {<NEW_LINE>arguments.add((Expression) fRewriter.createCopyTarget(rightHandSide));<NEW_LINE>} else {<NEW_LINE>// This is the compound assignment case: field+= 10;<NEW_LINE>InfixExpression exp = ast.newInfixExpression();<NEW_LINE>exp.setOperator(ASTNodes.convertToInfixOperator(node.getOperator()));<NEW_LINE>MethodInvocation getter = ast.newMethodInvocation();<NEW_LINE>getter.setName(ast.newSimpleName(fGetter));<NEW_LINE>fReferencingGetter = true;<NEW_LINE>if (receiver != null) {<NEW_LINE>getter.setExpression((Expression) fRewriter.createCopyTarget(receiver));<NEW_LINE>}<NEW_LINE>exp.setLeftOperand(getter);<NEW_LINE>Expression rhs = (Expression) fRewriter.createCopyTarget(rightHandSide);<NEW_LINE>if (NecessaryParenthesesChecker.needsParenthesesForRightOperand(rightHandSide, exp, leftHandSide.resolveTypeBinding())) {<NEW_LINE>ParenthesizedExpression p = ast.newParenthesizedExpression();<NEW_LINE>p.setExpression(rhs);<NEW_LINE>rhs = p;<NEW_LINE>}<NEW_LINE>exp.setRightOperand(rhs);<NEW_LINE>arguments.add(exp);<NEW_LINE>}<NEW_LINE>fRewriter.replace(node<MASK><NEW_LINE>}<NEW_LINE>rightHandSide.accept(this);<NEW_LINE>return false;<NEW_LINE>} | , invocation, createGroupDescription(WRITE_ACCESS)); |
530,455 | private void lf_init_lut() {<NEW_LINE>int filt_lvl;<NEW_LINE>short[] kfTHRLut = new short[MAX_LOOP_FILTER + 1];<NEW_LINE>short[] ifTHRLut = new short[MAX_LOOP_FILTER + 1];<NEW_LINE>for (filt_lvl = 0; filt_lvl <= LoopFilterInfoN.MAX_LOOP_FILTER; ++filt_lvl) {<NEW_LINE>if (filt_lvl >= 40) {<NEW_LINE>kfTHRLut[filt_lvl] = 2;<NEW_LINE>ifTHRLut[filt_lvl] = 3;<NEW_LINE>} else if (filt_lvl >= 20) {<NEW_LINE>kfTHRLut[filt_lvl] = 1;<NEW_LINE>ifTHRLut[filt_lvl] = 2;<NEW_LINE>} else if (filt_lvl >= 15) {<NEW_LINE>kfTHRLut[filt_lvl] = 1;<NEW_LINE>ifTHRLut[filt_lvl] = 1;<NEW_LINE>} else {<NEW_LINE>kfTHRLut[filt_lvl] = 0;<NEW_LINE>ifTHRLut[filt_lvl] = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>hev_thr_lut.put(FrameType.KEY_FRAME, kfTHRLut);<NEW_LINE>hev_thr_lut.put(FrameType.INTER_FRAME, ifTHRLut);<NEW_LINE>mode_lf_lut.put(MBPredictionMode.DC_PRED, (short) 1);<NEW_LINE>mode_lf_lut.put(MBPredictionMode.V_PRED, (short) 1);<NEW_LINE>mode_lf_lut.put(MBPredictionMode<MASK><NEW_LINE>mode_lf_lut.put(MBPredictionMode.TM_PRED, (short) 1);<NEW_LINE>mode_lf_lut.put(MBPredictionMode.B_PRED, (short) 0);<NEW_LINE>mode_lf_lut.put(MBPredictionMode.ZEROMV, (short) 1);<NEW_LINE>mode_lf_lut.put(MBPredictionMode.NEARESTMV, (short) 2);<NEW_LINE>mode_lf_lut.put(MBPredictionMode.NEARMV, (short) 2);<NEW_LINE>mode_lf_lut.put(MBPredictionMode.NEWMV, (short) 2);<NEW_LINE>mode_lf_lut.put(MBPredictionMode.SPLITMV, (short) 3);<NEW_LINE>} | .H_PRED, (short) 1); |
529,632 | Object invoke(String name, Object[] args) {<NEW_LINE>GrpcMethodStub stub = methodStubs.get(name);<NEW_LINE>if (stub == null) {<NEW_LINE>throw Status.INTERNAL.withDescription("gRPC method '" + name + "' does not exist").asRuntimeException();<NEW_LINE>}<NEW_LINE>ClientMethodDescriptor descriptor = stub.descriptor();<NEW_LINE>MethodHandler methodHandler = descriptor.methodHandler();<NEW_LINE>switch(descriptor.descriptor().getType()) {<NEW_LINE>case UNARY:<NEW_LINE>return methodHandler.<MASK><NEW_LINE>case CLIENT_STREAMING:<NEW_LINE>return methodHandler.clientStreaming(args, this::clientStreaming);<NEW_LINE>case SERVER_STREAMING:<NEW_LINE>return methodHandler.serverStreaming(args, this::serverStreaming);<NEW_LINE>case BIDI_STREAMING:<NEW_LINE>return methodHandler.bidirectional(args, this::bidiStreaming);<NEW_LINE>case UNKNOWN:<NEW_LINE>default:<NEW_LINE>throw Status.INTERNAL.withDescription("Unknown or unsupported method type for method " + name).asRuntimeException();<NEW_LINE>}<NEW_LINE>} | unary(args, this::unary); |
993,439 | public EventLogEntryEntity generateEventLogEntry(CommandContext commandContext) {<NEW_LINE>ActivitiMessageEvent messageEvent = (ActivitiMessageEvent) event;<NEW_LINE>Map<String, Object> data = new HashMap<String, Object>();<NEW_LINE>putInMapIfNotNull(data, Fields.ACTIVITY_ID, messageEvent.getActivityId());<NEW_LINE>putInMapIfNotNull(data, Fields.ACTIVITY_NAME, messageEvent.getActivityName());<NEW_LINE>putInMapIfNotNull(data, Fields.PROCESS_DEFINITION_ID, messageEvent.getProcessDefinitionId());<NEW_LINE>putInMapIfNotNull(data, Fields.PROCESS_INSTANCE_ID, messageEvent.getProcessInstanceId());<NEW_LINE>putInMapIfNotNull(data, Fields.EXECUTION_ID, messageEvent.getExecutionId());<NEW_LINE>putInMapIfNotNull(data, Fields.ACTIVITY_TYPE, messageEvent.getActivityType());<NEW_LINE>putInMapIfNotNull(data, Fields.MESSAGE_NAME, messageEvent.getMessageName());<NEW_LINE>putInMapIfNotNull(data, Fields.<MASK><NEW_LINE>return createEventLogEntry(messageEvent.getProcessDefinitionId(), messageEvent.getProcessInstanceId(), messageEvent.getExecutionId(), null, data);<NEW_LINE>} | MESSAGE_DATA, messageEvent.getMessageData()); |
1,317,311 | public byte[] readPrimitiveBytes(EClassifier classifier, ByteBuffer buffer, QueryInterface query) {<NEW_LINE>if (classifier == EcorePackage.eINSTANCE.getEString()) {<NEW_LINE>int length = buffer.getInt();<NEW_LINE>if (length != -1) {<NEW_LINE>byte[] result = new byte[length];<NEW_LINE>buffer.get(result, 0, length);<NEW_LINE>return result;<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else if (classifier == EcorePackage.eINSTANCE.getEInt() || classifier == EcorePackage.eINSTANCE.getEIntegerObject()) {<NEW_LINE>byte[] result = new byte[4];<NEW_LINE>buffer.get(result, 0, 4);<NEW_LINE>return result;<NEW_LINE>} else if (classifier == EcorePackage.eINSTANCE.getELong() || classifier == EcorePackage.eINSTANCE.getELongObject()) {<NEW_LINE>byte[] result = new byte[8];<NEW_LINE>buffer.get(result, 0, 8);<NEW_LINE>return result;<NEW_LINE>} else if (classifier == EcorePackage.eINSTANCE.getEFloat() || classifier == EcorePackage.eINSTANCE.getEFloatObject()) {<NEW_LINE>byte[] result = new byte[4];<NEW_LINE>buffer.get(result, 0, 4);<NEW_LINE>return result;<NEW_LINE>} else if (classifier == EcorePackage.eINSTANCE.getEDouble() || classifier == EcorePackage.eINSTANCE.getEDoubleObject()) {<NEW_LINE>byte[] result = new byte[8];<NEW_LINE>buffer.<MASK><NEW_LINE>return result;<NEW_LINE>} else if (classifier == EcorePackage.eINSTANCE.getEBoolean() || classifier == EcorePackage.eINSTANCE.getEBooleanObject()) {<NEW_LINE>byte[] result = new byte[1];<NEW_LINE>buffer.get(result, 0, 1);<NEW_LINE>return result;<NEW_LINE>} else if (classifier == EcorePackage.eINSTANCE.getEDate()) {<NEW_LINE>byte[] result = new byte[8];<NEW_LINE>buffer.get(result, 0, 8);<NEW_LINE>return result;<NEW_LINE>} else if (classifier == EcorePackage.eINSTANCE.getEByteArray()) {<NEW_LINE>int size = buffer.getInt();<NEW_LINE>byte[] result = new byte[size];<NEW_LINE>buffer.get(result);<NEW_LINE>return result;<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Unsupported type " + classifier.getName());<NEW_LINE>}<NEW_LINE>} | get(result, 0, 8); |
164,765 | final GetSubscriptionAttributesResult executeGetSubscriptionAttributes(GetSubscriptionAttributesRequest getSubscriptionAttributesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getSubscriptionAttributesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetSubscriptionAttributesRequest> request = null;<NEW_LINE>Response<GetSubscriptionAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetSubscriptionAttributesRequestMarshaller().marshall(super.beforeMarshalling(getSubscriptionAttributesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SNS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetSubscriptionAttributes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetSubscriptionAttributesResult> responseHandler = new StaxResponseHandler<GetSubscriptionAttributesResult>(new GetSubscriptionAttributesResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
805,665 | private boolean isServiceVulnerable(NetworkService networkService) {<NEW_LINE>HttpHeaders httpHeaders = HttpHeaders.builder().addHeader(com.google.common.net.HttpHeaders.CONTENT_TYPE, MediaType.JSON_UTF_8.toString()).build();<NEW_LINE>ByteString requestBody = ByteString.copyFromUtf8(payloadString);<NEW_LINE>String targetUri = buildTargetUrl(networkService);<NEW_LINE>try {<NEW_LINE>HttpResponse response = httpClient.send(post(targetUri).setHeaders(httpHeaders).setRequestBody(requestBody).build(), networkService);<NEW_LINE>if (response.status() == HttpStatus.OK && response.bodyString().isPresent()) {<NEW_LINE>String responseBody = response.bodyString().get();<NEW_LINE>if (VULNERABILITY_RESPONSE_PATTERN.matcher(responseBody).find()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.atWarning().withCause(e<MASK><NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ).log("Unable to query '%s'.", targetUri); |
693,240 | public void finalizeEStep(double weight, double prior) {<NEW_LINE>final int dim = covariance.length;<NEW_LINE>this.weight = weight;<NEW_LINE>double f = wsum > Double.MIN_NORMAL && wsum < Double.POSITIVE_INFINITY ? 1. / wsum : 1.;<NEW_LINE>if (prior > 0 && priormatrix != null) {<NEW_LINE>// MAP<NEW_LINE>// Popular default.<NEW_LINE>final double nu = dim + 2.;<NEW_LINE>final double f2 = 1. / (wsum + prior * (nu + dim + 2));<NEW_LINE>for (int i = 0; i < dim; i++) {<NEW_LINE>final double[] row_i = covariance[i], pri_i = priormatrix[i];<NEW_LINE>for (int j = 0; j < i; j++) {<NEW_LINE>// Restore symmetry & scale<NEW_LINE>covariance[j][i] = row_i[j] = (row_i[j] + prior * pri_i[j]) * f2;<NEW_LINE>}<NEW_LINE>// Diagonal<NEW_LINE>row_i[i] = (row_i[i] + prior * pri_i[i]) * f2;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// MLE<NEW_LINE>for (int i = 0; i < dim; i++) {<NEW_LINE>final double[] row_i = covariance[i];<NEW_LINE>for (int j = 0; j < i; j++) {<NEW_LINE>// Restore symmetry & scale<NEW_LINE>covariance[j][i] = row_i[j] *= f;<NEW_LINE>}<NEW_LINE>// Diagonal<NEW_LINE>row_i[i] *= f;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.chol = updateCholesky(covariance, null);<NEW_LINE>this.logNormDet = FastMath.log(weight) - .5 * <MASK><NEW_LINE>if (prior > 0 && priormatrix == null) {<NEW_LINE>priormatrix = copy(covariance);<NEW_LINE>}<NEW_LINE>} | logNorm - getHalfLogDeterminant(this.chol); |
210,032 | protected Object doExecute(ExecutionEvent event) throws ExecutionException {<NEW_LINE>final String networkURL = getGithubURL();<NEW_LINE>if (networkURL == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// Use View<NEW_LINE>// $NON-NLS-1$<NEW_LINE>final String browserViewerFieldName = "viewer";<NEW_LINE>final Class klass = WebBrowserView.class;<NEW_LINE>final IViewPart obj = // $NON-NLS-1$<NEW_LINE>getActivePage().// $NON-NLS-1$<NEW_LINE>showView(// $NON-NLS-1$<NEW_LINE>WebBrowserView.WEB_BROWSER_VIEW_ID, // $NON-NLS-1$<NEW_LINE>"-0", IWorkbenchPage.VIEW_VISIBLE);<NEW_LINE>try {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>Method m = WorkbenchPart.class.getDeclaredMethod("setPartName", String.class);<NEW_LINE>m.setAccessible(true);<NEW_LINE>m.invoke(obj, Messages.GithubNetworkHandler_ViewName);<NEW_LINE>} catch (Exception e) {<NEW_LINE>IdeLog.logError(GitUIPlugin.getDefault(), e, IDebugScopes.DEBUG);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Field f = klass.getDeclaredField(browserViewerFieldName);<NEW_LINE>f.setAccessible(true);<NEW_LINE>final BrowserViewer viewer = (<MASK><NEW_LINE>viewer.getBrowser().addProgressListener(new ProgressListener() {<NEW_LINE><NEW_LINE>public void completed(ProgressEvent event) {<NEW_LINE>String js = getGithubJS();<NEW_LINE>viewer.getBrowser().execute(js);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void changed(ProgressEvent event) {<NEW_LINE>}<NEW_LINE>});<NEW_LINE>viewer.setURL(networkURL);<NEW_LINE>} catch (Exception e) {<NEW_LINE>IdeLog.logError(GitUIPlugin.getDefault(), e, IDebugScopes.DEBUG);<NEW_LINE>}<NEW_LINE>} catch (CoreException e) {<NEW_LINE>IdeLog.logError(GitUIPlugin.getDefault(), e, IDebugScopes.DEBUG);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | BrowserViewer) f.get(obj); |
188,078 | final ListInvitationsResult executeListInvitations(ListInvitationsRequest listInvitationsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listInvitationsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListInvitationsRequest> request = null;<NEW_LINE>Response<ListInvitationsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListInvitationsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listInvitationsRequest));<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, "GuardDuty");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListInvitations");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListInvitationsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListInvitationsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,170,621 | // submit the map/reduce job.<NEW_LINE>public int run(final String[] args) throws Exception {<NEW_LINE>if (args.length != 5) {<NEW_LINE>return printUsage();<NEW_LINE>}<NEW_LINE>int ret_val = 0;<NEW_LINE>nreducers = Integer<MASK><NEW_LINE>Path y_path = new Path(args[1]);<NEW_LINE>Path x_path = new Path(args[2]);<NEW_LINE>double param_a = Double.parseDouble(args[3]);<NEW_LINE>block_width = Integer.parseInt(args[4]);<NEW_LINE>System.out.println("\n-----===[PEGASUS: A Peta-Scale Graph Mining System]===-----\n");<NEW_LINE>System.out.println("[PEGASUS] Computing SaxpyBlock. y_path=" + y_path.getName() + ", x_path=" + x_path.getName() + ", a=" + param_a + "\n");<NEW_LINE>final FileSystem fs = FileSystem.get(getConf());<NEW_LINE>Path saxpy_output = new Path("saxpy_output");<NEW_LINE>if (y_path.getName().equals("saxpy_output")) {<NEW_LINE>System.out.println("saxpy(): output path name is same as the input path name: changing the output path name to saxpy_output1");<NEW_LINE>saxpy_output = new Path("saxpy_output1");<NEW_LINE>ret_val = 1;<NEW_LINE>}<NEW_LINE>fs.delete(saxpy_output);<NEW_LINE>JobClient.runJob(configSaxpy(y_path, x_path, saxpy_output, param_a));<NEW_LINE>System.out.println("\n[PEGASUS] SaxpyBlock computed. Output is saved in HDFS " + saxpy_output.getName() + "\n");<NEW_LINE>return ret_val;<NEW_LINE>// return value : 1 (output path is saxpy_output1)<NEW_LINE>// 0 (output path is saxpy_output)<NEW_LINE>} | .parseInt(args[0]); |
1,380,416 | public TestAttemptContinuation execute() throws InterruptedException, ExecException {<NEW_LINE>SpawnContinuation nextContinuation = null;<NEW_LINE>try {<NEW_LINE>nextContinuation = spawnContinuation.execute();<NEW_LINE>if (!nextContinuation.isDone()) {<NEW_LINE>return new BazelCoveragePostProcessingContinuation(testAction, testMetadataHandler, actionExecutionContext, spawn, resolvedPaths, fileOutErr, streamed, testResultDataBuilder, ImmutableList.<SpawnResult>builder().addAll(primarySpawnResults).addAll(nextContinuation.get()).build(), nextContinuation);<NEW_LINE>}<NEW_LINE>} catch (SpawnExecException e) {<NEW_LINE>if (e.isCatastrophic()) {<NEW_LINE>closeSuppressed(e, streamed);<NEW_LINE>closeSuppressed(e, fileOutErr);<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>if (!e.getSpawnResult().setupSuccess()) {<NEW_LINE>closeSuppressed(e, streamed);<NEW_LINE>closeSuppressed(e, fileOutErr);<NEW_LINE>// Rethrow as the test could not be run and thus there's no point in retrying.<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>testResultDataBuilder.setCachable(e.getSpawnResult().status().isConsideredUserError()).setTestPassed(false).setStatus(e.hasTimedOut() ? <MASK><NEW_LINE>} catch (ExecException | InterruptedException e) {<NEW_LINE>closeSuppressed(e, fileOutErr);<NEW_LINE>closeSuppressed(e, streamed);<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>return new BazelTestAttemptContinuation(testAction, testMetadataHandler, actionExecutionContext, spawn, resolvedPaths, fileOutErr, streamed, /* startTimeMillis= */<NEW_LINE>0, nextContinuation, testResultDataBuilder, primarySpawnResults);<NEW_LINE>} | BlazeTestStatus.TIMEOUT : BlazeTestStatus.FAILED); |
1,833,840 | private List<EffigyFieldPair> pairByMinDifference() {<NEW_LINE>List<EffigyFieldPair> fieldPairs = new ArrayList<EffigyFieldPair>();<NEW_LINE>BitSet pairedFromIndices = new BitSet(from.getFields().size());<NEW_LINE>BitSet pairedToIndices = new BitSet(to.getFields().size());<NEW_LINE>int[] maxDiffBackoff = new int[] { 1, 2, <MASK><NEW_LINE>int maxPairs = Math.min(from.getFields().size(), to.getFields().size());<NEW_LINE>for (int i = 0; i < maxDiffBackoff.length && fieldPairs.size() < maxPairs; i++) {<NEW_LINE>long[] diffMatrixElements = pair(pairedFromIndices, pairedToIndices, maxDiffBackoff[i]);<NEW_LINE>Arrays.sort(diffMatrixElements);<NEW_LINE>for (long matrixElement : diffMatrixElements) {<NEW_LINE>if (fieldPairs.size() == maxPairs)<NEW_LINE>break;<NEW_LINE>int diffScore = getDiffScore(matrixElement);<NEW_LINE>if (diffScore == MAX_MATRIX_ELEMENT_FIELD_VALUE)<NEW_LINE>break;<NEW_LINE>int fromIndex = getFromIndex(matrixElement);<NEW_LINE>int toIndex = getToIndex(matrixElement);<NEW_LINE>if (pairedFromIndices.get(fromIndex))<NEW_LINE>continue;<NEW_LINE>if (pairedToIndices.get(toIndex))<NEW_LINE>continue;<NEW_LINE>fieldPairs.add(new EffigyFieldPair(from.getFields().get(fromIndex), to.getFields().get(toIndex), fromIndex, toIndex));<NEW_LINE>pairedFromIndices.set(fromIndex);<NEW_LINE>pairedToIndices.set(toIndex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>addUnmatchedElements(fieldPairs, pairedFromIndices, pairedToIndices);<NEW_LINE>return fieldPairs;<NEW_LINE>} | 4, 8, Integer.MAX_VALUE }; |
1,141,311 | public static Object[] optionListsFromValues(Component c, String func, Object... args) {<NEW_LINE>if (args.length == 0) {<NEW_LINE>return args;<NEW_LINE>}<NEW_LINE>Method calledFunc = getMethod(c, func);<NEW_LINE>if (calledFunc == null) {<NEW_LINE>return args;<NEW_LINE>}<NEW_LINE>Annotation[][<MASK><NEW_LINE>int i = 0;<NEW_LINE>for (Annotation[] annotations : paramAnnotations) {<NEW_LINE>for (Annotation annotation : annotations) {<NEW_LINE>if (annotation.annotationType() == Options.class) {<NEW_LINE>Options castAnnotation = (Options) annotation;<NEW_LINE>Class<?> optionListClass = castAnnotation.value();<NEW_LINE>try {<NEW_LINE>Method fromValue = optionListClass.getMethod("fromUnderlyingValue", args[i].getClass());<NEW_LINE>// Extensions might send values to events which aren't covered by the OptionList<NEW_LINE>// definition. In that case send the concrete value. See here for an example:<NEW_LINE>// https://github.com/BeksOmega/appinventor-sources/pull/24#discussion_r480355676<NEW_LINE>Object abstractVal = fromValue.invoke(optionListClass, args[i]);<NEW_LINE>if (abstractVal != null) {<NEW_LINE>args[i] = abstractVal;<NEW_LINE>}<NEW_LINE>} catch (NoSuchMethodException e) {<NEW_LINE>// If it doesn't exist just continue.<NEW_LINE>} catch (IllegalAccessException e) {<NEW_LINE>// If it's not accessible just continue.<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>// If it doesn't work just continue.<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>return args;<NEW_LINE>} | ] paramAnnotations = calledFunc.getParameterAnnotations(); |
1,343,781 | public GetEntitlementsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetEntitlementsResult getEntitlementsResult = new GetEntitlementsResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getEntitlementsResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Entitlements", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getEntitlementsResult.setEntitlements(new ListUnmarshaller<Entitlement>(EntitlementJsonUnmarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getEntitlementsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getEntitlementsResult;<NEW_LINE>} | )).unmarshall(context)); |
468,663 | private Map<String, Object> toJson(Trigger trigger, ZoneId zoneId) throws SchedulerException {<NEW_LINE>Scheduler scheduler = getScheduler();<NEW_LINE>Trigger.TriggerState state = scheduler.getTriggerState(trigger.getKey());<NEW_LINE>Map<String, Object> json = new LinkedHashMap<>();<NEW_LINE>json.put("key", trigger.getKey().toString());<NEW_LINE>json.put("state", state);<NEW_LINE>json.put("priority", trigger.getPriority());<NEW_LINE>Optional.ofNullable(trigger.getCalendarName()).ifPresent(value -> json.put("calendarName", value));<NEW_LINE>Optional.ofNullable(trigger.getDescription()).ifPresent(value -> json.put("description", value));<NEW_LINE>json.put("zoneId", zoneId);<NEW_LINE>json.put("startTime", format(trigger.getStartTime(), zoneId));<NEW_LINE>json.put("endTime", format(trigger.getEndTime(), zoneId));<NEW_LINE>json.put("finalFireTime", format(trigger.getFinalFireTime(), zoneId));<NEW_LINE>json.put("nextFireTime", format(trigger.getNextFireTime(), zoneId));<NEW_LINE>json.put("previousFireTime", format(trigger.getPreviousFireTime(), zoneId));<NEW_LINE>json.put("misfireInstruction", trigger.getMisfireInstruction());<NEW_LINE>json.put("mayFireAgain", trigger.mayFireAgain());<NEW_LINE>if (trigger instanceof CronTrigger) {<NEW_LINE>json.put("cron", ((CronTrigger<MASK><NEW_LINE>} else if (trigger instanceof SimpleTrigger) {<NEW_LINE>json.put("repeatCount", ((SimpleTrigger) trigger).getRepeatCount());<NEW_LINE>json.put("repeatInterval", ((SimpleTrigger) trigger).getRepeatInterval());<NEW_LINE>} else if (trigger instanceof CalendarIntervalTrigger) {<NEW_LINE>json.put("repeatInterval", ((CalendarIntervalTrigger) trigger).getRepeatInterval());<NEW_LINE>json.put("repeatIntervalUnit", ((CalendarIntervalTrigger) trigger).getRepeatIntervalUnit());<NEW_LINE>} else if (trigger instanceof DailyTimeIntervalTrigger) {<NEW_LINE>json.put("repeatInterval", ((DailyTimeIntervalTrigger) trigger).getRepeatInterval());<NEW_LINE>json.put("repeatIntervalUnit", ((DailyTimeIntervalTrigger) trigger).getRepeatIntervalUnit());<NEW_LINE>}<NEW_LINE>json.put("jobDataMap", trigger.getJobDataMap());<NEW_LINE>return json;<NEW_LINE>} | ) trigger).getCronExpression()); |
1,656,830 | public static void downloadUsernotes(String subreddit) {<NEW_LINE>WikiManager manager = new WikiManager(Authentication.reddit);<NEW_LINE>Gson gson = new GsonBuilder().registerTypeAdapter(new TypeToken<Map<String, List<Usernote>>>() {<NEW_LINE>}.getType(), new Usernotes.BlobDeserializer()).create();<NEW_LINE>try {<NEW_LINE>String data = manager.get(subreddit, "usernotes").getContent();<NEW_LINE>Usernotes result = gson.fromJson(data, Usernotes.class);<NEW_LINE>cache.edit().putLong(subreddit + "_usernotes_timestamp", System.currentTimeMillis()).apply();<NEW_LINE>if (result != null && result.getSchema() == 6) {<NEW_LINE>result.setSubreddit(subreddit);<NEW_LINE>notes.put(subreddit, result);<NEW_LINE>cache.edit().putBoolean(subreddit + "_usernotes_exists", true).putString(subreddit + "_usernotes_data", data).apply();<NEW_LINE>} else {<NEW_LINE>cache.edit().putBoolean(subreddit + "_usernotes_exists", false).apply();<NEW_LINE>}<NEW_LINE>} catch (NetworkException | JsonParseException e) {<NEW_LINE>if (e instanceof JsonParseException) {<NEW_LINE>notes.remove(subreddit);<NEW_LINE>} else if (e instanceof NetworkException && ((NetworkException) e).getResponse().getStatusCode() != 404) {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>cache.edit().putLong(subreddit + "_usernotes_timestamp", System.currentTimeMillis()).putBoolean(subreddit + <MASK><NEW_LINE>}<NEW_LINE>} | "_usernotes_exists", false).apply(); |
1,193,006 | public static String repeat(String string, int count) {<NEW_LINE>// eager for GWT.<NEW_LINE>checkNotNull(string);<NEW_LINE>if (count <= 1) {<NEW_LINE>checkArgument(count >= 0, "invalid count: %s", count);<NEW_LINE>return (count == 0) ? "" : string;<NEW_LINE>}<NEW_LINE>// IF YOU MODIFY THE CODE HERE, you must update StringsRepeatBenchmark<NEW_LINE>final int len = string.length();<NEW_LINE>final long longSize = (long) len * (long) count;<NEW_LINE><MASK><NEW_LINE>if (size != longSize) {<NEW_LINE>throw new ArrayIndexOutOfBoundsException("Required array size too large: " + longSize);<NEW_LINE>}<NEW_LINE>final char[] array = new char[size];<NEW_LINE>string.getChars(0, len, array, 0);<NEW_LINE>int n;<NEW_LINE>for (n = len; n < size - n; n <<= 1) {<NEW_LINE>System.arraycopy(array, 0, array, n, n);<NEW_LINE>}<NEW_LINE>System.arraycopy(array, 0, array, n, size - n);<NEW_LINE>return new String(array);<NEW_LINE>} | final int size = (int) longSize; |
232,749 | public List<ImageUrl> parseImages(String html, Chapter chapter) {<NEW_LINE>List<ImageUrl> list = new LinkedList<>();<NEW_LINE>String str = StringUtils.match("cp=\"(.*?)\"", html, 1);<NEW_LINE>if (str != null) {<NEW_LINE>try {<NEW_LINE>str = DecryptionUtils.evalDecrypt(DecryptionUtils.base64Decrypt(str));<NEW_LINE>String[] array = str.split(",");<NEW_LINE>for (int i = 0; i != array.length; ++i) {<NEW_LINE>Long comicChapter = chapter.getId();<NEW_LINE>Long id = Long.<MASK><NEW_LINE>list.add(new ImageUrl(id, comicChapter, i + 1, "http://res.img.youzipi.net/" + array[i], false));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return list;<NEW_LINE>} | parseLong(comicChapter + "000" + i); |
570,468 | public Object executeFunction() {<NEW_LINE>ReferenceExpression symb_arg = this.getSymbArgument(0);<NEW_LINE>Object conc_arg = this.getConcArgument(0);<NEW_LINE>ReferenceExpression symb_ret_val = this.getSymbRetVal();<NEW_LINE>String conc_ret_val = (String) this.getConcRetVal();<NEW_LINE>if (conc_arg != null && conc_arg instanceof String) {<NEW_LINE>String conc_str_arg = (String) conc_arg;<NEW_LINE>ReferenceConstant symb_non_null_str = (ReferenceConstant) symb_arg;<NEW_LINE>StringValue strExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_str_arg, symb_non_null_str, conc_str_arg);<NEW_LINE>ReferenceConstant symb_non_null_ret_val = (ReferenceConstant) symb_ret_val;<NEW_LINE>env.heap.putField(Types.JAVA_LANG_STRING, SymbolicHeap.<MASK><NEW_LINE>}<NEW_LINE>return this.getSymbRetVal();<NEW_LINE>} | $STRING_VALUE, conc_ret_val, symb_non_null_ret_val, strExpr); |
63,229 | private static <T, S> void register(TestGroup<T> group, Transformer<T, S> transformer, TypeHandler<S> handler) {<NEW_LINE>Output output = new Output(Serializer.BUFFER_SIZE);<NEW_LINE>Input input = new Input(output.getBuffer());<NEW_LINE>//<NEW_LINE>//<NEW_LINE>group.//<NEW_LINE>add(//<NEW_LINE>transformer, new BasicSerializer(handler, "kryo-auto-flat", false, false, output, input), new //<NEW_LINE>//<NEW_LINE>SerFeatures(//<NEW_LINE>SerFormat.BINARY, //<NEW_LINE>SerGraph.FLAT_TREE, SerClass.ZERO_KNOWLEDGE, "no class registration, no references"));<NEW_LINE>//<NEW_LINE>//<NEW_LINE>group.//<NEW_LINE>add(//<NEW_LINE>transformer, new BasicSerializer(handler, "kryo-auto", false, true, output, input), new //<NEW_LINE>//<NEW_LINE>SerFeatures(//<NEW_LINE>SerFormat.BINARY, //<NEW_LINE>SerGraph.FULL_GRAPH, SerClass.ZERO_KNOWLEDGE, "no class registration, references"));<NEW_LINE>//<NEW_LINE>//<NEW_LINE>group.//<NEW_LINE>add(//<NEW_LINE>transformer, new BasicSerializer(handler, "kryo-registered-flat", true, false, output, input), new //<NEW_LINE>//<NEW_LINE>SerFeatures(//<NEW_LINE>SerFormat.BINARY, //<NEW_LINE>SerGraph.FLAT_TREE<MASK><NEW_LINE>//<NEW_LINE>//<NEW_LINE>group.//<NEW_LINE>add(//<NEW_LINE>transformer, new BasicSerializer(handler, "kryo-registered", true, true, output, input), new //<NEW_LINE>//<NEW_LINE>SerFeatures(//<NEW_LINE>SerFormat.BINARY, //<NEW_LINE>SerGraph.FULL_GRAPH, SerClass.CLASSES_KNOWN, "class registration, references (typical usage)"));<NEW_LINE>//<NEW_LINE>//<NEW_LINE>group.//<NEW_LINE>add(//<NEW_LINE>transformer, new OptimizedSerializer(handler, "kryo-opt", output, input), new //<NEW_LINE>//<NEW_LINE>SerFeatures(//<NEW_LINE>SerFormat.BINARY, //<NEW_LINE>SerGraph.FLAT_TREE, SerClass.MANUAL_OPT, "manual optimization"));<NEW_LINE>//<NEW_LINE>//<NEW_LINE>group.//<NEW_LINE>add(//<NEW_LINE>transformer, new CustomSerializer(handler, "kryo-manual", output, input), new //<NEW_LINE>//<NEW_LINE>SerFeatures(//<NEW_LINE>SerFormat.BINARY, //<NEW_LINE>SerGraph.FLAT_TREE, SerClass.MANUAL_OPT, "complete manual optimization"));<NEW_LINE>// Unsfe buffers can be much faster with some data, eg large primitive arrays with variable length encoding disabled.<NEW_LINE>// UnsafeOutput unsafeOutput = new UnsafeOutput(Serializer.BUFFER_SIZE);<NEW_LINE>// UnsafeInput unsafeInput = new UnsafeInput(unsafeOutput.getBuffer());<NEW_LINE>// unsafeOutput.setVariableLengthEncoding(false);<NEW_LINE>// unsafeInput.setVariableLengthEncoding(false);<NEW_LINE>// group.add(transformer, new CustomSerializer(handler, "kryo-manual-unsafe", unsafeOutput, unsafeInput), //<NEW_LINE>// new SerFeatures(SerFormat.BINARY, //<NEW_LINE>// SerGraph.FLAT_TREE, //<NEW_LINE>// SerClass.MANUAL_OPT, //<NEW_LINE>// "manually optimized, unsafe buffers"));<NEW_LINE>} | , SerClass.CLASSES_KNOWN, "class registration, no references (typical usage)")); |
215,950 | public Map<String, Object> props() {<NEW_LINE>Map<String, Object> props = new LinkedHashMap<>();<NEW_LINE>applyTemplates(props, getResolvedExtraProperties());<NEW_LINE>props.put(KEY_DISTRIBUTION_NAME, name);<NEW_LINE>props.put(KEY_DISTRIBUTION_EXECUTABLE, executable.getName());<NEW_LINE>props.put(KEY_DISTRIBUTION_EXECUTABLE_NAME, executable.getName());<NEW_LINE>props.put(KEY_DISTRIBUTION_EXECUTABLE_UNIX, executable.resolveExecutable("linux"));<NEW_LINE>props.put(KEY_DISTRIBUTION_EXECUTABLE_WINDOWS, executable.resolveExecutable("windows"));<NEW_LINE>safePut(KEY_DISTRIBUTION_EXECUTABLE_EXTENSION_UNIX, executable.resolveUnixExtension(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_EXECUTABLE_EXTENSION_WINDOWS, executable.<MASK><NEW_LINE>props.put(KEY_DISTRIBUTION_TAGS_BY_SPACE, String.join(" ", tags));<NEW_LINE>props.put(KEY_DISTRIBUTION_TAGS_BY_COMMA, String.join(",", tags));<NEW_LINE>props.putAll(java.getResolvedExtraProperties());<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_GROUP_ID, java.getGroupId(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_ARTIFACT_ID, java.getArtifactId(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_MAIN_CLASS, java.getMainClass(), props, true);<NEW_LINE>if (isNotBlank(java.getVersion())) {<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION, java.getVersion());<NEW_LINE>SemVer jv = SemVer.of(java.getVersion());<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_MAJOR, jv.getMajor(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_MINOR, jv.getMinor(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_PATCH, jv.getPatch(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_TAG, jv.getTag(), props, true);<NEW_LINE>safePut(KEY_DISTRIBUTION_JAVA_VERSION_BUILD, jv.getBuild(), props, true);<NEW_LINE>} else {<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_MAJOR, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_MINOR, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_PATCH, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_TAG, "");<NEW_LINE>props.put(KEY_DISTRIBUTION_JAVA_VERSION_BUILD, "");<NEW_LINE>}<NEW_LINE>return props;<NEW_LINE>} | resolveWindowsExtension(), props, true); |
1,291,827 | public void restoreXml(Element el, SleighBase trans) {<NEW_LINE>defexp = null;<NEW_LINE>triple = null;<NEW_LINE>flags = 0;<NEW_LINE>hand = XmlUtils.decodeUnknownInt(el.getAttributeValue("index"));<NEW_LINE>reloffset = XmlUtils.decodeUnknownInt(el.getAttributeValue("off"));<NEW_LINE>offsetbase = XmlUtils.decodeUnknownInt(el.getAttributeValue("base"));<NEW_LINE>minimumlength = XmlUtils.decodeUnknownInt(el.getAttributeValue("minlen"));<NEW_LINE>String value = el.getAttributeValue("subsym");<NEW_LINE>if (value != null) {<NEW_LINE>int id = XmlUtils.decodeUnknownInt(value);<NEW_LINE>triple = (TripleSymbol) trans.findSymbol(id);<NEW_LINE>}<NEW_LINE>if (XmlUtils.decodeBoolean(el.getAttributeValue("code"))) {<NEW_LINE>flags |= code_address;<NEW_LINE>}<NEW_LINE>List<?> children = el.getChildren();<NEW_LINE>Element firstChild = (Element) children.get(0);<NEW_LINE>localexp = (OperandValue) PatternExpression.restoreExpression(firstChild, trans);<NEW_LINE>localexp.layClaim();<NEW_LINE>if (children.size() > 1) {<NEW_LINE>Element secondChild = (<MASK><NEW_LINE>defexp = PatternExpression.restoreExpression(secondChild, trans);<NEW_LINE>defexp.layClaim();<NEW_LINE>}<NEW_LINE>} | Element) children.get(1); |
1,245,388 | public void send(final MailMessage message) throws MailException {<NEW_LINE>final EmailAccount emailAccount = mailAccountService.getDefaultSender();<NEW_LINE>if (emailAccount == null) {<NEW_LINE>super.send(message);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Preconditions.checkNotNull(message, "mail message can't be null");<NEW_LINE>final Model related = findEntity(message);<NEW_LINE>final MailSender sender = getMailSender(emailAccount);<NEW_LINE>final Set<String> <MASK><NEW_LINE>if (recipients.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final MailMessageRepository messages = Beans.get(MailMessageRepository.class);<NEW_LINE>final MailBuilder builder = sender.compose().subject(getSubject(message, related));<NEW_LINE>for (String recipient : recipients) {<NEW_LINE>builder.to(recipient);<NEW_LINE>}<NEW_LINE>for (MetaAttachment attachment : messages.findAttachments(message)) {<NEW_LINE>final Path filePath = MetaFiles.getPath(attachment.getMetaFile());<NEW_LINE>final File file = filePath.toFile();<NEW_LINE>builder.attach(file.getName(), file.toString());<NEW_LINE>}<NEW_LINE>final MimeMessage email;<NEW_LINE>try {<NEW_LINE>builder.html(template(message, related));<NEW_LINE>email = builder.build(message.getMessageId());<NEW_LINE>final Set<String> references = new LinkedHashSet<>();<NEW_LINE>if (message.getParent() != null) {<NEW_LINE>references.add(message.getParent().getMessageId());<NEW_LINE>}<NEW_LINE>if (message.getRoot() != null) {<NEW_LINE>references.add(message.getRoot().getMessageId());<NEW_LINE>}<NEW_LINE>if (!references.isEmpty()) {<NEW_LINE>email.setHeader("References", Joiner.on(" ").skipNulls().join(references));<NEW_LINE>}<NEW_LINE>} catch (MessagingException | IOException e) {<NEW_LINE>throw new MailException(e);<NEW_LINE>}<NEW_LINE>// send email using a separate process to void thread blocking<NEW_LINE>executor.submit(new Callable<Boolean>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Boolean call() throws Exception {<NEW_LINE>send(sender, email);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | recipients = recipients(message, related); |
282,882 | private ObjectGroup unmarshalObjectGroup(Node t) throws Exception {<NEW_LINE>ObjectGroup og = null;<NEW_LINE>try {<NEW_LINE>og = <MASK><NEW_LINE>} catch (JAXBException e) {<NEW_LINE>// todo: replace with log message<NEW_LINE>e.printStackTrace();<NEW_LINE>return og;<NEW_LINE>}<NEW_LINE>final int offsetX = getAttribute(t, "x", 0);<NEW_LINE>final int offsetY = getAttribute(t, "y", 0);<NEW_LINE>og.setOffset(offsetX, offsetY);<NEW_LINE>final int locked = getAttribute(t, "locked", 0);<NEW_LINE>if (locked != 0) {<NEW_LINE>og.setLocked(1);<NEW_LINE>}<NEW_LINE>// Manually parse the objects in object group<NEW_LINE>og.getObjects().clear();<NEW_LINE>NodeList children = t.getChildNodes();<NEW_LINE>for (int i = 0; i < children.getLength(); i++) {<NEW_LINE>Node child = children.item(i);<NEW_LINE>if ("object".equalsIgnoreCase(child.getNodeName())) {<NEW_LINE>og.addObject(readMapObject(child));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return og;<NEW_LINE>} | unmarshalClass(t, ObjectGroup.class); |
1,612,383 | public void start(Promise<Void> startPromise) {<NEW_LINE>pool = PgPool.pool(vertx, options, new PoolOptions().setMaxSize(5));<NEW_LINE>pool.query("create table jokes(joke varchar(255))").execute().compose(v -> vertx.fileSystem().readFile("jokes.json")).compose(buffer -> {<NEW_LINE>JsonArray array = new JsonArray(buffer);<NEW_LINE>List<Tuple> batch = new ArrayList<>();<NEW_LINE>for (int i = 0; i < array.size(); i++) {<NEW_LINE>String joke = array.getJsonObject(i).getString("joke");<NEW_LINE>batch.add(Tuple.of(joke));<NEW_LINE>}<NEW_LINE>return pool.preparedQuery("insert into jokes values ($1)").executeBatch(batch);<NEW_LINE>}).<Void><MASK><NEW_LINE>vertx.createHttpServer().requestHandler(req -> {<NEW_LINE>pool.query("select joke from jokes ORDER BY random() limit 1").execute().onComplete(res -> {<NEW_LINE>if (res.succeeded() && res.result().size() > 0) {<NEW_LINE>Row row = res.result().iterator().next();<NEW_LINE>String joke = row.getString(0);<NEW_LINE>req.response().putHeader("content-type", "text/plain").end(joke);<NEW_LINE>} else {<NEW_LINE>req.response().setStatusCode(500).end("No jokes available");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}).listen(8082);<NEW_LINE>} | mapEmpty().onComplete(startPromise); |
1,213,439 | protected PwEntry populateNewEntry(PwEntry entry) {<NEW_LINE>PwEntry newEntry;<NEW_LINE>if (entry == null) {<NEW_LINE>newEntry = mEntry.clone(true);<NEW_LINE>} else {<NEW_LINE>newEntry = entry;<NEW_LINE>}<NEW_LINE>Date now = Calendar.getInstance().getTime();<NEW_LINE>newEntry.setLastAccessTime(now);<NEW_LINE>newEntry.setLastModificationTime(now);<NEW_LINE>PwDatabase db = App.getDB().pm;<NEW_LINE>newEntry.setTitle(Util.getEditText(this, R.id.entry_title), db);<NEW_LINE>newEntry.setUrl(Util.getEditText(this, R.id.entry_url), db);<NEW_LINE>newEntry.setUsername(Util.getEditText(this, R.id.entry_user_name), db);<NEW_LINE>newEntry.setNotes(Util.getEditText(this, R<MASK><NEW_LINE>newEntry.setPassword(Util.getEditText(this, R.id.entry_password), db);<NEW_LINE>return newEntry;<NEW_LINE>} | .id.entry_comment), db); |
1,298,114 | public Robot input(String value) {<NEW_LINE>if (highlight) {<NEW_LINE>getFocused().highlight(highlightDuration);<NEW_LINE>}<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>for (char c : value.toCharArray()) {<NEW_LINE>if (Keys.isModifier(c)) {<NEW_LINE>sb.append(c);<NEW_LINE>int[] codes = RobotUtils.KEY_CODES.get(c);<NEW_LINE>if (codes == null) {<NEW_LINE>logger.warn("cannot resolve char: {}", c);<NEW_LINE>robot.keyPress(c);<NEW_LINE>} else {<NEW_LINE>robot.keyPress(codes[0]);<NEW_LINE>}<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>int[] codes = RobotUtils.KEY_CODES.get(c);<NEW_LINE>if (codes == null) {<NEW_LINE>logger.warn("cannot resolve char: {}", c);<NEW_LINE>robot.keyPress(c);<NEW_LINE>robot.keyRelease(c);<NEW_LINE>} else if (codes.length > 1) {<NEW_LINE>robot.keyPress(codes[0]);<NEW_LINE>robot<MASK><NEW_LINE>robot.keyRelease(codes[1]);<NEW_LINE>robot.keyRelease(codes[0]);<NEW_LINE>} else {<NEW_LINE>robot.keyPress(codes[0]);<NEW_LINE>robot.keyRelease(codes[0]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (char c : sb.toString().toCharArray()) {<NEW_LINE>int[] codes = RobotUtils.KEY_CODES.get(c);<NEW_LINE>if (codes == null) {<NEW_LINE>logger.warn("cannot resolve char: {}", c);<NEW_LINE>robot.keyRelease(c);<NEW_LINE>} else {<NEW_LINE>robot.keyRelease(codes[0]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | .keyPress(codes[1]); |
1,050,193 | protected void deploy(DeploymentInfo deploymentInfo) {<NEW_LINE>LOG.info("Deploying JAX-RS deployment for protocol instance : " + this);<NEW_LINE>DeploymentManager manager = Servlets.defaultContainer().addDeployment(deploymentInfo);<NEW_LINE>manager.deploy();<NEW_LINE>HttpHandler httpHandler;<NEW_LINE>// Get realm from owning agent asset<NEW_LINE>String agentRealm = agent.getRealm();<NEW_LINE>if (TextUtil.isNullOrEmpty(agentRealm)) {<NEW_LINE>throw new IllegalStateException("Cannot determine the realm that this agent belongs to");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>httpHandler = manager.start();<NEW_LINE>// Wrap the handler to inject the realm<NEW_LINE>HttpHandler handlerWrapper = exchange -> {<NEW_LINE>exchange.getRequestHeaders().put(HttpString.tryFromString(Constants.REALM_PARAM_NAME), agentRealm);<NEW_LINE>httpHandler.handleRequest(exchange);<NEW_LINE>};<NEW_LINE>WebService.RequestHandler requestHandler = pathStartsWithHandler(deploymentInfo.getDeploymentName(), deploymentInfo.getContextPath(), handlerWrapper);<NEW_LINE>LOG.info("Registering HTTP Server Protocol request handler '" + this.getClass().getSimpleName() + <MASK><NEW_LINE>// Add the handler before the greedy deployment handler<NEW_LINE>webService.getRequestHandlers().add(0, requestHandler);<NEW_LINE>deployment = new DeploymentInstance(deploymentInfo, requestHandler);<NEW_LINE>} catch (ServletException e) {<NEW_LINE>LOG.severe("Failed to deploy deployment: " + deploymentInfo.getDeploymentName());<NEW_LINE>}<NEW_LINE>} | "' for request path: " + deploymentInfo.getContextPath()); |
1,834,036 | public static HAContextID decodeHAID(String haid) throws CSErrorException {<NEW_LINE>if (StringUtils.isBlank(haid)) {<NEW_LINE>throw new CSErrorException(ErrorCode.INVALID_NULL_STRING, "HAIDKey cannot be empty.");<NEW_LINE>}<NEW_LINE>if (!checkHAIDBasicFormat(haid)) {<NEW_LINE>logger.error("Invalid haid : " + haid);<NEW_LINE>throw new CSErrorException(ErrorCode.INVALID_HAID_STRING, "Invalid haid : " + haid);<NEW_LINE>}<NEW_LINE>String[] partArr = haid.split(HAID_PART_DELEMETER);<NEW_LINE>String[] insArr = partArr[0].split(HAID_INS_LEN_DELEMETER);<NEW_LINE>String contextID = null;<NEW_LINE>List<String> instanceList = new ArrayList<>();<NEW_LINE>String insStr = partArr[1];<NEW_LINE>try {<NEW_LINE>int index = 0, tmp = 0;<NEW_LINE>for (String len : insArr) {<NEW_LINE>tmp = Integer.parseInt(len);<NEW_LINE>instanceList.add(insStr.substring(index, index + tmp));<NEW_LINE>index += tmp;<NEW_LINE>}<NEW_LINE>contextID = insStr.substring(index);<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>logger.error("Invalid haid : " + haid + ", " + e.getMessage());<NEW_LINE>throw new CSErrorException(ErrorCode.INVALID_HAID_STRING, "Invalid haid : " + haid + ", " + e.getMessage());<NEW_LINE>}<NEW_LINE>String <MASK><NEW_LINE>return new CommonHAContextID(instance, instanceList.get(0), contextID);<NEW_LINE>} | instance = instanceList.remove(0); |
1,144,910 | static ThreePartName parse(String theProcName) {<NEW_LINE>String procedurePart = null;<NEW_LINE>String ownerPart = null;<NEW_LINE>String databasePart = null;<NEW_LINE>Matcher matcher;<NEW_LINE>if (null != theProcName) {<NEW_LINE>matcher = THREE_PART_NAME.matcher(theProcName);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>if (matcher.group(2) != null) {<NEW_LINE>databasePart = matcher.group(1);<NEW_LINE>// if we have two parts look to see if the last part can be broken even more<NEW_LINE>matcher = THREE_PART_NAME.matcher(matcher.group(2));<NEW_LINE>if (matcher.matches()) {<NEW_LINE>if (null != matcher.group(2)) {<NEW_LINE>ownerPart = matcher.group(1);<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>ownerPart = databasePart;<NEW_LINE>databasePart = null;<NEW_LINE>procedurePart = matcher.group(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>procedurePart = matcher.group(1);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>procedurePart = theProcName;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ThreePartName(databasePart, ownerPart, procedurePart);<NEW_LINE>} | procedurePart = matcher.group(2); |
1,725,918 | public void build(HttpResponse response) {<NEW_LINE>String origin = request.getHttpHeaders().getRequestHeaders().getFirst(ORIGIN_HEADER);<NEW_LINE>if (origin == null) {<NEW_LINE>logger.trace("No origin header ignoring");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!preflight && (allowedOrigins == null || (!allowedOrigins.contains(origin) && !allowedOrigins.contains(ACCESS_CONTROL_ALLOW_ORIGIN_WILDCARD)))) {<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debugv("Invalid CORS request: origin {0} not in allowed origins {1}", origin, allowedOrigins);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>response.getOutputHeaders().add(ACCESS_CONTROL_ALLOW_ORIGIN, origin);<NEW_LINE>if (preflight) {<NEW_LINE>if (allowedMethods != null) {<NEW_LINE>response.getOutputHeaders().add(ACCESS_CONTROL_ALLOW_METHODS, CollectionUtil.join(allowedMethods));<NEW_LINE>} else {<NEW_LINE>response.getOutputHeaders().add(ACCESS_CONTROL_ALLOW_METHODS, DEFAULT_ALLOW_METHODS);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!preflight && exposedHeaders != null) {<NEW_LINE>response.getOutputHeaders().add(ACCESS_CONTROL_EXPOSE_HEADERS<MASK><NEW_LINE>}<NEW_LINE>response.getOutputHeaders().add(ACCESS_CONTROL_ALLOW_CREDENTIALS, Boolean.toString(auth));<NEW_LINE>if (preflight) {<NEW_LINE>if (auth) {<NEW_LINE>response.getOutputHeaders().add(ACCESS_CONTROL_ALLOW_HEADERS, String.format("%s, %s", DEFAULT_ALLOW_HEADERS, AUTHORIZATION_HEADER));<NEW_LINE>} else {<NEW_LINE>response.getOutputHeaders().add(ACCESS_CONTROL_ALLOW_HEADERS, DEFAULT_ALLOW_HEADERS);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (preflight) {<NEW_LINE>response.getOutputHeaders().add(ACCESS_CONTROL_MAX_AGE, DEFAULT_MAX_AGE);<NEW_LINE>}<NEW_LINE>logger.debug("Added CORS headers to response");<NEW_LINE>} | , CollectionUtil.join(exposedHeaders)); |
737,594 | private Mono<Response<Object>> generateUpgradedDefinitionWithResponseAsync(String resourceGroupName, String workflowName, GenerateUpgradedDefinitionParameters parameters, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (workflowName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter workflowName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.generateUpgradedDefinition(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, workflowName, this.client.getApiVersion(<MASK><NEW_LINE>} | ), parameters, accept, context); |
1,469,418 | private static void checkForNullValues(String name, Object[] values) {<NEW_LINE>Preconditions.checkNotNull(name, "name is 'null'.");<NEW_LINE>List<Integer> indexes = new LinkedList<Integer>();<NEW_LINE>for (int i = 0; i < values.length; i++) {<NEW_LINE>if (values[i] == null) {<NEW_LINE>indexes.add(i);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>if (failedIndexCount > 0) {<NEW_LINE>final String valueTxt;<NEW_LINE>final String indexTxt;<NEW_LINE>if (failedIndexCount == 1) {<NEW_LINE>valueTxt = "value";<NEW_LINE>indexTxt = "index";<NEW_LINE>} else {<NEW_LINE>valueTxt = "values";<NEW_LINE>indexTxt = "indexes";<NEW_LINE>}<NEW_LINE>throw new NullPointerException(String.format("'null' %s detected for parameter '%s' on %s : %s", valueTxt, name, indexTxt, indexes.toString()));<NEW_LINE>}<NEW_LINE>} | int failedIndexCount = indexes.size(); |
166,958 | public void addInternalTriggers(Collection<ITriggerInternal> result, IStatementContainer container) {<NEW_LINE>Pipe<?> pipe = null;<NEW_LINE>TileEntity tile = container.getTile();<NEW_LINE>if (tile instanceof TileGenericPipe) {<NEW_LINE>pipe = ((TileGenericPipe) tile).pipe;<NEW_LINE>}<NEW_LINE>if (pipe == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>switch(((TileGenericPipe) tile).getPipeType()) {<NEW_LINE>case ITEM:<NEW_LINE>result.add(TriggerPipeContents.PipeContents.empty.trigger);<NEW_LINE>result.add(TriggerPipeContents.PipeContents.containsItems.trigger);<NEW_LINE>break;<NEW_LINE>case FLUID:<NEW_LINE>result.add(<MASK><NEW_LINE>result.add(TriggerPipeContents.PipeContents.containsFluids.trigger);<NEW_LINE>break;<NEW_LINE>case POWER:<NEW_LINE>result.add(TriggerPipeContents.PipeContents.empty.trigger);<NEW_LINE>result.add(TriggerPipeContents.PipeContents.containsEnergy.trigger);<NEW_LINE>result.add(TriggerPipeContents.PipeContents.tooMuchEnergy.trigger);<NEW_LINE>result.add(TriggerPipeContents.PipeContents.requestsEnergy.trigger);<NEW_LINE>break;<NEW_LINE>case STRUCTURE:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (container instanceof Gate) {<NEW_LINE>((Gate) container).addTriggers(result);<NEW_LINE>}<NEW_LINE>} | TriggerPipeContents.PipeContents.empty.trigger); |
1,610,399 | protected void paintIcon(Graphics2D gfx) {<NEW_LINE><MASK><NEW_LINE>gfx.setStroke(new BasicStroke(scale(1)));<NEW_LINE>gfx.setColor(Color.GRAY);<NEW_LINE>gfx.drawRect(scale(9), scale(0), wh, wh);<NEW_LINE>gfx.setStroke(new BasicStroke(scale(2)));<NEW_LINE>gfx.setColor(Color.BLUE.darker());<NEW_LINE>final var p = new GeneralPath();<NEW_LINE>p.moveTo(scale(1), scale(5));<NEW_LINE>p.quadTo(scale(10), scale(1), scale(14), scale(14));<NEW_LINE>gfx.draw(p);<NEW_LINE>gfx.setColor(Color.GRAY);<NEW_LINE>gfx.setStroke(new BasicStroke(scale(1)));<NEW_LINE>gfx.drawRect(scale(13), scale(13), wh, wh);<NEW_LINE>gfx.drawRect(scale(0), scale(5), wh, wh);<NEW_LINE>} | final var wh = scale(3); |
1,121,924 | CodeTypeElement createDefaultExportProvider(ExportsLibrary libraryExports) {<NEW_LINE>String libraryName = libraryExports.getLibrary().getTemplateType()<MASK><NEW_LINE>CodeTypeElement providerClass = createClass(libraryExports, null, modifiers(PUBLIC, STATIC, FINAL), libraryName + "Provider", null);<NEW_LINE>providerClass.getImplements().add(context.getTypes().DefaultExportProvider);<NEW_LINE>for (ExecutableElement method : ElementFilter.methodsIn(context.getTypes().DefaultExportProvider.asElement().getEnclosedElements())) {<NEW_LINE>CodeExecutableElement m = null;<NEW_LINE>switch(method.getSimpleName().toString()) {<NEW_LINE>case "getLibraryClassName":<NEW_LINE>m = CodeExecutableElement.cloneNoAnnotations(method);<NEW_LINE>m.createBuilder().startReturn().doubleQuote(context.getEnvironment().getElementUtils().getBinaryName(libraryExports.getLibrary().getTemplateType()).toString()).end();<NEW_LINE>break;<NEW_LINE>case "getDefaultExport":<NEW_LINE>m = CodeExecutableElement.cloneNoAnnotations(method);<NEW_LINE>m.createBuilder().startReturn().typeLiteral(libraryExports.getTemplateType().asType()).end();<NEW_LINE>break;<NEW_LINE>case "getReceiverClass":<NEW_LINE>m = CodeExecutableElement.cloneNoAnnotations(method);<NEW_LINE>m.createBuilder().startReturn().typeLiteral(libraryExports.getReceiverType()).end();<NEW_LINE>break;<NEW_LINE>case "getPriority":<NEW_LINE>m = CodeExecutableElement.cloneNoAnnotations(method);<NEW_LINE>m.createBuilder().startReturn().string(String.valueOf(libraryExports.getDefaultExportPriority())).end();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (m != null) {<NEW_LINE>m.getModifiers().remove(Modifier.ABSTRACT);<NEW_LINE>providerClass.add(m);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (providerClass.getEnclosedElements().size() != 4) {<NEW_LINE>throw new AssertionError();<NEW_LINE>}<NEW_LINE>return providerClass;<NEW_LINE>} | .getSimpleName().toString(); |
1,587,778 | public void pushEvent(IntVar var, ICause cause, IntEventType evt, int one, int two, int three) {<NEW_LINE>int size_ = size.get();<NEW_LINE>if (nbEntries != size_) {<NEW_LINE>synchronize(size_);<NEW_LINE>}<NEW_LINE>Entry root = rootEntries.get(var);<NEW_LINE>if (root == null) {<NEW_LINE>throw new Error("Unknown variable. This happens when a constraint is added after the call to `solver.setLearningClause();`");<NEW_LINE>}<NEW_LINE>int pidx = root.p;<NEW_LINE>Entry prev = entries[pidx];<NEW_LINE>assert prev != null;<NEW_LINE>assert prev.v == var;<NEW_LINE>if (mergeConditions(prev, cause)) {<NEW_LINE>mergeEntry(evt, one, prev);<NEW_LINE>} else {<NEW_LINE>addEntry(var, cause, <MASK><NEW_LINE>}<NEW_LINE>assert !XParameters.DEBUG_INTEGRITY || checkIntegrity();<NEW_LINE>} | evt, one, root, prev); |
118,168 | public Mat draw(SegResult result, Mat visualizeMat, ImageBlob imageBlob, int cutoutClass) {<NEW_LINE>int new_h = (int) imageBlob.getNewImageSize()[2];<NEW_LINE>int new_w = (int) <MASK><NEW_LINE>Mat mask = new Mat(new_h, new_w, CvType.CV_32FC(1));<NEW_LINE>float[] scoreData = new float[new_h * new_w];<NEW_LINE>System.arraycopy(result.getMask().getScoreData(), cutoutClass * new_h * new_w, scoreData, 0, new_h * new_w);<NEW_LINE>mask.put(0, 0, scoreData);<NEW_LINE>Core.multiply(mask, new Scalar(255), mask);<NEW_LINE>mask.convertTo(mask, CvType.CV_8UC(1));<NEW_LINE>ListIterator<Map.Entry<String, int[]>> reverseReshapeInfo = new ArrayList<Map.Entry<String, int[]>>(imageBlob.getReshapeInfo().entrySet()).listIterator(imageBlob.getReshapeInfo().size());<NEW_LINE>while (reverseReshapeInfo.hasPrevious()) {<NEW_LINE>Map.Entry<String, int[]> entry = reverseReshapeInfo.previous();<NEW_LINE>if (entry.getKey().equalsIgnoreCase("padding")) {<NEW_LINE>Rect crop_roi = new Rect(0, 0, entry.getValue()[0], entry.getValue()[1]);<NEW_LINE>mask = mask.submat(crop_roi);<NEW_LINE>} else if (entry.getKey().equalsIgnoreCase("resize")) {<NEW_LINE>Size sz = new Size(entry.getValue()[0], entry.getValue()[1]);<NEW_LINE>Imgproc.resize(mask, mask, sz, 0, 0, Imgproc.INTER_LINEAR);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Mat dst = new Mat();<NEW_LINE>List<Mat> listMat = Arrays.asList(visualizeMat, mask);<NEW_LINE>Core.merge(listMat, dst);<NEW_LINE>return dst;<NEW_LINE>} | imageBlob.getNewImageSize()[3]; |
1,365,802 | private Prune prune(Node node, List<Tuple> test, double[] importance, Formula formula, IntSet labels) {<NEW_LINE>if (node instanceof DecisionNode) {<NEW_LINE>DecisionNode leaf = (DecisionNode) node;<NEW_LINE>int y = leaf.output();<NEW_LINE>int error = 0;<NEW_LINE>for (Tuple t : test) {<NEW_LINE>if (y != labels.indexOf(formula.yint(t)))<NEW_LINE>error++;<NEW_LINE>}<NEW_LINE>return new Prune(node, error, leaf.count());<NEW_LINE>}<NEW_LINE>InternalNode parent = (InternalNode) node;<NEW_LINE>List<Tuple> <MASK><NEW_LINE>List<Tuple> falseBranch = new ArrayList<>();<NEW_LINE>for (Tuple t : test) {<NEW_LINE>if (parent.branch(formula.x(t)))<NEW_LINE>trueBranch.add(t);<NEW_LINE>else<NEW_LINE>falseBranch.add(t);<NEW_LINE>}<NEW_LINE>Prune trueChild = prune(parent.trueChild(), trueBranch, importance, formula, labels);<NEW_LINE>Prune falseChild = prune(parent.falseChild(), falseBranch, importance, formula, labels);<NEW_LINE>int[] count = new int[k];<NEW_LINE>for (int i = 0; i < k; i++) {<NEW_LINE>count[i] = trueChild.count[i] + falseChild.count[i];<NEW_LINE>}<NEW_LINE>int y = MathEx.whichMax(count);<NEW_LINE>int error = 0;<NEW_LINE>for (Tuple t : test) {<NEW_LINE>if (y != labels.indexOf(formula.yint(t)))<NEW_LINE>error++;<NEW_LINE>}<NEW_LINE>if (error < trueChild.error + falseChild.error) {<NEW_LINE>node = new DecisionNode(count);<NEW_LINE>importance[parent.feature()] -= parent.score();<NEW_LINE>} else {<NEW_LINE>error = trueChild.error + falseChild.error;<NEW_LINE>node = parent.replace(trueChild.node, falseChild.node);<NEW_LINE>}<NEW_LINE>return new Prune(node, error, count);<NEW_LINE>} | trueBranch = new ArrayList<>(); |
527,362 | protected OracleSchema convertSchema(Map<String, Object> recordMap) {<NEW_LINE>OracleSchema schema = new OracleSchema();<NEW_LINE>schema.setSchema(safeToString(recordMap.get("USERNAME")));<NEW_LINE>schema.setStatus(OracleSchemaStatus.valueOfCode(safeToString(recordMap.get("ACCOUNT_STATUS"))));<NEW_LINE>schema.setLockDate(safeToDate(<MASK><NEW_LINE>schema.setExpiryDate(safeToDate(recordMap.get("EXPIRY_DATE")));<NEW_LINE>schema.setDefaultTablespace(safeToString(recordMap.get("DEFAULT_TABLESPACE")));<NEW_LINE>schema.setTemporaryTablespace(safeToString(recordMap.get("TEMPORARY_TABLESPACE")));<NEW_LINE>schema.setCreated(safeToDate(recordMap.get("CREATED")));<NEW_LINE>schema.setProfile(safeToString(recordMap.get("PROFILE")));<NEW_LINE>schema.setAuthenticationType(OracleSchemaAuthType.valueOfCode(safeToString(recordMap.get("AUTHENTICATION_TYPE"))));<NEW_LINE>schema.setLastLogin(safeToDate(recordMap.get("LAST_LOGIN")));<NEW_LINE>return schema;<NEW_LINE>} | recordMap.get("LOCK_DATE"))); |
459,296 | public Observable<ServiceResponse<Project>> createProjectWithServiceResponseAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter) {<NEW_LINE>if (this.client.endpoint() == null) {<NEW_LINE>throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");<NEW_LINE>}<NEW_LINE>if (name == null) {<NEW_LINE>throw new IllegalArgumentException("Parameter name is required and cannot be null.");<NEW_LINE>}<NEW_LINE>if (this.client.apiKey() == null) {<NEW_LINE>throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");<NEW_LINE>}<NEW_LINE>final String description = createProjectOptionalParameter != null ? createProjectOptionalParameter.description() : null;<NEW_LINE>final UUID domainId = createProjectOptionalParameter != null ? createProjectOptionalParameter.domainId() : null;<NEW_LINE>final String classificationType = createProjectOptionalParameter != null <MASK><NEW_LINE>final List<String> targetExportPlatforms = createProjectOptionalParameter != null ? createProjectOptionalParameter.targetExportPlatforms() : null;<NEW_LINE>return createProjectWithServiceResponseAsync(name, description, domainId, classificationType, targetExportPlatforms);<NEW_LINE>} | ? createProjectOptionalParameter.classificationType() : null; |
550,520 | public static Volume createSecretVolume(String name, String secretName, Map<String, String> items, boolean isOpenshift) {<NEW_LINE>String validName = getValidVolumeName(name);<NEW_LINE>int mode = 0444;<NEW_LINE>if (isOpenshift) {<NEW_LINE>mode = 0440;<NEW_LINE>}<NEW_LINE>List<KeyToPath> keysPaths = new ArrayList<>();<NEW_LINE>for (Map.Entry<String, String> item : items.entrySet()) {<NEW_LINE>KeyToPath keyPath = new KeyToPathBuilder().withKey(item.getKey()).withPath(item.getValue()).build();<NEW_LINE>keysPaths.add(keyPath);<NEW_LINE>}<NEW_LINE>SecretVolumeSource secretVolumeSource = new SecretVolumeSourceBuilder().withDefaultMode(mode).withSecretName(secretName).<MASK><NEW_LINE>Volume volume = new VolumeBuilder().withName(validName).withSecret(secretVolumeSource).build();<NEW_LINE>return volume;<NEW_LINE>} | withItems(keysPaths).build(); |
327,982 | protected int apply(Instrumentation instrumentation, BatchAllocator redefinitionBatchAllocator, Listener redefinitionListener, int batch) {<NEW_LINE>Map<List<Class<?>>, Throwable> failures = new HashMap<List<Class<?>>, Throwable>();<NEW_LINE>PrependableIterator prependableIterator = new PrependableIterator(redefinitionBatchAllocator.batch(this.types));<NEW_LINE>while (prependableIterator.hasNext()) {<NEW_LINE>List<Class<?>> types = prependableIterator.next();<NEW_LINE>redefinitionListener.onBatch(batch, types, this.types);<NEW_LINE>try {<NEW_LINE>doApply(instrumentation, types);<NEW_LINE>} catch (Throwable throwable) {<NEW_LINE>prependableIterator.prepend(redefinitionListener.onError(batch, types<MASK><NEW_LINE>failures.put(types, throwable);<NEW_LINE>}<NEW_LINE>batch += 1;<NEW_LINE>}<NEW_LINE>redefinitionListener.onComplete(batch, types, failures);<NEW_LINE>return batch;<NEW_LINE>} | , throwable, this.types)); |
102,306 | public RestoreAddressToClassicResult unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>RestoreAddressToClassicResult restoreAddressToClassicResult = new RestoreAddressToClassicResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>int xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent == XmlPullParser.END_DOCUMENT)<NEW_LINE>return restoreAddressToClassicResult;<NEW_LINE>if (xmlEvent == XmlPullParser.START_TAG) {<NEW_LINE>if (context.testExpression("status", targetDepth)) {<NEW_LINE>restoreAddressToClassicResult.setStatus(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("publicIp", targetDepth)) {<NEW_LINE>restoreAddressToClassicResult.setPublicIp(StringStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent == XmlPullParser.END_TAG) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return restoreAddressToClassicResult;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().unmarshall(context)); |
1,554,593 | public void listen(FieldChangedEvent fieldChangedEvent) {<NEW_LINE>if (preferencesService.getFilePreferences().shouldFulltextIndexLinkedFiles()) {<NEW_LINE>if (fieldChangedEvent.getField().equals(StandardField.FILE)) {<NEW_LINE>List<LinkedFile> oldFileList = FileFieldParser.parse(fieldChangedEvent.getOldValue());<NEW_LINE>List<LinkedFile> newFileList = FileFieldParser.parse(fieldChangedEvent.getNewValue());<NEW_LINE>List<LinkedFile> addedFiles <MASK><NEW_LINE>addedFiles.remove(oldFileList);<NEW_LINE>List<LinkedFile> removedFiles = new ArrayList<>(oldFileList);<NEW_LINE>removedFiles.remove(newFileList);<NEW_LINE>try {<NEW_LINE>indexingTaskManager.addToIndex(PdfIndexer.of(bibDatabaseContext, preferencesService.getFilePreferences()), fieldChangedEvent.getBibEntry(), addedFiles, bibDatabaseContext);<NEW_LINE>indexingTaskManager.removeFromIndex(PdfIndexer.of(bibDatabaseContext, preferencesService.getFilePreferences()), fieldChangedEvent.getBibEntry(), removedFiles);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOGGER.warn("I/O error when writing lucene index", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = new ArrayList<>(newFileList); |
781,226 | private boolean openCustomEditor(ActionEvent e) {<NEW_LINE>if (getSelectedRowCount() != 1 || getSelectedColumnCount() != 1) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>int row = getSelectedRow();<NEW_LINE>if (row < 0)<NEW_LINE>return false;<NEW_LINE>int column = getSelectedColumn();<NEW_LINE>if (column < 0)<NEW_LINE>return false;<NEW_LINE>Object <MASK><NEW_LINE>if (!(o instanceof Node.Property)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Node.Property p = (Node.Property) o;<NEW_LINE>if (!Boolean.TRUE.equals(p.getValue("suppressCustomEditor"))) {<NEW_LINE>// NOI18N<NEW_LINE>PropertyPanel panel = new PropertyPanel(p);<NEW_LINE>@SuppressWarnings("deprecation")<NEW_LINE>PropertyEditor ed = panel.getPropertyEditor();<NEW_LINE>if ((ed != null) && ed.supportsCustomEditor()) {<NEW_LINE>// NOI18N<NEW_LINE>Action act = panel.getActionMap().get("invokeCustomEditor");<NEW_LINE>if (act != null) {<NEW_LINE>act.actionPerformed(null);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | o = getValueAt(row, column); |
680,672 | /* Build call for throttlingBlacklistConditionIdGet */<NEW_LINE>private com.squareup.okhttp.Call throttlingBlacklistConditionIdGetCall(String conditionId, String ifNoneMatch, String ifModifiedSince, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/throttling/blacklist/{conditionId}".replaceAll("\\{format\\}", "json").replaceAll("\\{" + "conditionId" + "\\}", apiClient.escapeString(conditionId.toString()));<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>if (ifNoneMatch != null)<NEW_LINE>localVarHeaderParams.put("If-None-Match", apiClient.parameterToString(ifNoneMatch));<NEW_LINE>if (ifModifiedSince != null)<NEW_LINE>localVarHeaderParams.put("If-Modified-Since", apiClient.parameterToString(ifModifiedSince));<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null)<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>final String[] localVarContentTypes = { "application/json" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>if (progressListener != null) {<NEW_LINE>apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {<NEW_LINE>com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());<NEW_LINE>return originalResponse.newBuilder().body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>String[] <MASK><NEW_LINE>return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);<NEW_LINE>} | localVarAuthNames = new String[] {}; |
154,154 | private Window.RexWinAggCall toWindowAggCall(Map<String, Object> jsonAggCall) {<NEW_LINE>final String aggName = (String) jsonAggCall.get("agg");<NEW_LINE>final SqlAggFunction aggregation = <MASK><NEW_LINE>final Boolean distinct = (Boolean) jsonAggCall.get("distinct");<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final List<Map<String, Object>> args = (List<Map<String, Object>>) jsonAggCall.get("operands");<NEW_LINE>List<RexNode> operands = Lists.newArrayList();<NEW_LINE>for (Map<String, Object> operand : args) {<NEW_LINE>int index = Integer.valueOf(operand.get("input").toString());<NEW_LINE>operands.add(new RexInputRef(index, getInput().getRowType().getFieldList().get(index).getType()));<NEW_LINE>}<NEW_LINE>final RelDataType type = relJson.toType(cluster.getTypeFactory(), jsonAggCall.get("type"));<NEW_LINE>// ordinal must not be null<NEW_LINE>Integer ordinal = Integer.valueOf(jsonAggCall.get("ordinal").toString());<NEW_LINE>Window.RexWinAggCall rexWinAggCall = new Window.RexWinAggCall(aggregation, type, operands, ordinal, false);<NEW_LINE>return rexWinAggCall;<NEW_LINE>} | relJson.toAggregation(aggName, jsonAggCall); |
1,191,153 | Set<Shape> markAndSweep(Model model) {<NEW_LINE>NeighborProvider <MASK><NEW_LINE>MarkerContext context = new MarkerContext(reverseNeighbors, model, sweepFilter);<NEW_LINE>int currentSize;<NEW_LINE>do {<NEW_LINE>currentSize = context.getMarkedForRemoval().size();<NEW_LINE>marker.accept(context);<NEW_LINE>// Find shapes that are only referenced by a shape that has been marked for removal.<NEW_LINE>model.shapes().filter(shape -> !shape.isMemberShape()).forEach(shape -> {<NEW_LINE>if (!context.getMarkedForRemoval().contains(shape)) {<NEW_LINE>Set<Shape> targetedFrom = context.getTargetedFrom(shape);<NEW_LINE>if (!targetedFrom.isEmpty()) {<NEW_LINE>targetedFrom.removeAll(context.getMarkedForRemoval());<NEW_LINE>if (targetedFrom.isEmpty()) {<NEW_LINE>context.markShape(shape);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} while (currentSize != context.getMarkedForRemoval().size());<NEW_LINE>return context.getMarkedForRemoval();<NEW_LINE>} | reverseNeighbors = NeighborProvider.reverse(model); |
768,355 | protected void handleTaskDone(Tag tagTaskDone, IMetaMember member) {<NEW_LINE>Map<String, String> attrs = tagTaskDone.getAttributes();<NEW_LINE>if (attrs.containsKey(ATTR_NMSIZE)) {<NEW_LINE>long nmsize = Long.parseLong(attrs.get(ATTR_NMSIZE));<NEW_LINE>model.addNativeBytes(nmsize);<NEW_LINE>}<NEW_LINE>if (member != null) {<NEW_LINE>Tag parent = tagTaskDone.getParent();<NEW_LINE>String compileID = null;<NEW_LINE>if (TAG_TASK.equals(parent.getName())) {<NEW_LINE>compileID = parent.getAttributes().get(ATTR_COMPILE_ID);<NEW_LINE>if (compileID != null) {<NEW_LINE>setTagTaskDone(compileID, tagTaskDone, member);<NEW_LINE>} else {<NEW_LINE>logger.warn("No compile_id attribute found on task");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.warn(<MASK><NEW_LINE>}<NEW_LINE>// prevents attr overwrite by next task_done if next member not<NEW_LINE>// found due to classpath issues<NEW_LINE>currentMember = null;<NEW_LINE>}<NEW_LINE>} | "Unexpected parent of task_done: {}", parent.getName()); |
671,208 | private void initComponentsMore() {<NEW_LINE>contentPanel.setLayout(new GridBagLayout());<NEW_LINE>// NOI18N<NEW_LINE>contentPanel.setBackground(UIManager.getColor("Table.background"));<NEW_LINE>int row = 0;<NEW_LINE>combos = new ArrayList<>(items.size());<NEW_LINE>// NOI18N<NEW_LINE>Font monoSpaced = new Font("Monospaced", Font.PLAIN, new JLabel().getFont().getSize());<NEW_LINE>FocusListener focusListener = new FocusAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void focusGained(FocusEvent e) {<NEW_LINE>Component c = e.getComponent();<NEW_LINE><MASK><NEW_LINE>contentPanel.scrollRectToVisible(r);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>for (int i = 0; i < items.size(); i++) {<NEW_LINE>ResolveDeclarationItem item = items.get(i);<NEW_LINE>JComboBox jComboBox = createComboBox(item, monoSpaced, focusListener);<NEW_LINE>combos.add(jComboBox);<NEW_LINE>JLabel lblSimpleName = new JLabel(item.getName());<NEW_LINE>lblSimpleName.setOpaque(false);<NEW_LINE>lblSimpleName.setFont(monoSpaced);<NEW_LINE>lblSimpleName.setLabelFor(jComboBox);<NEW_LINE>contentPanel.add(lblSimpleName, new GridBagConstraints(0, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 5, 2, 5), 0, 0));<NEW_LINE>contentPanel.add(jComboBox, new GridBagConstraints(1, row++, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 2, 5), 0, 0));<NEW_LINE>}<NEW_LINE>contentPanel.add(new JLabel(), new GridBagConstraints(2, row, 2, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));<NEW_LINE>Dimension d = contentPanel.getPreferredSize();<NEW_LINE>d.height = getRowHeight() * Math.min(combos.size(), 6);<NEW_LINE>} | Rectangle r = c.getBounds(); |
1,378,754 | public void importDeploymentData(final Path source, final Gson gson) throws FrameworkException {<NEW_LINE>final Path virtualTypesConf = source.resolve("virtual-types.json");<NEW_LINE>if (Files.exists(virtualTypesConf)) {<NEW_LINE>logger.info("Reading {}..", virtualTypesConf);<NEW_LINE>try (final Reader reader = Files.newBufferedReader(virtualTypesConf, Charset.forName("utf-8"))) {<NEW_LINE>final List<Map<String, Object>> virtualTypes = gson.fromJson(reader, List.class);<NEW_LINE>final SecurityContext context = SecurityContext.getSuperUserInstance();<NEW_LINE>context.setDoTransactionNotifications(false);<NEW_LINE>final App app = StructrApp.getInstance(context);<NEW_LINE>try (final Tx tx = app.tx()) {<NEW_LINE>for (final VirtualType toDelete : app.nodeQuery(VirtualType.class).getAsList()) {<NEW_LINE>app.delete(toDelete);<NEW_LINE>}<NEW_LINE>for (final VirtualProperty toDelete : app.nodeQuery(VirtualProperty.class).getAsList()) {<NEW_LINE>app.delete(toDelete);<NEW_LINE>}<NEW_LINE>for (final Map<String, Object> entry : virtualTypes) {<NEW_LINE>final PropertyMap map = PropertyMap.inputTypeToJavaType(<MASK><NEW_LINE>app.create(VirtualType.class, map);<NEW_LINE>}<NEW_LINE>tx.success();<NEW_LINE>}<NEW_LINE>} catch (IOException ioex) {<NEW_LINE>logger.warn("", ioex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | context, VirtualType.class, entry); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.