idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
504,712 | public void extractKeyParts(CacheKeyBuilder keyBuilder, Object targetObject, Object[] params) {<NEW_LINE>//<NEW_LINE>// include specified property values into the key<NEW_LINE>for (final String keyProp : keyProperties) {<NEW_LINE>if (targetObject instanceof PO) {<NEW_LINE>final PO po = (PO) targetObject;<NEW_LINE>if (po.get_ColumnIndex(keyProp) < 0) {<NEW_LINE>final String msg = // + "." + constructorOrMethod.getName()<NEW_LINE>"Invalid keyProperty '" + keyProp + "' for cached method " + targetObject.getClass() + ". Target PO has no such column; PO=" + po;<NEW_LINE>throw new RuntimeException(msg);<NEW_LINE>}<NEW_LINE>final Object keyValue = po.get_Value(keyProp);<NEW_LINE>keyBuilder.add(keyValue);<NEW_LINE>} else {<NEW_LINE>final StringBuilder getMethodName = new StringBuilder("get");<NEW_LINE>getMethodName.append(keyProp.substring(0, 1).toUpperCase());<NEW_LINE>getMethodName.append(keyProp.substring(1));<NEW_LINE>try {<NEW_LINE>final Method method = targetObject.getClass().<MASK><NEW_LINE>final Object keyValue = method.invoke(targetObject);<NEW_LINE>keyBuilder.add(keyValue);<NEW_LINE>} catch (Exception e) {<NEW_LINE>final String msg = // + "." + constructorOrMethod.getName()<NEW_LINE>"Invalid keyProperty '" + keyProp + "' for cached method " + targetObject.getClass().getName() + ". Can't access getter method get" + keyProp + ". Exception " + e + "; message: " + e.getMessage();<NEW_LINE>throw new RuntimeException(msg, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getMethod(getMethodName.toString()); |
645,129 | public void checkActivity() {<NEW_LINE>// Graceful time before the first afk check call.<NEW_LINE>if (System.currentTimeMillis() - lastActivity <= 10000) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final long autoafkkick = ess.getSettings().getAutoAfkKick();<NEW_LINE>if (autoafkkick > 0 && lastActivity > 0 && (lastActivity + (autoafkkick * 1000)) < System.currentTimeMillis() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt")) {<NEW_LINE>final String kickReason = tl("autoAfkKickReason", autoafkkick / 60.0);<NEW_LINE>lastActivity = 0;<NEW_LINE>this.getBase().kickPlayer(kickReason);<NEW_LINE>for (final User user : ess.getOnlineUsers()) {<NEW_LINE>if (user.isAuthorized("essentials.kick.notify")) {<NEW_LINE>user.sendMessage(tl("playerKicked", Console.DISPLAY_NAME, getName(), kickReason));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final long autoafk = ess.getSettings().getAutoAfk();<NEW_LINE>if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis() && isAuthorized("essentials.afk.auto")) {<NEW_LINE>setAfk(true, AfkStatusChangeEvent.Cause.ACTIVITY);<NEW_LINE>if (isAfk() && !isHidden()) {<NEW_LINE>setDisplayNick();<NEW_LINE>final String msg = <MASK><NEW_LINE>final String selfmsg = tl("userIsAwaySelf", getDisplayName());<NEW_LINE>if (!msg.isEmpty() && ess.getSettings().broadcastAfkMessage()) {<NEW_LINE>// exclude user from receiving general AFK announcement in favor of personal message<NEW_LINE>ess.broadcastMessage(this, msg, u -> u == this);<NEW_LINE>}<NEW_LINE>if (!selfmsg.isEmpty()) {<NEW_LINE>this.sendMessage(selfmsg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | tl("userIsAway", getDisplayName()); |
667,204 | private boolean doMove(boolean extending) {<NEW_LINE>Vector3 pos = this.getLocation();<NEW_LINE>BlockFace direction = getFacing();<NEW_LINE>if (!extending) {<NEW_LINE>this.level.setBlock(pos.getSide(direction), Block.get(BlockID.AIR), true, false);<NEW_LINE>}<NEW_LINE>BlocksCalculator calculator = new BlocksCalculator(this.level, this, direction, extending);<NEW_LINE>if (!calculator.canMove()) {<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>List<Block<MASK><NEW_LINE>List<Block> newBlocks = new ArrayList<>(blocks);<NEW_LINE>List<Block> destroyBlocks = calculator.getBlocksToDestroy();<NEW_LINE>BlockFace side = extending ? direction : direction.getOpposite();<NEW_LINE>for (int i = destroyBlocks.size() - 1; i >= 0; --i) {<NEW_LINE>Block block = destroyBlocks.get(i);<NEW_LINE>this.level.useBreakOn(block);<NEW_LINE>}<NEW_LINE>for (int i = blocks.size() - 1; i >= 0; --i) {<NEW_LINE>Block block = blocks.get(i);<NEW_LINE>this.level.setBlock(block, Block.get(BlockID.AIR));<NEW_LINE>Vector3 newPos = block.getLocation().getSide(side);<NEW_LINE>// TODO: change this to block entity<NEW_LINE>this.level.setBlock(newPos, newBlocks.get(i));<NEW_LINE>}<NEW_LINE>Vector3 pistonHead = pos.getSide(direction);<NEW_LINE>if (extending) {<NEW_LINE>// extension block entity<NEW_LINE>this.level.setBlock(pistonHead, Block.get(BlockID.PISTON_HEAD, this.getDamage()));<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} | > blocks = calculator.getBlocksToMove(); |
1,803,073 | private synchronized void onServiceChange(HotSwapAction callback, ServiceLoader<?> serviceLoader, String fullName) {<NEW_LINE>// sanity-check that the file modification has led to actual changes in services<NEW_LINE>serviceLoader.reload();<NEW_LINE>Set<String> currentServiceImpl = services.getOrDefault(fullName, Collections.emptySet());<NEW_LINE>Set<String> changedServiceImpl = Collections.synchronizedSet(new HashSet<>(currentServiceImpl.size() + 1));<NEW_LINE>Iterator<?> it = serviceLoader.iterator();<NEW_LINE>boolean callbackFired = false;<NEW_LINE>while (it.hasNext()) {<NEW_LINE>try {<NEW_LINE>Object o = it.next();<NEW_LINE>changedServiceImpl.add(o.<MASK><NEW_LINE>if (!currentServiceImpl.contains(o.getClass().getName())) {<NEW_LINE>// new service implementation detected<NEW_LINE>callback.fire();<NEW_LINE>callbackFired = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} catch (ServiceConfigurationError e) {<NEW_LINE>// services that we're not able to instantiate are irrelevant<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!callbackFired && changedServiceImpl.size() != currentServiceImpl.size()) {<NEW_LINE>// removed service implementation, fire callback<NEW_LINE>callback.fire();<NEW_LINE>}<NEW_LINE>// update the cached services<NEW_LINE>services.put(fullName, changedServiceImpl);<NEW_LINE>} | getClass().getName()); |
673,039 | private Predicate createPredicate(String theResourceName, List<List<IQueryParameterType>> theValues, SearchFilterParser.CompareOperation theOperation, RequestPartitionId theRequestPartitionId) {<NEW_LINE>Predicate nextPredicate = null;<NEW_LINE>Set<ResourcePersistentId> allOrPids = null;<NEW_LINE>for (List<? extends IQueryParameterType> nextValue : theValues) {<NEW_LINE>Set<ResourcePersistentId> orPids = new HashSet<>();<NEW_LINE>boolean haveValue = false;<NEW_LINE>for (IQueryParameterType next : nextValue) {<NEW_LINE>String value = next.getValueAsQueryToken(myContext);<NEW_LINE>if (value != null && value.startsWith("|")) {<NEW_LINE>value = value.substring(1);<NEW_LINE>}<NEW_LINE>IdType valueAsId = new IdType(value);<NEW_LINE>if (isNotBlank(value)) {<NEW_LINE>haveValue = true;<NEW_LINE>try {<NEW_LINE>ResourcePersistentId pid = myIdHelperService.resolveResourcePersistentIds(theRequestPartitionId, theResourceName, valueAsId.getIdPart());<NEW_LINE>orPids.add(pid);<NEW_LINE>} catch (ResourceNotFoundException e) {<NEW_LINE>// This is not an error in a search, it just results in no matchesFhirResourceDaoR4InterceptorTest<NEW_LINE>ourLog.debug("Resource ID {} was requested but does not exist", valueAsId.getIdPart());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (haveValue) {<NEW_LINE>if (allOrPids == null) {<NEW_LINE>allOrPids = orPids;<NEW_LINE>} else {<NEW_LINE>allOrPids.retainAll(orPids);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (allOrPids != null && allOrPids.isEmpty()) {<NEW_LINE>// This will never match<NEW_LINE>nextPredicate = myCriteriaBuilder.equal(myQueryStack<MASK><NEW_LINE>} else if (allOrPids != null) {<NEW_LINE>SearchFilterParser.CompareOperation operation = defaultIfNull(theOperation, SearchFilterParser.CompareOperation.eq);<NEW_LINE>assert operation == SearchFilterParser.CompareOperation.eq || operation == SearchFilterParser.CompareOperation.ne;<NEW_LINE>List<Predicate> codePredicates = new ArrayList<>();<NEW_LINE>switch(operation) {<NEW_LINE>default:<NEW_LINE>case eq:<NEW_LINE>codePredicates.add(myQueryStack.getResourcePidColumn().in(ResourcePersistentId.toLongList(allOrPids)));<NEW_LINE>nextPredicate = myCriteriaBuilder.and(toArray(codePredicates));<NEW_LINE>break;<NEW_LINE>case ne:<NEW_LINE>codePredicates.add(myQueryStack.getResourcePidColumn().in(ResourcePersistentId.toLongList(allOrPids)).not());<NEW_LINE>nextPredicate = myCriteriaBuilder.and(toArray(codePredicates));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return nextPredicate;<NEW_LINE>} | .getResourcePidColumn(), -1); |
1,778,747 | static // eventually should have the model problems coming from either the Mavenproject or the modelBuilder result.<NEW_LINE>List<ModelProblem> runMavenValidationImpl(final File pom) {<NEW_LINE>// TODO profiles based on current configuration??<NEW_LINE>MavenEmbedder embedder = EmbedderFactory.getProjectEmbedder();<NEW_LINE>MavenExecutionRequest meReq = embedder.createMavenExecutionRequest();<NEW_LINE>ProjectBuildingRequest req = meReq.getProjectBuildingRequest();<NEW_LINE>// currently enables just <reporting> warning<NEW_LINE>req.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1);<NEW_LINE>req.setLocalRepository(embedder.getLocalRepository());<NEW_LINE>List<ArtifactRepository> remoteRepos = RepositoryPreferences.<MASK><NEW_LINE>req.setRemoteRepositories(remoteRepos);<NEW_LINE>req.setRepositorySession(((DefaultMaven) embedder.lookupComponent(Maven.class)).newRepositorySession(meReq));<NEW_LINE>List<ModelProblem> problems;<NEW_LINE>try {<NEW_LINE>problems = embedder.lookupComponent(ProjectBuilder.class).build(pom, req).getProblems();<NEW_LINE>} catch (ProjectBuildingException x) {<NEW_LINE>problems = new ArrayList<ModelProblem>();<NEW_LINE>List<ProjectBuildingResult> results = x.getResults();<NEW_LINE>if (results != null) {<NEW_LINE>// one code point throwing ProjectBuildingException contains results,<NEW_LINE>for (ProjectBuildingResult result : results) {<NEW_LINE>problems.addAll(result.getProblems());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// another code point throwing ProjectBuildingException doesn't contain results..<NEW_LINE>Throwable cause = x.getCause();<NEW_LINE>if (cause instanceof ModelBuildingException) {<NEW_LINE>problems.addAll(((ModelBuildingException) cause).getProblems());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return problems;<NEW_LINE>} | getInstance().remoteRepositories(embedder); |
565,081 | public WFCMessage.ChatroomInfo toChatroomInfo() {<NEW_LINE>WFCMessage.ChatroomInfo.Builder builder = WFCMessage.ChatroomInfo.<MASK><NEW_LINE>if (!StringUtil.isNullOrEmpty(desc)) {<NEW_LINE>builder.setDesc(desc);<NEW_LINE>}<NEW_LINE>if (!StringUtil.isNullOrEmpty(portrait)) {<NEW_LINE>builder.setPortrait(portrait);<NEW_LINE>}<NEW_LINE>long current = System.currentTimeMillis();<NEW_LINE>builder.setCreateDt(current).setUpdateDt(current).setMemberCount(0);<NEW_LINE>if (!StringUtil.isNullOrEmpty(extra)) {<NEW_LINE>builder.setExtra(extra);<NEW_LINE>}<NEW_LINE>if (state == null || state == 0) {<NEW_LINE>builder.setState(ProtoConstants.ChatroomState.Chatroom_State_Normal);<NEW_LINE>} else if (state == 1) {<NEW_LINE>builder.setState(ProtoConstants.ChatroomState.Chatroom_State_NotStart);<NEW_LINE>} else {<NEW_LINE>builder.setState(ProtoConstants.ChatroomState.Chatroom_State_End);<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | newBuilder().setTitle(title); |
814,053 | public void writeUncommitted(SIMPMessage m) throws SIResourceException {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.entry(this, tc, "writeUncommitted", new Object[] { m });<NEW_LINE>TickRange tr = null;<NEW_LINE>JsMessage jsMsg = m.getMessage();<NEW_LINE>long stamp = jsMsg.getGuaranteedValueValueTick();<NEW_LINE>long starts = jsMsg.getGuaranteedValueStartTick();<NEW_LINE><MASK><NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>SibTr.debug(tc, "writeUncommitted at: " + stamp + " on Stream " + stream);<NEW_LINE>}<NEW_LINE>synchronized (this) {<NEW_LINE>if (m.getStreamIsGuess()) {<NEW_LINE>newGuessInStream(stamp);<NEW_LINE>}<NEW_LINE>msgAdded(stamp);<NEW_LINE>// write into stream<NEW_LINE>tr = TickRange.newUncommittedTick(stamp);<NEW_LINE>tr.startstamp = starts;<NEW_LINE>tr.endstamp = ends;<NEW_LINE>// Save message in the stream while it is Uncommitted<NEW_LINE>// It will be replaced by its index in the ItemStream once it becomes a Value<NEW_LINE>tr.value = m;<NEW_LINE>oststream.writeCombinedRange(tr);<NEW_LINE>// Now update our lastMsgAdded with the tick of the<NEW_LINE>// message we have just added<NEW_LINE>lastMsgAdded = stamp;<NEW_LINE>// SIB0105<NEW_LINE>// If this is the first uncommitted messages to be added to the stream, start off the<NEW_LINE>// blocked message health state timer. This will check back in the future to see if the<NEW_LINE>// message successfully sent.<NEW_LINE>if (blockedStreamAlarm == null) {<NEW_LINE>blockedStreamAlarm = new BlockedStreamAlarm(getCompletedPrefix());<NEW_LINE>am.create(mp.getCustomProperties().getBlockedStreamHealthCheckInterval(), blockedStreamAlarm);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// end synchronized<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.exit(tc, "writeUncommitted");<NEW_LINE>} | long ends = jsMsg.getGuaranteedValueEndTick(); |
1,263,172 | public boolean copySlides(Long originDisplayId, Long displayId, User user) {<NEW_LINE>// copy slide entity<NEW_LINE>List<DisplaySlide> originSlides = displaySlideMapper.selectByDisplayId(originDisplayId);<NEW_LINE>if (CollectionUtils.isEmpty(originSlides)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>List<RelModelCopy> slideCopies = new ArrayList<>();<NEW_LINE>originSlides.forEach(originDisplay -> {<NEW_LINE>DisplaySlide slide = new DisplaySlide();<NEW_LINE>BeanUtils.copyProperties(originDisplay, slide, "id");<NEW_LINE>slide.setDisplayId(displayId);<NEW_LINE>slide.createdBy(user.getId());<NEW_LINE>if (displaySlideMapper.insert(slide) > 0) {<NEW_LINE>optLogger.info("Slide({}) is copied from {}, by user({})", slide.toString(), originDisplay.toString(), user.getId());<NEW_LINE>slideCopies.add(new RelModelCopy(originDisplay.getId(), slide.getId()));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// copy relRoleSlide<NEW_LINE>if (!slideCopies.isEmpty()) {<NEW_LINE>if (relRoleSlideMapper.copyRoleSlideRelation(slideCopies, user.getId()) > 0) {<NEW_LINE>optLogger.info("Display({}) slides role is copied by user({}), from:{}", displayId, user.getId(), originDisplayId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// copy memDisplaySlideWidget<NEW_LINE>List<MemDisplaySlideWidgetWithSlide> memWithSlideWidgetList = memDisplaySlideWidgetMapper.getMemWithSlideByDisplayId(originDisplayId);<NEW_LINE>if (CollectionUtils.isEmpty(memWithSlideWidgetList)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>List<RelModelCopy> memCopies = new ArrayList<>();<NEW_LINE>Map<Long, Long> slideCopyIdMap = new HashMap<>();<NEW_LINE>slideCopies.forEach(copy -> slideCopyIdMap.put(copy.getOriginId(), copy.getCopyId()));<NEW_LINE>memWithSlideWidgetList.forEach(originMem -> {<NEW_LINE>MemDisplaySlideWidget mem = new MemDisplaySlideWidget();<NEW_LINE>BeanUtils.copyProperties(originMem, mem, "id");<NEW_LINE>mem.setDisplaySlideId(slideCopyIdMap.get<MASK><NEW_LINE>mem.createdBy(user.getId());<NEW_LINE>int insert = memDisplaySlideWidgetMapper.insert(mem);<NEW_LINE>if (insert > 0) {<NEW_LINE>optLogger.info("MemDisplaySlideWidget({}) is copied from {}, by user({})", mem.toString(), originMem.toString(), user.getId());<NEW_LINE>memCopies.add(new RelModelCopy(originMem.getId(), mem.getId()));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// copy relRoleDisplaySlideWidget<NEW_LINE>if (!memCopies.isEmpty()) {<NEW_LINE>if (relRoleDisplaySlideWidgetMapper.copyRoleSlideWidgetRelation(memCopies, user.getId()) > 0) {<NEW_LINE>optLogger.info("Display({}) relRoleDisplaySlideWidgetMapper is copied by user({}), from:{}", displayId, user.getId(), originDisplayId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | (originMem.getDisplaySlideId())); |
1,465,697 | public String chooseBackupInstance(String mainInstanceAlias) throws CSErrorException {<NEW_LINE>ServiceInstance mainInstance = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("Get Instance error, alias : {}, message : {}", mainInstanceAlias, e.getMessage());<NEW_LINE>throw new CSErrorException(CSErrorCode.INVALID_INSTANCE_ALIAS, e.getMessage() + ", alias : " + mainInstanceAlias);<NEW_LINE>}<NEW_LINE>List<ServiceInstance> allInstanceList = instanceAliasManager.getAllInstanceList();<NEW_LINE>List<ServiceInstance> remainInstanceList = new ArrayList<>();<NEW_LINE>for (ServiceInstance instance : allInstanceList) {<NEW_LINE>if (instance.equals(mainInstance)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>remainInstanceList.add(instance);<NEW_LINE>}<NEW_LINE>if (remainInstanceList.size() > 0) {<NEW_LINE>int index = getBackupInstanceIndex(remainInstanceList);<NEW_LINE>return instanceAliasManager.getAliasByServiceInstance(remainInstanceList.get(index));<NEW_LINE>} else {<NEW_LINE>// only one service instance<NEW_LINE>logger.error("Only one instance, no remains.");<NEW_LINE>return instanceAliasManager.getAliasByServiceInstance(mainInstance);<NEW_LINE>}<NEW_LINE>} | mainInstance = instanceAliasManager.getInstanceByAlias(mainInstanceAlias); |
690,008 | protected boolean selfSatisfied(ClusterModel clusterModel, BalancingAction action) {<NEW_LINE>Replica sourceReplica = clusterModel.broker(action.sourceBrokerId()).replica(action.topicPartition());<NEW_LINE>ActionType actionType = action.balancingAction();<NEW_LINE>Broker sourceBroker = sourceReplica.broker();<NEW_LINE>// The action must be executed if currently fixing offline replicas only and the offline source replica is proposed<NEW_LINE>// to be moved to another broker.<NEW_LINE>if (_fixOfflineReplicasOnly && sourceReplica.isCurrentOffline()) {<NEW_LINE>return action.balancingAction() == ActionType.INTER_BROKER_REPLICA_MOVEMENT;<NEW_LINE>}<NEW_LINE>Broker destinationBroker = clusterModel.broker(action.destinationBrokerId());<NEW_LINE>double destinationBrokerUtilization = clusterModel.potentialLeadershipLoadFor(destinationBroker.id()).expectedUtilizationFor(Resource.NW_OUT);<NEW_LINE>double destinationCapacity = destinationBroker.capacityFor(Resource.NW_OUT) * _balancingConstraint.capacityThreshold(Resource.NW_OUT);<NEW_LINE>double sourceReplicaUtilization = clusterModel.partition(sourceReplica.topicPartition()).leader().load(<MASK><NEW_LINE>if (actionType != ActionType.INTER_BROKER_REPLICA_SWAP) {<NEW_LINE>// Check whether replica or leadership transfer leads to violation of capacity limit requirement.<NEW_LINE>return destinationCapacity >= destinationBrokerUtilization + sourceReplicaUtilization;<NEW_LINE>}<NEW_LINE>// Ensure that the destination capacity of self-satisfied for action type swap is not violated.<NEW_LINE>double destinationReplicaUtilization = clusterModel.partition(action.destinationTopicPartition()).leader().load().expectedUtilizationFor(Resource.NW_OUT);<NEW_LINE>if (destinationCapacity < destinationBrokerUtilization + sourceReplicaUtilization - destinationReplicaUtilization) {<NEW_LINE>// Destination capacity would be violated due to swap.<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Ensure that the source capacity of self-satisfied for action type swap is not violated.<NEW_LINE>double sourceBrokerUtilization = clusterModel.potentialLeadershipLoadFor(sourceBroker.id()).expectedUtilizationFor(Resource.NW_OUT);<NEW_LINE>double sourceCapacity = sourceBroker.capacityFor(Resource.NW_OUT) * _balancingConstraint.capacityThreshold(Resource.NW_OUT);<NEW_LINE>return sourceCapacity >= sourceBrokerUtilization + destinationReplicaUtilization - sourceReplicaUtilization;<NEW_LINE>} | ).expectedUtilizationFor(Resource.NW_OUT); |
268,698 | public void createMenuItems(Bundle savedInstanceState) {<NEW_LINE>Bundle args = getArguments();<NEW_LINE>if (args != null) {<NEW_LINE>appMode = ApplicationMode.valueOfStringKey(args.getString(ROUTE_APP_MODE_KEY), null);<NEW_LINE>dialogType = (RouteBetweenPointsDialogType) args.get(DIALOG_TYPE_KEY);<NEW_LINE>defaultDialogMode = (RouteBetweenPointsDialogMode) args.get(DEFAULT_DIALOG_MODE_KEY);<NEW_LINE>}<NEW_LINE>if (savedInstanceState != null) {<NEW_LINE>dialogType = (RouteBetweenPointsDialogType) savedInstanceState.get(DIALOG_TYPE_KEY);<NEW_LINE>defaultDialogMode = (RouteBetweenPointsDialogMode) savedInstanceState.get(DEFAULT_DIALOG_MODE_KEY);<NEW_LINE>}<NEW_LINE>OsmandApplication app = requiredMyApplication();<NEW_LINE>nightMode = app.getDaynightHelper().isNightModeForMapControls();<NEW_LINE>final View mainView = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.fragment_route_between_points_bottom_sheet_dialog, null, false);<NEW_LINE>customRadioButton = mainView.findViewById(R.id.custom_radio_buttons);<NEW_LINE>customRadioButton.setMinimumHeight(getResources().getDimensionPixelSize(R.dimen.route_info_control_buttons_height));<NEW_LINE>TextView singleModeButton = mainView.findViewById(R.id.left_button);<NEW_LINE>singleModeButton.setText(getButtonText(RouteBetweenPointsDialogMode.SINGLE));<NEW_LINE>TextView allModeButton = mainView.findViewById(R.id.right_button);<NEW_LINE>allModeButton.setText(getButtonText(RouteBetweenPointsDialogMode.ALL));<NEW_LINE>btnDescription = mainView.findViewById(R.id.button_description);<NEW_LINE>LinearLayout navigationType = mainView.findViewById(R.id.navigation_types_container);<NEW_LINE>final List<ApplicationMode> modes = new ArrayList<>(ApplicationMode.values(app));<NEW_LINE>modes.remove(ApplicationMode.DEFAULT);<NEW_LINE>View.OnClickListener onClickListener = new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View view) {<NEW_LINE>ApplicationMode mode = DEFAULT_APP_MODE;<NEW_LINE>if ((int) view.getTag() != STRAIGHT_LINE_TAG) {<NEW_LINE>mode = modes.get((int) view.getTag());<NEW_LINE>}<NEW_LINE>Fragment fragment = getTargetFragment();<NEW_LINE>if (fragment instanceof RouteBetweenPointsFragmentListener) {<NEW_LINE>((RouteBetweenPointsFragmentListener) fragment).onChangeApplicationMode(mode, dialogType, defaultDialogMode);<NEW_LINE>}<NEW_LINE>dismiss();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Drawable icon = app.getUIUtilities().getIcon(<MASK><NEW_LINE>addProfileView(navigationType, onClickListener, STRAIGHT_LINE_TAG, icon, app.getText(R.string.routing_profile_straightline), appMode == DEFAULT_APP_MODE);<NEW_LINE>addDelimiterView(navigationType);<NEW_LINE>for (int i = 0; i < modes.size(); i++) {<NEW_LINE>ApplicationMode mode = modes.get(i);<NEW_LINE>if (!PUBLIC_TRANSPORT_KEY.equals(mode.getRoutingProfile())) {<NEW_LINE>icon = app.getUIUtilities().getPaintedIcon(mode.getIconRes(), mode.getProfileColor(nightMode));<NEW_LINE>addProfileView(navigationType, onClickListener, i, icon, mode.toHumanString(), mode.equals(appMode));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>singleModeButton.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>setDefaultDialogMode(RouteBetweenPointsDialogMode.SINGLE);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>allModeButton.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>setDefaultDialogMode(RouteBetweenPointsDialogMode.ALL);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>updateModeButtons();<NEW_LINE>items.add(new BaseBottomSheetItem.Builder().setCustomView(mainView).create());<NEW_LINE>} | R.drawable.ic_action_split_interval, nightMode); |
762,185 | public com.alipay.sofa.jraft.rpc.CliRequests.AddLearnersRequest buildPartial() {<NEW_LINE>com.alipay.sofa.jraft.rpc.CliRequests.AddLearnersRequest result = new com.alipay.sofa.jraft.rpc.CliRequests.AddLearnersRequest(this);<NEW_LINE>int from_bitField0_ = bitField0_;<NEW_LINE>int to_bitField0_ = 0;<NEW_LINE>if (((from_bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>to_bitField0_ |= 0x00000001;<NEW_LINE>}<NEW_LINE>result.groupId_ = groupId_;<NEW_LINE>if (((from_bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>to_bitField0_ |= 0x00000002;<NEW_LINE>}<NEW_LINE>result.leaderId_ = leaderId_;<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>learners_ = learners_.getUnmodifiableView();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>result.learners_ = learners_;<NEW_LINE>result.bitField0_ = to_bitField0_;<NEW_LINE>onBuilt();<NEW_LINE>return result;<NEW_LINE>} | bitField0_ = (bitField0_ & ~0x00000004); |
519,785 | private void processFilterFields() {<NEW_LINE>OsmandApplication app = getMyApplication();<NEW_LINE><MASK><NEW_LINE>if (!Algorithms.isEmpty(filterByName)) {<NEW_LINE>int index;<NEW_LINE>MapPoiTypes poiTypes = app.getPoiTypes();<NEW_LINE>Map<String, PoiType> poiAdditionals = filter.getPoiAdditionals();<NEW_LINE>Set<String> excludedPoiAdditionalCategories = getExcludedPoiAdditionalCategories();<NEW_LINE>List<PoiType> otherAdditionalCategories = poiTypes.getOtherMapCategory().getPoiAdditionalsCategorized();<NEW_LINE>if (!excludedPoiAdditionalCategories.contains(OPENING_HOURS)) {<NEW_LINE>String keyNameOpen = app.getString(R.string.shared_string_is_open).replace(' ', '_').toLowerCase();<NEW_LINE>String keyNameOpen24 = app.getString(R.string.shared_string_is_open_24_7).replace(' ', '_').toLowerCase();<NEW_LINE>index = filterByName.indexOf(keyNameOpen24);<NEW_LINE>if (index != -1) {<NEW_LINE>selectedPoiAdditionals.add(keyNameOpen24);<NEW_LINE>filterByName = filterByName.replaceAll(keyNameOpen24, "");<NEW_LINE>}<NEW_LINE>index = filterByName.indexOf(keyNameOpen);<NEW_LINE>if (index != -1) {<NEW_LINE>selectedPoiAdditionals.add(keyNameOpen);<NEW_LINE>filterByName = filterByName.replaceAll(keyNameOpen, "");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (poiAdditionals != null) {<NEW_LINE>Map<String, List<PoiType>> additionalsMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);<NEW_LINE>extractPoiAdditionals(poiAdditionals.values(), additionalsMap, excludedPoiAdditionalCategories, true);<NEW_LINE>extractPoiAdditionals(otherAdditionalCategories, additionalsMap, excludedPoiAdditionalCategories, true);<NEW_LINE>if (additionalsMap.size() > 0) {<NEW_LINE>List<String> filters = new ArrayList<>(Arrays.asList(filterByName.split(" ")));<NEW_LINE>for (Entry<String, List<PoiType>> entry : additionalsMap.entrySet()) {<NEW_LINE>for (PoiType poiType : entry.getValue()) {<NEW_LINE>String keyName = poiType.getKeyName().replace('_', ':').toLowerCase();<NEW_LINE>index = filters.indexOf(keyName);<NEW_LINE>if (index != -1) {<NEW_LINE>selectedPoiAdditionals.add(keyName);<NEW_LINE>filters.remove(index);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>filterByName = TextUtils.join(" ", filters);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (filterByName.trim().length() > 0 && Algorithms.isEmpty(nameFilterText)) {<NEW_LINE>nameFilterText = filterByName.trim();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String filterByName = filter.getFilterByName(); |
809,275 | public void onCompletion(String result, Exception exception) {<NEW_LINE>long processingStartTimeMs = SystemTime.getInstance().milliseconds();<NEW_LINE>metrics.idConverterProcessingTimeInMs.update(processingStartTimeMs - operationStartTimeMs);<NEW_LINE>try {<NEW_LINE>if (exception == null) {<NEW_LINE>BlobId blobId = FrontendUtils.getBlobIdFromString(result, clusterMap);<NEW_LINE>accountAndContainerInjector.injectTargetAccountAndContainerFromBlobId(blobId, restRequest, metrics.getSignedUrlMetricsGroup);<NEW_LINE>securityService.postProcessRequest(restRequest, new SecurityPostProcessRequestCallback(restRequest, restResponseChannel, callback));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>exception = e;<NEW_LINE>} finally {<NEW_LINE>metrics.getSignedUrlIdConverterCallbackProcessingTimeInMs.update(SystemTime.getInstance(<MASK><NEW_LINE>if (exception != null) {<NEW_LINE>callback.onCompletion(null, exception);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).milliseconds() - processingStartTimeMs); |
1,560,505 | final EngineDefaults executeDescribeEngineDefaultParameters(DescribeEngineDefaultParametersRequest describeEngineDefaultParametersRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeEngineDefaultParametersRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeEngineDefaultParametersRequest> request = null;<NEW_LINE>Response<EngineDefaults> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DescribeEngineDefaultParametersRequestMarshaller().marshall(super.beforeMarshalling(describeEngineDefaultParametersRequest));<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, "Neptune");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeEngineDefaultParameters");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<EngineDefaults> responseHandler = new StaxResponseHandler<EngineDefaults>(new EngineDefaultsStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
653,455 | public String backupDbsToSdCard() throws IOException {<NEW_LINE>SubscriptionsDb subscriptionsDb = SubscriptionsDb.getSubscriptionsDb();<NEW_LINE>BookmarksDb bookmarksDb = BookmarksDb.getBookmarksDb();<NEW_LINE>PlaybackStatusDb playbackDb = PlaybackStatusDb.getPlaybackStatusDb();<NEW_LINE>ChannelFilteringDb channelFilteringDb = ChannelFilteringDb.getChannelFilteringDb();<NEW_LINE>SearchHistoryDb searchHistoryDb = SearchHistoryDb.getSearchHistoryDb();<NEW_LINE>final File backupPath = new File(EXPORT_DIR, generateFileName());<NEW_LINE>Gson gson = new Gson();<NEW_LINE>// close the databases<NEW_LINE>subscriptionsDb.close();<NEW_LINE>bookmarksDb.close();<NEW_LINE>playbackDb.close();<NEW_LINE>channelFilteringDb.close();<NEW_LINE>searchHistoryDb.close();<NEW_LINE>try (ZipOutput databasesZip = new ZipOutput(backupPath)) {<NEW_LINE>// backup the databases inside a zip file<NEW_LINE>databasesZip.addFile(subscriptionsDb.getDatabasePath());<NEW_LINE>databasesZip.addFile(bookmarksDb.getDatabasePath());<NEW_LINE>databasesZip.addFile(playbackDb.getDatabasePath());<NEW_LINE>databasesZip.addFile(channelFilteringDb.getDatabasePath());<NEW_LINE>databasesZip.<MASK><NEW_LINE>databasesZip.addContent(PREFERENCES_JSON, gson.toJson(getImportantKeys()));<NEW_LINE>}<NEW_LINE>return backupPath.getPath();<NEW_LINE>} | addFile(searchHistoryDb.getDatabasePath()); |
1,430,840 | public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {<NEW_LINE>if (!StressImpact.isEnabled())<NEW_LINE>return false;<NEW_LINE>super.addToGoggleTooltip(tooltip, isPlayerSneaking);<NEW_LINE>double capacity = getNetworkCapacity();<NEW_LINE>double stressFraction = getNetworkStress() / (capacity == 0 ? 1 : capacity);<NEW_LINE>tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.stressometer.title").withStyle(ChatFormatting.GRAY)));<NEW_LINE>if (getTheoreticalSpeed() == 0)<NEW_LINE>tooltip.add(new TextComponent(spacing + ItemDescription.makeProgressBar(3, 0)).append(Lang.translate("gui.stressometer.no_rotation")).withStyle(ChatFormatting.DARK_GRAY));<NEW_LINE>else {<NEW_LINE>tooltip.add(componentSpacing.plainCopy().append(StressImpact.getFormattedStressText(stressFraction)));<NEW_LINE>tooltip.add(componentSpacing.plainCopy().append(Lang.translate("gui.stressometer.capacity").withStyle(ChatFormatting.GRAY)));<NEW_LINE>double remainingCapacity = capacity - getNetworkStress();<NEW_LINE>Component <MASK><NEW_LINE>MutableComponent stressTooltip = componentSpacing.plainCopy().append(new TextComponent(" " + IHaveGoggleInformation.format(remainingCapacity)).append(su.plainCopy()).withStyle(StressImpact.of(stressFraction).getRelativeColor()));<NEW_LINE>if (remainingCapacity != capacity) {<NEW_LINE>stressTooltip.append(new TextComponent(" / ").withStyle(ChatFormatting.GRAY)).append(new TextComponent(IHaveGoggleInformation.format(capacity)).append(su.plainCopy()).withStyle(ChatFormatting.DARK_GRAY));<NEW_LINE>}<NEW_LINE>tooltip.add(stressTooltip);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | su = Lang.translate("generic.unit.stress"); |
1,405,176 | private String generateChoicePut(final PrimitiveType type, final String bitIdx, final String byteOrder) {<NEW_LINE>switch(type) {<NEW_LINE>case UINT8:<NEW_LINE>return " byte bits = buffer.getByte(offset);\n" + " bits = (byte)(value ? bits | (1 << " + bitIdx + ") : bits & ~(1 << " + bitIdx + "));\n" + " buffer.putByte(offset, bits);";<NEW_LINE>case UINT16:<NEW_LINE>return " short bits = buffer.getShort(offset" + byteOrder + ");\n" + " bits = (short)(value ? bits | (1 << " + bitIdx + ") : bits & ~(1 << " + bitIdx <MASK><NEW_LINE>case UINT32:<NEW_LINE>return " int bits = buffer.getInt(offset" + byteOrder + ");\n" + " bits = value ? bits | (1 << " + bitIdx + ") : bits & ~(1 << " + bitIdx + ");\n" + " buffer.putInt(offset, bits" + byteOrder + ");";<NEW_LINE>case UINT64:<NEW_LINE>return " long bits = buffer.getLong(offset" + byteOrder + ");\n" + " bits = value ? bits | (1L << " + bitIdx + ") : bits & ~(1L << " + bitIdx + ");\n" + " buffer.putLong(offset, bits" + byteOrder + ");";<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("primitive type not supported: " + type);<NEW_LINE>} | + "));\n" + " buffer.putShort(offset, bits" + byteOrder + ");"; |
144,750 | protected void updateMarkActions() {<NEW_LINE>myEditingActionsGroup.removeAll();<NEW_LINE>myEditingActionsGroup.add(new ToolbarLabelAction() {<NEW_LINE><NEW_LINE>@RequiredUIAccess<NEW_LINE>@Override<NEW_LINE>public void update(@Nonnull AnActionEvent e) {<NEW_LINE>super.update(e);<NEW_LINE>e.getPresentation().setTextValue(LocalizeValue.localizeTODO("Mark as:"));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>Set<ContentFolderTypeProvider> folders = ContentFoldersSupportUtil.getSupportedFolders(myState.getRootModel());<NEW_LINE>ContentFolderTypeProvider[] supportedFolders = folders.toArray(new ContentFolderTypeProvider[folders.size()]);<NEW_LINE>Arrays.sort(supportedFolders, (o1, o2) -> ComparatorUtil.compareInt(o1.getWeight(), o2.getWeight()));<NEW_LINE>for (ContentFolderTypeProvider contentFolderTypeProvider : supportedFolders) {<NEW_LINE>ToggleFolderStateAction action = new <MASK><NEW_LINE>myEditingActionsGroup.add(action);<NEW_LINE>}<NEW_LINE>} | ToggleFolderStateAction(myTree, this, contentFolderTypeProvider); |
256,189 | protected Collection<Object> executeQuery(String dataType, SearchParameterMap map) {<NEW_LINE>// TODO: Once HAPI breaks this out from the server dependencies<NEW_LINE>// we can include it on its own.<NEW_LINE>ca.uhn.fhir.jpa.searchparam.SearchParameterMap hapiMap = ca.uhn.fhir.jpa.searchparam.SearchParameterMap.newSynchronous();<NEW_LINE>try {<NEW_LINE>Method[] methods = hapiMap.getClass().getDeclaredMethods();<NEW_LINE>List<Method> methodList = Arrays.asList(methods);<NEW_LINE>List<Method> puts = methodList.stream().filter(x -> x.getName().equals("put")).collect(Collectors.toList());<NEW_LINE>Method method = puts.get(0);<NEW_LINE>method.setAccessible(true);<NEW_LINE>for (Map.Entry<String, List<List<IQueryParameterType>>> entry : map.entrySet()) {<NEW_LINE>method.invoke(hapiMap, entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.warn("Error converting search parameter map", e);<NEW_LINE>}<NEW_LINE>IFhirResourceDao<?> dao = this.registry.getResourceDao(dataType);<NEW_LINE>IBundleProvider bundleProvider = dao.search(hapiMap, myRequestDetails);<NEW_LINE>if (bundleProvider.size() == null) {<NEW_LINE>return resolveResourceList(bundleProvider<MASK><NEW_LINE>}<NEW_LINE>List<IBaseResource> resourceList = bundleProvider.getAllResources();<NEW_LINE>return resolveResourceList(resourceList);<NEW_LINE>} | .getResources(0, 10000)); |
301,835 | public static void main(String[] args) {<NEW_LINE>Exercise12 exercise12 = new Exercise12();<NEW_LINE>EdgeWeightedDigraph edgeWeightedDigraphWithCycle = new EdgeWeightedDigraph(8);<NEW_LINE>edgeWeightedDigraphWithCycle.addEdge(new DirectedEdge(0, 1, 0.35));<NEW_LINE>edgeWeightedDigraphWithCycle.addEdge(new DirectedEdge(1, 2, 0.35));<NEW_LINE>edgeWeightedDigraphWithCycle.addEdge(new DirectedEdge(2, 3, 0.37));<NEW_LINE>edgeWeightedDigraphWithCycle.addEdge(new DirectedEdge(3, 4, 0.28));<NEW_LINE>edgeWeightedDigraphWithCycle.addEdge(new DirectedEdge(4, 1, 0.28));<NEW_LINE>edgeWeightedDigraphWithCycle.addEdge(new DirectedEdge(6, 7, 0.32));<NEW_LINE>edgeWeightedDigraphWithCycle.addEdge(new DirectedEdge<MASK><NEW_LINE>EdgeWeightedDigraph edgeWeightedDAG = new EdgeWeightedDigraph(5);<NEW_LINE>edgeWeightedDAG.addEdge(new DirectedEdge(0, 1, 0.35));<NEW_LINE>edgeWeightedDAG.addEdge(new DirectedEdge(1, 2, 0.22));<NEW_LINE>edgeWeightedDAG.addEdge(new DirectedEdge(3, 4, 0.31));<NEW_LINE>edgeWeightedDAG.addEdge(new DirectedEdge(4, 0, 0.29));<NEW_LINE>StdOut.println("Cycle:");<NEW_LINE>EdgeWeightedDirectedCycle edgeWeightedDirectedCycle = exercise12.new EdgeWeightedDirectedCycle(edgeWeightedDigraphWithCycle);<NEW_LINE>for (DirectedEdge edge : edgeWeightedDirectedCycle.cycle()) {<NEW_LINE>StdOut.print(edge.from() + "->" + edge.to() + " ");<NEW_LINE>}<NEW_LINE>StdOut.println("\nExpected: 1->2 2->3 3->4 4->1 ");<NEW_LINE>Topological topological = exercise12.new Topological(edgeWeightedDAG);<NEW_LINE>StdOut.println("\nTopological order:");<NEW_LINE>for (int vertex : topological.order()) {<NEW_LINE>StdOut.print(vertex + " ");<NEW_LINE>}<NEW_LINE>StdOut.println("\nExpected: 3 4 0 1 2");<NEW_LINE>} | (7, 5, 0.38)); |
1,255,251 | public Request<DescribeIndexFieldsRequest> marshall(DescribeIndexFieldsRequest describeIndexFieldsRequest) {<NEW_LINE>if (describeIndexFieldsRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<DescribeIndexFieldsRequest> request = new DefaultRequest<DescribeIndexFieldsRequest>(describeIndexFieldsRequest, "AmazonCloudSearchv2");<NEW_LINE>request.addParameter("Action", "DescribeIndexFields");<NEW_LINE>request.addParameter("Version", "2013-01-01");<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>if (describeIndexFieldsRequest.getDomainName() != null) {<NEW_LINE>request.addParameter("DomainName", StringUtils.fromString(describeIndexFieldsRequest.getDomainName()));<NEW_LINE>}<NEW_LINE>if (!describeIndexFieldsRequest.getFieldNames().isEmpty() || !((com.amazonaws.internal.SdkInternalList<String>) describeIndexFieldsRequest.getFieldNames()).isAutoConstruct()) {<NEW_LINE>com.amazonaws.internal.SdkInternalList<String> fieldNamesList = (com.amazonaws.internal.SdkInternalList<<MASK><NEW_LINE>int fieldNamesListIndex = 1;<NEW_LINE>for (String fieldNamesListValue : fieldNamesList) {<NEW_LINE>if (fieldNamesListValue != null) {<NEW_LINE>request.addParameter("FieldNames.member." + fieldNamesListIndex, StringUtils.fromString(fieldNamesListValue));<NEW_LINE>}<NEW_LINE>fieldNamesListIndex++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (describeIndexFieldsRequest.getDeployed() != null) {<NEW_LINE>request.addParameter("Deployed", StringUtils.fromBoolean(describeIndexFieldsRequest.getDeployed()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | String>) describeIndexFieldsRequest.getFieldNames(); |
190,361 | void xz(LZMACompressor.Native self, @SuppressWarnings("unused") int format, long preset, @SuppressWarnings("unused") PNone filters, @Shared("cs") @Cached NativeLibrary.InvokeNativeFunction createStream, @Cached NativeLibrary.InvokeNativeFunction lzmaEasyEncoder, @Cached ConditionProfile errProfile) {<NEW_LINE>NFILZMASupport lzmaSupport = PythonContext.get(this).getNFILZMASupport();<NEW_LINE>Object lzmast = lzmaSupport.createStream(createStream);<NEW_LINE><MASK><NEW_LINE>int lzret = lzmaSupport.lzmaEasyEncoder(lzmast, preset, self.getCheck(), lzmaEasyEncoder);<NEW_LINE>if (errProfile.profile(lzret != LZMA_OK)) {<NEW_LINE>errorHandling(lzret, getRaiseNode());<NEW_LINE>}<NEW_LINE>} | self.init(lzmast, lzmaSupport); |
722,321 | public OutboundSseEvent buildEvent(Builder eventBuilder, Set<String> itemNames) {<NEW_LINE>Map<String, StateDTO> payload = new HashMap<>(itemNames.size());<NEW_LINE>for (String itemName : itemNames) {<NEW_LINE>try {<NEW_LINE>Item <MASK><NEW_LINE>StateDTO stateDto = new StateDTO();<NEW_LINE>stateDto.state = item.getState().toString();<NEW_LINE>String displayState = getDisplayState(item, Locale.getDefault());<NEW_LINE>// Only include the display state if it's different than the raw state<NEW_LINE>if (stateDto.state != null && !stateDto.state.equals(displayState)) {<NEW_LINE>stateDto.displayState = displayState;<NEW_LINE>}<NEW_LINE>payload.put(itemName, stateDto);<NEW_LINE>} catch (ItemNotFoundException e) {<NEW_LINE>logger.warn("Attempting to send a state update of an item which doesn't exist: {}", itemName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!payload.isEmpty()) {<NEW_LINE>return eventBuilder.mediaType(MediaType.APPLICATION_JSON_TYPE).data(payload).build();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | item = itemRegistry.getItem(itemName); |
1,003,970 | public double evaluate(int[] designations, DataSet dataSet, int clusterID) {<NEW_LINE>int N = 0;<NEW_LINE>double sum = 0;<NEW_LINE>List<Vec<MASK><NEW_LINE>List<Double> cache = dm.getAccelerationCache(X);<NEW_LINE>if (// special case, can compute in O(N) isntead<NEW_LINE>dm instanceof EuclideanDistance) {<NEW_LINE>Vec mean = new DenseVector(X.get(0).length());<NEW_LINE>for (int i = 0; i < dataSet.size(); i++) {<NEW_LINE>if (designations[i] != clusterID)<NEW_LINE>continue;<NEW_LINE>mean.mutableAdd(X.get(i));<NEW_LINE>N++;<NEW_LINE>}<NEW_LINE>// 1e-10 incase N=0<NEW_LINE>mean.mutableDivide((N + 1e-10));<NEW_LINE>List<Double> qi = dm.getQueryInfo(mean);<NEW_LINE>for (int i = 0; i < dataSet.size(); i++) {<NEW_LINE>if (designations[i] == clusterID)<NEW_LINE>sum += Math.pow(dm.dist(i, mean, qi, X, cache), 2);<NEW_LINE>}<NEW_LINE>return sum;<NEW_LINE>}<NEW_LINE>// regulare case, O(N^2)<NEW_LINE>for (int i = 0; i < dataSet.size(); i++) {<NEW_LINE>if (designations[i] != clusterID)<NEW_LINE>continue;<NEW_LINE>N++;<NEW_LINE>for (int j = i + 1; j < dataSet.size(); j++) {<NEW_LINE>if (designations[j] == clusterID)<NEW_LINE>sum += 2 * Math.pow(dm.dist(i, j, X, cache), 2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sum / (N * 2);<NEW_LINE>} | > X = dataSet.getDataVectors(); |
86,411 | private byte[] createFlowControlPacket(Address member, Connection expectedConnection) throws IOException {<NEW_LINE>try (BufferObjectDataOutput output = createObjectDataOutput(nodeEngine, lastFlowPacketSize)) {<NEW_LINE>boolean hasData = false;<NEW_LINE>Map<Long, ExecutionContext> executionContexts = jobExecutionService.getExecutionContextsFor(member);<NEW_LINE>output.writeInt(executionContexts.size());<NEW_LINE>for (Entry<Long, ExecutionContext> executionIdAndCtx : executionContexts.entrySet()) {<NEW_LINE>output.writeLong(executionIdAndCtx.getKey());<NEW_LINE>// dest vertex id --> dest ordinal --> sender addr --> receiver tasklet<NEW_LINE>Map<Integer, Map<Integer, Map<Address, ReceiverTasklet>>> receiverMap = executionIdAndCtx<MASK><NEW_LINE>output.writeInt(receiverMap.values().stream().mapToInt(Map::size).sum());<NEW_LINE>for (Entry<Integer, Map<Integer, Map<Address, ReceiverTasklet>>> e1 : receiverMap.entrySet()) {<NEW_LINE>int vertexId = e1.getKey();<NEW_LINE>Map<Integer, Map<Address, ReceiverTasklet>> ordinalToMemberToTasklet = e1.getValue();<NEW_LINE>for (Entry<Integer, Map<Address, ReceiverTasklet>> e2 : ordinalToMemberToTasklet.entrySet()) {<NEW_LINE>int ordinal = e2.getKey();<NEW_LINE>Map<Address, ReceiverTasklet> memberToTasklet = e2.getValue();<NEW_LINE>output.writeInt(vertexId);<NEW_LINE>output.writeInt(ordinal);<NEW_LINE>ReceiverTasklet receiverTasklet = memberToTasklet.get(member);<NEW_LINE>output.writeInt(receiverTasklet.updateAndGetSendSeqLimitCompressed(expectedConnection));<NEW_LINE>hasData = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (hasData) {<NEW_LINE>byte[] payload = output.toByteArray();<NEW_LINE>lastFlowPacketSize = payload.length;<NEW_LINE>return payload;<NEW_LINE>} else {<NEW_LINE>return EMPTY_BYTES;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getValue().receiverMap(); |
1,635,413 | public long handle(Emulator<?> emulator) {<NEW_LINE>RegisterContext context = emulator.getContext();<NEW_LINE>UnidbgPointer clazz = context.getPointerArg(1);<NEW_LINE>UnidbgPointer jmethodID = context.getPointerArg(2);<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug("CallStaticIntMethodV clazz=" + clazz + ", jmethodID=" + jmethodID);<NEW_LINE>}<NEW_LINE>DvmClass dvmClass = classMap.get(clazz.toIntPeer());<NEW_LINE>DvmMethod dvmMethod = dvmClass == null ? null : dvmClass.getStaticMethod(jmethodID.toIntPeer());<NEW_LINE>if (dvmMethod == null) {<NEW_LINE>throw new BackendException();<NEW_LINE>} else {<NEW_LINE>VarArg varArg = ArmVarArg.create(<MASK><NEW_LINE>int ret = dvmMethod.callStaticIntMethod(varArg);<NEW_LINE>if (verbose) {<NEW_LINE>System.out.printf("JNIEnv->CallStaticIntMethod(%s, %s(%s) => %s) was called from %s%n", dvmClass, dvmMethod.methodName, varArg.formatArgs(), ret, context.getLRPointer());<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>}<NEW_LINE>} | emulator, DalvikVM.this, dvmMethod); |
1,453,782 | public void deleteTransform(String transformId, ActionListener<Boolean> listener) {<NEW_LINE>DeleteByQueryRequest request = createDeleteByQueryRequest();<NEW_LINE>request.indices(<MASK><NEW_LINE>QueryBuilder query = QueryBuilders.termQuery(TransformField.ID.getPreferredName(), transformId);<NEW_LINE>request.setQuery(query);<NEW_LINE>request.setRefresh(true);<NEW_LINE>executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, DeleteByQueryAction.INSTANCE, request, ActionListener.wrap(deleteResponse -> {<NEW_LINE>if (deleteResponse.getDeleted() == 0) {<NEW_LINE>listener.onFailure(new ResourceNotFoundException(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, transformId)));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>listener.onResponse(true);<NEW_LINE>}, e -> {<NEW_LINE>if (e.getClass() == IndexNotFoundException.class) {<NEW_LINE>listener.onFailure(new ResourceNotFoundException(TransformMessages.getMessage(TransformMessages.REST_UNKNOWN_TRANSFORM, transformId)));<NEW_LINE>} else {<NEW_LINE>listener.onFailure(e);<NEW_LINE>}<NEW_LINE>}));<NEW_LINE>} | TransformInternalIndexConstants.INDEX_NAME_PATTERN, TransformInternalIndexConstants.INDEX_NAME_PATTERN_DEPRECATED); |
1,022,717 | public static void proxyResponseHeaders(Map<String, String> respHeaders, SimpleHttpResp resp) {<NEW_LINE>for (Map.Entry<String, String> hdr : respHeaders.entrySet()) {<NEW_LINE><MASK><NEW_LINE>String value = hdr.getValue();<NEW_LINE>if (name.equalsIgnoreCase("Content-type")) {<NEW_LINE>resp.contentType = MediaType.of(value);<NEW_LINE>} else if (name.equalsIgnoreCase("Set-Cookie")) {<NEW_LINE>String[] parts = value.split("=", 2);<NEW_LINE>U.must(parts.length == 2, "Invalid value of the Set-Cookie header!");<NEW_LINE>if (resp.cookies == null) {<NEW_LINE>resp.cookies = U.map();<NEW_LINE>}<NEW_LINE>resp.cookies.put(parts[0], parts[1]);<NEW_LINE>} else if (!ignoreResponseHeaderInProxy(name)) {<NEW_LINE>if (resp.headers == null) {<NEW_LINE>resp.headers = U.map();<NEW_LINE>}<NEW_LINE>resp.headers.put(name, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String name = hdr.getKey(); |
1,463,629 | private boolean findAdapterName() {<NEW_LINE>Logger.D(TAG, "findAdapterName+");<NEW_LINE>boolean dorefresh = false;<NEW_LINE>Enumeration<NetworkInterface> interfaces = null;<NEW_LINE>try {<NEW_LINE>interfaces = NetworkInterface.getNetworkInterfaces();<NEW_LINE>int wifiIp = this.wifiIpAddress;<NEW_LINE>int reverseWifiIp = Integer.reverseBytes(wifiIp);<NEW_LINE>boolean bFoundInterface = false;<NEW_LINE>while (interfaces.hasMoreElements()) {<NEW_LINE>if (bFoundInterface)<NEW_LINE>break;<NEW_LINE>NetworkInterface iface = interfaces.nextElement();<NEW_LINE>Enumeration<InetAddress<MASK><NEW_LINE>while (inetAddresses.hasMoreElements()) {<NEW_LINE>InetAddress nextElement = inetAddresses.nextElement();<NEW_LINE>int byteArrayToInt = byteArrayToInt(nextElement.getAddress(), 0);<NEW_LINE>if (byteArrayToInt == wifiIp || byteArrayToInt == reverseWifiIp) {<NEW_LINE>if (!((this.adapterName).equalsIgnoreCase(iface.getDisplayName()))) {<NEW_LINE>this.adapterName = iface.getDisplayName();<NEW_LINE>dorefresh = true;<NEW_LINE>}<NEW_LINE>bFoundInterface = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (SocketException e) {<NEW_LINE>Logger.D(TAG, "Socket Exception in adapterName");<NEW_LINE>this.adapterName = "Socket Exception";<NEW_LINE>}<NEW_LINE>Logger.D(TAG, "findAdapterName-");<NEW_LINE>return dorefresh;<NEW_LINE>} | > inetAddresses = iface.getInetAddresses(); |
486,474 | protected void writeClassDescriptor(ObjectStreamClass desc) throws IOException {<NEW_LINE>Class<?> cl = desc.forClass();<NEW_LINE>if (ProxyFactory.isProxyClass(cl)) {<NEW_LINE>writeBoolean(true);<NEW_LINE>Class<?> superClass = cl.getSuperclass();<NEW_LINE>Class<?>[] interfaces = cl.getInterfaces();<NEW_LINE>byte[] signature = ProxyFactory.getFilterSignature(cl);<NEW_LINE>String name = superClass.getName();<NEW_LINE>writeObject(name);<NEW_LINE>// we don't write the marker interface ProxyObject<NEW_LINE>writeInt(interfaces.length - 1);<NEW_LINE>for (int i = 0; i < interfaces.length; i++) {<NEW_LINE>Class<<MASK><NEW_LINE>if (interfaze != ProxyObject.class && interfaze != Proxy.class) {<NEW_LINE>name = interfaces[i].getName();<NEW_LINE>writeObject(name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writeInt(signature.length);<NEW_LINE>write(signature);<NEW_LINE>} else {<NEW_LINE>writeBoolean(false);<NEW_LINE>super.writeClassDescriptor(desc);<NEW_LINE>}<NEW_LINE>} | ?> interfaze = interfaces[i]; |
1,149,830 | @ApiImplicitParams({ @ApiImplicitParam(name = "store", dataType = "String", defaultValue = "DEFAULT"), @ApiImplicitParam(name = "lang", dataType = "String", defaultValue = "en") })<NEW_LINE>@ApiOperation(httpMethod = "POST", value = "Patch product sort order", notes = "Change product sortOrder")<NEW_LINE>public void changeProductOrder(@PathVariable Long id, @RequestParam(value = "order", required = false, defaultValue = "0") Integer position, @ApiIgnore MerchantStore merchantStore, @ApiIgnore Language language) throws IOException {<NEW_LINE>try {<NEW_LINE>Product <MASK><NEW_LINE>if (p == null) {<NEW_LINE>throw new ResourceNotFoundException("Product [" + id + "] not found for merchant [" + merchantStore.getCode() + "]");<NEW_LINE>}<NEW_LINE>if (p.getMerchantStore().getId() != merchantStore.getId()) {<NEW_LINE>throw new ResourceNotFoundException("Product [" + id + "] not found for merchant [" + merchantStore.getCode() + "]");<NEW_LINE>}<NEW_LINE>p.setSortOrder(position);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Error while updating Product position", e);<NEW_LINE>throw new ServiceRuntimeException("Product [" + id + "] cannot be edited");<NEW_LINE>}<NEW_LINE>} | p = productService.getById(id); |
1,570,995 | private final void printProgresStats(final long startTime, final boolean isFinal) throws IOException {<NEW_LINE>final long fpSetSize = this.theFPSet.size();<NEW_LINE>// print progress showing states per minute metric (spm)<NEW_LINE>final double factor;<NEW_LINE>if (startTime < 0) {<NEW_LINE>factor = TLCGlobals.progressInterval / 60000d;<NEW_LINE>} else {<NEW_LINE>// This is final statistics<NEW_LINE>oldNumOfGenStates = 0;<NEW_LINE>oldFPSetSize = 0;<NEW_LINE>factor = (System.currentTimeMillis() - startTime) / 60000d;<NEW_LINE>}<NEW_LINE>final long l = getStatesGenerated();<NEW_LINE>statesPerMinute = (long) ((l - oldNumOfGenStates) / factor);<NEW_LINE>oldNumOfGenStates = l;<NEW_LINE>distinctStatesPerMinute = (long) (<MASK><NEW_LINE>oldFPSetSize = fpSetSize;<NEW_LINE>MP.printMessage(EC.TLC_PROGRESS_STATS, new String[] { String.valueOf(this.trace.getLevelForReporting()), MP.format(l), MP.format(fpSetSize), MP.format(this.theStateQueue.size()), MP.format(statesPerMinute), MP.format(distinctStatesPerMinute) });<NEW_LINE>TLAFlightRecorder.progress(isFinal, this.trace.getLevelForReporting(), l, fpSetSize, this.theStateQueue.size(), statesPerMinute, distinctStatesPerMinute);<NEW_LINE>} | (fpSetSize - oldFPSetSize) / factor); |
366,334 | public List<SequenceMatchResult<T>> findNonOverlapping(List<? extends T> elements, Comparator<? super SequenceMatchResult> cmp) {<NEW_LINE>Collection<SequencePattern<T>> triggered = getTriggeredPatterns(elements);<NEW_LINE>List<SequenceMatchResult<T>> all = new ArrayList<>();<NEW_LINE>int i = 0;<NEW_LINE>for (SequencePattern<T> p : triggered) {<NEW_LINE>if (Thread.interrupted()) {<NEW_LINE>// Allow interrupting<NEW_LINE>throw new RuntimeInterruptedException();<NEW_LINE>}<NEW_LINE>SequenceMatcher<T> m = p.getMatcher(elements);<NEW_LINE>m.setMatchWithResult(matchWithResult);<NEW_LINE>m.setOrder(i);<NEW_LINE>while (m.find()) {<NEW_LINE>all.add(m.toBasicSequenceMatchResult());<NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>List<SequenceMatchResult<T>> res = IntervalTree.getNonOverlapping(all, SequenceMatchResult.TO_INTERVAL, cmp);<NEW_LINE><MASK><NEW_LINE>return res;<NEW_LINE>} | res.sort(SequenceMatchResult.OFFSET_COMPARATOR); |
481,649 | public MemberSelectTree buildPrimValueMethodAccess(Tree expr) {<NEW_LINE>TypeMirror boxedType = TreeUtils.typeOf(expr);<NEW_LINE>TypeElement boxedElement = (TypeElement) ((DeclaredType) boxedType).asElement();<NEW_LINE>assert TypesUtils.isBoxedPrimitive(boxedType);<NEW_LINE>TypeMirror unboxedType = modelTypes.unboxedType(boxedType);<NEW_LINE>// Find the *Value() method of the boxed type<NEW_LINE>String primValueName <MASK><NEW_LINE>Symbol.MethodSymbol primValueMethod = null;<NEW_LINE>for (ExecutableElement method : ElementFilter.methodsIn(elements.getAllMembers(boxedElement))) {<NEW_LINE>if (method.getSimpleName().contentEquals(primValueName) && method.getParameters().isEmpty()) {<NEW_LINE>primValueMethod = (Symbol.MethodSymbol) method;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>assert primValueMethod != null : "@AssumeAssertion(nullness): no *Value method declared for boxed type";<NEW_LINE>Type.MethodType methodType = (Type.MethodType) primValueMethod.asType();<NEW_LINE>JCTree.JCFieldAccess primValueAccess = (JCTree.JCFieldAccess) maker.Select((JCTree.JCExpression) expr, primValueMethod);<NEW_LINE>primValueAccess.setType(methodType);<NEW_LINE>return primValueAccess;<NEW_LINE>} | = unboxedType.toString() + "Value"; |
1,453,253 | private BodyExtractor<Flux<Object>, ? super ClientHttpResponse> createBodyExtractor(Object expectedResponseType) {<NEW_LINE>if (expectedResponseType != null) {<NEW_LINE>if (this.replyPayloadToFlux) {<NEW_LINE>if (expectedResponseType instanceof ParameterizedTypeReference) {<NEW_LINE>return BodyExtractors.toFlux((ParameterizedTypeReference) expectedResponseType);<NEW_LINE>} else {<NEW_LINE>return BodyExtractors.toFlux((Class) expectedResponseType);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>BodyExtractor<? extends Mono<?>, ReactiveHttpInputMessage> monoExtractor;<NEW_LINE>if (expectedResponseType instanceof ParameterizedTypeReference<?>) {<NEW_LINE>monoExtractor = BodyExtractors.toMono((ParameterizedTypeReference) expectedResponseType);<NEW_LINE>} else {<NEW_LINE>monoExtractor = BodyExtractors.toMono((Class) expectedResponseType);<NEW_LINE>}<NEW_LINE>return (inputMessage, context) -> Flux.from(monoExtractor.extract(inputMessage, context));<NEW_LINE>}<NEW_LINE>} else if (this.bodyExtractor != null) {<NEW_LINE>return (inputMessage, context) -> {<NEW_LINE>Object body = this.bodyExtractor.extract(inputMessage, context);<NEW_LINE>if (body instanceof Publisher) {<NEW_LINE>return Flux<MASK><NEW_LINE>}<NEW_LINE>return Flux.just(body);<NEW_LINE>};<NEW_LINE>} else {<NEW_LINE>return (inputMessage, context) -> Flux.empty();<NEW_LINE>}<NEW_LINE>} | .from((Publisher) body); |
748,179 | public int compareTo(beginFateOperation_result other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.getClass().getName());<NEW_LINE>}<NEW_LINE>int lastComparison = 0;<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetSuccess(), other.isSetSuccess());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetSuccess()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetSec(), other.isSetSec());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetSec()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sec, other.sec);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.compare(isSetTnase(), other.isSetTnase());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetTnase()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(<MASK><NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | this.tnase, other.tnase); |
1,669,326 | public static void serialize(IntFloatVector feats, ByteBuf output) {<NEW_LINE>output.<MASK><NEW_LINE>output.writeInt((int) feats.getSize());<NEW_LINE>if (feats.isDense()) {<NEW_LINE>output.writeInt(StorageMethod.DENSE.getValue());<NEW_LINE>float[] values = feats.getStorage().getValues();<NEW_LINE>for (int i = 0; i < values.length; i++) {<NEW_LINE>output.writeFloat(values[i]);<NEW_LINE>}<NEW_LINE>} else if (feats.isSparse()) {<NEW_LINE>output.writeInt(StorageMethod.SPARSE.getValue());<NEW_LINE>ObjectIterator<Entry> iter = feats.getStorage().entryIterator();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>Entry entry = iter.next();<NEW_LINE>output.writeInt(entry.getIntKey());<NEW_LINE>output.writeFloat(entry.getFloatValue());<NEW_LINE>}<NEW_LINE>} else if (feats.isSorted()) {<NEW_LINE>output.writeInt(StorageMethod.SORTED.getValue());<NEW_LINE>int[] keys = feats.getStorage().getIndices();<NEW_LINE>float[] values = feats.getStorage().getValues();<NEW_LINE>for (int i = 0; i < keys.length; i++) {<NEW_LINE>output.writeInt(keys[i]);<NEW_LINE>output.writeFloat(values[i]);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("Unsupport storage type ");<NEW_LINE>}<NEW_LINE>} | writeInt(feats.getDim()); |
627,336 | void takeScreenshot(Canvas canvas, SingleObserver<String> observer) {<NEW_LINE>canvas.getScreenShot().subscribeOn(Schedulers.computation()).observeOn(Schedulers.io()).map(bitmap -> {<NEW_LINE>Calendar calendar = Calendar.getInstance();<NEW_LINE>Date now = calendar.getTime();<NEW_LINE>// noinspection SpellCheckingInspection<NEW_LINE>SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.US);<NEW_LINE>String fileName = "Screenshot_" + simpleDateFormat.format(now) + ".png";<NEW_LINE>File screenshotDir = new File(Config.SCREENSHOTS_DIR);<NEW_LINE>File screenshotFile = new File(screenshotDir, fileName);<NEW_LINE>if (!screenshotDir.exists() && !screenshotDir.mkdirs()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>FileOutputStream out = new FileOutputStream(screenshotFile);<NEW_LINE>bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);<NEW_LINE>return screenshotFile.getAbsolutePath();<NEW_LINE>}).observeOn(AndroidSchedulers.mainThread()).subscribe(observer);<NEW_LINE>} | throw new IOException("Can't create directory: " + screenshotDir); |
466,212 | String configFiles(Request req, Response res) {<NEW_LINE>ConfigRepoPlugin repoPlugin = pluginFromRequest(req);<NEW_LINE>File folder = null;<NEW_LINE>try {<NEW_LINE>JsonReader jsonReader = GsonTransformer.getInstance().jsonReaderFrom(req.body());<NEW_LINE>ConfigHelperOptions options = new ConfigHelperOptions(goConfigService.getCurrentConfig(), passwordDeserializer);<NEW_LINE>MaterialConfig materialConfig = MaterialsRepresenter.fromJSON(jsonReader, options);<NEW_LINE>if (!(materialConfig instanceof ScmMaterialConfig)) {<NEW_LINE>res.status(HttpStatus.UNPROCESSABLE_ENTITY.value());<NEW_LINE>return MessageJson.create(format("This material check requires an SCM repository; instead, supplied material was of type: %s", materialConfig.getType()));<NEW_LINE>}<NEW_LINE>validateMaterial(materialConfig);<NEW_LINE>if (materialConfig.errors().present()) {<NEW_LINE>res.status(HttpStatus.UNPROCESSABLE_ENTITY.value());<NEW_LINE>return MessageJson.create(format("Please fix the following SCM configuration errors: %s", materialConfig.errors().asString()));<NEW_LINE>}<NEW_LINE>if (configRepoService.hasConfigRepoByFingerprint(materialConfig.getFingerprint())) {<NEW_LINE>res.status(HttpStatus.CONFLICT.value());<NEW_LINE>return MessageJson.create("Material is already being used as a config repository");<NEW_LINE>}<NEW_LINE>folder = FileUtil.createTempFolder();<NEW_LINE>checkoutFromMaterialConfig(materialConfig, folder);<NEW_LINE>final Map<String, ConfigFileList> pacPluginFiles = Collections.singletonMap(repoPlugin.id(), repoPlugin.getConfigFiles(folder, <MASK><NEW_LINE>return jsonizeAsTopLevelObject(req, w -> ConfigFileListsRepresenter.toJSON(w, pacPluginFiles));<NEW_LINE>} catch (TimeoutException e) {<NEW_LINE>res.status(HttpStatus.PAYLOAD_TOO_LARGE.value());<NEW_LINE>return MessageJson.create("Aborted check because cloning the SCM repository took too long");<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>res.status(HttpStatus.INTERNAL_SERVER_ERROR.value());<NEW_LINE>// unwrap these exceptions thrown by the future<NEW_LINE>return MessageJson.create(e.getCause().getMessage());<NEW_LINE>} catch (Exception e) {<NEW_LINE>res.status(HttpStatus.INTERNAL_SERVER_ERROR.value());<NEW_LINE>return MessageJson.create(e.getMessage());<NEW_LINE>} finally {<NEW_LINE>if (null != folder) {<NEW_LINE>FileUtils.deleteQuietly(folder);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | new ArrayList<>())); |
701,480 | private void deletePartialRow(DataPointsRowKey rowKey, long start, long end, ClusterConnection cluster) throws DatastoreException {<NEW_LINE>RowSpec rowSpec = cluster.getRowSpec();<NEW_LINE>if (cluster.psDataPointsDeleteRange != null) {<NEW_LINE>BoundStatement statement = new BoundStatement(cluster.psDataPointsDeleteRange);<NEW_LINE>statement.setBytesUnsafe(0, DATA_POINTS_ROW_KEY_SERIALIZER.toByteBuffer(rowKey));<NEW_LINE>ByteBuffer b = ByteBuffer.allocate(4);<NEW_LINE>b.putInt(rowSpec.getColumnName(rowKey.getTimestamp(), start));<NEW_LINE>b.rewind();<NEW_LINE>statement.setBytesUnsafe(1, b);<NEW_LINE>b = ByteBuffer.allocate(4);<NEW_LINE>b.putInt(rowSpec.getColumnName(rowKey.getTimestamp(), end));<NEW_LINE>b.rewind();<NEW_LINE>statement.setBytesUnsafe(2, b);<NEW_LINE>statement.setConsistencyLevel(cluster.getReadConsistencyLevel());<NEW_LINE>cluster.executeAsync(statement);<NEW_LINE>} else {<NEW_LINE>// note, with multiple old clusters this query could be done multiple times<NEW_LINE>DatastoreMetricQuery deleteQuery = new QueryMetric(start, end, <MASK><NEW_LINE>cqlQueryWithRowKeys(deleteQuery, new DeletingCallback(deleteQuery.getName(), rowSpec), Collections.singletonList(rowKey).iterator());<NEW_LINE>}<NEW_LINE>} | 0, rowKey.getMetricName()); |
998,008 | public void processTransfer(TransferPacketExtension transfer) throws OperationFailedException {<NEW_LINE><MASK><NEW_LINE>if (attendantAddress == null) {<NEW_LINE>throw new OperationFailedException("Session transfer must contain a \'from\' attribute value.", OperationFailedException.ILLEGAL_ARGUMENT);<NEW_LINE>}<NEW_LINE>Jid calleeAddress = transfer.getTo();<NEW_LINE>if (calleeAddress == null) {<NEW_LINE>throw new OperationFailedException("Session transfer must contain a \'to\' attribute value.", OperationFailedException.ILLEGAL_ARGUMENT);<NEW_LINE>}<NEW_LINE>// Checks if the transfer remote peer is contained by the roster of this<NEW_LINE>// account.<NEW_LINE>Roster roster = Roster.getInstanceFor(getProtocolProvider().getConnection());<NEW_LINE>if (!roster.contains(calleeAddress.asBareJid())) {<NEW_LINE>String failedMessage = "Transfer impossible:\n" + "Account roster does not contain transfer peer: " + calleeAddress.asBareJid();<NEW_LINE>setState(CallPeerState.FAILED, failedMessage);<NEW_LINE>logger.info(failedMessage);<NEW_LINE>}<NEW_LINE>OperationSetBasicTelephonyJabberImpl basicTelephony = (OperationSetBasicTelephonyJabberImpl) getProtocolProvider().getOperationSet(OperationSetBasicTelephony.class);<NEW_LINE>CallJabberImpl calleeCall = new CallJabberImpl(basicTelephony);<NEW_LINE>TransferPacketExtension calleeTransfer = new TransferPacketExtension();<NEW_LINE>String sid = transfer.getSID();<NEW_LINE>calleeTransfer.setFrom(attendantAddress);<NEW_LINE>if (sid != null) {<NEW_LINE>calleeTransfer.setSID(sid);<NEW_LINE>calleeTransfer.setTo(calleeAddress);<NEW_LINE>}<NEW_LINE>basicTelephony.createOutgoingCall(calleeCall, calleeAddress.toString(), Arrays.asList(new ExtensionElement[] { calleeTransfer }));<NEW_LINE>} | Jid attendantAddress = transfer.getFrom(); |
233,151 | private InterEditor createEditor(Point location) {<NEW_LINE>// Inter is determined my latest history information<NEW_LINE>final List<Shape> history = shapeBoard.getHistory();<NEW_LINE>if (history.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final Shape shape = history.get(0);<NEW_LINE>if (!shape.isDraggable()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Staff staff = sheet.getStaffManager().getClosestStaff(location);<NEW_LINE>if (staff == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Inter inter = InterFactory.createManual(shape, sheet);<NEW_LINE>inter.setStaff(staff);<NEW_LINE>final int staffInterline = staff.getSpecificInterline();<NEW_LINE>final MusicFont font = (ShapeSet.Heads.contains(inter.getShape())) ? MusicFont.getHeadFont(sheet.getScale(), staffInterline) : MusicFont.getBaseFont(staffInterline);<NEW_LINE>inter.deriveFrom(shape.getSymbol(), sheet, font, location, Alignment.AREA_CENTER);<NEW_LINE>// To set inter sig<NEW_LINE>staff.getSystem().<MASK><NEW_LINE>// NOTA: this runs in a background task...<NEW_LINE>sheet.getInterController().addInter(inter);<NEW_LINE>return inter.getEditor();<NEW_LINE>} | getSig().addVertex(inter); |
1,277,453 | private static void upgradeTable(Connection connection, Integer currentVersion) throws SQLException {<NEW_LINE>LOGGER.info(LOG_UPGRADING_TABLE, DATABASE_NAME, TABLE_NAME, currentVersion, TABLE_VERSION);<NEW_LINE>try {<NEW_LINE>for (int version = currentVersion; version < TABLE_VERSION; version++) {<NEW_LINE>LOGGER.trace(LOG_UPGRADING_TABLE, DATABASE_NAME, TABLE_NAME, version, version + 1);<NEW_LINE>switch(version) {<NEW_LINE>case 1:<NEW_LINE>// From version 1 to 2, we stopped using KEY and VALUE, and instead use M_KEY and M_VALUE<NEW_LINE>executeUpdate(connection, "DROP INDEX IF EXISTS IDX_KEY");<NEW_LINE>executeUpdate(<MASK><NEW_LINE>executeUpdate(connection, "ALTER TABLE " + TABLE_NAME + " ALTER COLUMN `VALUE` RENAME TO M_VALUE");<NEW_LINE>executeUpdate(connection, "CREATE UNIQUE INDEX IDX_M_KEY ON " + TABLE_NAME + "(M_KEY)");<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException(getMessage(LOG_UPGRADING_TABLE_MISSING, DATABASE_NAME, TABLE_NAME, version, TABLE_VERSION));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>MediaTableTablesVersions.setTableVersion(connection, TABLE_NAME, TABLE_VERSION);<NEW_LINE>} catch (SQLException e) {<NEW_LINE>LOGGER.error("Failed setting the table version of the {} for {}", TABLE_NAME, e.getMessage());<NEW_LINE>throw new SQLException(e);<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>LOGGER.error(LOG_UPGRADING_TABLE_FAILED, DATABASE_NAME, TABLE_NAME, e.getMessage());<NEW_LINE>throw new SQLException(e);<NEW_LINE>}<NEW_LINE>} | connection, "ALTER TABLE " + TABLE_NAME + " ALTER COLUMN `KEY` RENAME TO M_KEY"); |
197,144 | public void parseBoundaryErrorEventDefinition(Element errorEventDefinition, ActivityImpl boundaryEventActivity) {<NEW_LINE>boundaryEventActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.BOUNDARY_ERROR);<NEW_LINE>String errorRef = errorEventDefinition.attribute("errorRef");<NEW_LINE>Error error = null;<NEW_LINE>ErrorEventDefinition definition = new ErrorEventDefinition(boundaryEventActivity.getId());<NEW_LINE>if (errorRef != null) {<NEW_LINE>error = errors.get(errorRef);<NEW_LINE>definition.setErrorCode(error == null ? errorRef : error.getErrorCode());<NEW_LINE>}<NEW_LINE>setErrorCodeVariableOnErrorEventDefinition(errorEventDefinition, definition);<NEW_LINE>setErrorMessageVariableOnErrorEventDefinition(errorEventDefinition, definition);<NEW_LINE>addErrorEventDefinition(definition, boundaryEventActivity.getEventScope());<NEW_LINE>for (BpmnParseListener parseListener : parseListeners) {<NEW_LINE>parseListener.parseBoundaryErrorEventDefinition(errorEventDefinition, true, (ActivityImpl) <MASK><NEW_LINE>}<NEW_LINE>} | boundaryEventActivity.getEventScope(), boundaryEventActivity); |
1,681,960 | public ServerAuthorConfigurationResponse configureViewService(String userId, String serverName, String serverToBeConfiguredName, String serviceURLMarker, Map<String, Object> viewServiceOptions) {<NEW_LINE>final String methodName = "configureViewService";<NEW_LINE>RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName);<NEW_LINE>ServerAuthorConfigurationResponse response = new ServerAuthorConfigurationResponse();<NEW_LINE>AuditLog auditLog = null;<NEW_LINE>try {<NEW_LINE>auditLog = instanceHandler.getAuditLog(userId, serverName, methodName);<NEW_LINE>ServerAuthorViewHandler serverAuthorViewHandler = instanceHandler.getServerAuthorViewHandler(userId, serverName, methodName);<NEW_LINE>serverAuthorViewHandler.configureViewService(className, methodName, serverToBeConfiguredName, serviceURLMarker, viewServiceOptions);<NEW_LINE>response = getStoredConfiguration(userId, serverName, serverToBeConfiguredName);<NEW_LINE>} catch (ServerAuthorViewServiceException error) {<NEW_LINE>ServerAuthorExceptionHandler.<MASK><NEW_LINE>} catch (Exception exception) {<NEW_LINE>restExceptionHandler.captureExceptions(response, exception, methodName, auditLog);<NEW_LINE>}<NEW_LINE>restCallLogger.logRESTCallReturn(token, response.toString());<NEW_LINE>return response;<NEW_LINE>} | captureCheckedException(response, error, className); |
719,575 | public void rewriteServerbound(ByteBuf packet, int oldId, int newId) {<NEW_LINE>super.rewriteServerbound(packet, oldId, newId);<NEW_LINE>// Special cases<NEW_LINE>int readerIndex = packet.readerIndex();<NEW_LINE>int packetId = DefinedPacket.readVarInt(packet);<NEW_LINE>int packetIdLength = packet.readerIndex() - readerIndex;<NEW_LINE>if (packetId == 0x18 && /* Spectate */<NEW_LINE>!BungeeCord.getInstance().getConfig().isIpForward()) {<NEW_LINE>UUID uuid = DefinedPacket.readUUID(packet);<NEW_LINE>ProxiedPlayer player;<NEW_LINE>if ((player = BungeeCord.getInstance().getPlayer(uuid)) != null) {<NEW_LINE>int previous = packet.writerIndex();<NEW_LINE>packet.readerIndex(readerIndex);<NEW_LINE>packet.writerIndex(readerIndex + packetIdLength);<NEW_LINE>DefinedPacket.writeUUID(((UserConnection) player).getPendingConnection(<MASK><NEW_LINE>packet.writerIndex(previous);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>packet.readerIndex(readerIndex);<NEW_LINE>} | ).getOfflineId(), packet); |
982,436 | private static Map<TypeAlias, jnr.ffi.NativeType> buildTypeMap() {<NEW_LINE>Map<TypeAlias, jnr.ffi.NativeType> m = new EnumMap<TypeAlias, jnr.ffi.NativeType>(TypeAlias.class);<NEW_LINE>m.put(TypeAlias.int8_t, NativeType.SCHAR);<NEW_LINE>m.put(TypeAlias.u_int8_t, NativeType.UCHAR);<NEW_LINE>m.put(TypeAlias.int16_t, NativeType.SSHORT);<NEW_LINE>m.put(TypeAlias.u_int16_t, NativeType.USHORT);<NEW_LINE>m.put(TypeAlias.int32_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.u_int32_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.int64_t, NativeType.SLONGLONG);<NEW_LINE>m.put(TypeAlias.u_int64_t, NativeType.ULONGLONG);<NEW_LINE>m.put(TypeAlias.intptr_t, NativeType.SLONG);<NEW_LINE>m.put(TypeAlias.uintptr_t, NativeType.ULONG);<NEW_LINE>m.put(TypeAlias.caddr_t, NativeType.ADDRESS);<NEW_LINE>m.put(TypeAlias.dev_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.blkcnt_t, NativeType.SLONGLONG);<NEW_LINE>m.put(TypeAlias.blksize_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.gid_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.in_addr_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.in_port_t, NativeType.USHORT);<NEW_LINE>m.put(TypeAlias.ino_t, NativeType.ULONGLONG);<NEW_LINE>m.put(TypeAlias.ino64_t, NativeType.ULONGLONG);<NEW_LINE>m.put(TypeAlias.key_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.mode_t, NativeType.USHORT);<NEW_LINE>m.put(TypeAlias.nlink_t, NativeType.USHORT);<NEW_LINE>m.put(TypeAlias.id_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.pid_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.off_t, NativeType.SLONGLONG);<NEW_LINE>m.put(TypeAlias.swblk_t, NativeType.SINT);<NEW_LINE>m.put(TypeAlias.uid_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.clock_t, NativeType.ULONG);<NEW_LINE>m.put(TypeAlias.size_t, NativeType.ULONG);<NEW_LINE>m.put(TypeAlias.ssize_t, NativeType.SLONG);<NEW_LINE>m.put(TypeAlias.time_t, NativeType.SLONG);<NEW_LINE>m.put(TypeAlias.fsblkcnt_t, NativeType.UINT);<NEW_LINE>m.put(<MASK><NEW_LINE>m.put(TypeAlias.sa_family_t, NativeType.UCHAR);<NEW_LINE>m.put(TypeAlias.socklen_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.rlim_t, NativeType.ULONGLONG);<NEW_LINE>m.put(TypeAlias.cc_t, NativeType.UCHAR);<NEW_LINE>m.put(TypeAlias.speed_t, NativeType.UINT);<NEW_LINE>m.put(TypeAlias.tcflag_t, NativeType.UINT);<NEW_LINE>return m;<NEW_LINE>} | TypeAlias.fsfilcnt_t, NativeType.UINT); |
738,043 | private void compile() throws UnsatisfiedParameterException, UnsatisfiedFieldsException {<NEW_LINE>Set<Class<?>> missing = new HashSet<>(fieldsByClass.keySet());<NEW_LINE>missing.removeAll(constructors.keySet());<NEW_LINE>if (!missing.isEmpty()) {<NEW_LINE>throw new UnsatisfiedFieldsException(missing);<NEW_LINE>}<NEW_LINE>Set<Class<?>> unordered = new HashSet<>(constructors.keySet());<NEW_LINE>while (!unordered.isEmpty()) {<NEW_LINE>Set<Class<?>> forRound = new HashSet<>(unordered);<NEW_LINE>forRound.removeAll(depsByDependents.keySet());<NEW_LINE>if (forRound.isEmpty()) {<NEW_LINE>throw new UnsatisfiedParameterException(unordered);<NEW_LINE>}<NEW_LINE>for (Class<?> ready : forRound) {<NEW_LINE>Method m = constructors.get(ready);<NEW_LINE>unordered.remove(ready);<NEW_LINE>ordered.add(new DependentServiceConstructor<MASK><NEW_LINE>depsByDependents.values().removeAll(Collections.singleton(ready));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>assert ordered.size() == constructors.size();<NEW_LINE>} | <>(ready, m)); |
553,902 | public void marshall(CreateFleetMetricRequest createFleetMetricRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createFleetMetricRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createFleetMetricRequest.getMetricName(), METRICNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFleetMetricRequest.getQueryString(), QUERYSTRING_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFleetMetricRequest.getAggregationType(), AGGREGATIONTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFleetMetricRequest.getPeriod(), PERIOD_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createFleetMetricRequest.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFleetMetricRequest.getQueryVersion(), QUERYVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFleetMetricRequest.getIndexName(), INDEXNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFleetMetricRequest.getUnit(), UNIT_BINDING);<NEW_LINE>protocolMarshaller.marshall(createFleetMetricRequest.getTags(), TAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createFleetMetricRequest.getAggregationField(), AGGREGATIONFIELD_BINDING); |
1,326,993 | protected Runnable asLongOperationRunnable(final Runnable runnable) {<NEW_LINE>final Component componentSwing = (Component) getParentComponent();<NEW_LINE>if (componentSwing == null) {<NEW_LINE>if (developerModeBL.isEnabled()) {<NEW_LINE>final AdempiereException ex = new AdempiereException("We were asked to run as a long operation but the parent component is not set." + "Ignore, but please check because this could be a development error." + <MASK><NEW_LINE>logger.warn(ex.getLocalizedMessage(), ex);<NEW_LINE>}<NEW_LINE>return runnable;<NEW_LINE>}<NEW_LINE>return new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String toString() {<NEW_LINE>return "LongOp[" + runnable + "]";<NEW_LINE>}<NEW_LINE><NEW_LINE>private Component cursorHolder;<NEW_LINE><NEW_LINE>private Cursor cursorOld;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>try {<NEW_LINE>showWaitingCursor();<NEW_LINE>//<NEW_LINE>// Actually invoke the runner<NEW_LINE>runnable.run();<NEW_LINE>} finally {<NEW_LINE>hideWaitingCursor();<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>private final void showWaitingCursor() {<NEW_LINE>// If we were also asked to show the glass pane, don't show the waiting cursor here<NEW_LINE>if (isShowGlassPane()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>cursorHolder = componentSwing;<NEW_LINE>if (cursorHolder != null) {<NEW_LINE>cursorOld = cursorHolder.getCursor();<NEW_LINE>cursorHolder.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>private final void hideWaitingCursor() {<NEW_LINE>final Component cursorHolder = this.cursorHolder;<NEW_LINE>this.cursorHolder = null;<NEW_LINE>if (cursorHolder != null) {<NEW_LINE>cursorHolder.setCursor(cursorOld);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | "\n Invoker: " + this + "\n Runnable: " + runnable); |
1,279,403 | protected AlgorithmParameters engineGenerateParameters() {<NEW_LINE>DSAParametersGenerator pGen;<NEW_LINE>if (strength <= 1024) {<NEW_LINE>pGen = new DSAParametersGenerator();<NEW_LINE>} else {<NEW_LINE>pGen = new DSAParametersGenerator(new SHA256Digest());<NEW_LINE>}<NEW_LINE>if (random == null) {<NEW_LINE>random = CryptoServicesRegistrar.getSecureRandom();<NEW_LINE>}<NEW_LINE>int certainty = PrimeCertaintyCalculator.getDefaultCertainty(strength);<NEW_LINE>if (strength == 1024) {<NEW_LINE>params = new DSAParameterGenerationParameters(1024, 160, certainty, random);<NEW_LINE>pGen.init(params);<NEW_LINE>} else if (strength > 1024) {<NEW_LINE>params = new DSAParameterGenerationParameters(strength, 256, certainty, random);<NEW_LINE>pGen.init(params);<NEW_LINE>} else {<NEW_LINE>pGen.init(strength, certainty, random);<NEW_LINE>}<NEW_LINE>DSAParameters p = pGen.generateParameters();<NEW_LINE>AlgorithmParameters params;<NEW_LINE>try {<NEW_LINE>params = createParametersInstance("DSA");<NEW_LINE>params.init(new DSAParameterSpec(p.getP(), p.getQ(), p.getG()));<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>return params;<NEW_LINE>} | RuntimeException(e.getMessage()); |
239,002 | private void loadNode1025() {<NEW_LINE>PropertyTypeNode node = new PropertyTypeNode(this.context, Identifiers.OperationLimitsType_MaxNodesPerRegisterNodes, new QualifiedName(0, "MaxNodesPerRegisterNodes"), new LocalizedText("en", "MaxNodesPerRegisterNodes"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.UInt32, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.OperationLimitsType_MaxNodesPerRegisterNodes, Identifiers.HasTypeDefinition, Identifiers.PropertyType<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.OperationLimitsType_MaxNodesPerRegisterNodes, Identifiers.HasModellingRule, Identifiers.ModellingRule_Optional.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.OperationLimitsType_MaxNodesPerRegisterNodes, Identifiers.HasProperty, Identifiers.OperationLimitsType.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), true)); |
1,116,697 | private void queueIO(TCPBaseRequestContext req) throws IOException {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {<NEW_LINE>Tr.entry(tc, "queueIO");<NEW_LINE>}<NEW_LINE>final TCPConnLink conn = req.getTCPConnLink();<NEW_LINE>final ChannelSelector channelSelector;<NEW_LINE>if (req.isRequestTypeRead()) {<NEW_LINE>channelSelector = ((NioSocketIOChannel) conn.getSocketIOChannel()).getChannelSelectorRead();<NEW_LINE>} else {<NEW_LINE>channelSelector = ((NioSocketIOChannel) conn.getSocketIOChannel()).getChannelSelectorWrite();<NEW_LINE>}<NEW_LINE>if (channelSelector != null) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {<NEW_LINE>Tr.event(tc, "Adding work to selector");<NEW_LINE>}<NEW_LINE>channelSelector.addWork(req);<NEW_LINE>} else {<NEW_LINE>// Figure out which ChannelSelector to queue this work<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (req.isRequestTypeRead()) {<NEW_LINE>// Read IO, determine if this req is inbound or outbound.<NEW_LINE>if (conn.getConfig().isInbound() || combineSelectors) {<NEW_LINE>moveIntoPosition(readInboundCount, readInbound, req, CS_READ_INBOUND);<NEW_LINE>} else {<NEW_LINE>moveIntoPosition(readOutboundCount, readOutbound, req, CS_READ_OUTBOUND);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Write IO, determine if this req is inbound or outbound.<NEW_LINE>if (conn.getConfig().isInbound() || combineSelectors) {<NEW_LINE>moveIntoPosition(writeInboundCount, writeInbound, req, CS_WRITE_INBOUND);<NEW_LINE>} else {<NEW_LINE>moveIntoPosition(writeOutboundCount, writeOutbound, req, CS_WRITE_OUTBOUND);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {<NEW_LINE>Tr.exit(tc, "queueIO");<NEW_LINE>}<NEW_LINE>} | Tr.event(tc, "Finding selector for IO"); |
1,012,689 | public void mapPartition(Iterable<Tuple2<Long, FeatureBinsCalculator>> values, Collector<Row> out) throws Exception {<NEW_LINE>Params meta = null;<NEW_LINE>if (getRuntimeContext().getIndexOfThisSubtask() == 0) {<NEW_LINE>List<Tuple3<Long, String, String>> colList = getRuntimeContext().getBroadcastVariable("selectedCols");<NEW_LINE>String[] selectedCols = new String[colList.size()];<NEW_LINE>String[] selectedColTypes = new String[colList.size()];<NEW_LINE>colList.forEach(selectedCol -> {<NEW_LINE>selectedCols[selectedCol.f0.<MASK><NEW_LINE>selectedColTypes[selectedCol.f0.intValue()] = selectedCol.f2;<NEW_LINE>});<NEW_LINE>meta = new Params().set(HasSelectedCols.SELECTED_COLS, selectedCols).set(HasSelectedColTypes.SELECTED_COL_TYPES, selectedColTypes).set(HasEnableElse.ENABLE_ELSE, true);<NEW_LINE>}<NEW_LINE>transformFeatureBinsToModel(values, out, meta);<NEW_LINE>} | intValue()] = selectedCol.f1; |
32,461 | protected TaskResult callExecutor(Path projectPath, String type, TaskRequest mergedRequest) {<NEW_LINE>OperatorFactory factory = registry.get(mergedRequest, type);<NEW_LINE>if (factory == null) {<NEW_LINE>throw new ConfigException("Unknown task type: " + type);<NEW_LINE>}<NEW_LINE>SecretStore secretStore = secretStoreManager.getSecretStore(mergedRequest.getSiteId());<NEW_LINE>SecretAccessContext secretContext = SecretAccessContext.builder().siteId(mergedRequest.getSiteId()).projectId(mergedRequest.getProjectId()).revision(mergedRequest.getRevision().get()).workflowName(mergedRequest.getWorkflowName()).taskName(mergedRequest.getTaskName()).operatorType(type).build();<NEW_LINE>// Users can mount secrets<NEW_LINE>Config secretMounts = mergedRequest.getConfig().getNestedOrGetEmpty("_secrets");<NEW_LINE>mergedRequest.getConfig().remove("_secrets");<NEW_LINE>DefaultSecretProvider secretProvider = new DefaultSecretProvider(secretContext, secretMounts, secretStore);<NEW_LINE>PrivilegedVariables privilegedVariables = GrantedPrivilegedVariables.build(mergedRequest.getLocalConfig().getNestedOrGetEmpty("_env"), GrantedPrivilegedVariables<MASK><NEW_LINE>OperatorContext context = new DefaultOperatorContext(projectPath, mergedRequest, secretProvider, privilegedVariables, limits);<NEW_LINE>Operator operator = factory.newOperator(context);<NEW_LINE>if (mergedRequest.isCancelRequested()) {<NEW_LINE>// NOTE: In the case of failure to perform cleanup,<NEW_LINE>// target resources continue to remain<NEW_LINE>operator.cleanup(mergedRequest);<NEW_LINE>// Throw exception to stop the task<NEW_LINE>throw new TaskExecutionException(String.format(ENGLISH, "Got a cancel-requested: attempt_id=%d, task_id=%d", mergedRequest.getAttemptId(), mergedRequest.getTaskId()));<NEW_LINE>}<NEW_LINE>return operator.run();<NEW_LINE>} | .privilegedSecretProvider(secretContext, secretStore)); |
779,908 | public GradientValue_I32 compute(int x, int y) {<NEW_LINE>int horizontalOffset = x - r - 1;<NEW_LINE>int indexSrc1 = input.startIndex + (y - r - 1) * input.stride + horizontalOffset;<NEW_LINE>int indexSrc2 = indexSrc1 + r * input.stride;<NEW_LINE>int indexSrc3 = indexSrc2 + input.stride;<NEW_LINE>int indexSrc4 = indexSrc3 + r * input.stride;<NEW_LINE>int p0 = input.data[indexSrc1];<NEW_LINE>int p1 = input.data[indexSrc1 + r];<NEW_LINE>int p2 = input.data[indexSrc1 + r + 1];<NEW_LINE>int p3 = input.data[indexSrc1 + w];<NEW_LINE>int <MASK><NEW_LINE>int p4 = input.data[indexSrc2 + w];<NEW_LINE>int p10 = input.data[indexSrc3];<NEW_LINE>int p5 = input.data[indexSrc3 + w];<NEW_LINE>int p9 = input.data[indexSrc4];<NEW_LINE>int p8 = input.data[indexSrc4 + r];<NEW_LINE>int p7 = input.data[indexSrc4 + r + 1];<NEW_LINE>int p6 = input.data[indexSrc4 + w];<NEW_LINE>int left = p8 - p9 - p1 + p0;<NEW_LINE>int right = p6 - p7 - p3 + p2;<NEW_LINE>int top = p4 - p11 - p3 + p0;<NEW_LINE>int bottom = p6 - p9 - p5 + p10;<NEW_LINE>ret.x = right - left;<NEW_LINE>ret.y = bottom - top;<NEW_LINE>return ret;<NEW_LINE>} | p11 = input.data[indexSrc2]; |
823,425 | private void refreshToken() {<NEW_LINE>try {<NEW_LINE>final URI resourceURI;<NEW_LINE>final UriComponentsBuilder <MASK><NEW_LINE>uriBuilder.pathSegment(PathSegmentsEnum.API.getValue()).pathSegment(PathSegmentsEnum.OATH.getValue()).pathSegment(PathSegmentsEnum.TOKEN.getValue());<NEW_LINE>final HttpEntity<GetBearerRequest> request = new HttpEntity<>(authToken.toGetBearerRequest(), getHttpHeaders());<NEW_LINE>resourceURI = uriBuilder.build().toUri();<NEW_LINE>final ResponseEntity<JsonOauthResponse> response = restTemplate().exchange(resourceURI, HttpMethod.POST, request, JsonOauthResponse.class);<NEW_LINE>if (response.getBody() == null) {<NEW_LINE>throw new RuntimeException("No access token returned from shopware!");<NEW_LINE>}<NEW_LINE>final JsonOauthResponse oauthResponse = response.getBody();<NEW_LINE>final Instant validUntil = Instant.now().plusSeconds(oauthResponse.getExpiresIn());<NEW_LINE>this.authToken.updateBearer(oauthResponse.getAccessToken(), validUntil);<NEW_LINE>} catch (final Exception exception) {<NEW_LINE>logger.log(Level.SEVERE, "Exception while trying to refresh the auth token: " + exception.getLocalizedMessage(), exception);<NEW_LINE>throw exception;<NEW_LINE>}<NEW_LINE>} | uriBuilder = UriComponentsBuilder.fromHttpUrl(baseUrl); |
1,126,109 | public static DescribeDomainStatusCodeListResponse unmarshall(DescribeDomainStatusCodeListResponse describeDomainStatusCodeListResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDomainStatusCodeListResponse.setRequestId(_ctx.stringValue("DescribeDomainStatusCodeListResponse.RequestId"));<NEW_LINE>List<StatusCode> statusCodeList = new ArrayList<StatusCode>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDomainStatusCodeListResponse.StatusCodeList.Length"); i++) {<NEW_LINE>StatusCode statusCode = new StatusCode();<NEW_LINE>statusCode.setIndex(_ctx.integerValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Index"));<NEW_LINE>statusCode.setTime(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Time"));<NEW_LINE>statusCode.setStatus2XX(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status2XX"));<NEW_LINE>statusCode.setStatus501(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status501"));<NEW_LINE>statusCode.setStatus502(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status502"));<NEW_LINE>statusCode.setStatus503(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status503"));<NEW_LINE>statusCode.setStatus504(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status504"));<NEW_LINE>statusCode.setStatus200(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status200"));<NEW_LINE>statusCode.setStatus405(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status405"));<NEW_LINE>statusCode.setStatus5XX(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status5XX"));<NEW_LINE>statusCode.setStatus4XX(_ctx.longValue<MASK><NEW_LINE>statusCode.setStatus403(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status403"));<NEW_LINE>statusCode.setStatus404(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status404"));<NEW_LINE>statusCode.setStatus3XX(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status3XX"));<NEW_LINE>statusCodeList.add(statusCode);<NEW_LINE>}<NEW_LINE>describeDomainStatusCodeListResponse.setStatusCodeList(statusCodeList);<NEW_LINE>List<StatusCode> statusCodeList1 = new ArrayList<StatusCode>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDomainStatusCodeListResponse.StatusCodeList.Length"); i++) {<NEW_LINE>StatusCode statusCode_ = new StatusCode();<NEW_LINE>statusCode_.setIndex(_ctx.integerValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Index"));<NEW_LINE>statusCode_.setTime(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Time"));<NEW_LINE>statusCode_.setStatus2XX(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status2XX"));<NEW_LINE>statusCode_.setStatus501(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status501"));<NEW_LINE>statusCode_.setStatus502(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status502"));<NEW_LINE>statusCode_.setStatus503(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status503"));<NEW_LINE>statusCode_.setStatus504(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status504"));<NEW_LINE>statusCode_.setStatus200(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status200"));<NEW_LINE>statusCode_.setStatus405(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status405"));<NEW_LINE>statusCode_.setStatus5XX(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status5XX"));<NEW_LINE>statusCode_.setStatus4XX(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status4XX"));<NEW_LINE>statusCode_.setStatus403(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status403"));<NEW_LINE>statusCode_.setStatus404(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status404"));<NEW_LINE>statusCode_.setStatus3XX(_ctx.longValue("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status3XX"));<NEW_LINE>statusCodeList1.add(statusCode_);<NEW_LINE>}<NEW_LINE>describeDomainStatusCodeListResponse.setStatusCodeList1(statusCodeList1);<NEW_LINE>return describeDomainStatusCodeListResponse;<NEW_LINE>} | ("DescribeDomainStatusCodeListResponse.StatusCodeList[" + i + "].Status4XX")); |
1,290,392 | public void initModel(Offer offer, PaymentAccount paymentAccount, boolean useSavingsWallet) {<NEW_LINE>this.clearModel();<NEW_LINE>this.offer = offer;<NEW_LINE>this.paymentAccount = paymentAccount;<NEW_LINE>this.addressEntry = btcWalletService.getOrCreateAddressEntry(<MASK><NEW_LINE>validateModelInputs();<NEW_LINE>this.useSavingsWallet = useSavingsWallet;<NEW_LINE>this.amount = valueOf(Math.min(offer.getAmount().value, getMaxTradeLimit()));<NEW_LINE>this.securityDeposit = offer.getDirection() == SELL ? offer.getBuyerSecurityDeposit() : offer.getSellerSecurityDeposit();<NEW_LINE>this.isCurrencyForTakerFeeBtc = offerUtil.isCurrencyForTakerFeeBtc(amount);<NEW_LINE>this.takerFee = offerUtil.getTakerFee(isCurrencyForTakerFeeBtc, amount);<NEW_LINE>calculateTxFees();<NEW_LINE>calculateVolume();<NEW_LINE>calculateTotalToPay();<NEW_LINE>offer.resetState();<NEW_LINE>priceFeedService.setCurrencyCode(offer.getCurrencyCode());<NEW_LINE>} | offer.getId(), OFFER_FUNDING); |
72,255 | public UIData load(JsonElement element, Locale otherLocale) throws IOException {<NEW_LINE>NUIManager nuiManager = CoreRegistry.get(NUIManager.class);<NEW_LINE>TranslationSystem translationSystem = CoreRegistry.get(TranslationSystem.class);<NEW_LINE>TypeHandlerLibrary library = CoreRegistry.get(TypeHandlerLibrary.class).copy();<NEW_LINE>library.addTypeHandler(UISkinAsset.class, new AssetTypeHandler<>(UISkinAsset.class));<NEW_LINE>library.addTypeHandler(UISkin.class, new UISkinTypeHandler());<NEW_LINE>// TODO: Rewrite to use TypeHandlerLibrary<NEW_LINE>GsonBuilder gsonBuilder = new GsonBuilder().registerTypeAdapterFactory(new GsonTypeSerializationLibraryAdapterFactory(library)).registerTypeAdapterFactory(new CaseInsensitiveEnumTypeAdapterFactory()).registerTypeAdapter(UIData.class, new UIDataTypeAdapter()).registerTypeHierarchyAdapter(UIWidget.class, new UIWidgetTypeAdapter(nuiManager));<NEW_LINE>// override the String TypeAdapter from the serialization library<NEW_LINE>gsonBuilder.registerTypeAdapter(String.class, <MASK><NEW_LINE>Gson gson = gsonBuilder.create();<NEW_LINE>return gson.fromJson(element, UIData.class);<NEW_LINE>} | new I18nStringTypeAdapter(translationSystem, otherLocale)); |
1,469,508 | public void run(CompilationController controller) throws IOException {<NEW_LINE>controller.toPhase(Phase.RESOLVED);<NEW_LINE>TypeElement classElement = getTopLevelClassElement(controller);<NEW_LINE>if (classElement == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>CompilationUnitTree tree = controller.getCompilationUnit();<NEW_LINE>Trees trees = controller.getTrees();<NEW_LINE>Tree elementTree;<NEW_LINE>Element element = null;<NEW_LINE>if (methodName == null) {<NEW_LINE>element = classElement;<NEW_LINE>} else {<NEW_LINE>List<ExecutableElement> methods = ElementFilter.<MASK><NEW_LINE>for (ExecutableElement method : methods) {<NEW_LINE>if (method.getSimpleName().toString().equals(methodName)) {<NEW_LINE>element = method;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (element != null) {<NEW_LINE>elementTree = trees.getTree(element);<NEW_LINE>long pos = trees.getSourcePositions().getStartPosition(tree, elementTree);<NEW_LINE>position[0] = tree.getLineMap().getLineNumber(pos) - 1;<NEW_LINE>position[1] = tree.getLineMap().getColumnNumber(pos) - 1;<NEW_LINE>}<NEW_LINE>} | methodsIn(classElement.getEnclosedElements()); |
264,992 | public void removeMember(JSConsumerKey key) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.entry(tc, "removeMember", key);<NEW_LINE>SelectionCriteria toRemove = ((RemoteQPConsumerKey) key).getSelectionCriteria()[0];<NEW_LINE>synchronized (criteriaLock) {<NEW_LINE>if (allCriterias != null) {<NEW_LINE>for (int i = 0; i < allCriterias.length; i++) {<NEW_LINE>if (toRemove == allCriterias[i]) {<NEW_LINE>// found<NEW_LINE>if (allCriterias.length == 1) {<NEW_LINE>allCriterias = null;<NEW_LINE>} else {<NEW_LINE>SelectionCriteria[] newCriterias = new <MASK><NEW_LINE>if (i > 0) {<NEW_LINE>System.arraycopy(allCriterias, 0, newCriterias, 0, i);<NEW_LINE>}<NEW_LINE>if (i < allCriterias.length - 1) {<NEW_LINE>// more to copy<NEW_LINE>System.arraycopy(allCriterias, i + 1, newCriterias, i, allCriterias.length - (i + 1));<NEW_LINE>}<NEW_LINE>allCriterias = newCriterias;<NEW_LINE>}<NEW_LINE>// end else<NEW_LINE>// break out of for loop<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// end if (toRemove == allCriterias[i])<NEW_LINE>}<NEW_LINE>// end for<NEW_LINE>}<NEW_LINE>// end if (allCriterias != null)<NEW_LINE>}<NEW_LINE>// end synchronized ...<NEW_LINE>// note we did not throw an exception/error if the SelectionCriteria is not found since we rely on the<NEW_LINE>// superclass method to check for such mistakes.<NEW_LINE>super.removeMember(key);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())<NEW_LINE>SibTr.exit(tc, "removeMember");<NEW_LINE>} | SelectionCriteria[allCriterias.length - 1]; |
675,825 | public void onMatch(RelOptRuleCall call) {<NEW_LINE>final Filter filter = call.rel(0);<NEW_LINE>final List<RexNode> expList = Lists.newArrayList(filter.getCondition());<NEW_LINE>RexNode newConditionExp;<NEW_LINE>boolean reduced;<NEW_LINE>final RelMetadataQuery mq = call.getMetadataQuery();<NEW_LINE>final RelOptPredicateList predicates = mq.getPulledUpPredicates(filter.getInput());<NEW_LINE>if (reduceExpressions(filter, expList, predicates, true, matchNullability)) {<NEW_LINE>assert expList.size() == 1;<NEW_LINE>newConditionExp = expList.get(0);<NEW_LINE>reduced = true;<NEW_LINE>} else {<NEW_LINE>// No reduction, but let's still test the original<NEW_LINE>// predicate to see if it was already a constant,<NEW_LINE>// in which case we don't need any runtime decision<NEW_LINE>// about filtering.<NEW_LINE>newConditionExp = filter.getCondition();<NEW_LINE>reduced = false;<NEW_LINE>}<NEW_LINE>// Even if no reduction, let's still test the original<NEW_LINE>// predicate to see if it was already a constant,<NEW_LINE>// in which case we don't need any runtime decision<NEW_LINE>// about filtering.<NEW_LINE>if (newConditionExp.isAlwaysTrue()) {<NEW_LINE>call.transformTo(filter.getInput());<NEW_LINE>} else if (newConditionExp instanceof RexLiteral || RexUtil.isNullLiteral(newConditionExp, true)) {<NEW_LINE>call.transformTo(createEmptyRelOrEquivalent(call, filter));<NEW_LINE>} else if (reduced) {<NEW_LINE>call.transformTo(call.builder().push(filter.getInput()).filter(newConditionExp).build());<NEW_LINE>} else {<NEW_LINE>if (newConditionExp instanceof RexCall) {<NEW_LINE>boolean reverse = newConditionExp<MASK><NEW_LINE>if (reverse) {<NEW_LINE>newConditionExp = ((RexCall) newConditionExp).getOperands().get(0);<NEW_LINE>}<NEW_LINE>reduceNotNullableFilter(call, filter, newConditionExp, reverse);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// New plan is absolutely better than old plan.<NEW_LINE>call.getPlanner().prune(filter);<NEW_LINE>} | .getKind() == SqlKind.NOT; |
1,687,248 | public Server.ServerRequest build() {<NEW_LINE>Preconditions.checkState(_payloadType != null && CollectionUtils.isNotEmpty(_segments), "Query and segmentsToQuery must be set");<NEW_LINE>Map<String, String> metadata = new HashMap<>();<NEW_LINE>metadata.put(Request.MetadataKeys.REQUEST_ID, Integer.toString(_requestId));<NEW_LINE>metadata.put(Request.MetadataKeys.BROKER_ID, _brokerId);<NEW_LINE>metadata.put(Request.MetadataKeys.ENABLE_TRACE<MASK><NEW_LINE>metadata.put(Request.MetadataKeys.ENABLE_STREAMING, Boolean.toString(_enableStreaming));<NEW_LINE>metadata.put(Request.MetadataKeys.PAYLOAD_TYPE, _payloadType);<NEW_LINE>if (_payloadType.equals(Request.PayloadType.SQL)) {<NEW_LINE>return Server.ServerRequest.newBuilder().putAllMetadata(metadata).setSql(_sql).addAllSegments(_segments).build();<NEW_LINE>} else {<NEW_LINE>byte[] payLoad;<NEW_LINE>try {<NEW_LINE>payLoad = new TSerializer(new TCompactProtocol.Factory()).serialize(_brokerRequest);<NEW_LINE>} catch (TException e) {<NEW_LINE>throw new RuntimeException("Caught exception while serializing broker request: " + _brokerRequest, e);<NEW_LINE>}<NEW_LINE>return Server.ServerRequest.newBuilder().putAllMetadata(metadata).setPayload(ByteString.copyFrom(payLoad)).addAllSegments(_segments).build();<NEW_LINE>}<NEW_LINE>} | , Boolean.toString(_enableTrace)); |
90,224 | public void start() {<NEW_LINE>if (current != null) {<NEW_LINE>current.show();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String imageURL = "https://upload.wikimedia.org/wikipedia/commons/f/f5/Steve_Jobs_Headshot_2010-CROP2.jpg";<NEW_LINE>Form hi = new Form("Hi World", new BorderLayout());<NEW_LINE>ImageViewer viewer = new ImageViewer();<NEW_LINE>Button getCroppedImage = new Button("Get Crop");<NEW_LINE>getCroppedImage.addActionListener(e -> {<NEW_LINE>Label l = new Label(viewer.getCroppedImage(300, -1, 0x0));<NEW_LINE>Dialog.show("Crop is", <MASK><NEW_LINE>});<NEW_LINE>Button getCroppedImageFullSize = new Button("Get Crop (Full Size)");<NEW_LINE>getCroppedImageFullSize.addActionListener(e -> {<NEW_LINE>Label l = new Label(viewer.getCroppedImage(0x0));<NEW_LINE>Dialog.show("Crop is", l, new Command("OK"));<NEW_LINE>});<NEW_LINE>Util.downloadImageToCache(imageURL).ready(img -> {<NEW_LINE>viewer.setImage(img);<NEW_LINE>hi.revalidateWithAnimationSafety();<NEW_LINE>}).except(ex -> Log.e(ex));<NEW_LINE>hi.add(BorderLayout.CENTER, viewer);<NEW_LINE>hi.add(BorderLayout.SOUTH, FlowLayout.encloseIn(getCroppedImage, getCroppedImageFullSize));<NEW_LINE>hi.show();<NEW_LINE>} | l, new Command("OK")); |
74,337 | public static DescribePriceResponse unmarshall(DescribePriceResponse describePriceResponse, UnmarshallerContext _ctx) {<NEW_LINE>describePriceResponse.setRequestId(_ctx.stringValue("DescribePriceResponse.RequestId"));<NEW_LINE>describePriceResponse.setOrderParams(_ctx.stringValue("DescribePriceResponse.OrderParams"));<NEW_LINE>Order order = new Order();<NEW_LINE>order.setOriginalAmount(_ctx.stringValue("DescribePriceResponse.Order.OriginalAmount"));<NEW_LINE>order.setHandlingFeeAmount(_ctx.stringValue("DescribePriceResponse.Order.HandlingFeeAmount"));<NEW_LINE>order.setCurrency(_ctx.stringValue("DescribePriceResponse.Order.Currency"));<NEW_LINE>order.setDiscountAmount(_ctx.stringValue("DescribePriceResponse.Order.DiscountAmount"));<NEW_LINE>order.setTradeAmount(_ctx.stringValue("DescribePriceResponse.Order.TradeAmount"));<NEW_LINE>List<String> ruleIds1 = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribePriceResponse.Order.RuleIds.Length"); i++) {<NEW_LINE>ruleIds1.add(_ctx.stringValue("DescribePriceResponse.Order.RuleIds[" + i + "]"));<NEW_LINE>}<NEW_LINE>order.setRuleIds1(ruleIds1);<NEW_LINE>List<Coupon> coupons = new ArrayList<Coupon>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribePriceResponse.Order.Coupons.Length"); i++) {<NEW_LINE>Coupon coupon = new Coupon();<NEW_LINE>coupon.setIsSelected(_ctx.stringValue("DescribePriceResponse.Order.Coupons[" + i + "].IsSelected"));<NEW_LINE>coupon.setCouponNo(_ctx.stringValue("DescribePriceResponse.Order.Coupons[" + i + "].CouponNo"));<NEW_LINE>coupon.setName(_ctx.stringValue("DescribePriceResponse.Order.Coupons[" + i + "].Name"));<NEW_LINE>coupon.setDescription(_ctx.stringValue("DescribePriceResponse.Order.Coupons[" + i + "].Description"));<NEW_LINE>coupons.add(coupon);<NEW_LINE>}<NEW_LINE>order.setCoupons(coupons);<NEW_LINE>describePriceResponse.setOrder(order);<NEW_LINE>List<Rule> rules = new ArrayList<Rule>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribePriceResponse.Rules.Length"); i++) {<NEW_LINE>Rule rule = new Rule();<NEW_LINE>rule.setRuleDescId(_ctx.longValue("DescribePriceResponse.Rules[" + i + "].RuleDescId"));<NEW_LINE>rule.setTitle(_ctx.stringValue("DescribePriceResponse.Rules[" + i + "].Title"));<NEW_LINE>rule.setName(_ctx.stringValue("DescribePriceResponse.Rules[" + i + "].Name"));<NEW_LINE>rules.add(rule);<NEW_LINE>}<NEW_LINE>describePriceResponse.setRules(rules);<NEW_LINE>List<SubOrder> subOrders = new ArrayList<SubOrder>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribePriceResponse.SubOrders.Length"); i++) {<NEW_LINE>SubOrder subOrder = new SubOrder();<NEW_LINE>subOrder.setOriginalAmount(_ctx.stringValue("DescribePriceResponse.SubOrders[" + i + "].OriginalAmount"));<NEW_LINE>subOrder.setInstanceId(_ctx.stringValue<MASK><NEW_LINE>subOrder.setDiscountAmount(_ctx.stringValue("DescribePriceResponse.SubOrders[" + i + "].DiscountAmount"));<NEW_LINE>subOrder.setTradeAmount(_ctx.stringValue("DescribePriceResponse.SubOrders[" + i + "].TradeAmount"));<NEW_LINE>List<String> ruleIds = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribePriceResponse.SubOrders[" + i + "].RuleIds.Length"); j++) {<NEW_LINE>ruleIds.add(_ctx.stringValue("DescribePriceResponse.SubOrders[" + i + "].RuleIds[" + j + "]"));<NEW_LINE>}<NEW_LINE>subOrder.setRuleIds(ruleIds);<NEW_LINE>subOrders.add(subOrder);<NEW_LINE>}<NEW_LINE>describePriceResponse.setSubOrders(subOrders);<NEW_LINE>return describePriceResponse;<NEW_LINE>} | ("DescribePriceResponse.SubOrders[" + i + "].InstanceId")); |
220,552 | protected void compute() {<NEW_LINE>boolean canCompute = (end - start) < threshold;<NEW_LINE>if (canCompute) {<NEW_LINE>if (v instanceof CompIntDoubleVector) {<NEW_LINE>apply((CompIntDoubleVector) v, op, (CompIntDoubleVector) result, start, end);<NEW_LINE>} else if (v instanceof CompIntFloatVector) {<NEW_LINE>apply((CompIntFloatVector) v, op, (CompIntFloatVector) result, start, end);<NEW_LINE>} else if (v instanceof CompIntLongVector) {<NEW_LINE>apply((CompIntLongVector) v, op, (CompIntLongVector) result, start, end);<NEW_LINE>} else if (v instanceof CompIntIntVector) {<NEW_LINE>apply((CompIntIntVector) v, op, (CompIntIntVector) result, start, end);<NEW_LINE>} else if (v instanceof CompLongDoubleVector) {<NEW_LINE>apply((CompLongDoubleVector) v, op, (CompLongDoubleVector) result, start, end);<NEW_LINE>} else if (v instanceof CompLongFloatVector) {<NEW_LINE>apply((CompLongFloatVector) v, op, (CompLongFloatVector) result, start, end);<NEW_LINE>} else if (v instanceof CompLongLongVector) {<NEW_LINE>apply((CompLongLongVector) v, op, (CompLongLongVector) result, start, end);<NEW_LINE>} else if (v instanceof CompLongIntVector) {<NEW_LINE>apply((CompLongIntVector) v, op, (CompLongIntVector) result, start, end);<NEW_LINE>} else {<NEW_LINE>throw new AngelException("Vector type is not support!");<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>int middle = (start + end) >> 1;<NEW_LINE>CompUnaExe left = new CompUnaExe(v, <MASK><NEW_LINE>CompUnaExe right = new CompUnaExe(v, op, result, middle + 1, end);<NEW_LINE>invokeAll(left, right);<NEW_LINE>}<NEW_LINE>} | op, result, start, middle); |
228,332 | public String bulkUpdate(Request request, Response response) throws IOException {<NEW_LINE>final AgentBulkUpdateRequest req = AgentBulkUpdateRequestRepresenter.fromJSON(request.body());<NEW_LINE>final HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();<NEW_LINE>try {<NEW_LINE>agentService.bulkUpdateAgentAttributes(req.getUuids(), req.getOperations().getResources().toAdd(), req.getOperations().getResources().toRemove(), req.getOperations().getEnvironments().toAdd(), req.getOperations().getEnvironments().toRemove(), req.getAgentConfigState(), environmentConfigService);<NEW_LINE>result.setMessage("Updated agent(s) with uuid(s): [" + join(req.getUuids<MASK><NEW_LINE>} catch (HttpException e) {<NEW_LINE>throw e;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw halt(HttpStatus.SC_INTERNAL_SERVER_ERROR, MessageJson.create(e.getMessage()));<NEW_LINE>}<NEW_LINE>return renderHTTPOperationResult(result, request, response);<NEW_LINE>} | (), ", ") + "]."); |
883,841 | private void run(String[] argv) throws Exception {<NEW_LINE>MaxwellBootstrapUtilityConfig config = new MaxwellBootstrapUtilityConfig(argv);<NEW_LINE>if (config.log_level != null) {<NEW_LINE>Logging.setLevel(config.log_level);<NEW_LINE>}<NEW_LINE>ConnectionPool connectionPool = getConnectionPool(config);<NEW_LINE>ConnectionPool replConnectionPool = getReplicationConnectionPool(config);<NEW_LINE>try (final <MASK><NEW_LINE>final Connection replicationConnection = replConnectionPool.getConnection()) {<NEW_LINE>if (config.abortBootstrapID != null) {<NEW_LINE>getInsertedRowsCount(connection, config.abortBootstrapID);<NEW_LINE>removeBootstrapRow(connection, config.abortBootstrapID);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long rowId;<NEW_LINE>if (config.monitorBootstrapID != null) {<NEW_LINE>getInsertedRowsCount(connection, config.monitorBootstrapID);<NEW_LINE>rowId = config.monitorBootstrapID;<NEW_LINE>} else {<NEW_LINE>Long totalRows = calculateRowCount(replicationConnection, config.databaseName, config.tableName, config.whereClause);<NEW_LINE>rowId = insertBootstrapStartRow(connection, config.databaseName, config.tableName, config.whereClause, config.clientID, config.comment, totalRows);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>monitorProgress(connection, rowId);<NEW_LINE>} catch (MissingBootstrapRowException e) {<NEW_LINE>LOGGER.error("bootstrap aborted.");<NEW_LINE>Runtime.getRuntime().halt(1);<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>LOGGER.error("failed to connect to mysql server @ " + config.getConnectionURI());<NEW_LINE>LOGGER.error(e.getLocalizedMessage());<NEW_LINE>e.printStackTrace();<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>} | Connection connection = connectionPool.getConnection(); |
802,619 | public boolean addAddress(Long version, String address) throws BrokerException {<NEW_LINE>log.info("associated groupId: {}", this.client.getGroupId());<NEW_LINE>// check exist manually to avoid duplicate record<NEW_LINE>Map<Long, String> topicControlAddresses = listAddress();<NEW_LINE>if (topicControlAddresses.containsKey(version)) {<NEW_LINE>log.info("already exist in CRUD, {} {}", version, address);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Map<String, String> fieldNameToValue = new HashMap<>();<NEW_LINE>fieldNameToValue.put(TableValue, address);<NEW_LINE>fieldNameToValue.put(TableVersion, String.valueOf(version));<NEW_LINE>org.fisco.bcos.sdk.contract.precompiled.crud.common.Entry fieldNameToValueEntry = new org.fisco.bcos.sdk.contract.precompiled.crud.common.Entry(fieldNameToValue);<NEW_LINE>fieldNameToValueEntry.setFieldNameToValue(fieldNameToValue);<NEW_LINE>try {<NEW_LINE>// notice: record's key can be duplicate in CRUD<NEW_LINE>RetCode retCode = this.crud.insert(TableName, ContractAddress, fieldNameToValueEntry);<NEW_LINE>if (retCode.getCode() == 1) {<NEW_LINE>log.info("add contract address into CRUD success");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>log.error(<MASK><NEW_LINE>return false;<NEW_LINE>} catch (ContractException e) {<NEW_LINE>log.error("add contract address into CRUD failed", e);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | "add contract address into CRUD failed, {}", retCode.toString()); |
326,793 | public static ListTenantResponse unmarshall(ListTenantResponse listTenantResponse, UnmarshallerContext _ctx) {<NEW_LINE>listTenantResponse.setRequestId(_ctx.stringValue("ListTenantResponse.RequestId"));<NEW_LINE>listTenantResponse.setSuccess(_ctx.booleanValue("ListTenantResponse.Success"));<NEW_LINE>listTenantResponse.setCode(_ctx.stringValue("ListTenantResponse.Code"));<NEW_LINE>listTenantResponse.setMessage(_ctx.stringValue("ListTenantResponse.Message"));<NEW_LINE>listTenantResponse.setPageNumber(_ctx.integerValue("ListTenantResponse.PageNumber"));<NEW_LINE>listTenantResponse.setPageSize(_ctx.integerValue("ListTenantResponse.PageSize"));<NEW_LINE>listTenantResponse.setTotal(_ctx.longValue("ListTenantResponse.Total"));<NEW_LINE>List<Tenant> model = new ArrayList<Tenant>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListTenantResponse.Model.Length"); i++) {<NEW_LINE>Tenant tenant = new Tenant();<NEW_LINE>tenant.setStatus(_ctx.stringValue<MASK><NEW_LINE>tenant.setSettleInfo(_ctx.stringValue("ListTenantResponse.Model[" + i + "].SettleInfo"));<NEW_LINE>tenant.setTenantDescription(_ctx.stringValue("ListTenantResponse.Model[" + i + "].TenantDescription"));<NEW_LINE>tenant.setVersion(_ctx.longValue("ListTenantResponse.Model[" + i + "].Version"));<NEW_LINE>tenant.setTenantName(_ctx.stringValue("ListTenantResponse.Model[" + i + "].TenantName"));<NEW_LINE>tenant.setCreateTime(_ctx.longValue("ListTenantResponse.Model[" + i + "].CreateTime"));<NEW_LINE>tenant.setBusiness(_ctx.stringValue("ListTenantResponse.Model[" + i + "].Business"));<NEW_LINE>tenant.setBizId(_ctx.stringValue("ListTenantResponse.Model[" + i + "].BizId"));<NEW_LINE>tenant.setExtInfo(_ctx.stringValue("ListTenantResponse.Model[" + i + "].ExtInfo"));<NEW_LINE>tenant.setTenantId(_ctx.stringValue("ListTenantResponse.Model[" + i + "].TenantId"));<NEW_LINE>tenant.setModifyTime(_ctx.longValue("ListTenantResponse.Model[" + i + "].ModifyTime"));<NEW_LINE>model.add(tenant);<NEW_LINE>}<NEW_LINE>listTenantResponse.setModel(model);<NEW_LINE>return listTenantResponse;<NEW_LINE>} | ("ListTenantResponse.Model[" + i + "].Status")); |
375,119 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "eq,neq,sqlneq,nneq".split(",");<NEW_LINE>String stmtText = "@name('s0') select " + "intPrimitive=all(select intPrimitive from SupportBean(theString like 'S%')#keepall) as eq, " <MASK><NEW_LINE>env.compileDeployAddListenerMileZero(stmtText, "s0");<NEW_LINE>env.sendEventBean(new SupportBean("E1", 10));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { true, true, true, false });<NEW_LINE>env.sendEventBean(new SupportBean("S1", 11));<NEW_LINE>env.sendEventBean(new SupportBean("E2", 11));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { true, false, false, false });<NEW_LINE>env.sendEventBean(new SupportBean("E3", 10));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { false, true, true, true });<NEW_LINE>env.sendEventBean(new SupportBean("S1", 12));<NEW_LINE>env.sendEventBean(new SupportBean("E4", 11));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { false, false, false, true });<NEW_LINE>env.sendEventBean(new SupportBean("E5", 14));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { false, true, true, true });<NEW_LINE>env.undeployAll();<NEW_LINE>} | + "intPrimitive != all (select intPrimitive from SupportBean(theString like 'S%')#keepall) as neq, " + "intPrimitive <> all (select intPrimitive from SupportBean(theString like 'S%')#keepall) as sqlneq, " + "not intPrimitive = all (select intPrimitive from SupportBean(theString like 'S%')#keepall) as nneq " + " from SupportBean(theString like 'E%')"; |
907,693 | public static void horizontal5(Kernel1D_S32 kernel, GrayS16 input, GrayI16 output, int skip) {<NEW_LINE>final short[] dataSrc = input.data;<NEW_LINE>final short[] dataDst = output.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int k5 = kernel.data[4];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int widthEnd = UtilDownConvolve.computeMaxSide(input.width, skip, radius);<NEW_LINE>final int height = input.getHeight();<NEW_LINE>final int offsetX = UtilDownConvolve.computeOffset(skip, radius);<NEW_LINE>for (int i = 0; i < height; i++) {<NEW_LINE>int indexDst = output.startIndex + i <MASK><NEW_LINE>int j = input.startIndex + i * input.stride - radius;<NEW_LINE>final int jEnd = j + widthEnd;<NEW_LINE>for (j += offsetX; j <= jEnd; j += skip) {<NEW_LINE>int indexSrc = j;<NEW_LINE>int total = (dataSrc[indexSrc++]) * k1;<NEW_LINE>total += (dataSrc[indexSrc++]) * k2;<NEW_LINE>total += (dataSrc[indexSrc++]) * k3;<NEW_LINE>total += (dataSrc[indexSrc++]) * k4;<NEW_LINE>total += (dataSrc[indexSrc]) * k5;<NEW_LINE>dataDst[indexDst++] = (short) total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | * output.stride + offsetX / skip; |
445,805 | private Callback<Void> securityPostProcessRequestCallback() {<NEW_LINE>return buildCallback(metrics.getStatsReportSecurityPostProcessRequestMetrics, securityCheckResult -> {<NEW_LINE>String clusterName = RestUtils.getHeader(restRequest.getArgs(), RestUtils.Headers.CLUSTER_NAME, true);<NEW_LINE>String reportType = RestUtils.getHeader(restRequest.getArgs(), RestUtils.Headers.GET_STATS_REPORT_TYPE, true);<NEW_LINE>StatsReportType statsReportType;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RestServiceException(reportType + " is not a valid StatsReportType", RestServiceErrorCode.BadRequest);<NEW_LINE>}<NEW_LINE>Object result;<NEW_LINE>switch(statsReportType) {<NEW_LINE>case ACCOUNT_REPORT:<NEW_LINE>result = accountStatsStore.queryAggregatedAccountStorageStatsByClusterName(clusterName);<NEW_LINE>break;<NEW_LINE>case PARTITION_CLASS_REPORT:<NEW_LINE>result = accountStatsStore.queryAggregatedPartitionClassStorageStatsByClusterName(clusterName);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new RestServiceException("StatsReportType " + statsReportType + "not supported", RestServiceErrorCode.BadRequest);<NEW_LINE>}<NEW_LINE>if (result == null) {<NEW_LINE>throw new RestServiceException("StatsReport not found for clusterName " + clusterName, RestServiceErrorCode.NotFound);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>byte[] jsonBytes = mapper.writeValueAsBytes(result);<NEW_LINE>restResponseChannel.setHeader(RestUtils.Headers.DATE, new GregorianCalendar().getTime());<NEW_LINE>restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, RestUtils.JSON_CONTENT_TYPE);<NEW_LINE>restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, jsonBytes.length);<NEW_LINE>ReadableStreamChannel channel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(jsonBytes));<NEW_LINE>finalCallback.onCompletion(channel, null);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RestServiceException("Couldn't serialize snapshot", e, RestServiceErrorCode.InternalServerError);<NEW_LINE>}<NEW_LINE>}, restRequest.getUri(), logger, finalCallback);<NEW_LINE>} | statsReportType = StatsReportType.valueOf(reportType); |
324,581 | private void parseLocation() {<NEW_LINE>LatLon loc;<NEW_LINE>LatLon additionalLoc = null;<NEW_LINE>try {<NEW_LINE>if (currentFormat == LocationConvert.UTM_FORMAT) {<NEW_LINE>double northing = Double.parseDouble(northingEdit.getText().toString());<NEW_LINE>double easting = Double.parseDouble(eastingEdit.getText().toString());<NEW_LINE>String zone = zoneEdit.getText().toString();<NEW_LINE>int zoneNumber = Integer.parseInt(zone.substring(0, zone.length() - 1));<NEW_LINE>char zoneLetter = zone.charAt(zone.length() - 1);<NEW_LINE>Pair<LatLon, LatLon> locations = parseUtmLocations(northing, easting, zoneNumber, zoneLetter);<NEW_LINE>loc = locations.first;<NEW_LINE>if (loc == null || !loc.equals(locations.second)) {<NEW_LINE>additionalLoc = locations.second;<NEW_LINE>}<NEW_LINE>} else if (currentFormat == LocationConvert.MGRS_FORMAT) {<NEW_LINE>String mgrs = (mgrsEdit.getText().toString());<NEW_LINE>MGRSPoint upoint = new MGRSPoint(mgrs);<NEW_LINE>LatLonPoint ll = upoint.toLatLonPoint();<NEW_LINE>loc = new LatLon(ll.getLatitude(), ll.getLongitude());<NEW_LINE>} else if (currentFormat == LocationConvert.OLC_FORMAT) {<NEW_LINE>String olcText = olcEdit<MASK><NEW_LINE>olcInfo.setText(provideOlcInfo(olcText));<NEW_LINE>loc = parseOlcCode(olcText);<NEW_LINE>} else if (currentFormat == LocationConvert.SWISS_GRID_FORMAT) {<NEW_LINE>double eastCoordinate = Double.parseDouble(swissGridEastEdit.getText().toString().replaceAll("\\s+", ""));<NEW_LINE>double northCoordinate = Double.parseDouble(swissGridNorthEdit.getText().toString().replaceAll("\\s+", ""));<NEW_LINE>loc = SwissGridApproximation.convertLV03ToWGS84(eastCoordinate, northCoordinate);<NEW_LINE>} else if (currentFormat == LocationConvert.SWISS_GRID_PLUS_FORMAT) {<NEW_LINE>double eastCoordinate = Double.parseDouble(swissGridEastEdit.getText().toString().replaceAll("\\s+", ""));<NEW_LINE>double northCoordinate = Double.parseDouble(swissGridNorthEdit.getText().toString().replaceAll("\\s+", ""));<NEW_LINE>loc = SwissGridApproximation.convertLV95ToWGS84(eastCoordinate, northCoordinate);<NEW_LINE>} else {<NEW_LINE>double lat = LocationConvert.convert(latEdit.getText().toString(), true);<NEW_LINE>double lon = LocationConvert.convert(lonEdit.getText().toString(), true);<NEW_LINE>loc = new LatLon(lat, lon);<NEW_LINE>}<NEW_LINE>currentLatLon = loc;<NEW_LINE>additionalUtmLatLon = additionalLoc;<NEW_LINE>} catch (Exception e) {<NEW_LINE>currentLatLon = null;<NEW_LINE>additionalUtmLatLon = null;<NEW_LINE>}<NEW_LINE>updateLocationCell(coordsView, currentLatLon, additionalUtmLatLon != null);<NEW_LINE>updateLocationCell(additionalCoordsView, additionalUtmLatLon, false);<NEW_LINE>updateErrorVisibility();<NEW_LINE>} | .getText().toString(); |
282,455 | public AssociateResolverRuleResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AssociateResolverRuleResult associateResolverRuleResult = new AssociateResolverRuleResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return associateResolverRuleResult;<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("ResolverRuleAssociation", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>associateResolverRuleResult.setResolverRuleAssociation(ResolverRuleAssociationJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return associateResolverRuleResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,065,801 | synchronized public int write(final long offset, final ByteBuffer data, final IReopenChannel<FileChannel> opener) throws IOException {<NEW_LINE>m_storeCounters.bufferDataWrites++;<NEW_LINE>final int data_len = data.remaining();<NEW_LINE>final int <MASK><NEW_LINE>int nwrites = 0;<NEW_LINE>final ByteBuffer m_data = this.m_data.get().buffer();<NEW_LINE>if (slot_len > m_data.remaining()) {<NEW_LINE>nwrites += flush(opener);<NEW_LINE>}<NEW_LINE>if (m_startAddr == -1) {<NEW_LINE>m_startAddr = m_endAddr = offset;<NEW_LINE>} else if (m_endAddr != offset) {<NEW_LINE>nwrites += flush(opener);<NEW_LINE>m_startAddr = m_endAddr = offset;<NEW_LINE>}<NEW_LINE>// copy the caller's record into the buffer.<NEW_LINE>m_data.put(data);<NEW_LINE>// if data_len < slot_len then clear remainder of buffer<NEW_LINE>int padding = slot_len - data_len;<NEW_LINE>while (padding > 0) {<NEW_LINE>if (padding > s_zeros.length) {<NEW_LINE>m_data.put(s_zeros);<NEW_LINE>padding -= s_zeros.length;<NEW_LINE>} else {<NEW_LINE>m_data.put(s_zeros, 0, padding);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// update the file offset by the size of the allocation slot<NEW_LINE>m_endAddr += slot_len;<NEW_LINE>// update the buffer position by the size of the allocation slot.<NEW_LINE>final long pos = m_endAddr - m_startAddr;<NEW_LINE>m_data.position((int) pos);<NEW_LINE>return nwrites;<NEW_LINE>} | slot_len = m_store.getSlotSize(data_len); |
567,609 | public Entity reloadEntityIfNeeded(Entity entity, Datasource targetDatasource) {<NEW_LINE>boolean needDynamicAttributes = false;<NEW_LINE>boolean dynamicAttributesAreLoaded = true;<NEW_LINE>if (entity instanceof BaseGenericIdEntity) {<NEW_LINE>BaseGenericIdEntity e = (BaseGenericIdEntity) entity;<NEW_LINE>dynamicAttributesAreLoaded <MASK><NEW_LINE>needDynamicAttributes = targetDatasource.getLoadDynamicAttributes();<NEW_LINE>}<NEW_LINE>View view = targetDatasource.getView();<NEW_LINE>if (view == null) {<NEW_LINE>view = viewRepository.getView(entity.getClass(), View.LOCAL);<NEW_LINE>}<NEW_LINE>if (!entityStates.isLoadedWithView(entity, view)) {<NEW_LINE>entity = targetDatasource.getDsContext().getDataSupplier().reload(entity, view, null, needDynamicAttributes);<NEW_LINE>} else if (needDynamicAttributes && !dynamicAttributesAreLoaded) {<NEW_LINE>dynamicAttributesGuiTools.reloadDynamicAttributes((BaseGenericIdEntity) entity);<NEW_LINE>}<NEW_LINE>return entity;<NEW_LINE>} | = e.getDynamicAttributes() != null; |
74,323 | // </editor-fold>//GEN-END:initComponents<NEW_LINE>private void btnFileActionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>// GEN-FIRST:event_btnFileActionPerformed<NEW_LINE>// TODO add your handling code here:<NEW_LINE>JFileChooser chooser = new JFileChooser(lastFolder);<NEW_LINE>chooser.setDialogTitle(org.openide.util.NbBundle.getMessage(InstallPanel.class, "TIT_Select_Artifact"));<NEW_LINE>chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);<NEW_LINE>chooser.setFileFilter(new FileFilter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean accept(File f) {<NEW_LINE>// NOI18N<NEW_LINE>return (f.isDirectory() || f.getName().toLowerCase<MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getDescription() {<NEW_LINE>return org.openide.util.NbBundle.getMessage(InstallPanel.class, "SEL_Jars");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>chooser.setMultiSelectionEnabled(false);<NEW_LINE>if (txtFile.getText().trim().length() > 0) {<NEW_LINE>File fil = new File(txtFile.getText().trim());<NEW_LINE>if (fil.exists()) {<NEW_LINE>chooser.setSelectedFile(fil);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int ret = chooser.showDialog(SwingUtilities.getWindowAncestor(this), org.openide.util.NbBundle.getMessage(InstallPanel.class, "TIT_Select"));<NEW_LINE>if (ret == JFileChooser.APPROVE_OPTION) {<NEW_LINE>txtFile.setText(chooser.getSelectedFile().getAbsolutePath());<NEW_LINE>txtFile.requestFocusInWindow();<NEW_LINE>}<NEW_LINE>} | ().endsWith(".jar")); |
1,281,630 | public static HttpResult request(String url, List<String> headers, Map<String, String> paramValues, int connectTimeout, int readTimeout, String encoding, String method) {<NEW_LINE>HttpURLConnection conn = null;<NEW_LINE>try {<NEW_LINE>String encodedContent = encodingParams(paramValues, encoding);<NEW_LINE>url += (null == encodedContent) ? "" : ("?" + encodedContent);<NEW_LINE>conn = (HttpURLConnection) new URL(url).openConnection();<NEW_LINE>conn.setConnectTimeout(connectTimeout);<NEW_LINE>conn.setReadTimeout(readTimeout);<NEW_LINE>conn.setRequestMethod(method);<NEW_LINE>conn.addRequestProperty("Client-Version", UtilsAndCommons.SERVER_VERSION);<NEW_LINE>conn.addRequestProperty("User-Agent", UtilsAndCommons.SERVER_VERSION);<NEW_LINE>setHeaders(conn, headers, encoding);<NEW_LINE>conn.connect();<NEW_LINE>return getResult(conn);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Loggers.SRV_LOG.<MASK><NEW_LINE>return new HttpResult(500, e.toString(), Collections.<String, String>emptyMap());<NEW_LINE>} finally {<NEW_LINE>if (conn != null) {<NEW_LINE>conn.disconnect();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | warn("Exception while request: {}, caused: {}", url, e); |
787,641 | public void clear(@NotNull final String queueId, final boolean shared, final int bucketIndex) {<NEW_LINE>checkNotNull(queueId, "Queue ID must not be null");<NEW_LINE>ThreadPreConditions.startsWith(SINGLE_WRITER_THREAD_PREFIX);<NEW_LINE>final Map<String, Messages> bucket = shared ? sharedBuckets[bucketIndex] : buckets[bucketIndex];<NEW_LINE>final Messages messages = bucket.remove(queueId);<NEW_LINE>if (messages == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (final MessageWithID messageWithID : messages.qos1Or2Messages) {<NEW_LINE>if (messageWithID instanceof PublishWithRetained) {<NEW_LINE>payloadPersistence.decrementReferenceCounter(((PublishWithRetained) messageWithID).getPublishId());<NEW_LINE>}<NEW_LINE>increaseMessagesMemory(-getMessageSize(messageWithID));<NEW_LINE>}<NEW_LINE>for (final PublishWithRetained qos0Message : messages.qos0Messages) {<NEW_LINE>payloadPersistence.<MASK><NEW_LINE>final int estimatedSize = qos0Message.getEstimatedSize();<NEW_LINE>increaseQos0MessagesMemory(-estimatedSize);<NEW_LINE>// increaseClientQos0MessagesMemory not necessary as messages are removed completely<NEW_LINE>increaseMessagesMemory(-estimatedSize);<NEW_LINE>}<NEW_LINE>} | decrementReferenceCounter(qos0Message.getPublishId()); |
143,640 | InMemorySpan createSpan(String operationName, List<InMemoryReference> references, Map<String, Object> tags, int maxTagSize, boolean ignoreActiveSpan, long startTimestampMicros) {<NEW_LINE>InMemorySpanContext maybeParent = parent();<NEW_LINE>if (maybeParent == null && !ignoreActiveSpan) {<NEW_LINE>// Try to infer the parent based upon the ScopeManager's active Scope.<NEW_LINE>InMemorySpan span = scopeManager().activeSpan();<NEW_LINE>if (span != null) {<NEW_LINE>maybeParent = span.context();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final String traceIdHex;<NEW_LINE>final String spanIdHex;<NEW_LINE>final String parentSpanIdHex;<NEW_LINE>final boolean sampled;<NEW_LINE>if (maybeParent != null) {<NEW_LINE>traceIdHex = maybeParent.toTraceId();<NEW_LINE>spanIdHex = nextId();<NEW_LINE>parentSpanIdHex = maybeParent.toSpanId();<NEW_LINE>sampled = isSampled(traceIdHex, maybeParent.isSampled());<NEW_LINE>} else {<NEW_LINE>spanIdHex = nextId();<NEW_LINE>traceIdHex = use128BitTraceId ? nextId() + spanIdHex : spanIdHex;<NEW_LINE>parentSpanIdHex = null;<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>final InMemorySpanContext context = newSpanContext(traceIdHex, spanIdHex, parentSpanIdHex, sampled);<NEW_LINE>if (sampled) {<NEW_LINE>SampledInMemorySpan span = new SampledInMemorySpan(operationName, references, context, tags, maxTagSize, startTimestampMicros, listeners, persistLogs);<NEW_LINE>span.start();<NEW_LINE>return span;<NEW_LINE>} else {<NEW_LINE>return new UnsampledInMemorySpan(operationName, references, context);<NEW_LINE>}<NEW_LINE>} | sampled = isSampled(traceIdHex, null); |
1,356,908 | public void scan(final byte[] startKey, final byte[] endKey, final int limit, @SuppressWarnings("unused") final boolean readOnlySafe, final boolean returnValue, final KVStoreClosure closure) {<NEW_LINE>final Timer.Context timeCtx = getTimeContext("SCAN");<NEW_LINE>final List<KVEntry> entries = Lists.newArrayList();<NEW_LINE>final int maxCount = normalizeLimit(limit);<NEW_LINE>final Lock readLock <MASK><NEW_LINE>readLock.lock();<NEW_LINE>try (final RocksIterator it = this.db.newIterator()) {<NEW_LINE>if (startKey == null) {<NEW_LINE>it.seekToFirst();<NEW_LINE>} else {<NEW_LINE>it.seek(startKey);<NEW_LINE>}<NEW_LINE>int count = 0;<NEW_LINE>while (it.isValid() && count++ < maxCount) {<NEW_LINE>final byte[] key = it.key();<NEW_LINE>if (endKey != null && BytesUtil.compare(key, endKey) >= 0) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>entries.add(new KVEntry(key, returnValue ? it.value() : null));<NEW_LINE>it.next();<NEW_LINE>}<NEW_LINE>setSuccess(closure, entries);<NEW_LINE>} catch (final Exception e) {<NEW_LINE>LOG.error("Fail to [SCAN], range: ['[{}, {})'], {}.", BytesUtil.toHex(startKey), BytesUtil.toHex(endKey), StackTraceUtil.stackTrace(e));<NEW_LINE>setFailure(closure, "Fail to [SCAN]");<NEW_LINE>} finally {<NEW_LINE>readLock.unlock();<NEW_LINE>timeCtx.stop();<NEW_LINE>}<NEW_LINE>} | = this.readWriteLock.readLock(); |
1,200,755 | public static ServerRow createServerRowHash(int rowIndex, RowType rowType, int estEleNum, Class<? extends IElement> valueClass) {<NEW_LINE>switch(rowType) {<NEW_LINE>case T_DOUBLE_SPARSE:<NEW_LINE>return new ServerIntDoubleRow(rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_FLOAT_SPARSE:<NEW_LINE>return new ServerIntFloatRow(rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_LONG_SPARSE:<NEW_LINE>return new ServerIntLongRow(rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_INT_SPARSE:<NEW_LINE>return new ServerIntIntRow(rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_DOUBLE_SPARSE_LONGKEY:<NEW_LINE>return new ServerLongDoubleRow(rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_FLOAT_SPARSE_LONGKEY:<NEW_LINE>return new ServerLongFloatRow(rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_LONG_SPARSE_LONGKEY:<NEW_LINE>return new ServerLongLongRow(rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_INT_SPARSE_LONGKEY:<NEW_LINE>return new ServerLongIntRow(rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_ANY_INTKEY_SPARSE:<NEW_LINE>return new ServerIntAnyRow(valueClass, rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_ANY_LONGKEY_SPARSE:<NEW_LINE>return new ServerLongAnyRow(valueClass, rowIndex, rowType, 0, <MASK><NEW_LINE>case T_ANY_STRINGKEY_SPARSE:<NEW_LINE>return new ServerStringAnyRow(valueClass, rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>case T_ANY_ANYKEY_SPARSE:<NEW_LINE>return new ServerAnyAnyRow(valueClass, rowIndex, rowType, 0, 0, estEleNum, RouterType.HASH);<NEW_LINE>default:<NEW_LINE>throw new UnsupportedOperationException("unsupport vector type:" + rowType);<NEW_LINE>}<NEW_LINE>} | 0, estEleNum, RouterType.HASH); |
321,198 | public static BinaryPartAbstractImage createLinkedImagePart(OpcPackage opcPackage, Part sourcePart, URL url) throws Exception {<NEW_LINE>log.debug("Incoming url for linked image: " + url.toString());<NEW_LINE>// final param doesn't matter in this case<NEW_LINE>ImageInfo info = ensureFormatIsSupported(url, null, null, false);<NEW_LINE>ContentTypeManager ctm = opcPackage.getContentTypeManager();<NEW_LINE>String proposedRelId = sourcePart.getRelationshipsPart().getNextId();<NEW_LINE>// In order to ensure unique part name,<NEW_LINE>// idea is to use the relId, which ought to be unique<NEW_LINE>String ext = info.getMimeType().substring(info.getMimeType().indexOf("/") + 1);<NEW_LINE>BinaryPartAbstractImage imagePart = (BinaryPartAbstractImage) ctm.newPartForContentType(info.getMimeType(), createImageName(opcPackage, sourcePart, proposedRelId, ext), null);<NEW_LINE>// NB: contents never populated<NEW_LINE>log.debug("created part " + imagePart.getClass().getName() + " with name " + imagePart.getPartName().toString());<NEW_LINE>// want to create rel with suitable name; side effect is to add part<NEW_LINE>imagePart.rels.add<MASK><NEW_LINE>imagePart.getRelLast().setTargetMode("External");<NEW_LINE>opcPackage.getExternalResources().put(imagePart.getExternalTarget(), imagePart);<NEW_LINE>// if (!url.getProtocol().equals("file") && new File(url.toString() ).isFile()) {<NEW_LINE>// imagePart.rel.setTarget("file:///" + url);<NEW_LINE>// } else {<NEW_LINE>// imagePart.rel.setTarget(url.toString());<NEW_LINE>// }<NEW_LINE>imagePart.getRelLast().setTarget(url.toString());<NEW_LINE>imagePart.setImageInfo(info);<NEW_LINE>return imagePart;<NEW_LINE>} | (sourcePart.addTargetPart(imagePart)); |
142,577 | final ListReviewPolicyResultsForHITResult executeListReviewPolicyResultsForHIT(ListReviewPolicyResultsForHITRequest listReviewPolicyResultsForHITRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listReviewPolicyResultsForHITRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListReviewPolicyResultsForHITRequest> request = null;<NEW_LINE>Response<ListReviewPolicyResultsForHITResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListReviewPolicyResultsForHITRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listReviewPolicyResultsForHITRequest));<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, "MTurk");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListReviewPolicyResultsForHITResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListReviewPolicyResultsForHITResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListReviewPolicyResultsForHIT"); |
312,578 | private void restoreState() {<NEW_LINE>state = Preferences.userRoot().node(PREFS_ROOT_PATH);<NEW_LINE>// restore directories history<NEW_LINE>String[] directories = getPrefsStrings(state, KEY_DIRECTORIES);<NEW_LINE>SortedComboBoxModel<File> model = new SortedComboBoxModel<>(new File[0]);<NEW_LINE>for (String dirStr : directories) {<NEW_LINE>File dir = new File(dirStr);<NEW_LINE>if (dir.isDirectory())<NEW_LINE>model.addElement(dir);<NEW_LINE>}<NEW_LINE>directoryField.setModel(model);<NEW_LINE>// restore overlay color models<NEW_LINE>FlatThemeEditorOverlay.showHSL = state.getBoolean(KEY_SHOW_HSL_COLORS, true);<NEW_LINE>FlatThemeEditorOverlay.showRGB = state.getBoolean(KEY_SHOW_RGB_COLORS, false);<NEW_LINE>FlatThemeEditorOverlay.showLuma = state.getBoolean(KEY_SHOW_COLOR_LUMA, false);<NEW_LINE>// restore menu item selection<NEW_LINE>previewMenuItem.setSelected(state.getBoolean(KEY_PREVIEW, true));<NEW_LINE>showHSLColorsMenuItem.setSelected(FlatThemeEditorOverlay.showHSL);<NEW_LINE>showRGBColorsMenuItem.setSelected(FlatThemeEditorOverlay.showRGB);<NEW_LINE><MASK><NEW_LINE>} | showColorLumaMenuItem.setSelected(FlatThemeEditorOverlay.showLuma); |
1,453,571 | public void onClick(View v) {<NEW_LINE>final Context context = SampleActivity.this;<NEW_LINE>ColorPickerDialogBuilder.with(context).setTitle(R.string.color_dialog_title).initialColor(currentBackgroundColor).wheelType(ColorPickerView.WHEEL_TYPE.FLOWER).density(12).setOnColorChangedListener(new OnColorChangedListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onColorChanged(int selectedColor) {<NEW_LINE>// Handle on color change<NEW_LINE>Log.d("ColorPicker", "onColorChanged: 0x" + Integer.toHexString(selectedColor));<NEW_LINE>}<NEW_LINE>}).setOnColorSelectedListener(new OnColorSelectedListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onColorSelected(int selectedColor) {<NEW_LINE>toast("onColorSelected: 0x" + Integer.toHexString(selectedColor));<NEW_LINE>}<NEW_LINE>}).setPositiveButton("ok", new ColorPickerClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {<NEW_LINE>changeBackgroundColor(selectedColor);<NEW_LINE>if (allColors != null) {<NEW_LINE>StringBuilder sb = null;<NEW_LINE>for (Integer color : allColors) {<NEW_LINE>if (color == null)<NEW_LINE>continue;<NEW_LINE>if (sb == null)<NEW_LINE>sb = new StringBuilder("Color List:");<NEW_LINE>sb.append("\r\n#" + Integer.toHexString<MASK><NEW_LINE>}<NEW_LINE>if (sb != null)<NEW_LINE>Toast.makeText(getApplicationContext(), sb.toString(), Toast.LENGTH_SHORT).show();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}).setNegativeButton("cancel", new DialogInterface.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(DialogInterface dialog, int which) {<NEW_LINE>}<NEW_LINE>}).showColorEdit(true).setColorEditTextColor(ContextCompat.getColor(SampleActivity.this, android.R.color.holo_blue_bright)).build().show();<NEW_LINE>} | (color).toUpperCase()); |
894,091 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "c0,c1".split(",");<NEW_LINE>String epl = "@Name('s0') select a.theString as c0, b.theString as c1 from pattern [a=SupportBean(intPrimitive=0) and b=SupportBean(intPrimitive=1)]";<NEW_LINE>env.compileDeploy(epl).addListener("s0");<NEW_LINE>env.milestone(0);<NEW_LINE>sendSupportBean(env, "EB", 1);<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.milestone(1);<NEW_LINE><MASK><NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "EA", "EB" });<NEW_LINE>env.milestone(2);<NEW_LINE>sendSupportBean(env, "EB", 1);<NEW_LINE>sendSupportBean(env, "EA", 0);<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.milestone(3);<NEW_LINE>sendSupportBean(env, "EB", 1);<NEW_LINE>sendSupportBean(env, "EA", 0);<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.undeployAll();<NEW_LINE>} | sendSupportBean(env, "EA", 0); |
1,242,706 | public void init(Map<String, Object> conf, SinkContext context) {<NEW_LINE>sinkConfig.putAll(conf);<NEW_LINE>sinkContext = context;<NEW_LINE>// Fill the tManagerMetricsFilter according to metrics-sink-configs.yaml<NEW_LINE>Map<String, String> tmanagerMetricsType = (Map<String, String>) sinkConfig.get(KEY_TMANAGER_METRICS_TYPE);<NEW_LINE>if (tmanagerMetricsType != null) {<NEW_LINE>for (Map.Entry<String, String> metricToType : tmanagerMetricsType.entrySet()) {<NEW_LINE><MASK><NEW_LINE>MetricsFilter.MetricAggregationType type;<NEW_LINE>if ("SUM".equals(value)) {<NEW_LINE>type = MetricsFilter.MetricAggregationType.SUM;<NEW_LINE>} else if ("AVG".equals(value)) {<NEW_LINE>type = MetricsFilter.MetricAggregationType.AVG;<NEW_LINE>} else if ("LAST".equals(value)) {<NEW_LINE>type = MetricsFilter.MetricAggregationType.LAST;<NEW_LINE>} else {<NEW_LINE>type = MetricsFilter.MetricAggregationType.UNKNOWN;<NEW_LINE>}<NEW_LINE>tManagerMetricsFilter.setPrefixToType(metricToType.getKey(), type);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Construct the long-live TManagerClientService<NEW_LINE>tManagerClientService = new TManagerClientService((Map<String, Object>) sinkConfig.get(KEY_TMANAGER), metricsCommunicator);<NEW_LINE>// Start the tManagerLocationStarter<NEW_LINE>startTManagerChecker();<NEW_LINE>} | String value = metricToType.getValue(); |
313,398 | public static GetHotlineGroupDetailReportResponse unmarshall(GetHotlineGroupDetailReportResponse getHotlineGroupDetailReportResponse, UnmarshallerContext _ctx) {<NEW_LINE>getHotlineGroupDetailReportResponse.setRequestId(_ctx.stringValue("GetHotlineGroupDetailReportResponse.RequestId"));<NEW_LINE>getHotlineGroupDetailReportResponse.setMessage<MASK><NEW_LINE>getHotlineGroupDetailReportResponse.setCode(_ctx.stringValue("GetHotlineGroupDetailReportResponse.Code"));<NEW_LINE>getHotlineGroupDetailReportResponse.setSuccess(_ctx.stringValue("GetHotlineGroupDetailReportResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageSize(_ctx.integerValue("GetHotlineGroupDetailReportResponse.Data.PageSize"));<NEW_LINE>data.setTotal(_ctx.integerValue("GetHotlineGroupDetailReportResponse.Data.Total"));<NEW_LINE>data.setPage(_ctx.integerValue("GetHotlineGroupDetailReportResponse.Data.Page"));<NEW_LINE>List<Map<Object, Object>> rows = _ctx.listMapValue("GetHotlineGroupDetailReportResponse.Data.Rows");<NEW_LINE>data.setRows(rows);<NEW_LINE>List<ColumnsItem> columns = new ArrayList<ColumnsItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetHotlineGroupDetailReportResponse.Data.Columns.Length"); i++) {<NEW_LINE>ColumnsItem columnsItem = new ColumnsItem();<NEW_LINE>columnsItem.setKey(_ctx.stringValue("GetHotlineGroupDetailReportResponse.Data.Columns[" + i + "].Key"));<NEW_LINE>columnsItem.setTitle(_ctx.stringValue("GetHotlineGroupDetailReportResponse.Data.Columns[" + i + "].Title"));<NEW_LINE>columns.add(columnsItem);<NEW_LINE>}<NEW_LINE>data.setColumns(columns);<NEW_LINE>getHotlineGroupDetailReportResponse.setData(data);<NEW_LINE>return getHotlineGroupDetailReportResponse;<NEW_LINE>} | (_ctx.stringValue("GetHotlineGroupDetailReportResponse.Message")); |
1,004,936 | public static ImmutableList<DiffFile> diffFiles(Path one, Path other, boolean verbose, @Nullable Map<String, String> environment) throws IOException, InsideGitDirException {<NEW_LINE>String cmdResult = new String(new FoldersDiff(verbose, environment).withZOption().withNameStatus().withNoRenames().run(one, other), StandardCharsets.UTF_8);<NEW_LINE>ImmutableList.Builder<DiffFile> result = ImmutableList.builder();<NEW_LINE>for (Iterator<String> iterator = Splitter.on((char) 0).split(cmdResult).iterator(); iterator.hasNext(); ) {<NEW_LINE><MASK><NEW_LINE>if (Strings.isNullOrEmpty(strOp)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Operation op = DiffFile.OP_BY_CHAR.get(strOp);<NEW_LINE>if (op == null) {<NEW_LINE>throw new IllegalStateException(String.format("Unknown type '%s'. Text:\n%s", strOp, cmdResult));<NEW_LINE>}<NEW_LINE>String file = iterator.next();<NEW_LINE>Preconditions.checkState(file.contains("/"));<NEW_LINE>result.add(new DiffFile(file.substring(file.indexOf("/") + 1), op));<NEW_LINE>}<NEW_LINE>return result.build();<NEW_LINE>} | String strOp = iterator.next(); |
178,580 | public synchronized boolean registerSubscriptionUnlessAlreadyRegistered(IBaseResource theSubscription) {<NEW_LINE>Validate.notNull(theSubscription);<NEW_LINE>Optional<CanonicalSubscription> existingSubscription = <MASK><NEW_LINE>CanonicalSubscription newSubscription = mySubscriptionCanonicalizer.canonicalize(theSubscription);<NEW_LINE>if (existingSubscription.isPresent()) {<NEW_LINE>if (newSubscription.equals(existingSubscription.get())) {<NEW_LINE>// No changes<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>ourLog.info("Updating already-registered active subscription {}", theSubscription.getIdElement().toUnqualified().getValue());<NEW_LINE>if (channelTypeSame(existingSubscription.get(), newSubscription)) {<NEW_LINE>ourLog.info("Channel type is same. Updating active subscription and re-using existing channel and handlers.");<NEW_LINE>updateSubscription(theSubscription);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>unregisterSubscriptionIfRegistered(theSubscription.getIdElement().getIdPart());<NEW_LINE>}<NEW_LINE>if (Subscription.SubscriptionStatus.ACTIVE.equals(newSubscription.getStatus())) {<NEW_LINE>registerSubscription(theSubscription.getIdElement(), newSubscription);<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | hasSubscription(theSubscription.getIdElement()); |
1,319,947 | private List<SystemGraphComponent> componentsToUpgrade(GraphDatabaseService system) throws Exception {<NEW_LINE>List<SystemGraphComponent> componentsToUpgrade = new ArrayList<>();<NEW_LINE>SystemGraphComponent.executeWithFullAccess(system, tx -> components.stream().filter(c -> {<NEW_LINE>SystemGraphComponent.Status <MASK><NEW_LINE>return // New components are not currently initialised in cluster deployment when new binaries are booted on top of an existing database.<NEW_LINE>status == SystemGraphComponent.Status.UNSUPPORTED_BUT_CAN_UPGRADE || status == SystemGraphComponent.Status.REQUIRES_UPGRADE || // This is a known shortcoming of the lifecycle and a state transfer from UNINITIALIZED to CURRENT must be supported<NEW_LINE>// as a workaround until it is fixed.<NEW_LINE>status == SystemGraphComponent.Status.UNINITIALIZED;<NEW_LINE>}).forEach(componentsToUpgrade::add));<NEW_LINE>return componentsToUpgrade;<NEW_LINE>} | status = c.detect(tx); |
1,409,254 | final AddRoleToDBInstanceResult executeAddRoleToDBInstance(AddRoleToDBInstanceRequest addRoleToDBInstanceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(addRoleToDBInstanceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<AddRoleToDBInstanceRequest> request = null;<NEW_LINE>Response<AddRoleToDBInstanceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new AddRoleToDBInstanceRequestMarshaller().marshall(super.beforeMarshalling(addRoleToDBInstanceRequest));<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, "RDS");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AddRoleToDBInstance");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<AddRoleToDBInstanceResult> responseHandler = new StaxResponseHandler<AddRoleToDBInstanceResult>(new AddRoleToDBInstanceResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
280,735 | private void mergeInitStepAnswer(InitInfoAnswerElement initInfoAnswerElement, InitStepAnswerElement initStepAnswerElement, boolean summary, boolean verboseError) {<NEW_LINE>if (!summary) {<NEW_LINE>if (verboseError) {<NEW_LINE>SortedMap<String, List<BatfishStackTrace>> errors = initInfoAnswerElement.getErrors();<NEW_LINE>initStepAnswerElement.getErrors().forEach((hostname, initStepErrors) -> errors.computeIfAbsent(hostname, k -> new ArrayList<>(<MASK><NEW_LINE>}<NEW_LINE>SortedMap<String, Warnings> warnings = initInfoAnswerElement.getWarnings();<NEW_LINE>initStepAnswerElement.getWarnings().forEach((hostname, initStepWarnings) -> {<NEW_LINE>Warnings combined = warnings.computeIfAbsent(hostname, h -> buildWarnings(_settings));<NEW_LINE>combined.getParseWarnings().addAll(initStepWarnings.getParseWarnings());<NEW_LINE>combined.getPedanticWarnings().addAll(initStepWarnings.getPedanticWarnings());<NEW_LINE>combined.getRedFlagWarnings().addAll(initStepWarnings.getRedFlagWarnings());<NEW_LINE>combined.getUnimplementedWarnings().addAll(initStepWarnings.getUnimplementedWarnings());<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | )).add(initStepErrors)); |
1,263,634 | Entry createEntry(ReadableArray values, int index) {<NEW_LINE>float x = index;<NEW_LINE>Entry entry;<NEW_LINE>if (ReadableType.Map.equals(values.getType(index))) {<NEW_LINE>ReadableMap map = values.getMap(index);<NEW_LINE>if (map.hasKey("x")) {<NEW_LINE>x = (float) map.getDouble("x");<NEW_LINE>}<NEW_LINE>if (map.hasKey("icon")) {<NEW_LINE>ReadableMap icon = map.getMap("icon");<NEW_LINE>ReadableMap bundle = icon.getMap("bundle");<NEW_LINE>int width = icon.getInt("width");<NEW_LINE>int height = icon.getInt("height");<NEW_LINE>entry = new Entry(x, (float) map.getDouble("y"), DrawableUtils.drawableFromUrl(bundle.getString("uri"), width, height));<NEW_LINE>} else {<NEW_LINE>entry = new Entry(x, (float) map.getDouble("y"), ConversionUtil.toMap(map));<NEW_LINE>}<NEW_LINE>} else if (ReadableType.Number.equals(values.getType(index))) {<NEW_LINE>entry = new Entry(x, (float<MASK><NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Unexpected entry type: " + values.getType(index));<NEW_LINE>}<NEW_LINE>return entry;<NEW_LINE>} | ) values.getDouble(index)); |
1,409,887 | private void processMBeanInfoURLs(Map<ObjectName, String> source, String parentPath, boolean complete) {<NEW_LINE>if (complete) {<NEW_LINE>// This is the complete set of MBeanInfo URLs, so remove any elements that are not present in the new map<NEW_LINE>Set<ObjectName> missingKeys = new HashSet<ObjectName>(mbeanInfoURLMap.keySet());<NEW_LINE>missingKeys.removeAll(source.keySet());<NEW_LINE>for (ObjectName missingKey : missingKeys) {<NEW_LINE>purgeMBeanURLs(missingKey);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map.Entry<ObjectName, String> e : source.entrySet()) {<NEW_LINE>if (!mbeanInfoURLMap.containsKey(e.getKey()) || !mbeanInfoURLMap.get(e.getKey()).getName().equals(e.getValue())) {<NEW_LINE>// if updating the MBeanInfo URL (because new URL did not match), other maps are now invalid,<NEW_LINE>// so purge before re-adding<NEW_LINE>if (mbeanInfoURLMap.containsKey(e.getKey()))<NEW_LINE>purgeMBeanURLs(e.getKey());<NEW_LINE>mbeanInfoURLMap.put(e.getKey(), new DynamicURL(connector<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , e.getValue())); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.