idx
int32
46
1.86M
input
stringlengths
321
6.6k
target
stringlengths
9
1.24k
332,738
private void importData(Task importRoot, Task root, Map<CustomPropertyDefinition, CustomPropertyDefinition> customPropertyMapping, Map<Task, Task> original2imported) {<NEW_LINE>Task[] nested = importRoot.getManager().getTaskHierarchy().getNestedTasks(importRoot);<NEW_LINE>for (Task task : nested) {<NEW_LINE>TaskBuilder builder = newTaskBuilder();<NEW_LINE>GanttTask that = (GanttTask) task;<NEW_LINE>if (getTask(that.getTaskID()) == null) {<NEW_LINE>builder = builder.withId(that.getTaskID());<NEW_LINE>}<NEW_LINE>Task nextImported = builder.withName(that.getName()).withStartDate(that.getStart().getTime()).withDuration(that.getDuration()).withColor(that.getColor()).withNotes(that.getNotes()).withWebLink(that.getWebLink()).withPriority(that.getPriority()).withParent(root).build();<NEW_LINE>nextImported.setShape(task.getShape());<NEW_LINE>nextImported.setCompletionPercentage(task.getCompletionPercentage());<NEW_LINE>nextImported.setTaskInfo(task.getTaskInfo());<NEW_LINE>nextImported.setExpand(task.getExpand());<NEW_LINE>nextImported.setMilestone(task.isMilestone());<NEW_LINE>nextImported.getCost().setValue(that.getCost());<NEW_LINE>if (task.getThird() != null) {<NEW_LINE>nextImported.setThirdDate(task.getThird().clone());<NEW_LINE>nextImported.setThirdDateConstraint(task.getThirdDateConstraint());<NEW_LINE>}<NEW_LINE>CustomColumnsValues customValues = task.getCustomValues();<NEW_LINE>for (CustomPropertyDefinition thatDef : importRoot.getManager().getCustomPropertyManager().getDefinitions()) {<NEW_LINE>CustomPropertyDefinition thisDef = customPropertyMapping.get(thatDef);<NEW_LINE>if (thisDef != null) {<NEW_LINE>Object value = customValues.getValue(thatDef);<NEW_LINE>if (value != null) {<NEW_LINE>try {<NEW_LINE>nextImported.getCustomValues().setValue(thisDef, value);<NEW_LINE>} catch (CustomColumnsException e) {<NEW_LINE>if (!GPLogger.log(e)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>GPLogger.log("Can't find custom property definition matching " + thatDef);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>original2imported.put(task, nextImported);<NEW_LINE>importData(task, nextImported, customPropertyMapping, original2imported);<NEW_LINE>}<NEW_LINE>}
e.printStackTrace(System.err);
202,660
public static Version maintain(GameRepository repository, Version version) {<NEW_LINE>if (version.getInheritsFrom() != null)<NEW_LINE>throw new IllegalArgumentException("MaintainTask requires independent game version");<NEW_LINE>String mainClass = version.resolve(null).getMainClass();<NEW_LINE>if (mainClass != null && mainClass.equals(LibraryAnalyzer.LAUNCH_WRAPPER_MAIN)) {<NEW_LINE>version = maintainOptiFineLibrary(repository, maintainGameWithLaunchWrapper(unique(version), true), false);<NEW_LINE>} else if (mainClass != null && mainClass.equals(LibraryAnalyzer.MOD_LAUNCHER_MAIN)) {<NEW_LINE>// Forge 1.13 and OptiFine<NEW_LINE>version = maintainOptiFineLibrary(repository, maintainGameWithCpwModLauncher(repository, unique(version)), true);<NEW_LINE>} else if (mainClass != null && mainClass.equals(LibraryAnalyzer.BOOTSTRAP_LAUNCHER_MAIN)) {<NEW_LINE>// Forge 1.17<NEW_LINE>version = maintainGameWithCpwBoostrapLauncher(repository, unique(version));<NEW_LINE>} else {<NEW_LINE>// Vanilla Minecraft does not need maintain<NEW_LINE>// Fabric does not need maintain, nothing compatible with fabric now.<NEW_LINE>version = maintainOptiFineLibrary(repository<MASK><NEW_LINE>}<NEW_LINE>List<Library> libraries = version.getLibraries();<NEW_LINE>if (libraries.size() > 0) {<NEW_LINE>Library library = libraries.get(0);<NEW_LINE>if ("org.glavo".equals(library.getGroupId()) && ("log4j-patch".equals(library.getArtifactId()) || "log4j-patch-beta9".equals(library.getArtifactId())) && "1.0".equals(library.getVersion()) && library.getDownload() == null) {<NEW_LINE>version = version.setLibraries(libraries.subList(1, libraries.size()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return version;<NEW_LINE>}
, unique(version), false);
1,416,074
private static int packTime(long millis) {<NEW_LINE>Calendar calendar = Calendar.getInstance();<NEW_LINE>calendar.clear();<NEW_LINE>calendar.setTimeInMillis(millis);<NEW_LINE>int year = calendar.get(Calendar.YEAR);<NEW_LINE>int month = calendar.get(Calendar.MONTH);<NEW_LINE>int day = <MASK><NEW_LINE>int hour = calendar.get(Calendar.HOUR);<NEW_LINE>int minute = calendar.get(Calendar.MINUTE);<NEW_LINE>int second = calendar.get(Calendar.SECOND);<NEW_LINE>if (month != 0) {<NEW_LINE>throw new ClusterJUserException(local.message("ERR_Write_Time_Domain", new java.sql.Time(millis), millis, year, month, day, hour, minute, second));<NEW_LINE>}<NEW_LINE>int time = ((day - 1) * 240000) + (hour * 10000) + (minute * 100) + second;<NEW_LINE>return time;<NEW_LINE>}
calendar.get(Calendar.DATE);
1,692,005
public void encode() {<NEW_LINE>this.reset();<NEW_LINE>this.putEntityUniqueId(this.entityUniqueId);<NEW_LINE>this.putEntityRuntimeId(this.entityRuntimeId);<NEW_LINE>this.putVarInt(this.playerGamemode);<NEW_LINE>this.putVector3f(this.x, this.y, this.z);<NEW_LINE>this.putLFloat(this.yaw);<NEW_LINE>this.putLFloat(this.pitch);<NEW_LINE>this.putVarInt(this.seed);<NEW_LINE>this.putVarInt(this.dimension);<NEW_LINE>this.putVarInt(this.generator);<NEW_LINE>this.putVarInt(this.worldGamemode);<NEW_LINE>this.putVarInt(this.difficulty);<NEW_LINE>this.putBlockVector3(this.spawnX, this.spawnY, this.spawnZ);<NEW_LINE>this.putBoolean(this.hasAchievementsDisabled);<NEW_LINE>this.putVarInt(this.dayCycleStopTime);<NEW_LINE>this.putBoolean(this.eduMode);<NEW_LINE>this.putLFloat(this.rainLevel);<NEW_LINE><MASK><NEW_LINE>this.putBoolean(this.multiplayerGame);<NEW_LINE>this.putBoolean(this.broadcastToLAN);<NEW_LINE>this.putBoolean(this.broadcastToXboxLive);<NEW_LINE>this.putBoolean(this.commandsEnabled);<NEW_LINE>this.putBoolean(this.isTexturePacksRequired);<NEW_LINE>this.putGameRules(gameRules);<NEW_LINE>this.putBoolean(this.bonusChest);<NEW_LINE>this.putBoolean(this.trustPlayers);<NEW_LINE>this.putVarInt(this.permissionLevel);<NEW_LINE>this.putVarInt(this.gamePublish);<NEW_LINE>this.putLInt(this.serverChunkTickRange);<NEW_LINE>this.putString(this.levelId);<NEW_LINE>this.putString(this.worldName);<NEW_LINE>this.putString(this.premiumWorldTemplateId);<NEW_LINE>this.putBoolean(this.unknown);<NEW_LINE>this.putLLong(this.currentTick);<NEW_LINE>this.putVarInt(this.enchantmentSeed);<NEW_LINE>}
this.putLFloat(this.lightningLevel);
1,728,138
protected void onSaveInstanceState(Bundle outState) {<NEW_LINE>super.onSaveInstanceState(outState);<NEW_LINE>outState.putInt(getString(R.string.frag_prev_mid), initalMiddleFragment);<NEW_LINE>outState.putInt(getString(R.string.frag_prev_bottom), initalBottomFragment);<NEW_LINE>outState.putInt(getString(R.string.frag_prev), mode);<NEW_LINE>outState.putBoolean("Dialogshown", exitDialog);<NEW_LINE><MASK><NEW_LINE>outState.putBoolean("modeChanges", modeChangesExit);<NEW_LINE>outState.putInt("checkMode", modeCheck);<NEW_LINE>outState.putInt("checkString", messageCheck);<NEW_LINE>outState.putParcelable("Edited Bitmap", mainBitmap);<NEW_LINE>outState.putInt("numberOfEdits", mOpTimes);<NEW_LINE>if (addTextFragment.isAdded()) {<NEW_LINE>getSupportFragmentManager().putFragment(outState, "addTextFragment", addTextFragment);<NEW_LINE>}<NEW_LINE>}
outState.putBoolean("exitWithoutChanges", exitWithoutChanges);
1,340,248
public static void grayToBuffered(GrayF32 src, DataBufferByte buffer, WritableRaster dst) {<NEW_LINE>final float[] srcData = src.data;<NEW_LINE>final byte[] dstData = buffer.getData();<NEW_LINE>final int numBands = dst.getNumBands();<NEW_LINE>if (numBands == 3) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, src.height, y -> {<NEW_LINE>for (int y = 0; y < src.height; y++) {<NEW_LINE>int indexSrc = src.startIndex + src.stride * y;<NEW_LINE>int indexSrcEnd = indexSrc + src.width;<NEW_LINE>int indexDst = y * src.width * numBands;<NEW_LINE>for (; indexSrc < indexSrcEnd; indexSrc++) {<NEW_LINE>byte val = (byte) srcData[indexSrc];<NEW_LINE>dstData[indexDst++] = val;<NEW_LINE>dstData[indexDst++] = val;<NEW_LINE>dstData[indexDst++] = val;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else if (numBands == 1) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, src.height, y -> {<NEW_LINE>for (int y = 0; y < src.height; y++) {<NEW_LINE>int indexSrc = src.startIndex + src.stride * y;<NEW_LINE>int indexSrcEnd = indexSrc + src.width;<NEW_LINE>int indexDst <MASK><NEW_LINE>for (; indexSrc < indexSrcEnd; indexSrc++) {<NEW_LINE>dstData[indexDst++] = (byte) srcData[indexSrc];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else if (numBands == 4) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, src.height, y -> {<NEW_LINE>for (int y = 0; y < src.height; y++) {<NEW_LINE>int indexSrc = src.startIndex + src.stride * y;<NEW_LINE>int indexSrcEnd = indexSrc + src.width;<NEW_LINE>int indexDst = y * src.width * numBands;<NEW_LINE>for (; indexSrc < indexSrcEnd; indexSrc++) {<NEW_LINE>byte val = (byte) srcData[indexSrc];<NEW_LINE>indexDst++;<NEW_LINE>dstData[indexDst++] = val;<NEW_LINE>dstData[indexDst++] = val;<NEW_LINE>dstData[indexDst++] = val;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Code more here");<NEW_LINE>}<NEW_LINE>}
= y * src.width * numBands;
343,068
public void navigate(final String url) {<NEW_LINE>RepeatingCommand navigateCommand = new RepeatingCommand() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean execute() {<NEW_LINE>if (getIFrame() != null && getWindow() != null) {<NEW_LINE>// if this is the same page but without an anchor qualification<NEW_LINE>// then reload (so we preserve the anchor location)<NEW_LINE>if (isBasePageOfCurrentAnchor(url)) {<NEW_LINE>getWindow().reload();<NEW_LINE>} else // if it's the same page then set the anchor and force a reload<NEW_LINE>if (isSamePage(url)) {<NEW_LINE><MASK><NEW_LINE>getWindow().reload();<NEW_LINE>} else // otherwise a new url, merely replacing will force a reload<NEW_LINE>{<NEW_LINE>getWindow().replaceLocationHref(url);<NEW_LINE>}<NEW_LINE>if (autoFocus_)<NEW_LINE>getWindow().focus();<NEW_LINE>return false;<NEW_LINE>} else {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>if (navigateCommand.execute())<NEW_LINE>Scheduler.get().scheduleFixedDelay(navigateCommand, 50);<NEW_LINE>}
getWindow().replaceLocationHref(url);
473,624
public void mapPartition(Iterable<Row> values, Collector<Tuple2<Integer, Row>> out) {<NEW_LINE>int parallel = getIterationRuntimeContext().getNumberOfParallelSubtasks();<NEW_LINE>int nextSuperStep = getIterationRuntimeContext().getSuperstepNumber();<NEW_LINE>int start = (nextSuperStep - 1) * parallel, end = nextSuperStep * parallel;<NEW_LINE>int numTreesCurLoop = Math.min(numTrees - start, end - start);<NEW_LINE>Random rnd = ThreadLocalRandom.current();<NEW_LINE>List<PriorityQueue<Tuple3<Double, Integer, Row>>> priorityQueues <MASK><NEW_LINE>for (int i = 0; i < numTreesCurLoop; ++i) {<NEW_LINE>priorityQueues.add(new PriorityQueue<>(subsamplingSize, Comparator.comparing(o -> o.f0)));<NEW_LINE>}<NEW_LINE>for (Row row : values) {<NEW_LINE>for (int i = 0; i < numTreesCurLoop; ++i) {<NEW_LINE>PriorityQueue<Tuple3<Double, Integer, Row>> q = priorityQueues.get(i);<NEW_LINE>if (q.size() < subsamplingSize) {<NEW_LINE>q.offer(Tuple3.of(rnd.nextDouble(), i, row));<NEW_LINE>} else {<NEW_LINE>Double rand = rnd.nextDouble();<NEW_LINE>if (rand > q.element().f0) {<NEW_LINE>q.poll();<NEW_LINE>q.offer(Tuple3.of(rand, i, row));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (PriorityQueue<Tuple3<Double, Integer, Row>> q : priorityQueues) {<NEW_LINE>for (Tuple3<Double, Integer, Row> item : q) {<NEW_LINE>out.collect(Tuple2.of(item.f1, item.f2));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
= new ArrayList<>(numTreesCurLoop);
1,510,525
public static void directInlineCacheCall(CompilationResultBuilder crb, AMD64MacroAssembler masm, InvokeTarget callTarget, MarkId markId, long nonOopBits, LIRFrameState info) {<NEW_LINE>masm.alignBeforeCall(true, INLINE_CACHE_MOV_SIZE);<NEW_LINE>// The mark for an invocation that uses an inline cache must be placed at the<NEW_LINE>// instruction that loads the Klass from the inline cache.<NEW_LINE>crb.recordMark(markId);<NEW_LINE>int movPos = masm.position();<NEW_LINE>masm.movq(AMD64.rax, nonOopBits);<NEW_LINE>int before = masm.position();<NEW_LINE>assert movPos + INLINE_CACHE_MOV_SIZE == before;<NEW_LINE>masm.call();<NEW_LINE>int after = masm.position();<NEW_LINE>Call call = crb.recordDirectCall(<MASK><NEW_LINE>checkCallDisplacementAlignment(crb, before, call);<NEW_LINE>crb.recordExceptionHandlers(after, info);<NEW_LINE>masm.ensureUniquePC();<NEW_LINE>}
before, after, callTarget, info);
531,251
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {<NEW_LINE>switch(position) {<NEW_LINE>case 0:<NEW_LINE>((OscilloscopeActivity) getActivity()).setRightYAxisScale(16, -16);<NEW_LINE>break;<NEW_LINE>case 1:<NEW_LINE>((OscilloscopeActivity) getActivity()).setRightYAxisScale(8, -8);<NEW_LINE>break;<NEW_LINE>case 2:<NEW_LINE>((OscilloscopeActivity) getActivity()).setRightYAxisScale(4, -4);<NEW_LINE>break;<NEW_LINE>case 3:<NEW_LINE>((OscilloscopeActivity) getActivity()).setRightYAxisScale(3, -3);<NEW_LINE>break;<NEW_LINE>case 4:<NEW_LINE>((OscilloscopeActivity) getActivity())<MASK><NEW_LINE>break;<NEW_LINE>case 5:<NEW_LINE>((OscilloscopeActivity) getActivity()).setRightYAxisScale(1.5, -1.5);<NEW_LINE>break;<NEW_LINE>case 6:<NEW_LINE>((OscilloscopeActivity) getActivity()).setRightYAxisScale(1, -1);<NEW_LINE>break;<NEW_LINE>case 7:<NEW_LINE>((OscilloscopeActivity) getActivity()).setRightYAxisScale(500, -500);<NEW_LINE>break;<NEW_LINE>case 8:<NEW_LINE>((OscilloscopeActivity) getActivity()).setRightYAxisScale(160, -160);<NEW_LINE>openAlertDialogBox("CH2");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}
.setRightYAxisScale(2, -2);
1,082,846
protected void onPostExecute(Object result) {<NEW_LINE>if (result instanceof StatusLine) {<NEW_LINE>notificationManager.cancel(Util.NOTIFY_UPDATE);<NEW_LINE>StatusLine status = (StatusLine) result;<NEW_LINE>if (status.getStatusCode() == 204) {<NEW_LINE>// No Content<NEW_LINE>String none = mContext.getString(R.string.title_update_none);<NEW_LINE>Toast.makeText(mContext, none, <MASK><NEW_LINE>} else<NEW_LINE>Toast.makeText(mContext, status.getStatusCode() + " " + status.getReasonPhrase(), Toast.LENGTH_LONG).show();<NEW_LINE>} else if (result instanceof Throwable) {<NEW_LINE>notificationManager.cancel(Util.NOTIFY_UPDATE);<NEW_LINE>Throwable ex = (Throwable) result;<NEW_LINE>Toast.makeText(mContext, ex.toString(), Toast.LENGTH_LONG).show();<NEW_LINE>} else {<NEW_LINE>File download = (File) result;<NEW_LINE>Intent intent = new Intent(Intent.ACTION_VIEW);<NEW_LINE>intent.setDataAndType(Uri.fromFile(download), "application/vnd.android.package-archive");<NEW_LINE>PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);<NEW_LINE>// Update notification<NEW_LINE>builder.setContentText(mContext.getString(R.string.title_update_install));<NEW_LINE>builder.setWhen(System.currentTimeMillis());<NEW_LINE>builder.setAutoCancel(true);<NEW_LINE>builder.setOngoing(false);<NEW_LINE>builder.setContentIntent(pi);<NEW_LINE>notification = builder.build();<NEW_LINE>notificationManager.notify(Util.NOTIFY_UPDATE, notification);<NEW_LINE>}<NEW_LINE>}
Toast.LENGTH_LONG).show();
1,306,244
public void addRangeToSqlBuilder(final SqlBuilder sqlBuilder, final String valueExpression, final Func1<T, T> valueConverter) {<NEW_LINE>final boolean hasSpecial = specialNumber != null && includeSpecialNumber != null;<NEW_LINE>final boolean hasMinMax = minRangeValue != null || maxRangeValue != null;<NEW_LINE>if (valueExpression == null || (!hasSpecial && !hasMinMax)) {<NEW_LINE>sqlBuilder.addWhereAlwaysInclude();<NEW_LINE>} else {<NEW_LINE>if (hasSpecial) {<NEW_LINE>sqlBuilder.openWhere(includeSpecialNumber ? SqlBuilder.WhereType.<MASK><NEW_LINE>final T sn = valueConverter == null ? specialNumber : valueConverter.call(specialNumber);<NEW_LINE>if (includeSpecialNumber) {<NEW_LINE>sqlBuilder.addWhere(valueExpression + " = " + sn);<NEW_LINE>} else {<NEW_LINE>sqlBuilder.addWhere(valueExpression + " <> " + sn);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sqlBuilder.openWhere(SqlBuilder.WhereType.AND);<NEW_LINE>if (minRangeValue != null) {<NEW_LINE>sqlBuilder.addWhere(valueExpression + " >= " + (valueConverter == null ? minRangeValue : valueConverter.call(minRangeValue)));<NEW_LINE>}<NEW_LINE>if (maxRangeValue != null) {<NEW_LINE>sqlBuilder.addWhere(valueExpression + " <= " + (valueConverter == null ? maxRangeValue : valueConverter.call(maxRangeValue)));<NEW_LINE>}<NEW_LINE>if (minRangeValue == null && maxRangeValue == null) {<NEW_LINE>sqlBuilder.addWhereTrue();<NEW_LINE>}<NEW_LINE>sqlBuilder.closeWhere();<NEW_LINE>if (hasSpecial) {<NEW_LINE>sqlBuilder.closeWhere();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
OR : SqlBuilder.WhereType.AND);
987,974
/* Initilizes the view.<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void addNotify() {<NEW_LINE>super.addNotify();<NEW_LINE>// run under mutex<NEW_LINE>ExplorerManager <MASK><NEW_LINE>if (em != manager) {<NEW_LINE>if (manager != null) {<NEW_LINE>manager.removeVetoableChangeListener(wlvc);<NEW_LINE>manager.removePropertyChangeListener(wlpc);<NEW_LINE>}<NEW_LINE>manager = em;<NEW_LINE>manager.addVetoableChangeListener(wlvc = WeakListeners.vetoableChange(managerListener, manager));<NEW_LINE>manager.addPropertyChangeListener(wlpc = WeakListeners.propertyChange(managerListener, manager));<NEW_LINE>setNode(manager.getExploredContext());<NEW_LINE>updateSelection();<NEW_LINE>} else {<NEW_LINE>// bugfix #23509, the listener were removed --> add it again<NEW_LINE>if (!listenerActive && (manager != null)) {<NEW_LINE>manager.addVetoableChangeListener(wlvc = WeakListeners.vetoableChange(managerListener, manager));<NEW_LINE>manager.addPropertyChangeListener(wlpc = WeakListeners.propertyChange(managerListener, manager));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!listenerActive) {<NEW_LINE>listenerActive = true;<NEW_LINE>list.getSelectionModel().addListSelectionListener(managerListener);<NEW_LINE>model.addListDataListener(managerListener);<NEW_LINE>// bugfix #23974, model doesn't reflect an explorer context change<NEW_LINE>// because any listener was not active<NEW_LINE>setNode(manager.getExploredContext());<NEW_LINE>list.addMouseListener(popupSupport);<NEW_LINE>}<NEW_LINE>}
em = ExplorerManager.find(this);
660,720
private void filterCardsType(int modifiers, String actionCommand) {<NEW_LINE>// ALT or CTRL button was pushed<NEW_LINE>if ((modifiers & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK || (modifiers & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) {<NEW_LINE>boolean invert = (modifiers & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK;<NEW_LINE>tbArifiacts.setSelected(inverter(invert, tbArifiacts.getActionCommand(), actionCommand));<NEW_LINE>tbCreatures.setSelected(inverter(invert, tbCreatures.getActionCommand(), actionCommand));<NEW_LINE>tbEnchantments.setSelected(inverter(invert, tbEnchantments.getActionCommand(), actionCommand));<NEW_LINE>tbInstants.setSelected(inverter(invert, tbInstants.getActionCommand(), actionCommand));<NEW_LINE>tbLand.setSelected(inverter(invert, tbLand<MASK><NEW_LINE>tbPlaneswalkers.setSelected(inverter(invert, tbPlaneswalkers.getActionCommand(), actionCommand));<NEW_LINE>tbSorceries.setSelected(inverter(invert, tbSorceries.getActionCommand(), actionCommand));<NEW_LINE>}<NEW_LINE>filterCards();<NEW_LINE>}
.getActionCommand(), actionCommand));
1,236,207
public SourceForBinaryQueryImplementation2.Result findSourceRoots2(URL binaryRoot) {<NEW_LINE>SourceForBinaryQueryImplementation2.Result res = this.cache.get(binaryRoot);<NEW_LINE>if (res != null) {<NEW_LINE>return res;<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final Collection<JavaPlatform> candidates = new ArrayDeque<>();<NEW_LINE>for (JavaPlatform platform : jpm.getInstalledPlatforms()) {<NEW_LINE>if (contains(platform, binaryRoot)) {<NEW_LINE>candidates.add(platform);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!candidates.isEmpty()) {<NEW_LINE>res = new Result(jpm, binaryRoot, candidates);<NEW_LINE>this.cache.put(binaryRoot, res);<NEW_LINE>return res;<NEW_LINE>}<NEW_LINE>String binaryRootS = binaryRoot.toExternalForm();<NEW_LINE>if (binaryRootS.startsWith(JAR_FILE)) {<NEW_LINE>if (binaryRootS.endsWith(RTJAR_PATH)) {<NEW_LINE>// Unregistered platform<NEW_LINE>String srcZipS = binaryRootS.substring(4, binaryRootS.length() - RTJAR_PATH.length()) + SRC_ZIP;<NEW_LINE>try {<NEW_LINE>URL srcZip = FileUtil.getArchiveRoot(new URL(srcZipS));<NEW_LINE>FileObject fo = URLMapper.findFileObject(srcZip);<NEW_LINE>if (fo != null) {<NEW_LINE>return new UnregisteredPlatformResult(fo);<NEW_LINE>}<NEW_LINE>} catch (MalformedURLException mue) {<NEW_LINE>Exceptions.printStackTrace(mue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}
JavaPlatformManager jpm = JavaPlatformManager.getDefault();
307,276
public void write(org.apache.thrift.protocol.TProtocol oprot, knnQueryBatch_args struct) throws org.apache.thrift.TException {<NEW_LINE>struct.validate();<NEW_LINE>oprot.writeStructBegin(STRUCT_DESC);<NEW_LINE>oprot.writeFieldBegin(K_FIELD_DESC);<NEW_LINE>oprot.writeI32(struct.k);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>if (struct.queryObj != null) {<NEW_LINE>oprot.writeFieldBegin(QUERY_OBJ_FIELD_DESC);<NEW_LINE>{<NEW_LINE>oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct<MASK><NEW_LINE>for (java.nio.ByteBuffer _iter19 : struct.queryObj) {<NEW_LINE>oprot.writeBinary(_iter19);<NEW_LINE>}<NEW_LINE>oprot.writeListEnd();<NEW_LINE>}<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>}<NEW_LINE>oprot.writeFieldBegin(RET_EXTERN_ID_FIELD_DESC);<NEW_LINE>oprot.writeBool(struct.retExternId);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>oprot.writeFieldBegin(RET_OBJ_FIELD_DESC);<NEW_LINE>oprot.writeBool(struct.retObj);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>oprot.writeFieldBegin(NUM_THREADS_FIELD_DESC);<NEW_LINE>oprot.writeI32(struct.numThreads);<NEW_LINE>oprot.writeFieldEnd();<NEW_LINE>oprot.writeFieldStop();<NEW_LINE>oprot.writeStructEnd();<NEW_LINE>}
.queryObj.size()));
1,403,752
public ListBillingGroupsResult listBillingGroups(ListBillingGroupsRequest listBillingGroupsRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listBillingGroupsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListBillingGroupsRequest> request = null;<NEW_LINE>Response<ListBillingGroupsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListBillingGroupsRequestMarshaller().marshall(listBillingGroupsRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<ListBillingGroupsResult, JsonUnmarshallerContext> unmarshaller = new ListBillingGroupsResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<ListBillingGroupsResult> responseHandler = new JsonResponseHandler<ListBillingGroupsResult>(unmarshaller);<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>}
invoke(request, responseHandler, executionContext);
596,993
protected <T> T doOperation(RequestMessage request, ResponseParser<T> parser, String bucketName, String key, boolean keepResponseOpen, List<RequestHandler> requestHandlers, List<ResponseHandler> reponseHandlers) throws OSSException, ClientException {<NEW_LINE>final WebServiceRequest originalRequest = request.getOriginalRequest();<NEW_LINE>request.getHeaders().putAll(client.getClientConfiguration().getDefaultHeaders());<NEW_LINE>request.getHeaders().putAll(originalRequest.getHeaders());<NEW_LINE>request.getParameters().putAll(originalRequest.getParameters());<NEW_LINE>ExecutionContext context = createDefaultContext(request.getMethod(<MASK><NEW_LINE>if (context.getCredentials().useSecurityToken() && !request.isUseUrlSignature()) {<NEW_LINE>request.addHeader(OSSHeaders.OSS_SECURITY_TOKEN, context.getCredentials().getSecurityToken());<NEW_LINE>}<NEW_LINE>context.addRequestHandler(new RequestProgressHanlder());<NEW_LINE>if (requestHandlers != null) {<NEW_LINE>for (RequestHandler handler : requestHandlers) context.addRequestHandler(handler);<NEW_LINE>}<NEW_LINE>if (client.getClientConfiguration().isCrcCheckEnabled()) {<NEW_LINE>context.addRequestHandler(new RequestChecksumHanlder());<NEW_LINE>}<NEW_LINE>context.addResponseHandler(new ResponseProgressHandler(originalRequest));<NEW_LINE>if (reponseHandlers != null) {<NEW_LINE>for (ResponseHandler handler : reponseHandlers) context.addResponseHandler(handler);<NEW_LINE>}<NEW_LINE>if (client.getClientConfiguration().isCrcCheckEnabled()) {<NEW_LINE>context.addResponseHandler(new ResponseChecksumHandler());<NEW_LINE>}<NEW_LINE>List<RequestSigner> signerHandlers = this.client.getClientConfiguration().getSignerHandlers();<NEW_LINE>if (signerHandlers != null) {<NEW_LINE>for (RequestSigner signer : signerHandlers) {<NEW_LINE>context.addSignerHandler(signer);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ResponseMessage response = send(request, context, keepResponseOpen);<NEW_LINE>try {<NEW_LINE>return parser.parse(response);<NEW_LINE>} catch (ResponseParseException rpe) {<NEW_LINE>OSSException oe = ExceptionFactory.createInvalidResponseException(response.getRequestId(), rpe.getMessage(), rpe);<NEW_LINE>logException("Unable to parse response error: ", rpe);<NEW_LINE>throw oe;<NEW_LINE>}<NEW_LINE>}
), bucketName, key, originalRequest);
1,400,977
public SwaggerEntity swaggerJson() {<NEW_LINE>this.DEFINITION_MAP.clear();<NEW_LINE>List<ApiInfo> infos = requestMagicDynamicRegistry.mappings();<NEW_LINE>SwaggerEntity swaggerEntity = new SwaggerEntity();<NEW_LINE>swaggerEntity.setInfo(info);<NEW_LINE>swaggerEntity.setBasePath(this.basePath);<NEW_LINE>for (ApiInfo info : infos) {<NEW_LINE>String groupName = magicResourceService.getGroupName(info.getGroupId()).replace("/", "-");<NEW_LINE>String requestPath = PathUtils.replaceSlash(this.prefix + magicResourceService.getGroupPath(info.getGroupId()) + "/" + info.getPath());<NEW_LINE>SwaggerEntity.Path path = new SwaggerEntity.Path(info.getId());<NEW_LINE>path.addTag(groupName);<NEW_LINE>boolean hasBody = false;<NEW_LINE>try {<NEW_LINE>List<Map<String, Object>> parameters = parseParameters(info);<NEW_LINE>hasBody = parameters.stream().anyMatch(it -> VAR_NAME_REQUEST_BODY.equals(it.get("in")));<NEW_LINE><MASK><NEW_LINE>if (hasBody && baseDefinition != null) {<NEW_LINE>doProcessDefinition(baseDefinition, info, groupName, "root_", "request", 0);<NEW_LINE>}<NEW_LINE>parameters.forEach(path::addParameter);<NEW_LINE>if (this.persistenceResponseBody) {<NEW_LINE>baseDefinition = info.getResponseBodyDefinition();<NEW_LINE>if (baseDefinition != null) {<NEW_LINE>Map responseMap = parseResponse(info);<NEW_LINE>if (!responseMap.isEmpty()) {<NEW_LINE>path.setResponses(responseMap);<NEW_LINE>doProcessDefinition(baseDefinition, info, groupName, "root_" + baseDefinition.getName(), "response", 0);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>path.addResponse("200", JsonUtils.readValue(Objects.toString(info.getResponseBody(), BODY_EMPTY), Object.class));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception ignored) {<NEW_LINE>}<NEW_LINE>if (hasBody) {<NEW_LINE>path.addConsume("application/json");<NEW_LINE>} else {<NEW_LINE>path.addConsume("*/*");<NEW_LINE>}<NEW_LINE>path.addProduce("application/json");<NEW_LINE>path.setSummary(info.getName());<NEW_LINE>path.setDescription(StringUtils.defaultIfBlank(info.getDescription(), info.getName()));<NEW_LINE>swaggerEntity.addPath(requestPath, info.getMethod(), path);<NEW_LINE>}<NEW_LINE>if (this.DEFINITION_MAP.size() > 0) {<NEW_LINE>Set<Map.Entry> entries = ((Map) this.DEFINITION_MAP).entrySet();<NEW_LINE>for (Map.Entry entry : entries) {<NEW_LINE>swaggerEntity.addDefinitions(Objects.toString(entry.getKey()), entry.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return swaggerEntity;<NEW_LINE>}
BaseDefinition baseDefinition = info.getRequestBodyDefinition();
1,031,567
public World[] updates(@QueryParam("queries") String queriesParam) throws InterruptedException, ExecutionException {<NEW_LINE><MASK><NEW_LINE>final World[] worlds = new World[queries];<NEW_LINE>Callable<World[]> callable = () -> {<NEW_LINE>Session session = emf.createEntityManager().unwrap(Session.class);<NEW_LINE>session.setDefaultReadOnly(false);<NEW_LINE>Transaction txn = session.beginTransaction();<NEW_LINE>try {<NEW_LINE>// using write batching. See the data source properties provided<NEW_LINE>// in the configuration file<NEW_LINE>// 1. Read and update the entities from the DB<NEW_LINE>final AtomicInteger ii = new AtomicInteger(0);<NEW_LINE>ThreadLocalRandom.current().ints(1, 10001).distinct().limit(queries).forEach((randomValue) -> {<NEW_LINE>final World world = (World) session.byId(World.class).load(randomValue);<NEW_LINE>world.setRandomNumber(randomWorld());<NEW_LINE>worlds[ii.getAndAdd(1)] = world;<NEW_LINE>});<NEW_LINE>// 2. Sort the array to prevent transaction deadlock in the DB<NEW_LINE>Arrays.sort(worlds, Comparator.comparingInt(World::getId));<NEW_LINE>// 3. Actually save the entities<NEW_LINE>for (int i = 0; i < worlds.length; i++) {<NEW_LINE>session.persist(worlds[i]);<NEW_LINE>}<NEW_LINE>session.flush();<NEW_LINE>session.clear();<NEW_LINE>txn.commit();<NEW_LINE>return worlds;<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>if (txn != null && txn.isActive())<NEW_LINE>txn.rollback();<NEW_LINE>throw e;<NEW_LINE>} finally {<NEW_LINE>session.close();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>Future<World[]> futureWorlds = Common.EXECUTOR.submit(callable);<NEW_LINE>return futureWorlds.get();<NEW_LINE>}
final int queries = getQueries(queriesParam);
1,673,088
private String validateAndCreateMethod() {<NEW_LINE>String methodName = getMethodName();<NEW_LINE>if (!PsiNameHelper.getInstance(myProject).isIdentifier(methodName)) {<NEW_LINE>return RefactoringMessageUtil.getIncorrectIdentifierMessage(methodName);<NEW_LINE>}<NEW_LINE>final PsiElementFactory factory = JavaPsiFacade.getInstance(myProject).getElementFactory();<NEW_LINE>final PsiMethod oldMethod = myMethod.getMethod();<NEW_LINE>final PsiMethod newMethod = factory.createMethod(methodName, oldMethod.getReturnType());<NEW_LINE>final List<ParameterTableModelItemBase<ParameterInfoImpl>> tableModelItems = myParametersTableModel.getItems();<NEW_LINE>final PsiParameterList parameterList = newMethod.getParameterList();<NEW_LINE>for (final ParameterTableModelItemBase<ParameterInfoImpl> item : tableModelItems) {<NEW_LINE>final String parameterName = item.parameter.getName();<NEW_LINE>if (!PsiNameHelper.getInstance(myProject).isIdentifier(parameterName)) {<NEW_LINE>return RefactoringMessageUtil.getIncorrectIdentifierMessage(parameterName);<NEW_LINE>}<NEW_LINE>final PsiType parameterType;<NEW_LINE>try {<NEW_LINE>parameterType = ((PsiTypeCodeFragment) item.typeCodeFragment).getType();<NEW_LINE>} catch (PsiTypeCodeFragment.TypeSyntaxException e) {<NEW_LINE>return RefactoringBundle.message("changeSignature.wrong.type.for.parameter", item.typeCodeFragment.getText(), parameterName);<NEW_LINE>} catch (PsiTypeCodeFragment.NoTypeException e) {<NEW_LINE>return RefactoringBundle.message("changeSignature.no.type.for.parameter", "return", parameterName);<NEW_LINE>}<NEW_LINE>if (PsiTypesUtil.hasUnresolvedComponents(parameterType)) {<NEW_LINE>return RefactoringBundle.message("changeSignature.cannot.resolve.parameter.type");<NEW_LINE>}<NEW_LINE>if (parameterType instanceof PsiEllipsisType) {<NEW_LINE>return "Don`t use varargs type for " + parameterName;<NEW_LINE>}<NEW_LINE>PsiParameter parameter = getInitialMethodParameter(<MASK><NEW_LINE>if (parameter == null) {<NEW_LINE>parameter = factory.createParameter(parameterName, parameterType);<NEW_LINE>final PsiModifierList parameterModifierList = parameter.getModifierList();<NEW_LINE>if (parameterModifierList == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>parameterModifierList.addAnnotation(Param.class.getName());<NEW_LINE>}<NEW_LINE>parameterList.add(parameter);<NEW_LINE>}<NEW_LINE>// TODO T39429594: Context should be not removable<NEW_LINE>// TODO T39429594: Extract createMethod logic into Utility class<NEW_LINE>// TODO T39429594: Check for duplicate parameter names<NEW_LINE>final PsiModifierList modifierList = newMethod.getModifierList();<NEW_LINE>for (PsiElement modifier : oldMethod.getModifierList().getChildren()) {<NEW_LINE>modifierList.add(modifier);<NEW_LINE>}<NEW_LINE>modifierList.setModifierProperty(PsiModifier.PACKAGE_LOCAL, true);<NEW_LINE>this.newMethod = newMethod;<NEW_LINE>return null;<NEW_LINE>}
parameterName, parameterType.getPresentableText());
230,649
void parallelizeWithParentSequence(LayoutInterval interval, int endIndex, int dimension) {<NEW_LINE>LayoutInterval parent = interval.getParent();<NEW_LINE>assert parent.isParallel();<NEW_LINE>LayoutInterval parParent = parent;<NEW_LINE>while (!parParent.getParent().isSequential()) {<NEW_LINE>parParent = parParent.getParent();<NEW_LINE>}<NEW_LINE>LayoutInterval parentSeq = parParent.getParent();<NEW_LINE>int startIndex = parentSeq.indexOf(parParent);<NEW_LINE>if (endIndex < 0)<NEW_LINE>endIndex = parentSeq.getSubIntervalCount() - 1;<NEW_LINE>else if (startIndex > endIndex) {<NEW_LINE>int temp = startIndex;<NEW_LINE>startIndex = endIndex;<NEW_LINE>endIndex = temp;<NEW_LINE>}<NEW_LINE>layoutModel.removeInterval(interval);<NEW_LINE>// TODO compensate possible group shrinking when removing the biggest interval<NEW_LINE>if (interval.getAlignment() == DEFAULT) {<NEW_LINE>layoutModel.setIntervalAlignment(<MASK><NEW_LINE>}<NEW_LINE>addParallelWithSequence(interval, parentSeq, startIndex, endIndex, dimension);<NEW_LINE>if (parent.getSubIntervalCount() == 1) {<NEW_LINE>addContent(layoutModel.removeInterval(parent, 0), parent.getParent(), layoutModel.removeInterval(parent), dimension);<NEW_LINE>} else if (parent.getSubIntervalCount() == 0) {<NEW_LINE>layoutModel.removeInterval(parent);<NEW_LINE>}<NEW_LINE>}
interval, parent.getGroupAlignment());
1,260,954
public void aggregate(int length, AggregationResultHolder aggregationResultHolder, Map<ExpressionContext, BlockValSet> blockValSetMap) {<NEW_LINE>BlockValSet <MASK><NEW_LINE>switch(blockValSet.getValueType().getStoredType()) {<NEW_LINE>case INT:<NEW_LINE>{<NEW_LINE>int[] values = blockValSet.getIntValuesSV();<NEW_LINE>int min = values[0];<NEW_LINE>for (int i = 0; i < length & i < values.length; i++) {<NEW_LINE>min = Math.min(values[i], min);<NEW_LINE>}<NEW_LINE>aggregationResultHolder.setValue(Math.min(min, aggregationResultHolder.getDoubleResult()));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case LONG:<NEW_LINE>{<NEW_LINE>long[] values = blockValSet.getLongValuesSV();<NEW_LINE>long min = values[0];<NEW_LINE>for (int i = 0; i < length & i < values.length; i++) {<NEW_LINE>min = Math.min(values[i], min);<NEW_LINE>}<NEW_LINE>aggregationResultHolder.setValue(Math.min(min, aggregationResultHolder.getDoubleResult()));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case FLOAT:<NEW_LINE>{<NEW_LINE>float[] values = blockValSet.getFloatValuesSV();<NEW_LINE>float min = values[0];<NEW_LINE>for (int i = 0; i < length & i < values.length; i++) {<NEW_LINE>min = Math.min(values[i], min);<NEW_LINE>}<NEW_LINE>aggregationResultHolder.setValue(Math.min(min, aggregationResultHolder.getDoubleResult()));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case DOUBLE:<NEW_LINE>{<NEW_LINE>double[] values = blockValSet.getDoubleValuesSV();<NEW_LINE>double min = values[0];<NEW_LINE>for (int i = 0; i < length & i < values.length; i++) {<NEW_LINE>min = Math.min(values[i], min);<NEW_LINE>}<NEW_LINE>aggregationResultHolder.setValue(Math.min(min, aggregationResultHolder.getDoubleResult()));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("Cannot compute min for non-numeric type: " + blockValSet.getValueType());<NEW_LINE>}<NEW_LINE>}
blockValSet = blockValSetMap.get(_expression);
1,423,883
public boolean start() {<NEW_LINE>InfluxDbIO.Read spec = source.spec;<NEW_LINE>try (InfluxDB influxDB = getConnection(spec.dataSourceConfiguration(), spec.disableCertificateValidation())) {<NEW_LINE>final String db = spec.database();<NEW_LINE>influxDB.setDatabase(spec.database());<NEW_LINE>influxDB.setRetentionPolicy(spec.retentionPolicy());<NEW_LINE>String query = getQueryToRun(spec);<NEW_LINE>final QueryResult queryResult = influxDB.query(new Query(query, db));<NEW_LINE>resultIterator = queryResult.getResults().iterator();<NEW_LINE>if (resultIterator.hasNext()) {<NEW_LINE>Result result = resultIterator.next();<NEW_LINE>if (result != null && result.getSeries() != null) {<NEW_LINE>seriesIterator = result.getSeries().iterator();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (seriesIterator.hasNext()) {<NEW_LINE>valuesIterator = seriesIterator.next()<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return advance();<NEW_LINE>}
.getValues().iterator();
454,071
public Request<DeleteCallAnalyticsJobRequest> marshall(DeleteCallAnalyticsJobRequest deleteCallAnalyticsJobRequest) {<NEW_LINE>if (deleteCallAnalyticsJobRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(DeleteCallAnalyticsJobRequest)");<NEW_LINE>}<NEW_LINE>Request<DeleteCallAnalyticsJobRequest> request = new DefaultRequest<DeleteCallAnalyticsJobRequest>(deleteCallAnalyticsJobRequest, "AmazonTranscribe");<NEW_LINE>String target = "Transcribe.DeleteCallAnalyticsJob";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (deleteCallAnalyticsJobRequest.getCallAnalyticsJobName() != null) {<NEW_LINE>String callAnalyticsJobName = deleteCallAnalyticsJobRequest.getCallAnalyticsJobName();<NEW_LINE>jsonWriter.name("CallAnalyticsJobName");<NEW_LINE>jsonWriter.value(callAnalyticsJobName);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.<MASK><NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>}
setContent(new StringInputStream(snippet));
1,660,028
public <T> Mono<T> init() {<NEW_LINE>return this.containerManager.validateControlContainer().flatMap(dummy -> this.containerManager.getOrCreateConfigItem()).flatMap(dummy -> {<NEW_LINE>double loadFactor = this.calculateLoadFactor();<NEW_LINE>return this.calculateClientThroughputShare(loadFactor).flatMap(controller -> this.containerManager.createGroupClientItem(loadFactor<MASK><NEW_LINE>}).flatMap(dummy -> this.resolveRequestController()).doOnSuccess(dummy -> {<NEW_LINE>this.throughputUsageCycleRenewTask(this.cancellationTokenSource.getToken()).publishOn(CosmosSchedulers.COSMOS_PARALLEL).subscribe();<NEW_LINE>this.calculateClientThroughputShareTask(this.cancellationTokenSource.getToken()).publishOn(CosmosSchedulers.COSMOS_PARALLEL).subscribe();<NEW_LINE>}).thenReturn((T) this);<NEW_LINE>}
, this.getClientAllocatedThroughput()));
309,898
public void marshall(Container container, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (container == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(container.getContainerArn(), CONTAINERARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getTaskArn(), TASKARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getImage(), IMAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getImageDigest(), IMAGEDIGEST_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getRuntimeId(), RUNTIMEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getLastStatus(), LASTSTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getExitCode(), EXITCODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getReason(), REASON_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getNetworkBindings(), NETWORKBINDINGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getNetworkInterfaces(), NETWORKINTERFACES_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getHealthStatus(), HEALTHSTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getManagedAgents(), MANAGEDAGENTS_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getCpu(), CPU_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getMemory(), MEMORY_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getMemoryReservation(), MEMORYRESERVATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(container.getGpuIds(), GPUIDS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + <MASK><NEW_LINE>}<NEW_LINE>}
e.getMessage(), e);
1,084,446
private void createBackup(@Nonnull ZipOutputStream output) throws IOException {<NEW_LINE>Validate.notNull(output, "The Output Stream cannot be null!");<NEW_LINE>for (File folder : new File("data-storage/Slimefun/stored-blocks/").listFiles()) {<NEW_LINE>addDirectory(output, folder, "stored-blocks/" + folder.getName());<NEW_LINE>}<NEW_LINE>addDirectory(output, new File("data-storage/Slimefun/universal-inventories/"), "universal-inventories");<NEW_LINE>addDirectory(output, new File("data-storage/Slimefun/stored-inventories/"), "stored-inventories");<NEW_LINE>File chunks = new File("data-storage/Slimefun/stored-chunks/chunks.sfc");<NEW_LINE>if (chunks.exists()) {<NEW_LINE>byte[] buffer = new byte[1024];<NEW_LINE><MASK><NEW_LINE>output.putNextEntry(entry);<NEW_LINE>try (FileInputStream input = new FileInputStream(chunks)) {<NEW_LINE>int length;<NEW_LINE>while ((length = input.read(buffer)) > 0) {<NEW_LINE>output.write(buffer, 0, length);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>output.closeEntry();<NEW_LINE>}<NEW_LINE>}
ZipEntry entry = new ZipEntry("stored-chunks/chunks.sfc");
1,586,873
private void vpcTiersCanBeMigrated(List<? extends Network> tiersInVpc, Account account, Map<String, String> networkToOffering, boolean resume) {<NEW_LINE>for (Network network : tiersInVpc) {<NEW_LINE>String networkOfferingUuid = networkToOffering.get(network.getUuid());<NEW_LINE>// offering uuid can be a tier where the uuid is previously already swapped in a previous migration<NEW_LINE>if (resume && networkOfferingUuid == null) {<NEW_LINE>NetworkVO oldVPCtier = _networksDao.findById(network.getRelated());<NEW_LINE>networkOfferingUuid = networkToOffering.get(oldVPCtier.getUuid());<NEW_LINE>}<NEW_LINE>if (networkOfferingUuid == null) {<NEW_LINE>throwInvalidIdException("Failed to migrate VPC as the specified tierNetworkOfferings is not complete", String.valueOf(network.getUuid()), "networkUuid");<NEW_LINE>}<NEW_LINE>NetworkOfferingVO newNtwkOff = _networkOfferingDao.findByUuid(networkOfferingUuid);<NEW_LINE>if (newNtwkOff == null) {<NEW_LINE>throwInvalidIdException("Failed to migrate VPC as at least one network offering in tierNetworkOfferings does not exist", networkOfferingUuid, "networkOfferingUuid");<NEW_LINE>}<NEW_LINE>if (!_configMgr.isOfferingForVpc(newNtwkOff)) {<NEW_LINE>throw new InvalidParameterValueException("Network offering " + newNtwkOff.getName() + " (" + newNtwkOff.getUuid() + ") can't be used for VPC networks for network " + network.getName() + "(" + network.getUuid() + ")");<NEW_LINE>}<NEW_LINE>verifyNetworkCanBeMigrated(account, network);<NEW_LINE>long newPhysicalNetworkId = findPhysicalNetworkId(network.getDataCenterId(), newNtwkOff.getTags(<MASK><NEW_LINE>final long oldNetworkOfferingId = network.getNetworkOfferingId();<NEW_LINE>NetworkOffering oldNtwkOff = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId);<NEW_LINE>networkNeedsMigration(network, newPhysicalNetworkId, oldNtwkOff, newNtwkOff);<NEW_LINE>}<NEW_LINE>}
), newNtwkOff.getTrafficType());
1,738,349
public void drawCounterClassic(InstancePainter painter) {<NEW_LINE>final var g = painter.getGraphics();<NEW_LINE>final var bds = painter.getBounds();<NEW_LINE>final var state = (RegisterData) painter.getData();<NEW_LINE>final var widthVal = painter.getAttributeValue(StdAttr.WIDTH);<NEW_LINE>final var width = widthVal == null ? 8 : widthVal.getWidth();<NEW_LINE>// determine text to draw in label<NEW_LINE>String a;<NEW_LINE>String b = null;<NEW_LINE>if (painter.getShowState()) {<NEW_LINE>final var val = state == null ? 0 : state.value.toLongValue();<NEW_LINE>final var str = StringUtil.toHexString(width, val);<NEW_LINE>if (str.length() <= 4) {<NEW_LINE>a = str;<NEW_LINE>} else {<NEW_LINE>int split = str.length() - 4;<NEW_LINE>a = str.substring(0, split);<NEW_LINE>b = str.substring(split);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>a = S.get("counterLabel");<NEW_LINE>b = S.get("registerWidthLabel", "" + widthVal.getWidth());<NEW_LINE>}<NEW_LINE>// draw boundary, label<NEW_LINE>painter.drawBounds();<NEW_LINE>painter.drawLabel();<NEW_LINE>// draw input and output ports<NEW_LINE>if (b == null) {<NEW_LINE>painter.drawPort(IN, "D", Direction.EAST);<NEW_LINE>painter.drawPort(OUT, "Q", Direction.WEST);<NEW_LINE>} else {<NEW_LINE>painter.drawPort(IN);<NEW_LINE>painter.drawPort(OUT);<NEW_LINE>}<NEW_LINE>g.setColor(Color.GRAY);<NEW_LINE>painter.drawPort(LD);<NEW_LINE>painter.drawPort(UD);<NEW_LINE>painter.drawPort(CARRY);<NEW_LINE>painter.drawPort(CLR, "0", Direction.SOUTH);<NEW_LINE>painter.drawPort(EN, S.get("counterEnableLabel"), Direction.EAST);<NEW_LINE>g.setColor(Color.BLACK);<NEW_LINE>painter.drawClock(CK, Direction.NORTH);<NEW_LINE>// draw contents<NEW_LINE>if (b == null) {<NEW_LINE>GraphicsUtil.drawText(g, a, bds.getX() + 15, bds.getY() + 4, GraphicsUtil.H_CENTER, GraphicsUtil.V_TOP);<NEW_LINE>} else {<NEW_LINE>GraphicsUtil.drawText(g, a, bds.getX() + 15, bds.getY() + 3, GraphicsUtil.H_CENTER, GraphicsUtil.V_TOP);<NEW_LINE>GraphicsUtil.drawText(g, b, bds.getX() + 15, bds.getY() + 15, <MASK><NEW_LINE>}<NEW_LINE>}
GraphicsUtil.H_CENTER, GraphicsUtil.V_TOP);
479,276
private static int merge(Candidate[] K, int k, int i, int[] equvalenceLines, boolean[] equivalence, int p) {<NEW_LINE>int r = 0;<NEW_LINE>Candidate c = K[0];<NEW_LINE>do {<NEW_LINE>int j = equvalenceLines[p];<NEW_LINE>int s = binarySearch(<MASK><NEW_LINE>if (s >= 0) {<NEW_LINE>// j was found in K[]<NEW_LINE>s = k + 1;<NEW_LINE>} else {<NEW_LINE>s = -s - 2;<NEW_LINE>if (s < r || s > k)<NEW_LINE>s = k + 1;<NEW_LINE>}<NEW_LINE>if (s <= k) {<NEW_LINE>if (K[s + 1].b > j) {<NEW_LINE>Candidate newc = new Candidate(i, j, K[s]);<NEW_LINE>K[r] = c;<NEW_LINE>r = s + 1;<NEW_LINE>c = newc;<NEW_LINE>}<NEW_LINE>if (s == k) {<NEW_LINE>K[k + 2] = K[k + 1];<NEW_LINE>k++;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (equivalence[p]) {<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>p++;<NEW_LINE>}<NEW_LINE>} while (true);<NEW_LINE>K[r] = c;<NEW_LINE>return k;<NEW_LINE>}
K, j, r, k);
624,633
private static void createTable(String tableName, long readCapacityUnits, long writeCapacityUnits, String partitionKeyName, String partitionKeyType, String sortKeyName, String sortKeyType) {<NEW_LINE>try {<NEW_LINE>System.out.println("Creating table " + tableName);<NEW_LINE>List<KeySchemaElement> keySchema <MASK><NEW_LINE>// Partition<NEW_LINE>keySchema.add(new KeySchemaElement().withAttributeName(partitionKeyName).withKeyType(KeyType.HASH));<NEW_LINE>// key<NEW_LINE>List<AttributeDefinition> attributeDefinitions = new ArrayList<AttributeDefinition>();<NEW_LINE>attributeDefinitions.add(new AttributeDefinition().withAttributeName(partitionKeyName).withAttributeType(partitionKeyType));<NEW_LINE>if (sortKeyName != null) {<NEW_LINE>// Sort<NEW_LINE>keySchema.add(new KeySchemaElement().withAttributeName(sortKeyName).withKeyType(KeyType.RANGE));<NEW_LINE>// key<NEW_LINE>attributeDefinitions.add(new AttributeDefinition().withAttributeName(sortKeyName).withAttributeType(sortKeyType));<NEW_LINE>}<NEW_LINE>Table table = dynamoDB.createTable(tableName, keySchema, attributeDefinitions, new ProvisionedThroughput().withReadCapacityUnits(readCapacityUnits).withWriteCapacityUnits(writeCapacityUnits));<NEW_LINE>System.out.println("Waiting for " + tableName + " to be created...this may take a while...");<NEW_LINE>table.waitForActive();<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.err.println("Failed to create table " + tableName);<NEW_LINE>e.printStackTrace(System.err);<NEW_LINE>}<NEW_LINE>}
= new ArrayList<KeySchemaElement>();
276,403
public void sync(String trackingUrl, float position, float length) {<NEW_LINE>Log.d(TAG, String.format("Start history updating: %s, position: %s, length: %s", trackingUrl, position, length));<NEW_LINE>HashMap<String, String> headers = mManager.getHeaders();<NEW_LINE>String authorization = headers.get("Authorization");<NEW_LINE>if (authorization == null) {<NEW_LINE>Log.e(TAG, "Error: Authorization not found!");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// TODO: for testing only!<NEW_LINE>HashMap<String, String> testHeaders = new HashMap<>();<NEW_LINE>testHeaders.put("Authorization", authorization);<NEW_LINE>final String fullTrackingUrl = processUrl(trackingUrl, position, length);<NEW_LINE>Log.d(TAG, "Composed tracking url: " + fullTrackingUrl);<NEW_LINE>// Log.d(TAG, "Tracking headers: " + headers);<NEW_LINE>new Thread(() -> {<NEW_LINE>// avoid NetworkOnMainThreadException<NEW_LINE>Response response = OkHttpHelpers.doGetOkHttpRequest(fullTrackingUrl.replace("api/stats/watchtime?", "api/stats/playback?"), testHeaders);<NEW_LINE>if (response == null || !response.isSuccessful()) {<NEW_LINE>Log.e(TAG, "Bad tracking response: " + response);<NEW_LINE>}<NEW_LINE>response = <MASK><NEW_LINE>if (response == null || !response.isSuccessful()) {<NEW_LINE>Log.e(TAG, "Bad tracking response: " + response);<NEW_LINE>}<NEW_LINE>}).start();<NEW_LINE>}
OkHttpHelpers.doGetOkHttpRequest(fullTrackingUrl, testHeaders);
1,477,768
public static synchronized void foreachLiveWindow(int dataHandle, Consumer<CallbackData> callback) {<NEW_LINE>CallbackData cbdata = new CallbackData();<NEW_LINE>foreachComponents.clear();<NEW_LINE>foreachComponents.addAll(components.values());<NEW_LINE>for (Component comp : foreachComponents) {<NEW_LINE>if (comp.m_builder == null || comp.m_sendable == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>cbdata.sendable <MASK><NEW_LINE>if (cbdata.sendable != null && comp.m_liveWindow) {<NEW_LINE>cbdata.name = comp.m_name;<NEW_LINE>cbdata.subsystem = comp.m_subsystem;<NEW_LINE>if (comp.m_parent != null) {<NEW_LINE>cbdata.parent = comp.m_parent.get();<NEW_LINE>} else {<NEW_LINE>cbdata.parent = null;<NEW_LINE>}<NEW_LINE>if (comp.m_data != null && dataHandle < comp.m_data.length) {<NEW_LINE>cbdata.data = comp.m_data[dataHandle];<NEW_LINE>} else {<NEW_LINE>cbdata.data = null;<NEW_LINE>}<NEW_LINE>cbdata.builder = comp.m_builder;<NEW_LINE>try {<NEW_LINE>callback.accept(cbdata);<NEW_LINE>} catch (Throwable throwable) {<NEW_LINE>Throwable cause = throwable.getCause();<NEW_LINE>if (cause != null) {<NEW_LINE>throwable = cause;<NEW_LINE>}<NEW_LINE>System.err.println("Unhandled exception calling LiveWindow for " + comp.m_name + ": ");<NEW_LINE>throwable.printStackTrace();<NEW_LINE>comp.m_liveWindow = false;<NEW_LINE>}<NEW_LINE>if (cbdata.data != null) {<NEW_LINE>if (comp.m_data == null) {<NEW_LINE>comp.m_data = new Object[dataHandle + 1];<NEW_LINE>} else if (dataHandle >= comp.m_data.length) {<NEW_LINE>comp.m_data = Arrays.copyOf(comp.m_data, dataHandle + 1);<NEW_LINE>}<NEW_LINE>comp.m_data[dataHandle] = cbdata.data;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>foreachComponents.clear();<NEW_LINE>}
= comp.m_sendable.get();
1,600,138
public com.amazonaws.services.computeoptimizer.model.LimitExceededException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.computeoptimizer.model.LimitExceededException limitExceededException = new com.amazonaws.services.computeoptimizer.model.LimitExceededException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} 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 limitExceededException;<NEW_LINE>}
int originalDepth = context.getCurrentDepth();
1,172,963
public static NDVShardSketch buildNDVShardSketch(String schemaName, String tableName, String columnName) throws SQLException {<NEW_LINE>StatisticUtils.logDebug(schemaName, "build ndv sketch start:" + tableName + "," + columnName);<NEW_LINE>String shardKey = buildSketchKey(schemaName, tableName, columnName);<NEW_LINE>// shard parts build<NEW_LINE>String[] <MASK><NEW_LINE>if (shardPart == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>long[] dnCardinalityArray = new long[shardPart.length];<NEW_LINE>String sketchType = "HYPER_LOG_LOG";<NEW_LINE>byte[][] sketchArray = new byte[shardPart.length][];<NEW_LINE>long[] gmtUpdate = new long[shardPart.length];<NEW_LINE>long[] gmtCreated = new long[shardPart.length];<NEW_LINE>long sketchTime = 0;<NEW_LINE>long cardinalityTime = 0;<NEW_LINE>// fill cardinality and sketch bytes<NEW_LINE>for (int i = 0; i < shardPart.length; i++) {<NEW_LINE>long start = System.currentTimeMillis();<NEW_LINE>dnCardinalityArray[i] = getCurrentCardinality(shardKey, shardPart[i]);<NEW_LINE>long mid = System.currentTimeMillis();<NEW_LINE>cardinalityTime += mid - start;<NEW_LINE>sketchArray[i] = getCurrentHll(shardKey, shardPart[i], true);<NEW_LINE>sketchTime += System.currentTimeMillis() - mid;<NEW_LINE>gmtUpdate[i] = System.currentTimeMillis();<NEW_LINE>gmtCreated[i] = System.currentTimeMillis();<NEW_LINE>}<NEW_LINE>StatisticUtils.logInfo(schemaName, "build ndv sketch end:" + tableName + "," + columnName + ", sketch time:" + sketchTime + ", cardinality time:" + cardinalityTime);<NEW_LINE>long cardinality = estimate(sketchArray);<NEW_LINE>NDVShardSketch ndvShardSketch = new NDVShardSketch(shardKey, shardPart, dnCardinalityArray, sketchType, gmtUpdate, gmtCreated);<NEW_LINE>ndvShardSketch.setCardinality(cardinality);<NEW_LINE>// persist<NEW_LINE>PolarDbXSystemTableNDVSketchStatistic.getInstance().batchReplace(ndvShardSketch.serialize(sketchArray));<NEW_LINE>SyncManagerHelper.sync(new UpdateStatisticSyncAction(schemaName, tableName, null), schemaName);<NEW_LINE>return ndvShardSketch;<NEW_LINE>}
shardPart = buildShardParts(schemaName, tableName);
790,608
public int[][] highFive(int[][] items) {<NEW_LINE>TreeMap<Integer, PriorityQueue<Integer>> treeMap = new TreeMap<>();<NEW_LINE>for (int[] studentToScores : items) {<NEW_LINE>if (treeMap.containsKey(studentToScores[0])) {<NEW_LINE>PriorityQueue<Integer> maxHeap = treeMap.get(studentToScores[0]);<NEW_LINE>maxHeap.offer(studentToScores[1]);<NEW_LINE>if (maxHeap.size() > 5) {<NEW_LINE>maxHeap.poll();<NEW_LINE>}<NEW_LINE>treeMap.put(studentToScores[0], maxHeap);<NEW_LINE>} else {<NEW_LINE>PriorityQueue<Integer> maxHeap = new PriorityQueue<>();<NEW_LINE>maxHeap.offer(studentToScores[1]);<NEW_LINE>treeMap.put(studentToScores[0], maxHeap);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int[][] result = new int[treeMap.size()][2];<NEW_LINE>for (int id : treeMap.keySet()) {<NEW_LINE>result[id - 1][0] = id;<NEW_LINE>int sum = 0;<NEW_LINE>PriorityQueue<Integer> maxHeap = treeMap.get(id);<NEW_LINE>while (!maxHeap.isEmpty()) {<NEW_LINE>sum += maxHeap.poll();<NEW_LINE>}<NEW_LINE>result[id - 1<MASK><NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}
][1] = sum / 5;
159,763
private void handlePurchase(final Purchase purchase) {<NEW_LINE>if (!verifyValidSignature(purchase.getOriginalJson(), purchase.getSignature())) {<NEW_LINE>LOG.info("Got a purchase: " + purchase + ", but signature is bad. Skipping...");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {<NEW_LINE>// Acknowledge the purchase if it hasn't already been acknowledged.<NEW_LINE>if (!purchase.isAcknowledged()) {<NEW_LINE>AcknowledgePurchaseParams acknowledgePurchaseParams = AcknowledgePurchaseParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build();<NEW_LINE>mBillingClient.acknowledgePurchase(acknowledgePurchaseParams, new AcknowledgePurchaseResponseListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onAcknowledgePurchaseResponse(BillingResult billingResult) {<NEW_LINE>if (billingResult.getResponseCode() != BillingResponseCode.OK) {<NEW_LINE>LOG.info("Acknowledge a purchase: " + purchase + " failed (" + billingResult.getResponseCode() + "). " + billingResult.getDebugMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} else if (purchase.getPurchaseState() == Purchase.PurchaseState.PENDING) {<NEW_LINE>LOG.info("Got a purchase: " + purchase + ", but purchase state is pending. Skipping...");<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>LOG.info("Got a purchase: " + purchase + ", but purchase state is " + <MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>LOG.debug("Got a verified purchase: " + purchase);<NEW_LINE>mPurchases.add(purchase);<NEW_LINE>}
purchase.getPurchaseState() + ". Skipping...");
529,350
public GetDomainStatisticsReportResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetDomainStatisticsReportResult getDomainStatisticsReportResult = new GetDomainStatisticsReportResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getDomainStatisticsReportResult;<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("OverallVolume", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getDomainStatisticsReportResult.setOverallVolume(OverallVolumeJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("DailyVolumes", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getDomainStatisticsReportResult.setDailyVolumes(new ListUnmarshaller<DailyVolume>(DailyVolumeJsonUnmarshaller.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 getDomainStatisticsReportResult;<NEW_LINE>}
int originalDepth = context.getCurrentDepth();
977,940
public void readTitledBorder(org.w3c.dom.Node element) throws IOException {<NEW_LINE>if (!XML_TITLED_BORDER.equals(element.getNodeName()))<NEW_LINE>// NOI18N<NEW_LINE>throw new IOException("Invalid format: missing \"" + XML_TITLED_BORDER + "\" element.");<NEW_LINE>try {<NEW_LINE>org.w3c.dom.NamedNodeMap attributes = element.getAttributes();<NEW_LINE>org.w3c.dom.Node node;<NEW_LINE>borderSupport = new BorderDesignSupport(TitledBorder.class);<NEW_LINE>borderSupport.setPropertyContext(propertyContext);<NEW_LINE>FormProperty prop;<NEW_LINE>// NOI18N<NEW_LINE>readBorderProperty(<MASK><NEW_LINE>// for title, first try to read FormDesignValue<NEW_LINE>// NOI18N<NEW_LINE>Object title = readBorderProperty(ATTR_TITLE_X, "title", borderSupport, element);<NEW_LINE>if (// no design value, get simple String attribute<NEW_LINE>title == null && (node = attributes.getNamedItem(ATTR_TITLE)) != null && // NOI18N<NEW_LINE>(prop = (FormProperty) borderSupport.getPropertyOfName("title")) != null)<NEW_LINE>prop.setValue(node.getNodeValue());<NEW_LINE>node = attributes.getNamedItem(ATTR_JUSTIFICATION);<NEW_LINE>if (node != null && // NOI18N<NEW_LINE>(prop = (FormProperty) borderSupport.getPropertyOfName("titleJustification")) != null)<NEW_LINE>prop.setValue(new Integer(node.getNodeValue()));<NEW_LINE>node = attributes.getNamedItem(ATTR_POSITION);<NEW_LINE>if (node != null && // NOI18N<NEW_LINE>(prop = (FormProperty) borderSupport.getPropertyOfName("titlePosition")) != null)<NEW_LINE>prop.setValue(new Integer(node.getNodeValue()));<NEW_LINE>// NOI18N<NEW_LINE>readBorderProperty(ATTR_FONT, "titleFont", borderSupport, element);<NEW_LINE>// NOI18N<NEW_LINE>readBorderProperty(ATTR_TITLE_COLOR, "titleColor", borderSupport, element);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw ex;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>IOException ioex = new IOException();<NEW_LINE>ErrorManager.getDefault().annotate(ioex, ex);<NEW_LINE>throw ioex;<NEW_LINE>}<NEW_LINE>}
ATTR_BORDER, "border", borderSupport, element);
643,149
private int applyValuesToMapField(ArgSpec argSpec, LookBehind lookBehind, boolean alreadyUnquoted, Range arity, Stack<String> args, Set<ArgSpec> initialized, String argDescription) throws Exception {<NEW_LINE>Class<?>[] classes = argSpec.auxiliaryTypes();<NEW_LINE>if (classes.length < 2) {<NEW_LINE>throw new ParameterException(CommandLine.this, argSpec.toString() + " needs two types (one for the map key, one for the value) but only has " + classes.<MASK><NEW_LINE>}<NEW_LINE>ITypeConverter<?> keyConverter = getTypeConverter(classes[0], argSpec, 0);<NEW_LINE>ITypeConverter<?> valueConverter = getTypeConverter(classes[1], argSpec, 1);<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Map<Object, Object> map = (Map<Object, Object>) argSpec.getValue();<NEW_LINE>if (map == null || !initialized.contains(argSpec)) {<NEW_LINE>tracer.debug("Initializing binding for %s on %s with empty %s%n", optionDescription("", argSpec, 0), argSpec.scopeString(), argSpec.type().getSimpleName());<NEW_LINE>// map class<NEW_LINE>map = createMap(argSpec.type());<NEW_LINE>argSpec.setValue(map);<NEW_LINE>}<NEW_LINE>initialized.add(argSpec);<NEW_LINE>int originalSize = map.size();<NEW_LINE>int pos = getPosition(argSpec);<NEW_LINE>consumeMapArguments(argSpec, lookBehind, alreadyUnquoted, arity, args, classes, keyConverter, valueConverter, map, argDescription);<NEW_LINE>parseResultBuilder.add(argSpec, pos);<NEW_LINE>argSpec.setValue(map);<NEW_LINE>return map.size() - originalSize;<NEW_LINE>}
length + " types configured.", argSpec, null);
1,374,826
public Request<ListBotsRequest> marshall(ListBotsRequest listBotsRequest) {<NEW_LINE>if (listBotsRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(ListBotsRequest)");<NEW_LINE>}<NEW_LINE>Request<ListBotsRequest> request = new DefaultRequest<ListBotsRequest>(listBotsRequest, "AmazonConnect");<NEW_LINE>request.setHttpMethod(HttpMethodName.GET);<NEW_LINE>String uriResourcePath = "/instance/{InstanceId}/bots";<NEW_LINE>uriResourcePath = uriResourcePath.replace("{InstanceId}", (listBotsRequest.getInstanceId() == null) ? "" : StringUtils.fromString(listBotsRequest.getInstanceId()));<NEW_LINE>if (listBotsRequest.getNextToken() != null) {<NEW_LINE>request.addParameter("nextToken", StringUtils.fromString(listBotsRequest.getNextToken()));<NEW_LINE>}<NEW_LINE>if (listBotsRequest.getMaxResults() != null) {<NEW_LINE>request.addParameter("maxResults", StringUtils.fromInteger(listBotsRequest.getMaxResults()));<NEW_LINE>}<NEW_LINE>if (listBotsRequest.getLexVersion() != null) {<NEW_LINE>request.addParameter("lexVersion", StringUtils.fromString(listBotsRequest.getLexVersion()));<NEW_LINE>}<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>}
request.addHeader("Content-Type", "application/x-amz-json-1.1");
739,379
private static void addVersionConstructorOverload(ClassOrInterfaceDeclaration clazz, ConstructorDeclaration creatorCtor, String versionType, Expression v1Constant) {<NEW_LINE>int nextCtorPosition = clazz.getMembers().indexOf(creatorCtor) + 1;<NEW_LINE>ConstructorDeclaration versionCtor = creatorCtor.clone();<NEW_LINE>versionCtor.getAnnotationByName("JsonCreator").ifPresent(AnnotationExpr::remove);<NEW_LINE>versionCtor.getParameters().forEach(param -> param.getAnnotationByName("JsonProperty")<MASK><NEW_LINE>versionCtor.addParameter(versionType, "version");<NEW_LINE>versionCtor.setJavadocComment(versionCtor.getJavadoc().get().addBlockTag(JavadocBlockTag.createParamBlockTag("version", String.format("the %s value to set.", versionType))));<NEW_LINE>versionCtor.getBody().addStatement(new AssignExpr(new FieldAccessExpr().setName("version"), new NameExpr("version"), AssignExpr.Operator.ASSIGN));<NEW_LINE>clazz.getMembers().add(nextCtorPosition, versionCtor);<NEW_LINE>ExplicitConstructorInvocationStmt thisCtorCall = new ExplicitConstructorInvocationStmt().setThis(true).setArguments(new NodeList<>(new NameExpr("inputs"), new NameExpr("outputs"), v1Constant));<NEW_LINE>creatorCtor.getBody().setStatements(new NodeList<>(thisCtorCall));<NEW_LINE>}
.ifPresent(AnnotationExpr::remove));
1,569,144
public static int deserializeInt(final JsonReader reader) throws IOException {<NEW_LINE>if (reader.last() == '"') {<NEW_LINE>final int position = reader.getCurrentIndex();<NEW_LINE>final char[] buf = reader.readSimpleQuote();<NEW_LINE>try {<NEW_LINE>return parseNumberGeneric(buf, reader.getCurrentIndex() - position - 1, reader, true).intValueExact();<NEW_LINE>} catch (ArithmeticException ignore) {<NEW_LINE>throw reader.newParseErrorAt("Integer overflow detected", reader.getCurrentIndex() - position);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final int start = reader.scanNumber();<NEW_LINE>final int end = reader.getCurrentIndex();<NEW_LINE>final byte[] buf = reader.buffer;<NEW_LINE><MASK><NEW_LINE>if (ch == '-') {<NEW_LINE>if (end > start + 2 && buf[start + 1] == '0' && buf[start + 2] >= '0' && buf[start + 2] <= '9') {<NEW_LINE>numberException(reader, start, end, "Leading zero is not allowed");<NEW_LINE>}<NEW_LINE>return parseNegativeInt(buf, reader, start, end);<NEW_LINE>} else {<NEW_LINE>if (ch == '0' && end > start + 1 && buf[start + 1] >= '0' && buf[start + 1] <= '9') {<NEW_LINE>numberException(reader, start, end, "Leading zero is not allowed");<NEW_LINE>}<NEW_LINE>return parsePositiveInt(buf, reader, start, end, 0);<NEW_LINE>}<NEW_LINE>}
final byte ch = buf[start];
1,166,983
protected void registerStatesAndModels() {<NEW_LINE>registerFluidBlockStates(MekanismFluids.FLUIDS.getAllFluids());<NEW_LINE>ResourceLocation basicCube = modLoc("block/basic_cube");<NEW_LINE>for (Map.Entry<IResource, BlockRegistryObject<?, ?>> entry : MekanismBlocks.PROCESSED_RESOURCE_BLOCKS.entrySet()) {<NEW_LINE>String registrySuffix = entry.getKey().getRegistrySuffix();<NEW_LINE>ResourceLocation texture = modLoc("block/block_" + registrySuffix);<NEW_LINE>ModelFile file;<NEW_LINE>if (models().textureExists(texture)) {<NEW_LINE>// If we have an override we can just use a basic cube that has no color tints in it<NEW_LINE>file = models().withExistingParent("block/storage/" + registrySuffix, basicCube).texture("all", texture);<NEW_LINE>} else {<NEW_LINE>// If the texture does not exist fallback to the default texture and use a colorable base model<NEW_LINE>file = models().withExistingParent("block/storage/" + registrySuffix, modLoc("block/colored_cube")).texture("all", modLoc("block/resource_block"));<NEW_LINE>}<NEW_LINE>simpleBlock(entry.getValue(<MASK><NEW_LINE>models().withExistingParent("item/block_" + registrySuffix, modLoc("block/storage/" + registrySuffix));<NEW_LINE>}<NEW_LINE>for (Map.Entry<OreType, OreBlockType> entry : MekanismBlocks.ORES.entrySet()) {<NEW_LINE>String registrySuffix = entry.getKey().getResource().getRegistrySuffix();<NEW_LINE>OreBlockType oreBlockType = entry.getValue();<NEW_LINE>addOreBlock(basicCube, oreBlockType.stone(), "block/ore/" + registrySuffix);<NEW_LINE>addOreBlock(basicCube, oreBlockType.deepslate(), "block/deepslate_ore/" + registrySuffix);<NEW_LINE>}<NEW_LINE>BlockModelBuilder barrelModel = models().cubeBottomTop(MekanismBlocks.PERSONAL_BARREL.getName(), Mekanism.rl("block/personal_barrel/side"), Mekanism.rl("block/personal_barrel/bottom"), Mekanism.rl("block/personal_barrel/top"));<NEW_LINE>BlockModelBuilder openBarrel = models().getBuilder(MekanismBlocks.PERSONAL_BARREL.getName() + "_open").parent(barrelModel).texture("top", Mekanism.rl("block/personal_barrel/top_open"));<NEW_LINE>directionalBlock(MekanismBlocks.PERSONAL_BARREL.getBlock(), state -> state.getValue(BlockStateProperties.OPEN) ? openBarrel : barrelModel);<NEW_LINE>models().withExistingParent("item/" + MekanismBlocks.PERSONAL_BARREL.getName(), modLoc("block/" + MekanismBlocks.PERSONAL_BARREL.getName()));<NEW_LINE>}
).getBlock(), file);
77,394
public void generate(int genType) {<NEW_LINE>String targetOutputDir = "";<NEW_LINE>for (TableMeta tableMeta : tableMetaList) {<NEW_LINE>data.set("tableMeta", tableMeta);<NEW_LINE>String lowerCaseModelName = StrKit.firstCharToLowerCase(tableMeta.modelName);<NEW_LINE>data.set("lowerCaseModelName", lowerCaseModelName);<NEW_LINE>if (AddonUIGenerator.UI_CONTROLLER == genType) {<NEW_LINE>targetTemplate = templatesDir + templates[0];<NEW_LINE>targetOutputDir = controllerOutputDir;<NEW_LINE>targetOutputDirFile = targetOutputDir + File.separator + "_" + tableMeta.modelName + "Controller" + ".java";<NEW_LINE>}<NEW_LINE>if (AddonUIGenerator.UI_EDIT == genType) {<NEW_LINE>targetTemplate = templatesDir + templates[1];<NEW_LINE>targetOutputDir = htmlOutputDir;<NEW_LINE>targetOutputDirFile = targetOutputDir + File<MASK><NEW_LINE>}<NEW_LINE>if (AddonUIGenerator.UI_LIST == genType) {<NEW_LINE>targetTemplate = templatesDir + templates[2];<NEW_LINE>targetOutputDir = htmlOutputDir;<NEW_LINE>targetOutputDirFile = targetOutputDir + File.separator + tableMeta.name + "_list.html";<NEW_LINE>}<NEW_LINE>// tableMeta.columnMetas.get(0).remarks<NEW_LINE>String content = engine.getTemplate(targetTemplate).renderToString(data);<NEW_LINE>//<NEW_LINE>File dir = new File(targetOutputDir);<NEW_LINE>if (!dir.exists()) {<NEW_LINE>dir.mkdirs();<NEW_LINE>}<NEW_LINE>File targetFile = new File(targetOutputDirFile);<NEW_LINE>if (targetFile.exists()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>FileWriter fw = new FileWriter(targetOutputDirFile);<NEW_LINE>try {<NEW_LINE>fw.write(content);<NEW_LINE>} finally {<NEW_LINE>fw.close();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
.separator + tableMeta.name + "_edit.html";
593,555
public static String formatSummary(StreamSummary<String> topk) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>List<Counter<String>> counters = topk.topK(topk.getCapacity());<NEW_LINE>String itemHeader = "item";<NEW_LINE>String countHeader = "count";<NEW_LINE>String errorHeader = "error";<NEW_LINE>int maxItemLen = itemHeader.length();<NEW_LINE><MASK><NEW_LINE>int maxErrorLen = errorHeader.length();<NEW_LINE>for (Counter<String> counter : counters) {<NEW_LINE>maxItemLen = Math.max(counter.getItem().length(), maxItemLen);<NEW_LINE>maxCountLen = Math.max(Long.toString(counter.getCount()).length(), maxCountLen);<NEW_LINE>maxErrorLen = Math.max(Long.toString(counter.getError()).length(), maxErrorLen);<NEW_LINE>}<NEW_LINE>sb.append(String.format("%" + maxItemLen + "s %" + maxCountLen + "s %" + maxErrorLen + "s", itemHeader, countHeader, errorHeader));<NEW_LINE>sb.append('\n');<NEW_LINE>sb.append(String.format("%" + maxItemLen + "s %" + maxCountLen + "s %" + maxErrorLen + "s", string('-', maxItemLen), string('-', maxCountLen), string('-', maxErrorLen)));<NEW_LINE>sb.append('\n');<NEW_LINE>for (Counter<String> counter : counters) {<NEW_LINE>sb.append(String.format("%" + maxItemLen + "s %" + maxCountLen + "d %" + maxErrorLen + "d", counter.getItem(), counter.getCount(), counter.getError()));<NEW_LINE>sb.append('\n');<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>}
int maxCountLen = countHeader.length();
301,407
public OSSAsyncTask<PutBucketLifecycleResult> putBucketLifecycle(PutBucketLifecycleRequest request, OSSCompletedCallback<PutBucketLifecycleRequest, PutBucketLifecycleResult> completedCallback) {<NEW_LINE>RequestMessage requestMessage = new RequestMessage();<NEW_LINE>Map<String, String> query = new LinkedHashMap<String, String>();<NEW_LINE>query.put("lifecycle", "");<NEW_LINE>requestMessage.setIsAuthorizationRequired(request.isAuthorizationRequired());<NEW_LINE>requestMessage.setEndpoint(endpoint);<NEW_LINE>requestMessage.setMethod(HttpMethod.PUT);<NEW_LINE>requestMessage.setBucketName(request.getBucketName());<NEW_LINE>requestMessage.setParameters(query);<NEW_LINE>try {<NEW_LINE>requestMessage.putBucketLifecycleRequestBodyMarshall(request.getLifecycleRules());<NEW_LINE>} catch (UnsupportedEncodingException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>canonicalizeRequestMessage(requestMessage, request);<NEW_LINE>ExecutionContext<PutBucketLifecycleRequest, PutBucketLifecycleResult> executionContext = new ExecutionContext(getInnerClient(), request, applicationContext);<NEW_LINE>if (completedCallback != null) {<NEW_LINE>executionContext.setCompletedCallback(completedCallback);<NEW_LINE>}<NEW_LINE>ResponseParser<PutBucketLifecycleResult> <MASK><NEW_LINE>Callable<PutBucketLifecycleResult> callable = new OSSRequestTask<PutBucketLifecycleResult>(requestMessage, parser, executionContext, maxRetryCount);<NEW_LINE>return OSSAsyncTask.wrapRequestTask(executorService.submit(callable), executionContext);<NEW_LINE>}
parser = new ResponseParsers.PutBucketLifecycleResponseParser();
1,583,173
public int compareTo(getTabletStats_result other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.<MASK><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>return 0;<NEW_LINE>}
getClass().getName());
388,701
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {<NEW_LINE>builder.startObject();<NEW_LINE>builder.field(NUM_PAGES.getPreferredName(), numPages);<NEW_LINE>builder.field(NUM_INPUT_DOCUMENTS.getPreferredName(), numInputDocuments);<NEW_LINE>builder.field(NUM_OUTPUT_DOCUMENTS.getPreferredName(), numOuputDocuments);<NEW_LINE>builder.field(NUM_DELETED_DOCUMENTS.getPreferredName(), numDeletedDocuments);<NEW_LINE>builder.field(<MASK><NEW_LINE>builder.field(INDEX_TIME_IN_MS.getPreferredName(), indexTime);<NEW_LINE>builder.field(INDEX_TOTAL.getPreferredName(), indexTotal);<NEW_LINE>builder.field(INDEX_FAILURES.getPreferredName(), indexFailures);<NEW_LINE>builder.field(SEARCH_TIME_IN_MS.getPreferredName(), searchTime);<NEW_LINE>builder.field(SEARCH_TOTAL.getPreferredName(), searchTotal);<NEW_LINE>builder.field(SEARCH_FAILURES.getPreferredName(), searchFailures);<NEW_LINE>builder.field(PROCESSING_TIME_IN_MS.getPreferredName(), processingTime);<NEW_LINE>builder.field(PROCESSING_TOTAL.getPreferredName(), processingTotal);<NEW_LINE>builder.field(DELETE_TIME_IN_MS.getPreferredName(), deleteTime);<NEW_LINE>builder.field(EXPONENTIAL_AVG_CHECKPOINT_DURATION_MS.getPreferredName(), this.expAvgCheckpointDurationMs);<NEW_LINE>builder.field(EXPONENTIAL_AVG_DOCUMENTS_INDEXED.getPreferredName(), this.expAvgDocumentsIndexed);<NEW_LINE>builder.field(EXPONENTIAL_AVG_DOCUMENTS_PROCESSED.getPreferredName(), this.expAvgDocumentsProcessed);<NEW_LINE>builder.endObject();<NEW_LINE>return builder;<NEW_LINE>}
NUM_INVOCATIONS.getPreferredName(), numInvocations);
549,099
public String conjugateEnglish(String lemma, boolean negated) {<NEW_LINE>String[] data = ENGLISH_TENSES.<MASK><NEW_LINE>if (data != null) {<NEW_LINE>String conjugated = data[negated ? column + 12 : column];<NEW_LINE>if (!"".equals(conjugated)) {<NEW_LINE>// case: we found a match<NEW_LINE>return conjugated;<NEW_LINE>} else if (negated) {<NEW_LINE>// case: try the unnegated form<NEW_LINE>conjugated = data[column];<NEW_LINE>if (!"".equals(conjugated)) {<NEW_LINE>return conjugated;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// case: tense not explicit in map<NEW_LINE>if (column >= 0 && column < 6) {<NEW_LINE>conjugated = data[INFINITIVE.column];<NEW_LINE>} else {<NEW_LINE>conjugated = data[PAST.column];<NEW_LINE>}<NEW_LINE>if (!"".equals(conjugated)) {<NEW_LINE>return conjugated;<NEW_LINE>} else {<NEW_LINE>return lemma;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// case: word not in dictionary<NEW_LINE>return lemma;<NEW_LINE>}<NEW_LINE>}
get().get(lemma);
1,746,793
public static // todo have the submatrices be from different shaped inputs<NEW_LINE>void checkSubImage(Object testClass, String function, boolean checkEquals, Object... inputParam) {<NEW_LINE>try {<NEW_LINE>ImageBase[] larger = new ImageBase[inputParam.length];<NEW_LINE>ImageBase[] subImg = new ImageBase[inputParam.length];<NEW_LINE>Class<?>[] paramDesc = new Class<?>[inputParam.length];<NEW_LINE>Object[] inputModified = new Object[inputParam.length];<NEW_LINE>for (int i = 0; i < inputParam.length; i++) {<NEW_LINE>if (ImageBase.class.isAssignableFrom(inputParam[i].getClass())) {<NEW_LINE>ImageBase<?> img = (ImageBase<?>) inputParam[i];<NEW_LINE>// copy the original image inside of a larger image<NEW_LINE>larger[i] = img.createNew(img.getWidth() + 10, img.getHeight() + 12);<NEW_LINE>// extract a sub-image and make it equivalent to the original image.<NEW_LINE>subImg[i] = larger[i].subimage(5, 6, 5 + img.getWidth(), 6 + img.getHeight(), null);<NEW_LINE>subImg[i].setTo(img);<NEW_LINE>}<NEW_LINE>// the first time it is called use the original inputs<NEW_LINE>inputModified[i] = inputParam[i];<NEW_LINE>paramDesc[i] = inputParam[i].getClass();<NEW_LINE>}<NEW_LINE>// first try it with the original image<NEW_LINE>Method m = findMethod(testClass.<MASK><NEW_LINE>m.invoke(testClass, inputModified);<NEW_LINE>// now try it with the sub-image<NEW_LINE>for (int i = 0; i < inputModified.length; i++) {<NEW_LINE>if (subImg[i] != null)<NEW_LINE>inputModified[i] = subImg[i];<NEW_LINE>}<NEW_LINE>m.invoke(testClass, inputModified);<NEW_LINE>// the result should be the identical<NEW_LINE>if (checkEquals) {<NEW_LINE>for (int i = 0; i < inputParam.length; i++) {<NEW_LINE>if (subImg[i] == null)<NEW_LINE>continue;<NEW_LINE>assertEquals((ImageBase) inputModified[i], subImg[i], 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (InvocationTargetException | IllegalAccessException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>}
getClass(), function, paramDesc);
1,367,642
public static void ycbcrToRgb_U8(Planar<GrayU8> yuv, Planar<GrayU8> rgb) {<NEW_LINE>GrayU8 Y = yuv.getBand(0);<NEW_LINE>GrayU8 U = yuv.getBand(1);<NEW_LINE>GrayU8 V = yuv.getBand(2);<NEW_LINE>GrayU8 R = rgb.getBand(0);<NEW_LINE>GrayU8 G = rgb.getBand(1);<NEW_LINE>GrayU8 B = rgb.getBand(2);<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0,yuv.height,row->{<NEW_LINE>for (int row = 0; row < yuv.height; row++) {<NEW_LINE>int indexYuv = yuv.startIndex + row * yuv.stride;<NEW_LINE>int indexRgb = rgb.startIndex + row * rgb.stride;<NEW_LINE>for (int col = 0; col < yuv.width; col++, indexYuv++, indexRgb++) {<NEW_LINE>int y = 1191 * ((Y.data[indexYuv] & 0xFF) - 16);<NEW_LINE>int cb = (U.data[indexYuv] & 0xFF) - 128;<NEW_LINE>int cr = (V.data[indexYuv] & 0xFF) - 128;<NEW_LINE>if (y < 0)<NEW_LINE>y = 0;<NEW_LINE>int r = (y + 1836 * cr) >> 10;<NEW_LINE>int g = (y - 547 * cr - 218 * cb) >> 10;<NEW_LINE>int b = (y + 2165 * cb) >> 10;<NEW_LINE>if (r < 0)<NEW_LINE>r = 0;<NEW_LINE>else if (r > 255)<NEW_LINE>r = 255;<NEW_LINE>if (g < 0)<NEW_LINE>g = 0;<NEW_LINE>else if (g > 255)<NEW_LINE>g = 255;<NEW_LINE>if (b < 0)<NEW_LINE>b = 0;<NEW_LINE>else if (b > 255)<NEW_LINE>b = 255;<NEW_LINE>R.data[indexRgb] = (byte) r;<NEW_LINE>G.data<MASK><NEW_LINE>B.data[indexRgb] = (byte) b;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>}
[indexRgb] = (byte) g;
567,216
public void stopOpt(SourceRequest request, String operator) {<NEW_LINE>StreamSourceEntity existEntity = sourceMapper.selectByIdForUpdate(request.getId());<NEW_LINE>SourceState curState = SourceState.<MASK><NEW_LINE>SourceState nextState = SourceState.TO_BE_ISSUED_FROZEN;<NEW_LINE>if (!SourceState.isAllowedTransition(curState, nextState)) {<NEW_LINE>throw new BusinessException(String.format("Source=%s is not allowed to stop", existEntity));<NEW_LINE>}<NEW_LINE>StreamSourceEntity curEntity = CommonBeanUtils.copyProperties(request, StreamSourceEntity::new);<NEW_LINE>curEntity.setVersion(existEntity.getVersion() + 1);<NEW_LINE>curEntity.setModifyTime(new Date());<NEW_LINE>curEntity.setPreviousStatus(curState.getCode());<NEW_LINE>curEntity.setStatus(nextState.getCode());<NEW_LINE>sourceMapper.updateByPrimaryKeySelective(curEntity);<NEW_LINE>}
forCode(existEntity.getStatus());
1,653,337
private void initPolarDbXComponents() {<NEW_LINE>// Set private protocol port first(or we will fail to connect metaDB with Xproto).<NEW_LINE>XConnectionManager.getInstance().setMetaDbPort(this.system.getMetaDbXprotoPort());<NEW_LINE>XConnectionManager.getInstance().setStorageDbPort(this.system.getStorageDbXprotoPort());<NEW_LINE>// Init metadb datasource<NEW_LINE>MetaDbDataSource.initMetaDbDataSource(this.system.getMetaDbAddr(), this.system.getMetaDbName(), this.system.getMetaDbProp(), this.system.getMetaDbUser(), this.system.getMetaDbPasswd());<NEW_LINE>// Do schema change prior to other components' initializations.<NEW_LINE>SchemaChangeManager.getInstance().handle();<NEW_LINE>// Init ServerInstIdManager<NEW_LINE>ServerInstIdManager.getInstance();<NEW_LINE>// Init MetaDbConfigManager<NEW_LINE>MetaDbConfigManager.getInstance();<NEW_LINE>// Init system default properties manager<NEW_LINE>MetaDbInstConfigManager.getInstance();<NEW_LINE>// Init conn pool manager<NEW_LINE>ConnPoolConfigManager.getInstance();<NEW_LINE>// Init group configs for read-only inst if need<NEW_LINE>DbTopologyManager.initGroupConfigsForReadOnlyInstIfNeed();<NEW_LINE>LocalityManager lm = LocalityManager.getInstance();<NEW_LINE>Balancer balancer = Balancer.getInstance();<NEW_LINE>balancer.enableBalancer(this.system.isEnableBalancer());<NEW_LINE>balancer.setBalancerRunningWindow(this.system.getBalancerWindow());<NEW_LINE>// Init HaManager to auto refresh storage infos<NEW_LINE>StorageHaManager shm = StorageHaManager.getInstance();<NEW_LINE>shm.setEnablePrimaryZoneMaintain(<MASK><NEW_LINE>shm.setPrimaryZoneSupplier(lm.getSupplier());<NEW_LINE>// Init port info by meta db<NEW_LINE>initPortInfoAndInstId();<NEW_LINE>// Init DbTopologManager<NEW_LINE>DbTopologyManager.initDbTopologyManager(new SchemaMetaUtil.PolarDbXSchemaMetaCleaner());<NEW_LINE>// Init system db<NEW_LINE>MetaDbDataSource.initSystemDbIfNeed();<NEW_LINE>// Init the polarx priv manager from meta db<NEW_LINE>PolarPrivManager.getInstance();<NEW_LINE>// Init the cleaner of remvved read-only inst<NEW_LINE>ReadOnlyInstConfigCleaner.getInstance();<NEW_LINE>// Init the stat of feature usage<NEW_LINE>FeatureUsageStatistics.init();<NEW_LINE>}
this.system.getEnablePrimaryZoneMaintain());
423,184
private synchronized V _put(K key, V value, MODE m) {<NEW_LINE>LinkedEntry<K, V>[] tab = table;<NEW_LINE>int index = hash(key) % tab.length;<NEW_LINE>for (LinkedEntry<K, V> e = tab[index]; e != null; e = e.next) {<NEW_LINE>if (CompareUtil.equals(e.key, key)) {<NEW_LINE>V old = e.value;<NEW_LINE>e.value = value;<NEW_LINE>switch(m) {<NEW_LINE>case FORCE_FIRST:<NEW_LINE>if (header.link_next != e) {<NEW_LINE>unchain(e);<NEW_LINE>chain(header, header.link_next, e);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case FORCE_LAST:<NEW_LINE>if (header.link_prev != e) {<NEW_LINE>unchain(e);<NEW_LINE>chain(header.link_prev, header, e);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return old;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (max > 0) {<NEW_LINE>switch(m) {<NEW_LINE>case FORCE_FIRST:<NEW_LINE>case FIRST:<NEW_LINE>while (count >= max) {<NEW_LINE>K k = header.link_prev.key;<NEW_LINE>V v = remove(k);<NEW_LINE>overflowed(k, v);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case FORCE_LAST:<NEW_LINE>case LAST:<NEW_LINE>while (count >= max) {<NEW_LINE>K k = header.link_next.key;<NEW_LINE>V v = remove(k);<NEW_LINE>overflowed(k, v);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (count >= threshold) {<NEW_LINE>rehash();<NEW_LINE>tab = table;<NEW_LINE>index = hash(key) % tab.length;<NEW_LINE>}<NEW_LINE>LinkedEntry<K, V> e = new LinkedEntry(key, value, tab[index]);<NEW_LINE>tab[index] = e;<NEW_LINE>switch(m) {<NEW_LINE>case FORCE_FIRST:<NEW_LINE>case FIRST:<NEW_LINE>chain(<MASK><NEW_LINE>break;<NEW_LINE>case FORCE_LAST:<NEW_LINE>case LAST:<NEW_LINE>chain(header.link_prev, header, e);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>count++;<NEW_LINE>return null;<NEW_LINE>}
header, header.link_next, e);
182,239
// http auth credential, either for proxy or target host<NEW_LINE>protected void populateHttpCredential(HttpHost host, AuthScheme authScheme, String user, String password) {<NEW_LINE>UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(user, password);<NEW_LINE>AuthCache authCache = httpClientContext.getAuthCache();<NEW_LINE>if (authCache == null) {<NEW_LINE>authCache = new BasicAuthCache();<NEW_LINE>httpClientContext.setAuthCache(authCache);<NEW_LINE>}<NEW_LINE>// Do not attempt to cache DIGEST auth:<NEW_LINE>// See https://github.com/internetarchive/heritrix3/pull/397<NEW_LINE>if (!(authScheme instanceof org.apache.http.impl.auth.DigestScheme)) {<NEW_LINE>authCache.put(host, authScheme);<NEW_LINE>}<NEW_LINE>if (httpClientContext.getCredentialsProvider() == null) {<NEW_LINE>httpClientContext<MASK><NEW_LINE>}<NEW_LINE>httpClientContext.getCredentialsProvider().setCredentials(new AuthScope(host), credentials);<NEW_LINE>}
.setCredentialsProvider(new BasicCredentialsProvider());
56,196
private CompiledCondition generateExpiryCompiledCondition() {<NEW_LINE>MetaStreamEvent tableMetaStreamEvent = new MetaStreamEvent();<NEW_LINE>tableMetaStreamEvent.setEventType(MetaStreamEvent.EventType.TABLE);<NEW_LINE>TableDefinition matchingTableDefinition = TableDefinition.id(cacheTable.<MASK><NEW_LINE>for (Attribute attribute : cacheTable.getTableDefinition().getAttributeList()) {<NEW_LINE>tableMetaStreamEvent.addOutputData(attribute);<NEW_LINE>matchingTableDefinition.attribute(attribute.getName(), attribute.getType());<NEW_LINE>}<NEW_LINE>tableMetaStreamEvent.addInputDefinition(matchingTableDefinition);<NEW_LINE>streamEventFactory = new StreamEventFactory(tableMetaStreamEvent);<NEW_LINE>Variable rightExpressionForSubtract = new Variable(CACHE_TABLE_TIMESTAMP_ADDED);<NEW_LINE>rightExpressionForSubtract.setStreamId(cacheTable.getTableDefinition().getId());<NEW_LINE>Expression rightExpressionForCompare = new LongConstant(retentionPeriod);<NEW_LINE>Compare.Operator greaterThanOperator = Compare.Operator.GREATER_THAN;<NEW_LINE>MetaStreamEvent currentTimeMetaStreamEvent = new MetaStreamEvent();<NEW_LINE>currentTimeMetaStreamEvent.setEventType(MetaStreamEvent.EventType.TABLE);<NEW_LINE>Attribute currentTimeAttribute = new Attribute(CACHE_EXPIRE_CURRENT_TIME, Attribute.Type.LONG);<NEW_LINE>currentTimeMetaStreamEvent.addOutputData(currentTimeAttribute);<NEW_LINE>TableDefinition currentTimeTableDefinition = TableDefinition.id("");<NEW_LINE>currentTimeTableDefinition.attribute(CACHE_EXPIRE_CURRENT_TIME, Attribute.Type.LONG);<NEW_LINE>currentTimeMetaStreamEvent.addInputDefinition(currentTimeTableDefinition);<NEW_LINE>MetaStateEvent metaStateEvent = new MetaStateEvent(2);<NEW_LINE>metaStateEvent.addEvent(currentTimeMetaStreamEvent);<NEW_LINE>metaStateEvent.addEvent(tableMetaStreamEvent);<NEW_LINE>MatchingMetaInfoHolder matchingMetaInfoHolder = MatcherParser.constructMatchingMetaStateHolder(metaStateEvent, 0, cacheTable.getTableDefinition(), 0);<NEW_LINE>List<VariableExpressionExecutor> variableExpressionExecutors = new ArrayList<>();<NEW_LINE>Expression leftExpressionForSubtract = new Variable(CACHE_EXPIRE_CURRENT_TIME);<NEW_LINE>Expression leftExpressionForCompare = new Subtract(leftExpressionForSubtract, rightExpressionForSubtract);<NEW_LINE>Expression deleteCondition = new Compare(leftExpressionForCompare, greaterThanOperator, rightExpressionForCompare);<NEW_LINE>SiddhiQueryContext siddhiQueryContext = new SiddhiQueryContext(siddhiAppContext, "expiryDeleteQuery");<NEW_LINE>return cacheTable.compileCondition(deleteCondition, matchingMetaInfoHolder, variableExpressionExecutors, tableMap, siddhiQueryContext);<NEW_LINE>}
getTableDefinition().getId());
1,204,015
public int createAttempt(final long jobId, final Path logPath) throws IOException {<NEW_LINE>final LocalDateTime now = LocalDateTime.ofInstant(timeSupplier.get(), ZoneOffset.UTC);<NEW_LINE>return jobDatabase.transaction(ctx -> {<NEW_LINE>final Job job = getJob(ctx, jobId);<NEW_LINE>if (job.isJobInTerminalState()) {<NEW_LINE>final var errMsg = String.format("Cannot create an attempt for a job id: %s that is in a terminal state: %s for connection id: %s", job.getId(), job.getStatus(), job.getScope());<NEW_LINE>throw new IllegalStateException(errMsg);<NEW_LINE>}<NEW_LINE>if (job.hasRunningAttempt()) {<NEW_LINE>final var errMsg = String.format("Cannot create an attempt for a job id: %s that has a running attempt: %s for connection id: %s", job.getId(), job.getStatus(<MASK><NEW_LINE>throw new IllegalStateException(errMsg);<NEW_LINE>}<NEW_LINE>updateJobStatusIfNotInTerminalState(ctx, jobId, JobStatus.RUNNING, now);<NEW_LINE>// will fail if attempt number already exists for the job id.<NEW_LINE>return ctx.fetch("INSERT INTO attempts(job_id, attempt_number, log_path, status, created_at, updated_at) VALUES(?, ?, ?, CAST(? AS ATTEMPT_STATUS), ?, ?) RETURNING attempt_number", jobId, job.getAttemptsCount(), logPath.toString(), Sqls.toSqlName(AttemptStatus.RUNNING), now, now).stream().findFirst().map(r -> r.get("attempt_number", Integer.class)).orElseThrow(() -> new RuntimeException("This should not happen"));<NEW_LINE>});<NEW_LINE>}
), job.getScope());
384,361
public void addSendResultMetric(ProfileEvent currentRecord, String topic, boolean result, long sendTime) {<NEW_LINE>Map<String, String> dimensions = new HashMap<>();<NEW_LINE>dimensions.put(SortMetricItem.KEY_CLUSTER_ID, this.getClusterId());<NEW_LINE>dimensions.put(SortMetricItem.KEY_TASK_NAME, this.getTaskName());<NEW_LINE>// metric<NEW_LINE>fillInlongId(currentRecord, dimensions);<NEW_LINE>dimensions.put(SortMetricItem.KEY_SINK_ID, this.getSinkName());<NEW_LINE>dimensions.put(SortMetricItem.KEY_SINK_DATA_ID, topic);<NEW_LINE>long msgTime = currentRecord.getRawLogTime();<NEW_LINE>long auditFormatTime = msgTime - msgTime % CommonPropertiesHolder.getAuditFormatInterval();<NEW_LINE>dimensions.put(SortMetricItem.KEY_MESSAGE_TIME, String.valueOf(auditFormatTime));<NEW_LINE>SortMetricItem metricItem = this.getMetricItemSet().findMetricItem(dimensions);<NEW_LINE>long count = 1;<NEW_LINE>long size = currentRecord.getBody().length;<NEW_LINE>if (result) {<NEW_LINE>metricItem.sendSuccessCount.addAndGet(count);<NEW_LINE>metricItem.sendSuccessSize.addAndGet(size);<NEW_LINE>AuditUtils.add(AuditUtils.AUDIT_ID_SEND_SUCCESS, currentRecord);<NEW_LINE>if (sendTime > 0) {<NEW_LINE>long currentTime = System.currentTimeMillis();<NEW_LINE>long sinkDuration = currentTime - sendTime;<NEW_LINE>long nodeDuration = currentTime - NumberUtils.toLong(Constants.HEADER_KEY_SOURCE_TIME, msgTime);<NEW_LINE>long wholeDuration = currentTime - msgTime;<NEW_LINE>metricItem.sinkDuration.addAndGet(sinkDuration * count);<NEW_LINE>metricItem.nodeDuration.addAndGet(nodeDuration * count);<NEW_LINE>metricItem.wholeDuration.addAndGet(wholeDuration * count);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>metricItem.sendFailCount.addAndGet(count);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}
metricItem.sendFailSize.addAndGet(size);
1,773,888
public static GeoCodingResult geocode(final String street, final String house, String postalCode, final String city, final String state, final String country) throws FrameworkException {<NEW_LINE>final String language = Settings.GeocodingLanguage.getValue();<NEW_LINE>final String cacheKey = cacheKey(street, house, postalCode, <MASK><NEW_LINE>GeoCodingResult result = geoCache.get(cacheKey);<NEW_LINE>if (result == null) {<NEW_LINE>GeoCodingProvider provider = getGeoCodingProvider();<NEW_LINE>if (provider != null) {<NEW_LINE>try {<NEW_LINE>result = provider.geocode(street, house, postalCode, city, state, country, language);<NEW_LINE>if (result != null) {<NEW_LINE>// store in cache<NEW_LINE>geoCache.put(cacheKey, result);<NEW_LINE>}<NEW_LINE>} catch (IOException ioex) {<NEW_LINE>// IOException, try again next time<NEW_LINE>logger.warn("Unable to obtain geocoding result using provider {}: {}", new Object[] { provider.getClass().getName(), ioex.getMessage() });<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}
city, state, country, language);
1,620,878
public boolean apply(Game game, Ability source) {<NEW_LINE>boolean applied = false;<NEW_LINE>for (UUID playerId : targetPointer.getTargets(game, source)) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null) {<NEW_LINE>// filter can be static, so it's important to copy here<NEW_LINE>FilterPermanent newFilter = filter.copy();<NEW_LINE>newFilter.add(new ControllerIdPredicate(player.getId()));<NEW_LINE>int amount = count.calculate(game, source, this);<NEW_LINE>int realCount = game.getBattlefield().countAll(newFilter, player.getId(), game);<NEW_LINE>amount = Math.min(amount, realCount);<NEW_LINE>Target target = new TargetPermanent(amount, amount, newFilter, true);<NEW_LINE>if (amount > 0 && target.canChoose(player.getId(), source, game)) {<NEW_LINE>while (!target.isChosen() && target.canChoose(player.getId(), source, game) && player.canRespond()) {<NEW_LINE>player.chooseTarget(Outcome.<MASK><NEW_LINE>}<NEW_LINE>for (int idx = 0; idx < target.getTargets().size(); idx++) {<NEW_LINE>Permanent permanent = game.getPermanent(target.getTargets().get(idx));<NEW_LINE>if (permanent != null && permanent.sacrifice(source, game)) {<NEW_LINE>applied = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return applied;<NEW_LINE>}
Sacrifice, target, source, game);
1,466,148
public ConnectionRequest fetchAsProperties(final OnComplete<Response<PropertyBusinessObject>> callback, final Class type) {<NEW_LINE>final Connection request = createRequest(true);<NEW_LINE>request.addResponseListener(new ActionListener<NetworkEvent>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(NetworkEvent evt) {<NEW_LINE>if (request.errorCode) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Response res = null;<NEW_LINE>Map response = (Map) evt.getMetaData();<NEW_LINE>try {<NEW_LINE>PropertyBusinessObject pb = <MASK><NEW_LINE>pb.getPropertyIndex().populateFromMap(response);<NEW_LINE>res = new Response(evt.getResponseCode(), pb, evt.getMessage());<NEW_LINE>callback.completed(res);<NEW_LINE>} catch (Exception err) {<NEW_LINE>Log.e(err);<NEW_LINE>throw new RuntimeException(err.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>fetched = true;<NEW_LINE>CN.addToQueue(request);<NEW_LINE>return request;<NEW_LINE>}
(PropertyBusinessObject) type.newInstance();
566,324
public static DescribeRenewalPriceResponse unmarshall(DescribeRenewalPriceResponse describeRenewalPriceResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeRenewalPriceResponse.setRequestId(_ctx.stringValue("DescribeRenewalPriceResponse.RequestId"));<NEW_LINE>PriceInfo priceInfo = new PriceInfo();<NEW_LINE>priceInfo.setCurrency(_ctx.stringValue("DescribeRenewalPriceResponse.PriceInfo.Currency"));<NEW_LINE>priceInfo.setOriginalPrice(_ctx.floatValue("DescribeRenewalPriceResponse.PriceInfo.OriginalPrice"));<NEW_LINE>priceInfo.setTradePrice(_ctx.floatValue("DescribeRenewalPriceResponse.PriceInfo.TradePrice"));<NEW_LINE>priceInfo.setDiscountPrice(_ctx.floatValue("DescribeRenewalPriceResponse.PriceInfo.DiscountPrice"));<NEW_LINE>List<String> ruleIds = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeRenewalPriceResponse.PriceInfo.RuleIds.Length"); i++) {<NEW_LINE>ruleIds.add(_ctx.stringValue<MASK><NEW_LINE>}<NEW_LINE>priceInfo.setRuleIds(ruleIds);<NEW_LINE>ActivityInfo activityInfo = new ActivityInfo();<NEW_LINE>activityInfo.setCheckErrMsg(_ctx.stringValue("DescribeRenewalPriceResponse.PriceInfo.ActivityInfo.CheckErrMsg"));<NEW_LINE>activityInfo.setErrorCode(_ctx.stringValue("DescribeRenewalPriceResponse.PriceInfo.ActivityInfo.ErrorCode"));<NEW_LINE>activityInfo.setSuccess(_ctx.stringValue("DescribeRenewalPriceResponse.PriceInfo.ActivityInfo.Success"));<NEW_LINE>priceInfo.setActivityInfo(activityInfo);<NEW_LINE>List<Coupon> coupons = new ArrayList<Coupon>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeRenewalPriceResponse.PriceInfo.Coupons.Length"); i++) {<NEW_LINE>Coupon coupon = new Coupon();<NEW_LINE>coupon.setCouponNo(_ctx.stringValue("DescribeRenewalPriceResponse.PriceInfo.Coupons[" + i + "].CouponNo"));<NEW_LINE>coupon.setName(_ctx.stringValue("DescribeRenewalPriceResponse.PriceInfo.Coupons[" + i + "].Name"));<NEW_LINE>coupon.setDescription(_ctx.stringValue("DescribeRenewalPriceResponse.PriceInfo.Coupons[" + i + "].Description"));<NEW_LINE>coupon.setIsSelected(_ctx.stringValue("DescribeRenewalPriceResponse.PriceInfo.Coupons[" + i + "].IsSelected"));<NEW_LINE>coupons.add(coupon);<NEW_LINE>}<NEW_LINE>priceInfo.setCoupons(coupons);<NEW_LINE>describeRenewalPriceResponse.setPriceInfo(priceInfo);<NEW_LINE>List<Rule> rules = new ArrayList<Rule>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeRenewalPriceResponse.Rules.Length"); i++) {<NEW_LINE>Rule rule = new Rule();<NEW_LINE>rule.setRuleId(_ctx.longValue("DescribeRenewalPriceResponse.Rules[" + i + "].RuleId"));<NEW_LINE>rule.setName(_ctx.stringValue("DescribeRenewalPriceResponse.Rules[" + i + "].Name"));<NEW_LINE>rule.setDescription(_ctx.stringValue("DescribeRenewalPriceResponse.Rules[" + i + "].Description"));<NEW_LINE>rules.add(rule);<NEW_LINE>}<NEW_LINE>describeRenewalPriceResponse.setRules(rules);<NEW_LINE>return describeRenewalPriceResponse;<NEW_LINE>}
("DescribeRenewalPriceResponse.PriceInfo.RuleIds[" + i + "]"));
120,303
private void writeScnToFile() throws IOException {<NEW_LINE>long scn = _scn.longValue();<NEW_LINE>File dir = _staticConfig.getScnDir();<NEW_LINE>if (!dir.exists() && !dir.mkdirs()) {<NEW_LINE>throw new IOException("unable to create SCN file parent:" + dir.getAbsolutePath());<NEW_LINE>}<NEW_LINE>// delete the temp file if one exists<NEW_LINE>File tempScnFile = new File(_scnFileName + TEMP);<NEW_LINE>if (tempScnFile.exists() && !tempScnFile.delete()) {<NEW_LINE>LOG.error("unable to erase temp SCN file: " + tempScnFile.getAbsolutePath());<NEW_LINE>}<NEW_LINE>File scnFile = new File(_scnFileName);<NEW_LINE>if (scnFile.exists() && !scnFile.renameTo(tempScnFile)) {<NEW_LINE>LOG.error("unable to backup scn file");<NEW_LINE>}<NEW_LINE>if (!scnFile.createNewFile()) {<NEW_LINE>LOG.error("unable to create new SCN file:" + scnFile.getAbsolutePath());<NEW_LINE>}<NEW_LINE>FileWriter writer = new FileWriter(scnFile);<NEW_LINE>writer.write(Long.toString(scn));<NEW_LINE>writer.write(SCN_SEPARATOR + new <MASK><NEW_LINE>writer.flush();<NEW_LINE>writer.close();<NEW_LINE>LOG.debug("scn persisted: " + scn);<NEW_LINE>}
Date().toString());
1,792,786
public ConstantPropagationStore leastUpperBound(ConstantPropagationStore other) {<NEW_LINE>Map<Node, Constant> newContents = new LinkedHashMap<>(contents.size() + <MASK><NEW_LINE>// go through all of the information of the other class<NEW_LINE>for (Map.Entry<Node, Constant> e : other.contents.entrySet()) {<NEW_LINE>Node n = e.getKey();<NEW_LINE>Constant otherVal = e.getValue();<NEW_LINE>if (contents.containsKey(n)) {<NEW_LINE>// merge if both contain information about a variable<NEW_LINE>newContents.put(n, otherVal.leastUpperBound(contents.get(n)));<NEW_LINE>} else {<NEW_LINE>// add new information<NEW_LINE>newContents.put(n, otherVal);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Map.Entry<Node, Constant> e : contents.entrySet()) {<NEW_LINE>Node n = e.getKey();<NEW_LINE>Constant thisVal = e.getValue();<NEW_LINE>if (!other.contents.containsKey(n)) {<NEW_LINE>// add new information<NEW_LINE>newContents.put(n, thisVal);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ConstantPropagationStore(newContents);<NEW_LINE>}
other.contents.size());
307,284
public ModifyTrafficMirrorFilterNetworkServicesResult unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>ModifyTrafficMirrorFilterNetworkServicesResult modifyTrafficMirrorFilterNetworkServicesResult = new ModifyTrafficMirrorFilterNetworkServicesResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return modifyTrafficMirrorFilterNetworkServicesResult;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("trafficMirrorFilter", targetDepth)) {<NEW_LINE>modifyTrafficMirrorFilterNetworkServicesResult.setTrafficMirrorFilter(TrafficMirrorFilterStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return modifyTrafficMirrorFilterNetworkServicesResult;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
().unmarshall(context));
517,127
public void addData(InputStream dataStream, String baseURI, RDFFormat format, boolean verifyData, AdminListener listener) throws IOException, AccessDeniedException {<NEW_LINE>try {<NEW_LINE>Parser parser = null;<NEW_LINE>Map noParams = new HashMap();<NEW_LINE>if (format.equals(RDFFormat.TURTLE)) {<NEW_LINE>parser = new TurtleParser();<NEW_LINE>} else if (format.equals(RDFFormat.RDFXML)) {<NEW_LINE>parser = new RdfXmlParser();<NEW_LINE>} else if (format.equals(RDFFormat.NTRIPLES)) {<NEW_LINE>parser = new NTriplesParser();<NEW_LINE>} else<NEW_LINE>return;<NEW_LINE>// TODO find out what this is doing<NEW_LINE><MASK><NEW_LINE>StatementHandler sh = new StatementHandler() {<NEW_LINE><NEW_LINE>public void handleStatement(Resource subj, URI pred, Value obj) {<NEW_LINE>addSingleStatement(subj, pred, obj);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>parser.setStatementHandler(sh);<NEW_LINE>parser.parse(dataStream, baseURI);<NEW_LINE>dataStream.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.out.println(e.getMessage());<NEW_LINE>} finally {<NEW_LINE>dataStream.close();<NEW_LINE>}<NEW_LINE>}
parser.setDatatypeHandling(Parser.DT_IGNORE);
316,767
public void handle(Element element) {<NEW_LINE>handleCommonBeanAttributes(element, builder, parserContext);<NEW_LINE><MASK><NEW_LINE>if (attributes != null) {<NEW_LINE>Node instanceRefNode = attributes.getNamedItem("instance-ref");<NEW_LINE>if (instanceRefNode == null) {<NEW_LINE>throw new IllegalStateException("'instance-ref' attribute is required for creating Hazelcast " + type);<NEW_LINE>}<NEW_LINE>String instanceRef = getTextContent(instanceRefNode);<NEW_LINE>if (HazelcastNamespaceHandler.CP_TYPES.contains(type)) {<NEW_LINE>builder.getRawBeanDefinition().setFactoryBeanName(instanceRef + CP_SUBSYSTEM_SUFFIX);<NEW_LINE>} else {<NEW_LINE>builder.getRawBeanDefinition().setFactoryBeanName(instanceRef);<NEW_LINE>}<NEW_LINE>builder.addDependsOn(instanceRef);<NEW_LINE>Node nameNode = attributes.getNamedItem("name");<NEW_LINE>if (nameNode == null) {<NEW_LINE>nameNode = attributes.getNamedItem("id");<NEW_LINE>}<NEW_LINE>builder.addConstructorArgValue(getTextContent(nameNode));<NEW_LINE>}<NEW_LINE>}
NamedNodeMap attributes = element.getAttributes();
322,524
public static void main(String[] args) {<NEW_LINE>// Apache SIS j.u.l logging redirection.<NEW_LINE>SLF4JBridgeHandler.removeHandlersForRootLogger();<NEW_LINE>SLF4JBridgeHandler.install();<NEW_LINE>LOGGER.info("Arguments Received: {}", Arrays.asList(args));<NEW_LINE>ArgsConfig argsConfig = new ArgsConfig();<NEW_LINE>JCommander jCommander = JCommander.newBuilder().addObject(argsConfig).build();<NEW_LINE>jCommander.setProgramName("GeoSPARQL Fuseki");<NEW_LINE>jCommander.parse(args);<NEW_LINE>if (argsConfig.isHelp()) {<NEW_LINE>jCommander.usage();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Setup dataset<NEW_LINE>try {<NEW_LINE>Dataset <MASK><NEW_LINE>// Configure server<NEW_LINE>GeosparqlServer server = new GeosparqlServer(argsConfig.getPort(), argsConfig.getDatsetName(), argsConfig.isLoopbackOnly(), dataset, argsConfig.isUpdateAllowed());<NEW_LINE>server.start();<NEW_LINE>} catch (SrsException | DatasetException | SpatialIndexException ex) {<NEW_LINE>LOGGER.error("GeoSPARQL Server: Exiting - {}: {}", ex.getMessage(), argsConfig.getDatsetName());<NEW_LINE>}<NEW_LINE>}
dataset = DatasetOperations.setup(argsConfig);
1,439,475
public static String parseTree(String s, Vector children) {<NEW_LINE>children.clear();<NEW_LINE>String root;<NEW_LINE>if ((s != null) && (s.length() > 0) && s.startsWith("{") && s.endsWith("}")) {<NEW_LINE>int end = s.indexOf('{', 1);<NEW_LINE>if (end == -1) {<NEW_LINE>end = s.indexOf('}', 1);<NEW_LINE>return s.substring(1, end);<NEW_LINE>}<NEW_LINE>root = s.substring(1, end);<NEW_LINE>String rest = s.substring(end, s.length() - 1);<NEW_LINE>int match = 0;<NEW_LINE>while ((rest.length() > 0) && (match = matchingBracket(rest, 0)) != -1) {<NEW_LINE>children.add(rest.substring<MASK><NEW_LINE>if (match + 1 < rest.length()) {<NEW_LINE>rest = rest.substring(match + 1);<NEW_LINE>} else {<NEW_LINE>rest = "";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return root;<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}
(0, match + 1));
1,231,523
public void onEnd(AttributesBuilder attributes, Context context, REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error) {<NEW_LINE>set(attributes, SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH, getter.requestContentLength(request, response));<NEW_LINE>set(attributes, SemanticAttributes.HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED, getter.requestContentLengthUncompressed(request, response));<NEW_LINE>if (response != null) {<NEW_LINE>Integer statusCode = getter.statusCode(request, response);<NEW_LINE>if (statusCode != null && statusCode > 0) {<NEW_LINE>set(attributes, SemanticAttributes.HTTP_STATUS_CODE, (long) statusCode);<NEW_LINE>}<NEW_LINE>set(attributes, SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH, getter.responseContentLength(request, response));<NEW_LINE>set(attributes, SemanticAttributes.HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED, getter.responseContentLengthUncompressed(request, response));<NEW_LINE>for (String name : capturedResponseHeaders) {<NEW_LINE>List<String> values = getter.<MASK><NEW_LINE>if (!values.isEmpty()) {<NEW_LINE>set(attributes, responseAttributeKey(name), values);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
responseHeader(request, response, name);
114,766
public int connect(String address, String username, String password) {<NEW_LINE>int result = CONNECT_ERROR;<NEW_LINE>String camIP = "";<NEW_LINE>try {<NEW_LINE>camIP = getURL(address);<NEW_LINE>nvt = new OnvifDevice(camIP, username, password);<NEW_LINE>nvt.getSoap().setLogging(false);<NEW_LINE>nvt.getDevices().getCapabilities().getDevice();<NEW_LINE>nvt.getDevices().getServices(false);<NEW_LINE>ptzDevices = nvt.getPtz();<NEW_LINE>profiles = nvt.getDevices().getProfiles();<NEW_LINE>if (profiles != null) {<NEW_LINE>for (Profile profile : profiles) {<NEW_LINE>if (profile.getPTZConfiguration() != null) {<NEW_LINE>profileToken = profile.getToken();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (profileToken == null) {<NEW_LINE>profileToken = profiles.<MASK><NEW_LINE>}<NEW_LINE>result = CONNECTION_SUCCESS;<NEW_LINE>} else {<NEW_LINE>// it is likely authentication error but maybe something else<NEW_LINE>// inform user to check username and password<NEW_LINE>result = AUTHENTICATION_ERROR;<NEW_LINE>}<NEW_LINE>} catch (ConnectException | SOAPException e) {<NEW_LINE>// connection error. Let the user check ip address<NEW_LINE>result = CONNECT_ERROR;<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}
get(0).getToken();
925,477
public void sendMetaKey(MetaKeyBean meta) {<NEW_LINE>RemotePointer pointer = canvas.getPointer();<NEW_LINE>int x = pointer.getX();<NEW_LINE>int y = pointer.getY();<NEW_LINE>if (meta.isMouseClick()) {<NEW_LINE>GeneralUtils.debugLog(debugLogging, TAG, "event is a mouse click");<NEW_LINE>int button = meta.getMouseButtons();<NEW_LINE>switch(button) {<NEW_LINE>case RemoteVncPointer.MOUSE_BUTTON_LEFT:<NEW_LINE>pointer.leftButtonDown(x, y, meta.getMetaFlags() | onScreenMetaState);<NEW_LINE>break;<NEW_LINE>case RemoteVncPointer.MOUSE_BUTTON_RIGHT:<NEW_LINE>pointer.rightButtonDown(x, y, <MASK><NEW_LINE>break;<NEW_LINE>case RemoteVncPointer.MOUSE_BUTTON_MIDDLE:<NEW_LINE>pointer.middleButtonDown(x, y, meta.getMetaFlags() | onScreenMetaState);<NEW_LINE>break;<NEW_LINE>case RemoteVncPointer.MOUSE_BUTTON_SCROLL_UP:<NEW_LINE>pointer.scrollUp(x, y, meta.getMetaFlags() | onScreenMetaState);<NEW_LINE>break;<NEW_LINE>case RemoteVncPointer.MOUSE_BUTTON_SCROLL_DOWN:<NEW_LINE>pointer.scrollDown(x, y, meta.getMetaFlags() | onScreenMetaState);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Thread.sleep(50);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>}<NEW_LINE>pointer.releaseButton(x, y, meta.getMetaFlags() | onScreenMetaState);<NEW_LINE>// rfb.writePointerEvent(x, y, meta.getMetaFlags()|onScreenMetaState, button);<NEW_LINE>// rfb.writePointerEvent(x, y, meta.getMetaFlags()|onScreenMetaState, 0);<NEW_LINE>} else if (meta.equals(MetaKeyBean.keyCtrlAltDel)) {<NEW_LINE>writeKeyEvent(false, KeyEvent.KEYCODE_FORWARD_DEL, RemoteKeyboard.CTRL_MASK | RemoteKeyboard.ALT_MASK, true, true);<NEW_LINE>} else {<NEW_LINE>sendKeySym(meta.getKeySym(), meta.getMetaFlags());<NEW_LINE>}<NEW_LINE>}
meta.getMetaFlags() | onScreenMetaState);
371,181
static FileObject copyBuildScript(@NonNull final Project project) throws IOException {<NEW_LINE>final <MASK><NEW_LINE>FileObject rpBuildScript = projDir.getFileObject(BUILD_SCRIPT_PATH);<NEW_LINE>if (rpBuildScript != null && !isBuildScriptUpToDate(project)) {<NEW_LINE>// try to close the file just in case the file is already opened in editor<NEW_LINE>DataObject dobj = DataObject.find(rpBuildScript);<NEW_LINE>CloseCookie closeCookie = dobj.getLookup().lookup(CloseCookie.class);<NEW_LINE>if (closeCookie != null) {<NEW_LINE>closeCookie.close();<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>final FileObject nbproject = projDir.getFileObject("nbproject");<NEW_LINE>// NOI18N<NEW_LINE>final FileObject backupFile = nbproject.getFileObject(BUILD_SCRIPT_BACK_UP, "xml");<NEW_LINE>if (backupFile != null) {<NEW_LINE>backupFile.delete();<NEW_LINE>}<NEW_LINE>FileUtil.moveFile(rpBuildScript, nbproject, BUILD_SCRIPT_BACK_UP);<NEW_LINE>rpBuildScript = null;<NEW_LINE>}<NEW_LINE>if (rpBuildScript == null) {<NEW_LINE>if (LOG.isLoggable(Level.FINE)) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.// NOI18N<NEW_LINE>log(// NOI18N<NEW_LINE>Level.FINE, "Updating remote build script in project {0} ({1})", new Object[] { ProjectUtils.getInformation(project).getDisplayName(), FileUtil.getFileDisplayName(projDir) });<NEW_LINE>}<NEW_LINE>rpBuildScript = FileUtil.createData(project.getProjectDirectory(), BUILD_SCRIPT_PATH);<NEW_LINE>try (final InputStream in = new BufferedInputStream(RemotePlatformProjectSaver.class.getResourceAsStream(BUILD_SCRIPT_PROTOTYPE));<NEW_LINE>final OutputStream out = new BufferedOutputStream(rpBuildScript.getOutputStream())) {<NEW_LINE>FileUtil.copy(in, out);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return rpBuildScript;<NEW_LINE>}
FileObject projDir = project.getProjectDirectory();
666,421
public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) {<NEW_LINE>final ObjectMapper mapper = new ObjectMapper();<NEW_LINE>mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);<NEW_LINE>try {<NEW_LINE>final Map<String, Integer> coordinates = mapper.readValue((String) operand.get("coordinates"), new TypeReference<Map<String, Integer>>() {<NEW_LINE>});<NEW_LINE>final Map<String, String> userConfig = mapper.readValue((String) operand.get("userConfig"), new TypeReference<Map<String, String>>() {<NEW_LINE>});<NEW_LINE>final String index = (String) operand.get("index");<NEW_LINE>Preconditions.checkArgument(index != null, "index is missing in configuration");<NEW_LINE>final RestClient <MASK><NEW_LINE>return new ElasticsearchSchema(client, index);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException("Cannot parse values from json", e);<NEW_LINE>}<NEW_LINE>}
client = connect(coordinates, userConfig);
627,693
public Params map(Params value) throws Exception {<NEW_LINE>long corpusRowCnt = value.getLong("corpusRowCnt");<NEW_LINE>long corpusWordCnt = value.getLong("corpusWordCnt");<NEW_LINE>int batchSize;<NEW_LINE>if (corpusRowCnt < 10000) {<NEW_LINE>batchSize = (int) (corpusRowCnt / 2 + corpusRowCnt % 2);<NEW_LINE>} else if (corpusRowCnt < 100000) {<NEW_LINE>batchSize = (int) (corpusRowCnt / 5 + corpusRowCnt % 5);<NEW_LINE>} else {<NEW_LINE>int window = value.getIntegerOrDefault("window", 5);<NEW_LINE>int negative = <MASK><NEW_LINE>int vectorSize = value.getIntegerOrDefault("vectorSize", 100);<NEW_LINE>// 762 for sina news avg word per doc<NEW_LINE>batchSize = new Double(Math.ceil(((double) corpusRowCnt * 762.0 * 6000.0 * parallelism * 5.0 * 10.0 * 100.0) / ((double) corpusWordCnt * window * negative * vectorSize)) / 5.0).intValue();<NEW_LINE>if (batchSize == 0) {<NEW_LINE>batchSize = (int) corpusRowCnt;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOG.info("batchSize: {}, corpusWordCnt: {}, corpusRowCnt: {}", batchSize, corpusWordCnt, corpusRowCnt);<NEW_LINE>return value.set(HasBatchSize.BATCH_SIZE, batchSize);<NEW_LINE>}
value.getIntegerOrDefault("negative", 5);
842,962
private DeviceCredentials saveOrUpdate(TenantId tenantId, DeviceCredentials deviceCredentials) {<NEW_LINE>if (deviceCredentials.getCredentialsType() == null) {<NEW_LINE>throw new DataValidationException("Device credentials type should be specified");<NEW_LINE>}<NEW_LINE>formatCredentials(deviceCredentials);<NEW_LINE>log.trace("Executing updateDeviceCredentials [{}]", deviceCredentials);<NEW_LINE>credentialsValidator.validate(deviceCredentials, id -> tenantId);<NEW_LINE>try {<NEW_LINE>return deviceCredentialsDao.saveAndFlush(tenantId, deviceCredentials);<NEW_LINE>} catch (Exception t) {<NEW_LINE>ConstraintViolationException e = extractConstraintViolationException<MASK><NEW_LINE>if (e != null && e.getConstraintName() != null && (e.getConstraintName().equalsIgnoreCase("device_credentials_id_unq_key") || e.getConstraintName().equalsIgnoreCase("device_credentials_device_id_unq_key"))) {<NEW_LINE>throw new DataValidationException("Specified credentials are already registered!");<NEW_LINE>} else {<NEW_LINE>throw t;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
(t).orElse(null);
1,233,541
public void process(ICStream ics, float[] data, FilterBank filterBank, SampleFrequency sf) {<NEW_LINE>final ICSInfo info = ics.getInfo();<NEW_LINE>if (!info.isEightShortFrame()) {<NEW_LINE>final int samples = frameLength << 1;<NEW_LINE>final float[] _in = new float[2048];<NEW_LINE>final float[] out = new float[2048];<NEW_LINE>for (int i = 0; i < samples; i++) {<NEW_LINE>_in[i] = states[samples + i - lag] * CODEBOOK[coef];<NEW_LINE>}<NEW_LINE>filterBank.processLTP(info.getWindowSequence(), info.getWindowShape(ICSInfo.CURRENT), info.getWindowShape(ICSInfo.PREVIOUS), _in, out);<NEW_LINE>if (ics.isTNSDataPresent())<NEW_LINE>ics.getTNS().process(<MASK><NEW_LINE>final int[] swbOffsets = info.getSWBOffsets();<NEW_LINE>final int swbOffsetMax = info.getSWBOffsetMax();<NEW_LINE>int low, high, bin;<NEW_LINE>for (int sfb = 0; sfb < lastBand; sfb++) {<NEW_LINE>if (longUsed[sfb]) {<NEW_LINE>low = swbOffsets[sfb];<NEW_LINE>high = Math.min(swbOffsets[sfb + 1], swbOffsetMax);<NEW_LINE>for (bin = low; bin < high; bin++) {<NEW_LINE>data[bin] += out[bin];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
ics, out, sf, true);
663,176
protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {<NEW_LINE>Parser parser = new Parser(PATTERN, (String) msg);<NEW_LINE>if (!parser.matches()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Position position = new Position(getProtocolName());<NEW_LINE>position.setDeviceId(deviceSession.getDeviceId());<NEW_LINE>position.setTime(parser.nextDateTime());<NEW_LINE>position.setValid(true);<NEW_LINE>position.<MASK><NEW_LINE>position.setLatitude(parser.nextDouble());<NEW_LINE>position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble()));<NEW_LINE>position.setCourse(parser.nextDouble());<NEW_LINE>position.setAltitude(parser.nextDouble());<NEW_LINE>position.set(Position.KEY_SATELLITES, parser.nextInt());<NEW_LINE>int event = parser.nextInt();<NEW_LINE>position.set(Position.KEY_ALARM, decodeAlarm(event));<NEW_LINE>position.set(Position.KEY_EVENT, event);<NEW_LINE>position.set(Position.KEY_INPUT, parser.nextInt());<NEW_LINE>position.set(Position.KEY_OUTPUT, parser.nextInt());<NEW_LINE>position.set(Position.PREFIX_ADC + 1, parser.nextDouble());<NEW_LINE>position.set(Position.PREFIX_ADC + 2, parser.nextDouble());<NEW_LINE>// J1939 data<NEW_LINE>if (parser.hasNext(10)) {<NEW_LINE>position.set(Position.KEY_OBD_SPEED, parser.nextInt());<NEW_LINE>position.set(Position.KEY_RPM, parser.nextInt());<NEW_LINE>position.set("coolant", parser.nextInt());<NEW_LINE>position.set(Position.KEY_FUEL_LEVEL, parser.nextInt());<NEW_LINE>position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextInt());<NEW_LINE>position.set(Position.PREFIX_TEMP + 1, parser.nextInt());<NEW_LINE>position.set("chargerPressure", parser.nextInt());<NEW_LINE>position.set("tpl", parser.nextInt());<NEW_LINE>position.set(Position.KEY_AXLE_WEIGHT, parser.nextInt());<NEW_LINE>position.set(Position.KEY_OBD_ODOMETER, parser.nextInt());<NEW_LINE>}<NEW_LINE>return position;<NEW_LINE>}
setLongitude(parser.nextDouble());
1,337,405
public static SearchAudiencesResponse unmarshall(SearchAudiencesResponse searchAudiencesResponse, UnmarshallerContext _ctx) {<NEW_LINE>searchAudiencesResponse.setRequestId(_ctx.stringValue("SearchAudiencesResponse.RequestId"));<NEW_LINE>searchAudiencesResponse.setErrorDesc(_ctx.stringValue("SearchAudiencesResponse.ErrorDesc"));<NEW_LINE>searchAudiencesResponse.setTraceId(_ctx.stringValue("SearchAudiencesResponse.TraceId"));<NEW_LINE>searchAudiencesResponse.setErrorCode(_ctx.stringValue("SearchAudiencesResponse.ErrorCode"));<NEW_LINE>searchAudiencesResponse.setSuccess(_ctx.booleanValue("SearchAudiencesResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageNum(_ctx.integerValue("SearchAudiencesResponse.Data.PageNum"));<NEW_LINE>data.setPageSize<MASK><NEW_LINE>data.setTotalNum(_ctx.longValue("SearchAudiencesResponse.Data.TotalNum"));<NEW_LINE>List<ContentItem> content = new ArrayList<ContentItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("SearchAudiencesResponse.Data.Content.Length"); i++) {<NEW_LINE>ContentItem contentItem = new ContentItem();<NEW_LINE>contentItem.setDataModelName(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].DataModelName"));<NEW_LINE>contentItem.setGmtModified(_ctx.longValue("SearchAudiencesResponse.Data.Content[" + i + "].GmtModified"));<NEW_LINE>contentItem.setDbName(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].DbName"));<NEW_LINE>contentItem.setNumberOfAudiences(_ctx.longValue("SearchAudiencesResponse.Data.Content[" + i + "].NumberOfAudiences"));<NEW_LINE>contentItem.setErrorMessage(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].ErrorMessage"));<NEW_LINE>contentItem.setDbType(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].DbType"));<NEW_LINE>contentItem.setPermission(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].Permission"));<NEW_LINE>contentItem.setType(_ctx.integerValue("SearchAudiencesResponse.Data.Content[" + i + "].Type"));<NEW_LINE>contentItem.setGmtCreate(_ctx.longValue("SearchAudiencesResponse.Data.Content[" + i + "].GmtCreate"));<NEW_LINE>contentItem.setVersion(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].Version"));<NEW_LINE>contentItem.setParentId(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].ParentId"));<NEW_LINE>contentItem.setModifyUser(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].ModifyUser"));<NEW_LINE>contentItem.setModifyUserName(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].ModifyUserName"));<NEW_LINE>contentItem.setLatestDataModifyStatus(_ctx.integerValue("SearchAudiencesResponse.Data.Content[" + i + "].LatestDataModifyStatus"));<NEW_LINE>contentItem.set_Public(_ctx.booleanValue("SearchAudiencesResponse.Data.Content[" + i + "].Public"));<NEW_LINE>contentItem.setSubtype(_ctx.integerValue("SearchAudiencesResponse.Data.Content[" + i + "].Subtype"));<NEW_LINE>contentItem.setName(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].Name"));<NEW_LINE>contentItem.setAutoUpdateData(_ctx.booleanValue("SearchAudiencesResponse.Data.Content[" + i + "].AutoUpdateData"));<NEW_LINE>contentItem.setCreateUser(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].CreateUser"));<NEW_LINE>contentItem.setId(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].Id"));<NEW_LINE>contentItem.setLatestDataModifyTime(_ctx.longValue("SearchAudiencesResponse.Data.Content[" + i + "].LatestDataModifyTime"));<NEW_LINE>contentItem.setDesc(_ctx.stringValue("SearchAudiencesResponse.Data.Content[" + i + "].Desc"));<NEW_LINE>content.add(contentItem);<NEW_LINE>}<NEW_LINE>data.setContent(content);<NEW_LINE>searchAudiencesResponse.setData(data);<NEW_LINE>return searchAudiencesResponse;<NEW_LINE>}
(_ctx.integerValue("SearchAudiencesResponse.Data.PageSize"));
924,269
private void modifyForSoundVibrationAndLight(Builder mBuilder, boolean notify, boolean quietHours, SharedPreferences preferences) {<NEW_LINE>final Resources resources = mXmppConnectionService.getResources();<NEW_LINE>final String ringtone = preferences.getString("notification_ringtone", resources.getString(R.string.notification_ringtone));<NEW_LINE>final boolean vibrate = preferences.getBoolean("vibrate_on_notification", resources.getBoolean(R.bool.vibrate_on_notification));<NEW_LINE>final boolean led = preferences.getBoolean("led", resources.getBoolean(R.bool.led));<NEW_LINE>final boolean headsup = preferences.getBoolean("notification_headsup", resources.getBoolean(R.bool.headsup_notifications));<NEW_LINE>if (notify && !quietHours) {<NEW_LINE>if (vibrate) {<NEW_LINE>final int dat = 70;<NEW_LINE>final long[] pattern = { 0, 3 * dat, dat, dat };<NEW_LINE>mBuilder.setVibrate(pattern);<NEW_LINE>} else {<NEW_LINE>mBuilder.setVibrate(new long[] { 0 });<NEW_LINE>}<NEW_LINE>Uri uri = Uri.parse(ringtone);<NEW_LINE>try {<NEW_LINE>mBuilder.setSound(fixRingtoneUri(uri));<NEW_LINE>} catch (SecurityException e) {<NEW_LINE>Log.d(Config.LOGTAG, "unable to use custom notification sound " + uri.toString());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mBuilder.setLocalOnly(true);<NEW_LINE>}<NEW_LINE>if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>mBuilder.setPriority(notify ? (headsup ? NotificationCompat.PRIORITY_HIGH : NotificationCompat.PRIORITY_DEFAULT) : NotificationCompat.PRIORITY_LOW);<NEW_LINE>setNotificationColor(mBuilder);<NEW_LINE>mBuilder.setDefaults(0);<NEW_LINE>if (led) {<NEW_LINE>mBuilder.setLights(LED_COLOR, 2000, 3000);<NEW_LINE>}<NEW_LINE>}
mBuilder.setCategory(Notification.CATEGORY_MESSAGE);
1,450,809
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {<NEW_LINE>tvX.setText(String.valueOf(seekBarX.getProgress()));<NEW_LINE>tvY.setText(String.valueOf(seekBarY.getProgress()));<NEW_LINE>ArrayList<BarEntry> values = new ArrayList<>();<NEW_LINE>for (int i = 0; i < seekBarX.getProgress(); i++) {<NEW_LINE>float multi = (seekBarY.getProgress() + 1);<NEW_LINE>float val = (float) (Math.random() * multi) + multi / 3;<NEW_LINE>values.add(new BarEntry(i, val));<NEW_LINE>}<NEW_LINE>BarDataSet set1;<NEW_LINE>if (chart.getData() != null && chart.getData().getDataSetCount() > 0) {<NEW_LINE>set1 = (BarDataSet) chart.getData().getDataSetByIndex(0);<NEW_LINE>set1.setValues(values);<NEW_LINE>chart<MASK><NEW_LINE>chart.notifyDataSetChanged();<NEW_LINE>} else {<NEW_LINE>set1 = new BarDataSet(values, "Data Set");<NEW_LINE>set1.setColors(ColorTemplate.VORDIPLOM_COLORS);<NEW_LINE>set1.setDrawValues(false);<NEW_LINE>ArrayList<IBarDataSet> dataSets = new ArrayList<>();<NEW_LINE>dataSets.add(set1);<NEW_LINE>BarData data = new BarData(dataSets);<NEW_LINE>chart.setData(data);<NEW_LINE>chart.setFitBars(true);<NEW_LINE>}<NEW_LINE>chart.invalidate();<NEW_LINE>}
.getData().notifyDataChanged();
1,042,593
public void process(double[] input, double[] output) {<NEW_LINE>H.data = input;<NEW_LINE>int outputIdx = 0;<NEW_LINE>for (int viewIdx = 0; viewIdx < cameras1.size(); viewIdx++) {<NEW_LINE>DMatrixRMaj P = cameras1.get(viewIdx);<NEW_LINE>for (int pointIdx = 0; pointIdx < scene1.size(); pointIdx++) {<NEW_LINE>Point4D_F64 a = scene1.get(pointIdx);<NEW_LINE>Point4D_F64 b = scene2.get(pointIdx);<NEW_LINE>GeometryMath_F64.mult(H, b, ba);<NEW_LINE>// NOTE: This could be cached<NEW_LINE>PerspectiveOps.<MASK><NEW_LINE>PerspectiveOps.renderPixel(P, ba, pixel2);<NEW_LINE>output[outputIdx++] = pixel1.x - pixel2.x;<NEW_LINE>output[outputIdx++] = pixel1.y - pixel2.y;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}
renderPixel(P, a, pixel1);
464,862
public Settings unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AwsJsonReader reader = context.getReader();<NEW_LINE>if (!reader.isContainer()) {<NEW_LINE>reader.skipValue();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Settings settings = new Settings();<NEW_LINE>reader.beginObject();<NEW_LINE>while (reader.hasNext()) {<NEW_LINE>String name = reader.nextName();<NEW_LINE>if (name.equals("VocabularyName")) {<NEW_LINE>settings.setVocabularyName(StringJsonUnmarshaller.getInstance<MASK><NEW_LINE>} else if (name.equals("ShowSpeakerLabels")) {<NEW_LINE>settings.setShowSpeakerLabels(BooleanJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("MaxSpeakerLabels")) {<NEW_LINE>settings.setMaxSpeakerLabels(IntegerJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("ChannelIdentification")) {<NEW_LINE>settings.setChannelIdentification(BooleanJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("ShowAlternatives")) {<NEW_LINE>settings.setShowAlternatives(BooleanJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("MaxAlternatives")) {<NEW_LINE>settings.setMaxAlternatives(IntegerJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("VocabularyFilterName")) {<NEW_LINE>settings.setVocabularyFilterName(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("VocabularyFilterMethod")) {<NEW_LINE>settings.setVocabularyFilterMethod(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else {<NEW_LINE>reader.skipValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>reader.endObject();<NEW_LINE>return settings;<NEW_LINE>}
().unmarshall(context));
1,434,218
// Get frequency element in collection<NEW_LINE>private static void testCount() {<NEW_LINE>Collection<String> collection = Lists.newArrayList(<MASK><NEW_LINE>Iterable<String> iterable = collection;<NEW_LINE>MutableCollection<String> collectionGS = FastList.newListWith("a1", "a2", "a3", "a1");<NEW_LINE>// Get frequency element in collection<NEW_LINE>// using guava<NEW_LINE>int i1 = Iterables.frequency(iterable, "a1");<NEW_LINE>// using JDK<NEW_LINE>int i2 = Collections.frequency(collection, "a1");<NEW_LINE>// using Apache<NEW_LINE>int i3 = CollectionUtils.cardinality("a1", iterable);<NEW_LINE>int i4 = collectionGS.count("a1"::equals);<NEW_LINE>// using stream JDK<NEW_LINE>long i5 = collection.stream().filter("a1"::equals).count();<NEW_LINE>// print count = 2:2:2:2:2<NEW_LINE>System.out.println("count = " + i1 + ":" + i2 + ":" + i3 + ":" + i4 + ":" + i5);<NEW_LINE>}
"a1", "a2", "a3", "a1");
1,379,738
public String loginUser(String username, String password) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'username' is set<NEW_LINE>if (username == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'username' when calling loginUser");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'password' is set<NEW_LINE>if (password == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/user/login".replaceAll("\\{format\\}", "json");<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username));<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password));<NEW_LINE>final String[] localVarAccepts = { "application/xml", "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>GenericType<String> localVarReturnType = new GenericType<String>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>}
throw new ApiException(400, "Missing the required parameter 'password' when calling loginUser");
1,252,239
private boolean updateBytes(UserStatisticsVO userStats, long newCurrentBytesSent, long newCurrentBytesReceived) {<NEW_LINE>long oldNetBytesSent = userStats.getNetBytesSent();<NEW_LINE>long oldNetBytesReceived = userStats.getNetBytesReceived();<NEW_LINE>long oldCurrentBytesSent = userStats.getCurrentBytesSent();<NEW_LINE>long oldCurrentBytesReceived = userStats.getCurrentBytesReceived();<NEW_LINE>String warning = "Received an external network stats byte count that was less than the stored value. Zone ID: " + userStats.getDataCenterId() + ", account ID: " + userStats.getAccountId() + ".";<NEW_LINE>userStats.setCurrentBytesSent(newCurrentBytesSent);<NEW_LINE>if (oldCurrentBytesSent > newCurrentBytesSent) {<NEW_LINE>s_logger.warn(warning + "Stored bytes sent: " + toHumanReadableSize(oldCurrentBytesSent) + ", new bytes sent: " + toHumanReadableSize(newCurrentBytesSent) + ".");<NEW_LINE>userStats.setNetBytesSent(oldNetBytesSent + oldCurrentBytesSent);<NEW_LINE>}<NEW_LINE>userStats.setCurrentBytesReceived(newCurrentBytesReceived);<NEW_LINE>if (oldCurrentBytesReceived > newCurrentBytesReceived) {<NEW_LINE>s_logger.warn(warning + "Stored bytes received: " + toHumanReadableSize(oldCurrentBytesReceived) + ", new bytes received: " <MASK><NEW_LINE>userStats.setNetBytesReceived(oldNetBytesReceived + oldCurrentBytesReceived);<NEW_LINE>}<NEW_LINE>return _userStatsDao.update(userStats.getId(), userStats);<NEW_LINE>}
+ toHumanReadableSize(newCurrentBytesReceived) + ".");
1,757,200
private void addNewNode() {<NEW_LINE>if (gridTab.getRecord_ID() > 0) {<NEW_LINE>String name = (String) gridTab.getValue("Name");<NEW_LINE>String description = (String) gridTab.getValue("Description");<NEW_LINE>boolean summary = gridTab.getValueAsBoolean("IsSummary");<NEW_LINE>// Menu - Action<NEW_LINE>String imageIndicator = (String) gridTab.getValue("Action");<NEW_LINE>//<NEW_LINE>SimpleTreeModel model = (SimpleTreeModel) treePanel.getTree().getModel();<NEW_LINE>SimpleTreeNode treeNode = model.getRoot();<NEW_LINE>MTreeNode root = (MTreeNode) treeNode.getData();<NEW_LINE>MTreeNode node = new MTreeNode(gridTab.getRecord_ID(), 0, name, description, root.getNode_ID(), summary, imageIndicator, false, null);<NEW_LINE>SimpleTreeNode newNode = new SimpleTreeNode(node, new ArrayList<Object>());<NEW_LINE>model.addNode(newNode);<NEW_LINE>int[] path = model.getPath(model.getRoot(), newNode);<NEW_LINE>Treeitem ti = treePanel.<MASK><NEW_LINE>treePanel.getTree().setSelectedItem(ti);<NEW_LINE>}<NEW_LINE>}
getTree().renderItemByPath(path);
88,031
public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {<NEW_LINE>String sql;<NEW_LINE>SqlMethod sqlMethod = SqlMethod.LOGIC_DELETE_BY_MAP;<NEW_LINE>if (tableInfo.isWithLogicDelete()) {<NEW_LINE>sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(), sqlLogicSet(tableInfo), sqlWhereByMap(tableInfo));<NEW_LINE>SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, Map.class);<NEW_LINE>return addUpdateMappedStatement(mapperClass, Map.class, getMethod(sqlMethod), sqlSource);<NEW_LINE>} else {<NEW_LINE>sqlMethod = SqlMethod.DELETE_BY_MAP;<NEW_LINE>sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(), this.sqlWhereByMap(tableInfo));<NEW_LINE>SqlSource sqlSource = languageDriver.createSqlSource(<MASK><NEW_LINE>return this.addDeleteMappedStatement(mapperClass, getMethod(sqlMethod), sqlSource);<NEW_LINE>}<NEW_LINE>}
configuration, sql, Map.class);
533,760
private static void writeUsersAndRoles(OutputWriter viewWriter, List<AdminUser> users, List<AdminRole> roles) {<NEW_LINE>List<String> userErrors = new ArrayList<>();<NEW_LINE>users.stream().map(user -> user.errors().getAllOn(AdminUser.ADMIN)).filter(Objects::nonNull).forEach(userErrors::addAll);<NEW_LINE>List<String> rolesErrors = new ArrayList<>();<NEW_LINE>roles.stream().map(role -> role.errors().getAllOn(AdminRole.ADMIN)).filter(Objects::nonNull).forEach(rolesErrors::addAll);<NEW_LINE>if (!rolesErrors.isEmpty() || !userErrors.isEmpty()) {<NEW_LINE>viewWriter.addChild("errors", errorsWriter -> {<NEW_LINE>errorsWriter.addChildList("roles", rolesErrors);<NEW_LINE><MASK><NEW_LINE>});<NEW_LINE>}<NEW_LINE>if (users.isEmpty()) {<NEW_LINE>viewWriter.addChildList("users", Collections.emptyList());<NEW_LINE>} else {<NEW_LINE>viewWriter.addChildList("users", users.stream().map(AdminUser::getName).map(CaseInsensitiveString::toString).collect(Collectors.toList()));<NEW_LINE>}<NEW_LINE>if (roles.isEmpty()) {<NEW_LINE>viewWriter.addChildList("roles", Collections.emptyList());<NEW_LINE>} else {<NEW_LINE>viewWriter.addChildList("roles", roles.stream().map(AdminRole::getName).map(CaseInsensitiveString::toString).collect(Collectors.toList()));<NEW_LINE>}<NEW_LINE>}
errorsWriter.addChildList("users", userErrors);
1,100,807
public static void main(String[] args) {<NEW_LINE>final String USAGE = "\n" + "Usage:\n" + " CreateDatasetExportJob <name, datasetArn, ingestionMode, roleArn, s3BucketPath>\n\n" + "Where:\n" + " jobName - The name for the dataset export job.\n" + " datasetArn - The Amazon Resource Name (ARN) of the dataset that contains the data to export.\n" + " ingestionMode - The data to export, based on how you imported the data.\n" + " roleArn - The Amazon Resource Name (ARN) of the IAM service role that" + "has permissions to add data to your output Amazon S3 bucket.\n" + " s3BucketPath - The path to your output bucket\n" + " kmsKeyArn - The ARN for your KMS key\n\n";<NEW_LINE>if (args.length != 6) {<NEW_LINE>System.out.println(USAGE);<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>IngestionMode ingestionMode = IngestionMode.ALL;<NEW_LINE>String jobName = args[0];<NEW_LINE>String datasetArn = args[1];<NEW_LINE>if (args[2].toLowerCase().equals("put")) {<NEW_LINE>ingestionMode = IngestionMode.PUT;<NEW_LINE>} else if (args[2].toLowerCase().equals("bulk")) {<NEW_LINE>ingestionMode = IngestionMode.BULK;<NEW_LINE>}<NEW_LINE>String roleArn = args[3];<NEW_LINE>String s3BucketPath = args[4];<NEW_LINE>String kmsKeyArn = args[5];<NEW_LINE>Region region = Region.US_WEST_2;<NEW_LINE>PersonalizeClient personalizeClient = PersonalizeClient.builder().region(region).build();<NEW_LINE>createDatasetExportJob(personalizeClient, jobName, datasetArn, <MASK><NEW_LINE>personalizeClient.close();<NEW_LINE>}
ingestionMode, roleArn, s3BucketPath, kmsKeyArn);
1,311,720
public boolean configure(final FeatureContext context) {<NEW_LINE>final Configuration config = context.getConfiguration();<NEW_LINE>final String jsonFeature = getValue(config.getProperties(), config.getRuntimeType(), JSON_FEATURE, ST_JSON_FEATURE, String.class);<NEW_LINE>// Do not register our JSON feature if another one is already registered<NEW_LINE>if (!ST_JSON_FEATURE.equalsIgnoreCase(jsonFeature)) {<NEW_LINE>LOGGER.warn("Skipping registration of: {} as JSON support is already provided by: {}", ST_JSON_FEATURE, jsonFeature);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Prevent other not yet registered JSON features to register themselves<NEW_LINE>context.property(getPropertyNameForRuntime(JSON_FEATURE, config<MASK><NEW_LINE>if (!config.isRegistered(JacksonSerializerMessageBodyReaderWriter.class)) {<NEW_LINE>context.register(JacksonSerializationExceptionMapper.class);<NEW_LINE>context.register(JacksonSerializerMessageBodyReaderWriter.class);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}
.getRuntimeType()), ST_JSON_FEATURE);
1,203,149
public DeleteFlowResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DeleteFlowResult deleteFlowResult = new DeleteFlowResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return deleteFlowResult;<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("flowArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deleteFlowResult.setFlowArn(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("status", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deleteFlowResult.setStatus(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return deleteFlowResult;<NEW_LINE>}
String currentParentElement = context.getCurrentParentElement();
780,460
public static void main(String[] args) throws Exception {<NEW_LINE>AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://localhost:8000", "us-west-2")).build();<NEW_LINE>DynamoDB dynamoDB = new DynamoDB(client);<NEW_LINE>Table table = dynamoDB.getTable("Movies");<NEW_LINE>int year = 2015;<NEW_LINE>String title = "The Big New Movie";<NEW_LINE>final Map<String, Object> infoMap = new HashMap<String, Object>();<NEW_LINE>infoMap.put("plot", "Nothing happens at all.");<NEW_LINE>infoMap.put("rating", 0);<NEW_LINE>try {<NEW_LINE>System.out.println("Adding a new item...");<NEW_LINE>PutItemOutcome outcome = table.putItem(new Item().withPrimaryKey("year", year, "title", title)<MASK><NEW_LINE>System.out.println("PutItem succeeded:\n" + outcome.getPutItemResult());<NEW_LINE>} catch (Exception e) {<NEW_LINE>System.err.println("Unable to add item: " + year + " " + title);<NEW_LINE>System.err.println(e.getMessage());<NEW_LINE>}<NEW_LINE>}
.withMap("info", infoMap));
686,436
private InputStreamGroupIterator copyFilesFromSharedVolume(String containerId, String folderName) {<NEW_LINE>Map<String, File> streams = new HashMap<>();<NEW_LINE>Optional<String> oWorkDir = client.pods().withName(containerId).get().getSpec().getContainers().get(0).getEnv().stream().filter(env -> env.getName().equals("SHARED_DIR")).map(env -> env.getValue()).findFirst();<NEW_LINE>if (!oWorkDir.isPresent()) {<NEW_LINE>throw new RuntimeException("SHARED_DIR not present in pod" + containerId);<NEW_LINE>}<NEW_LINE>String workDir = oWorkDir.get();<NEW_LINE>File dir = new File(workDir + folderName);<NEW_LINE>File[] directoryListing = dir.listFiles();<NEW_LINE>for (File f : directoryListing) {<NEW_LINE>if (f.getName().endsWith(".log") || f.getName().endsWith(".mp4")) {<NEW_LINE>streams.put(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new MapInputStreamAdapter(streams);<NEW_LINE>}
f.getName(), f);
1,030,452
public CaseDefinitionResponse createCaseDefinitionResponse(CaseDefinition caseDefinition, RestUrlBuilder urlBuilder) {<NEW_LINE>CaseDefinitionResponse response = new CaseDefinitionResponse();<NEW_LINE>response.setUrl(urlBuilder.buildUrl(CmmnRestUrls.URL_CASE_DEFINITION, caseDefinition.getId()));<NEW_LINE>response.setId(caseDefinition.getId());<NEW_LINE>response.setKey(caseDefinition.getKey());<NEW_LINE>response.setVersion(caseDefinition.getVersion());<NEW_LINE>response.setCategory(caseDefinition.getCategory());<NEW_LINE>response.setName(caseDefinition.getName());<NEW_LINE>response.setDescription(caseDefinition.getDescription());<NEW_LINE>response.setGraphicalNotationDefined(caseDefinition.hasGraphicalNotation());<NEW_LINE>response.<MASK><NEW_LINE>response.setTenantId(caseDefinition.getTenantId());<NEW_LINE>// Links to other resources<NEW_LINE>response.setDeploymentId(caseDefinition.getDeploymentId());<NEW_LINE>response.setDeploymentUrl(urlBuilder.buildUrl(CmmnRestUrls.URL_DEPLOYMENT, caseDefinition.getDeploymentId()));<NEW_LINE>response.setResource(urlBuilder.buildUrl(CmmnRestUrls.URL_DEPLOYMENT_RESOURCE, caseDefinition.getDeploymentId(), caseDefinition.getResourceName()));<NEW_LINE>if (caseDefinition.getDiagramResourceName() != null) {<NEW_LINE>response.setDiagramResource(urlBuilder.buildUrl(CmmnRestUrls.URL_DEPLOYMENT_RESOURCE, caseDefinition.getDeploymentId(), caseDefinition.getDiagramResourceName()));<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>}
setStartFormDefined(caseDefinition.hasStartFormKey());
990,737
private Whitespace countWhiteSpaceBeforeRightBrace(CodeStyle.BracePlacement placement, int currentLine, int addLine, int indent, List<FormatToken> formatTokens, int currentIndex, CharSequence oldText, int lastBracedBlockIndent) {<NEW_LINE>int lines;<NEW_LINE>int spaces;<NEW_LINE>Whitespace result;<NEW_LINE>if (placement == CodeStyle.BracePlacement.PRESERVE_EXISTING) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>lines = addLines(currentLine, addLine);<NEW_LINE>// check whether the } is not before open php tag in html<NEW_LINE>int index = currentIndex;<NEW_LINE>while (index > 0 && (formatTokens.get(index).isWhitespace() || formatTokens.get(index).getId() == FormatToken.Kind.INDENT)) {<NEW_LINE>index--;<NEW_LINE>}<NEW_LINE>if (lines == 0 && formatTokens.get(index).getId() == FormatToken.Kind.OPEN_TAG) {<NEW_LINE>spaces = 1;<NEW_LINE>} else {<NEW_LINE>spaces = placement == CodeStyle.BracePlacement.NEW_LINE_INDENTED ? indent + docOptions.indentSize : indent;<NEW_LINE>}<NEW_LINE>result = new Whitespace(lines, spaces);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}
result = countWhiteSpaceForPreserveExistingBracePlacement(oldText, lastBracedBlockIndent);
348,898
public static DescribeAppEnvsResponse unmarshall(DescribeAppEnvsResponse describeAppEnvsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeAppEnvsResponse.setRequestId(_ctx.stringValue("DescribeAppEnvsResponse.RequestId"));<NEW_LINE>describeAppEnvsResponse.setCode(_ctx.stringValue("DescribeAppEnvsResponse.Code"));<NEW_LINE>describeAppEnvsResponse.setMessage(_ctx.stringValue("DescribeAppEnvsResponse.Message"));<NEW_LINE>describeAppEnvsResponse.setPageNumber(_ctx.integerValue("DescribeAppEnvsResponse.PageNumber"));<NEW_LINE>describeAppEnvsResponse.setPageSize(_ctx.integerValue("DescribeAppEnvsResponse.PageSize"));<NEW_LINE>describeAppEnvsResponse.setTotalCount(_ctx.integerValue("DescribeAppEnvsResponse.TotalCount"));<NEW_LINE>List<AppEnv> appEnvs = new ArrayList<AppEnv>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAppEnvsResponse.AppEnvs.Length"); i++) {<NEW_LINE>AppEnv appEnv = new AppEnv();<NEW_LINE>appEnv.setEnvId(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].EnvId"));<NEW_LINE>appEnv.setEnvName(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].EnvName"));<NEW_LINE>appEnv.setEnvDescription(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].EnvDescription"));<NEW_LINE>appEnv.setCreateUsername(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].CreateUsername"));<NEW_LINE>appEnv.setUpdateUsername(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].UpdateUsername"));<NEW_LINE>appEnv.setCreateTime(_ctx.longValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].CreateTime"));<NEW_LINE>appEnv.setUpdateTime(_ctx.longValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].UpdateTime"));<NEW_LINE>appEnv.setStackId(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].StackId"));<NEW_LINE>appEnv.setStackName(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].StackName"));<NEW_LINE>appEnv.setAppName(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].AppName"));<NEW_LINE>appEnv.setAppId(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].AppId"));<NEW_LINE>appEnv.setApplyingChange(_ctx.booleanValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].ApplyingChange"));<NEW_LINE>appEnv.setAbortingChange(_ctx.booleanValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].AbortingChange"));<NEW_LINE>appEnv.setEnvType(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].EnvType"));<NEW_LINE>appEnv.setPkgVersionId(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].PkgVersionId"));<NEW_LINE>appEnv.setPkgVersionLabel(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].PkgVersionLabel"));<NEW_LINE>appEnv.setEnvStatus(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].EnvStatus"));<NEW_LINE>appEnv.setLastEnvStatus(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].LastEnvStatus"));<NEW_LINE>appEnv.setStorageBase(_ctx.stringValue<MASK><NEW_LINE>appEnv.setDataRoot(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].DataRoot"));<NEW_LINE>appEnv.setLatestChangeId(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].LatestChangeId"));<NEW_LINE>appEnv.setChangeBanner(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].ChangeBanner"));<NEW_LINE>appEnv.setCategoryName(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].CategoryName"));<NEW_LINE>appEnv.setTotalInstances(_ctx.longValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].TotalInstances"));<NEW_LINE>appEnv.setLogBase(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].LogBase"));<NEW_LINE>appEnv.setPkgVersionStorageKey(_ctx.stringValue("DescribeAppEnvsResponse.AppEnvs[" + i + "].PkgVersionStorageKey"));<NEW_LINE>appEnvs.add(appEnv);<NEW_LINE>}<NEW_LINE>describeAppEnvsResponse.setAppEnvs(appEnvs);<NEW_LINE>return describeAppEnvsResponse;<NEW_LINE>}
("DescribeAppEnvsResponse.AppEnvs[" + i + "].StorageBase"));
232,374
public Object strPropFromVars(List<Object> parameters, String lastParam, String props, Map<String, String> map, List<String> oldKeys, List<String> oldKeysNormalized, VariableResolver resolver) throws ParserException {<NEW_LINE>Object retval = null;<NEW_LINE>String delim = ";";<NEW_LINE>int minParams = 1;<NEW_LINE>int maxParams = 3;<NEW_LINE>checkVaryingParameters("strPropFromVars()", minParams, maxParams, parameters, new Class[] { String<MASK><NEW_LINE>if (parameters.size() == maxParams)<NEW_LINE>delim = lastParam;<NEW_LINE>String varStyleString = parameters.size() > 1 ? parameters.get(1).toString() : "UNSUFFIXED";<NEW_LINE>int varStyle;<NEW_LINE>if (varStyleString.equalsIgnoreCase("SUFFIXED")) {<NEW_LINE>varStyle = 0;<NEW_LINE>} else if (varStyleString.equalsIgnoreCase("UNSUFFIXED")) {<NEW_LINE>varStyle = 1;<NEW_LINE>} else {<NEW_LINE>throw new ParameterException(I18N.getText("macro.function.strPropFromVar.wrongArgs", varStyleString));<NEW_LINE>}<NEW_LINE>List<String> varList = StrListFunctions.toList(parameters.get(0).toString(), ",");<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>int i = 0;<NEW_LINE>int varListSize = varList.size();<NEW_LINE>for (String var : varList) {<NEW_LINE>String varToGet = (varStyle == 0) ? var + "_" : var;<NEW_LINE>sb.append(var);<NEW_LINE>sb.append("=");<NEW_LINE>String value = resolver.getVariable(varToGet).toString();<NEW_LINE>sb.append(value);<NEW_LINE>i += 1;<NEW_LINE>if (i < varListSize) {<NEW_LINE>sb.append(" ").append(delim).append(" ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>retval = sb.toString();<NEW_LINE>return retval;<NEW_LINE>}
.class, String.class });