before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
public FebsResponse fail() { put("code", HttpStatus.INTERNAL_SERVER_ERROR.value()); return this; return this; }
public FebsResponse fail() { <DeepExtract> put("code", HttpStatus.INTERNAL_SERVER_ERROR.value()); return this; </DeepExtract> return this; }
FEBS-Shiro-jht
positive
2,541
public void keepBottomNKeys(int keepN) { Counter<E> tmp = new Counter<E>(); int n = 0; for (E e : Iterators.able(false ? asPriorityQueue() : asMinPriorityQueue())) { if (n <= keepN) tmp.setCount(e, getCount(e)); n++; } clear(); incrementAll(tmp); dirty = true; }
public void keepBottomNKeys(int keepN) { <DeepExtract> Counter<E> tmp = new Counter<E>(); int n = 0; for (E e : Iterators.able(false ? asPriorityQueue() : asMinPriorityQueue())) { if (n <= keepN) tmp.setCount(e, getCount(e)); n++; } clear(); incrementAll(tmp); dirty = true; </DeepExtract> }
Canova
positive
2,542
@Override public void aggregate(Output<File> output, Map<String, String> metadata) throws IOException { TreeSet<String> sorted = new TreeSet<>(metadata.keySet()); try (BufferedWriter w = new BufferedWriter(new OutputStreamWriter(output.newOutputStream(), Charsets.UTF_8))) { for (String type : sorted) { w.write(type); w.newLine(); } } }
@Override public void aggregate(Output<File> output, Map<String, String> metadata) throws IOException { <DeepExtract> TreeSet<String> sorted = new TreeSet<>(metadata.keySet()); try (BufferedWriter w = new BufferedWriter(new OutputStreamWriter(output.newOutputStream(), Charsets.UTF_8))) { for (String type : sorted) { w.write(type); w.newLine(); } } </DeepExtract> }
takari-lifecycle
positive
2,544
public boolean joinRoom(RoomData roomData, String uid, boolean isPairing, PartnerListener partnerListener, PartnerDetectionListener partnerDetectionListener) { this.isPairing = isPairing; mRoomData = roomData; if (app == null) { return false; } roomRef = roomsListRef.child(roomData.key); partnersRef = roomRef.child(KEY_PARTICIPANTS); Participant participant = new Participant(false, isPairing); partnersRef.child(uid).setValue(participant); onDisconnectRef = partnersRef.child(uid).onDisconnect(); onDisconnectRef.removeValue(); listenForPartners(uid, partnerListener); checkForPartners(uid, partnerDetectionListener); return true; }
public boolean joinRoom(RoomData roomData, String uid, boolean isPairing, PartnerListener partnerListener, PartnerDetectionListener partnerDetectionListener) { this.isPairing = isPairing; mRoomData = roomData; <DeepExtract> if (app == null) { return false; } roomRef = roomsListRef.child(roomData.key); partnersRef = roomRef.child(KEY_PARTICIPANTS); Participant participant = new Participant(false, isPairing); partnersRef.child(uid).setValue(participant); onDisconnectRef = partnersRef.child(uid).onDisconnect(); onDisconnectRef.removeValue(); listenForPartners(uid, partnerListener); checkForPartners(uid, partnerDetectionListener); return true; </DeepExtract> }
justaline-android
positive
2,545
public void setSmallIcon(String smallIcon) { if (smallIcon == null) this.smallIcon = null; if (smallIcon.contains("/")) { this.smallIcon = smallIcon.substring(smallIcon.lastIndexOf('/') + 1); } if (smallIcon.contains(".")) { this.smallIcon = smallIcon.substring(0, smallIcon.lastIndexOf('.')); } return smallIcon; }
public void setSmallIcon(String smallIcon) { <DeepExtract> if (smallIcon == null) this.smallIcon = null; if (smallIcon.contains("/")) { this.smallIcon = smallIcon.substring(smallIcon.lastIndexOf('/') + 1); } if (smallIcon.contains(".")) { this.smallIcon = smallIcon.substring(0, smallIcon.lastIndexOf('.')); } return smallIcon; </DeepExtract> }
capacitor-music-controls-plugin
positive
2,546
public TableBuilder addIntegerColumn(String name, int flags) { if (this.mBuilder == null) { this.mBuilder = new StringBuilder(); this.mBuilder.append("CREATE TABLE ").append(this.mTableName).append(" ("); } else { this.mBuilder.append(", "); } this.mBuilder.append(name).append(" ").append(TYPE_INTEGER); if ((flags & FLAG_PRIMARY_KEY) != 0) { this.mBuilder.append(" primary key "); } if ((flags & FLAG_AUTOINCREMENT) != 0) { this.mBuilder.append(" autoincrement "); } if ((flags & FLAG_NOT_NULL) != 0) { this.mBuilder.append(" not null "); } if ((flags & FLAG_COLLATE_NOCASE) != 0) { this.mBuilder.append(" collate nocase "); } return this; }
public TableBuilder addIntegerColumn(String name, int flags) { <DeepExtract> if (this.mBuilder == null) { this.mBuilder = new StringBuilder(); this.mBuilder.append("CREATE TABLE ").append(this.mTableName).append(" ("); } else { this.mBuilder.append(", "); } this.mBuilder.append(name).append(" ").append(TYPE_INTEGER); if ((flags & FLAG_PRIMARY_KEY) != 0) { this.mBuilder.append(" primary key "); } if ((flags & FLAG_AUTOINCREMENT) != 0) { this.mBuilder.append(" autoincrement "); } if ((flags & FLAG_NOT_NULL) != 0) { this.mBuilder.append(" not null "); } if ((flags & FLAG_COLLATE_NOCASE) != 0) { this.mBuilder.append(" collate nocase "); } return this; </DeepExtract> }
SorceryIconPack
positive
2,547
@Test public void moreSlop() { this.slop = 3; phrase(0, 1, 2, 4, 5, 2); inputs(0, 1, 2, 2, 2, 4, 4, 5, 1); result(2, 2, 2, 1, 1, 2, 1, 2, 1); this.slop = 4; inputs(0, 1, 2, 2, 2, 4, 4, 5, 1); result(2, 2, 2, 1, 1, 2, 1, 2, 1); this.slop = 2; inputs(0, 1, 2, 2, 2, 4, 4, 5, 1); result(1, 1, 1, 1, 1, 1, 1, 1, 1); }
@Test public void moreSlop() { this.slop = 3; phrase(0, 1, 2, 4, 5, 2); inputs(0, 1, 2, 2, 2, 4, 4, 5, 1); result(2, 2, 2, 1, 1, 2, 1, 2, 1); this.slop = 4; inputs(0, 1, 2, 2, 2, 4, 4, 5, 1); result(2, 2, 2, 1, 1, 2, 1, 2, 1); <DeepExtract> this.slop = 2; </DeepExtract> inputs(0, 1, 2, 2, 2, 4, 4, 5, 1); result(1, 1, 1, 1, 1, 1, 1, 1, 1); }
search-highlighter
positive
2,548
@Override public String getOwner(SkullMeta skull) { return skull.getOwner(); }
@Override public String getOwner(SkullMeta skull) { <DeepExtract> return skull.getOwner(); </DeepExtract> }
PlayerHeads
positive
2,550
public long randomUUID() { long timestamp = timeGen(); if (timestamp < lastTimestamp) { throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp)); } if (lastTimestamp == timestamp) { sequence = (sequence + 1) & sequenceMask; if (sequence == 0) { timestamp = tilNextMillis(lastTimestamp); } } else { sequence = 0L; } lastTimestamp = timestamp; return ((timestamp - twepoch) << timestampLeftShift) | (datacenterId << datacenterIdShift) | (workerId << workerIdShift) | sequence; }
public long randomUUID() { <DeepExtract> long timestamp = timeGen(); if (timestamp < lastTimestamp) { throw new RuntimeException(String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp)); } if (lastTimestamp == timestamp) { sequence = (sequence + 1) & sequenceMask; if (sequence == 0) { timestamp = tilNextMillis(lastTimestamp); } } else { sequence = 0L; } lastTimestamp = timestamp; return ((timestamp - twepoch) << timestampLeftShift) | (datacenterId << datacenterIdShift) | (workerId << workerIdShift) | sequence; </DeepExtract> }
gts
positive
2,551
private static RequestBody createPlaybackControllerEvent(String name, PlaybackStatePayload playbackState, SpeechStatePayload speechState, AlertsStatePayload alertState, VolumeStatePayload volumeState) { Header header = new MessageIdHeader(AVSAPIConstants.PlaybackController.NAMESPACE, name); Event event = new Event(header, new Payload()); List<ComponentState> context = Arrays.asList(ComponentStateFactory.createPlaybackState(playbackState), ComponentStateFactory.createSpeechState(speechState), ComponentStateFactory.createAlertState(alertState), ComponentStateFactory.createVolumeState(volumeState)); return new ContextEventRequestBody(context, event); }
private static RequestBody createPlaybackControllerEvent(String name, PlaybackStatePayload playbackState, SpeechStatePayload speechState, AlertsStatePayload alertState, VolumeStatePayload volumeState) { Header header = new MessageIdHeader(AVSAPIConstants.PlaybackController.NAMESPACE, name); Event event = new Event(header, new Payload()); <DeepExtract> List<ComponentState> context = Arrays.asList(ComponentStateFactory.createPlaybackState(playbackState), ComponentStateFactory.createSpeechState(speechState), ComponentStateFactory.createAlertState(alertState), ComponentStateFactory.createVolumeState(volumeState)); return new ContextEventRequestBody(context, event); </DeepExtract> }
magic-mirror-voice
positive
2,552
public static void showToastLong(final String str) { if (XDialog.appContext == null) { throw new RuntimeException("DialogUIUtils not initialized!"); } int layoutId = R.layout.dialogui_toast; if (Gravity.BOTTOM == Gravity.TOP) { if (mToastTop == null) { mToastTop = Toast.makeText(XDialog.appContext, str, Toast.LENGTH_LONG); LayoutInflater inflate = (LayoutInflater) XDialog.appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflate.inflate(layoutId, null); mToastTop.setView(view); mToastTop.setGravity(Gravity.BOTTOM, 0, XDialog.appContext.getResources().getDimensionPixelSize(R.dimen.dialogui_toast_margin)); } mToast = mToastTop; mToast.setText(str); mToast.show(); } else if (Gravity.BOTTOM == Gravity.CENTER) { if (mToastCenter == null) { mToastCenter = Toast.makeText(XDialog.appContext, str, Toast.LENGTH_LONG); LayoutInflater inflate = (LayoutInflater) XDialog.appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflate.inflate(layoutId, null); mToastCenter.setView(view); mToastCenter.setGravity(Gravity.BOTTOM, 0, 0); } mToast = mToastCenter; mToast.setText(str); mToast.show(); } else if (Gravity.BOTTOM == Gravity.BOTTOM) { if (mToastBottom == null) { mToastBottom = Toast.makeText(XDialog.appContext, str, Toast.LENGTH_LONG); LayoutInflater inflate = (LayoutInflater) XDialog.appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflate.inflate(layoutId, null); mToastBottom.setView(view); mToastBottom.setGravity(Gravity.BOTTOM, 0, XDialog.appContext.getResources().getDimensionPixelSize(R.dimen.dialogui_toast_margin)); } mToast = mToastBottom; mToast.setText(str); mToast.show(); } }
public static void showToastLong(final String str) { <DeepExtract> if (XDialog.appContext == null) { throw new RuntimeException("DialogUIUtils not initialized!"); } int layoutId = R.layout.dialogui_toast; if (Gravity.BOTTOM == Gravity.TOP) { if (mToastTop == null) { mToastTop = Toast.makeText(XDialog.appContext, str, Toast.LENGTH_LONG); LayoutInflater inflate = (LayoutInflater) XDialog.appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflate.inflate(layoutId, null); mToastTop.setView(view); mToastTop.setGravity(Gravity.BOTTOM, 0, XDialog.appContext.getResources().getDimensionPixelSize(R.dimen.dialogui_toast_margin)); } mToast = mToastTop; mToast.setText(str); mToast.show(); } else if (Gravity.BOTTOM == Gravity.CENTER) { if (mToastCenter == null) { mToastCenter = Toast.makeText(XDialog.appContext, str, Toast.LENGTH_LONG); LayoutInflater inflate = (LayoutInflater) XDialog.appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflate.inflate(layoutId, null); mToastCenter.setView(view); mToastCenter.setGravity(Gravity.BOTTOM, 0, 0); } mToast = mToastCenter; mToast.setText(str); mToast.show(); } else if (Gravity.BOTTOM == Gravity.BOTTOM) { if (mToastBottom == null) { mToastBottom = Toast.makeText(XDialog.appContext, str, Toast.LENGTH_LONG); LayoutInflater inflate = (LayoutInflater) XDialog.appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflate.inflate(layoutId, null); mToastBottom.setView(view); mToastBottom.setGravity(Gravity.BOTTOM, 0, XDialog.appContext.getResources().getDimensionPixelSize(R.dimen.dialogui_toast_margin)); } mToast = mToastBottom; mToast.setText(str); mToast.show(); } </DeepExtract> }
DialogUi
positive
2,553
@Override public void componentShown(ComponentEvent ev) { if (surface != null && !surface.requestFocusInWindow()) { surface.requestFocus(); } }
@Override public void componentShown(ComponentEvent ev) { <DeepExtract> if (surface != null && !surface.requestFocusInWindow()) { surface.requestFocus(); } </DeepExtract> }
tvnjviewer
positive
2,554
public ParserSpec endOfOptionsDelimiter(String delimiter) { if (delimiter == null) { throw new NullPointerException("end-of-options delimiter"); } return delimiter; return this; }
public ParserSpec endOfOptionsDelimiter(String delimiter) { <DeepExtract> if (delimiter == null) { throw new NullPointerException("end-of-options delimiter"); } return delimiter; </DeepExtract> return this; }
eclipstyle
positive
2,555
public void removePoint(MapPoint mapPoint) { points.remove(mapPoint); path = null; extension = null; }
public void removePoint(MapPoint mapPoint) { points.remove(mapPoint); <DeepExtract> path = null; extension = null; </DeepExtract> }
JMapProjLib
positive
2,556
private PostRequest createPostRequest(String path, JSONObject body) throws LiveOperationException { assert !TextUtils.isEmpty(path); assert body != null; HttpEntity entity; assert body != null; try { entity = new JsonEntity(body); } catch (UnsupportedEncodingException e) { throw new LiveOperationException(ErrorMessages.CLIENT_ERROR, e); } return new PostRequest(this.session, this.httpClient, path, entity); }
private PostRequest createPostRequest(String path, JSONObject body) throws LiveOperationException { assert !TextUtils.isEmpty(path); assert body != null; <DeepExtract> HttpEntity entity; assert body != null; try { entity = new JsonEntity(body); } catch (UnsupportedEncodingException e) { throw new LiveOperationException(ErrorMessages.CLIENT_ERROR, e); } </DeepExtract> return new PostRequest(this.session, this.httpClient, path, entity); }
LiveSDK-for-Android
positive
2,558
public void setMonthValue(int month) { if (month == m_month) return; checkForDate(m_day, month, m_year, "Invalid month value:" + month); m_day = m_day; m_month = month; m_year = m_year; m_dayOfWeek = getDayOfWeek(m_day, m_month, m_year); }
public void setMonthValue(int month) { if (month == m_month) return; checkForDate(m_day, month, m_year, "Invalid month value:" + month); <DeepExtract> m_day = m_day; m_month = month; m_year = m_year; m_dayOfWeek = getDayOfWeek(m_day, m_month, m_year); </DeepExtract> }
Java-Nov-2020
positive
2,559
public static String newStringUtf16Le(byte[] bytes) { if (bytes == null) { return null; } try { return new String(bytes, CharEncoding.UTF_16LE); } catch (UnsupportedEncodingException e) { throw StringUtils.newIllegalStateException(CharEncoding.UTF_16LE, e); } }
public static String newStringUtf16Le(byte[] bytes) { <DeepExtract> if (bytes == null) { return null; } try { return new String(bytes, CharEncoding.UTF_16LE); } catch (UnsupportedEncodingException e) { throw StringUtils.newIllegalStateException(CharEncoding.UTF_16LE, e); } </DeepExtract> }
jsonde
positive
2,560
public SystemCommand withIgnoringStdoutConsumer() { if (stdoutHandler != null) { throw new RuntimeException("There can only be one consumer."); } this.stdoutHandler = new IgnoringCommandOutputHandler(); return this; }
public SystemCommand withIgnoringStdoutConsumer() { <DeepExtract> if (stdoutHandler != null) { throw new RuntimeException("There can only be one consumer."); } this.stdoutHandler = new IgnoringCommandOutputHandler(); return this; </DeepExtract> }
unix-maven-plugin
positive
2,561
void add(AbstractOptionSpec<?> spec) { detectedSpecs.add(spec); for (String each : spec.options()) detectedOptions.put(each, spec); List<String> optionArguments = optionsToArguments.get(spec); if (optionArguments == null) { optionArguments = new ArrayList<String>(); optionsToArguments.put(spec, optionArguments); } if (null != null) optionArguments.add(null); }
void add(AbstractOptionSpec<?> spec) { <DeepExtract> detectedSpecs.add(spec); for (String each : spec.options()) detectedOptions.put(each, spec); List<String> optionArguments = optionsToArguments.get(spec); if (optionArguments == null) { optionArguments = new ArrayList<String>(); optionsToArguments.put(spec, optionArguments); } if (null != null) optionArguments.add(null); </DeepExtract> }
tlv-comp
positive
2,562
@Override public synchronized void drop(DropTargetDropEvent dtde) { jTabbedPane1.setBorder(null); dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); try { if (canImport(dtde.getTransferable().getTransferDataFlavors())) { files = (List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor); THREAD_POOL.execute(() -> { _file_drop_notify(files); }); } } catch (Exception ex) { JOptionPane.showMessageDialog(main_panel.getView(), LabelTranslatorSingleton.getInstance().translate("ERROR DOING DRAG AND DROP WITH THIS FILE (use button method)"), "Error", JOptionPane.ERROR_MESSAGE); } }
@Override public synchronized void drop(DropTargetDropEvent dtde) { <DeepExtract> jTabbedPane1.setBorder(null); </DeepExtract> dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); try { if (canImport(dtde.getTransferable().getTransferDataFlavors())) { files = (List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor); THREAD_POOL.execute(() -> { _file_drop_notify(files); }); } } catch (Exception ex) { JOptionPane.showMessageDialog(main_panel.getView(), LabelTranslatorSingleton.getInstance().translate("ERROR DOING DRAG AND DROP WITH THIS FILE (use button method)"), "Error", JOptionPane.ERROR_MESSAGE); } }
megabasterd
positive
2,563
public Criteria andSecretLessThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "secret" + " cannot be null"); } criteria.add(new Criterion("secret <", value)); return (Criteria) this; }
public Criteria andSecretLessThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "secret" + " cannot be null"); } criteria.add(new Criterion("secret <", value)); </DeepExtract> return (Criteria) this; }
oauth4j
positive
2,565
public static void loadMessageDataWithPayloadAtDefaultOffset(byte[] messageData, UInt64 tags) { int offset = PAYLOAD_OFFSET; byte[] memberData; memberData = tags; System.arraycopy(memberData, 0, messageData, offset, memberData.length); offset += memberData.length; }
public static void loadMessageDataWithPayloadAtDefaultOffset(byte[] messageData, UInt64 tags) { int offset = PAYLOAD_OFFSET; <DeepExtract> byte[] memberData; memberData = tags; System.arraycopy(memberData, 0, messageData, offset, memberData.length); offset += memberData.length; </DeepExtract> }
lifx-sdk-android
positive
2,566
public static Date withSecond(Date date, long newValue) { Objects.requireNonNull(date, "temporal"); return date.with(ChronoField.SECOND_OF_MINUTE, newValue); }
public static Date withSecond(Date date, long newValue) { <DeepExtract> Objects.requireNonNull(date, "temporal"); return date.with(ChronoField.SECOND_OF_MINUTE, newValue); </DeepExtract> }
jstarcraft-nlp
positive
2,567
@Override public void run() { System.err.println("RawCapturer: notifyFailure for " + dependents.size()); for (CaptureEventListener s : dependents) { s.captureFailed(this, exception); } }
@Override public void run() { <DeepExtract> System.err.println("RawCapturer: notifyFailure for " + dependents.size()); for (CaptureEventListener s : dependents) { s.captureFailed(this, exception); } </DeepExtract> }
crowdpp
positive
2,568
@Override public void setEnvironment(Environment env) { RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "druid."); initialSize = Integer.parseInt(propertyResolver.getProperty("initialSize")); minIdle = Integer.parseInt(propertyResolver.getProperty("minIdle")); maxActive = Integer.parseInt(propertyResolver.getProperty("maxActive")); maxWait = Long.parseLong(propertyResolver.getProperty("maxWait")); timeBetweenEvictionRunsMillis = Long.parseLong(propertyResolver.getProperty("timeBetweenEvictionRunsMillis")); minEvictableIdleTimeMillis = Long.parseLong(propertyResolver.getProperty("minEvictableIdleTimeMillis")); validationQuery = propertyResolver.getProperty("validationQuery"); testWhileIdle = Boolean.parseBoolean(propertyResolver.getProperty("testWhileIdle")); testOnBorrow = Boolean.parseBoolean(propertyResolver.getProperty("testOnBorrow")); testOnReturn = Boolean.parseBoolean(propertyResolver.getProperty("testOnReturn")); poolPreparedStatements = Boolean.parseBoolean(propertyResolver.getProperty("poolPreparedStatements")); maxPoolPreparedStatementPerConnectionSize = Integer.parseInt(propertyResolver.getProperty("maxPoolPreparedStatementPerConnectionSize")); filters = propertyResolver.getProperty("filters"); connectionProperties = propertyResolver.getProperty("connectionProperties"); RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "master.datasource."); Map<String, Object> dsMap = new HashMap<>(); dsMap.put("type", propertyResolver.getProperty("type")); dsMap.put("driver-class-name", propertyResolver.getProperty("driver-class-name")); dsMap.put("url", propertyResolver.getProperty("url")); dsMap.put("username", propertyResolver.getProperty("username")); dsMap.put("password", propertyResolver.getProperty("password")); defaultDataSource = buildDataSource(dsMap); dataBinder(defaultDataSource, env); RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "slave.datasource."); String dsPrefixs = propertyResolver.getProperty("names"); for (String dsPrefix : dsPrefixs.split(",")) { Map<String, Object> dsMap = propertyResolver.getSubProperties(dsPrefix + "."); DataSource ds = buildDataSource(dsMap); customDataSources.put(dsPrefix, ds); dataBinder(ds, env); } }
@Override public void setEnvironment(Environment env) { RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "druid."); initialSize = Integer.parseInt(propertyResolver.getProperty("initialSize")); minIdle = Integer.parseInt(propertyResolver.getProperty("minIdle")); maxActive = Integer.parseInt(propertyResolver.getProperty("maxActive")); maxWait = Long.parseLong(propertyResolver.getProperty("maxWait")); timeBetweenEvictionRunsMillis = Long.parseLong(propertyResolver.getProperty("timeBetweenEvictionRunsMillis")); minEvictableIdleTimeMillis = Long.parseLong(propertyResolver.getProperty("minEvictableIdleTimeMillis")); validationQuery = propertyResolver.getProperty("validationQuery"); testWhileIdle = Boolean.parseBoolean(propertyResolver.getProperty("testWhileIdle")); testOnBorrow = Boolean.parseBoolean(propertyResolver.getProperty("testOnBorrow")); testOnReturn = Boolean.parseBoolean(propertyResolver.getProperty("testOnReturn")); poolPreparedStatements = Boolean.parseBoolean(propertyResolver.getProperty("poolPreparedStatements")); maxPoolPreparedStatementPerConnectionSize = Integer.parseInt(propertyResolver.getProperty("maxPoolPreparedStatementPerConnectionSize")); filters = propertyResolver.getProperty("filters"); connectionProperties = propertyResolver.getProperty("connectionProperties"); RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "master.datasource."); Map<String, Object> dsMap = new HashMap<>(); dsMap.put("type", propertyResolver.getProperty("type")); dsMap.put("driver-class-name", propertyResolver.getProperty("driver-class-name")); dsMap.put("url", propertyResolver.getProperty("url")); dsMap.put("username", propertyResolver.getProperty("username")); dsMap.put("password", propertyResolver.getProperty("password")); defaultDataSource = buildDataSource(dsMap); dataBinder(defaultDataSource, env); <DeepExtract> RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "slave.datasource."); String dsPrefixs = propertyResolver.getProperty("names"); for (String dsPrefix : dsPrefixs.split(",")) { Map<String, Object> dsMap = propertyResolver.getSubProperties(dsPrefix + "."); DataSource ds = buildDataSource(dsMap); customDataSources.put(dsPrefix, ds); dataBinder(ds, env); } </DeepExtract> }
spring-boot-sample
positive
2,569
@Override public void onCompletion(MediaPlayer mp) { mPlayPause.setImageResource(R.drawable.ic_play); mVideoView.stopPlayback(); mHandlerForProgressBar.removeCallbacks(mRunnForProgressBar); mPbForPlaying.setProgress(0); mIsPlaying = 0; mPlayPause.setImageResource(R.drawable.ic_play); }
@Override public void onCompletion(MediaPlayer mp) { mPlayPause.setImageResource(R.drawable.ic_play); <DeepExtract> mVideoView.stopPlayback(); mHandlerForProgressBar.removeCallbacks(mRunnForProgressBar); mPbForPlaying.setProgress(0); mIsPlaying = 0; mPlayPause.setImageResource(R.drawable.ic_play); </DeepExtract> }
Spika
positive
2,570
public void showDialog(boolean files_selected) { if (files_selected) { selected_files = true; selectedFilenamesIndices = MyVariables.getSelectedFilenamesIndices(); files = MyVariables.getLoadedFiles(); } progressBar.setVisible(false); pack(); setLocationByPlatform(true); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("renamephotos.title")); RenamingGeneralText.setText(String.format(ProgramTexts.HTML, 650, ResourceBundle.getBundle("translations/program_strings").getString("rph.toptext"))); RenamingDuplicateNames.setText(String.format(ProgramTexts.HTML, 370, ResourceBundle.getBundle("translations/program_strings").getString("rph.duplicatestext"))); RenamingSourceFoldertextField.setText(""); for (String item : MyConstants.DATES_TIMES_STRINGS) { prefixDate_timecomboBox.addItem(item); suffixDatetimecomboBox.addItem(item); } for (String item : MyConstants.DATES_STRINGS) { prefixDatecomboBox.addItem(item); suffixDatecomboBox.addItem(item); } for (int digit = 2; digit <= 6; digit++) { DigitscomboBox.addItem(digit); } StartOnImgcomboBox.addItem(ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitszero")); StartOnImgcomboBox.addItem(ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitsone")); StartOnImgcomboBox.addItem(ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitstwo")); StartOnImgcomboBox.setSelectedIndex(1); setVisible(true); }
public void showDialog(boolean files_selected) { if (files_selected) { selected_files = true; selectedFilenamesIndices = MyVariables.getSelectedFilenamesIndices(); files = MyVariables.getLoadedFiles(); } progressBar.setVisible(false); pack(); setLocationByPlatform(true); setTitle(ResourceBundle.getBundle("translations/program_strings").getString("renamephotos.title")); <DeepExtract> RenamingGeneralText.setText(String.format(ProgramTexts.HTML, 650, ResourceBundle.getBundle("translations/program_strings").getString("rph.toptext"))); RenamingDuplicateNames.setText(String.format(ProgramTexts.HTML, 370, ResourceBundle.getBundle("translations/program_strings").getString("rph.duplicatestext"))); RenamingSourceFoldertextField.setText(""); for (String item : MyConstants.DATES_TIMES_STRINGS) { prefixDate_timecomboBox.addItem(item); suffixDatetimecomboBox.addItem(item); } for (String item : MyConstants.DATES_STRINGS) { prefixDatecomboBox.addItem(item); suffixDatecomboBox.addItem(item); } for (int digit = 2; digit <= 6; digit++) { DigitscomboBox.addItem(digit); } StartOnImgcomboBox.addItem(ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitszero")); StartOnImgcomboBox.addItem(ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitsone")); StartOnImgcomboBox.addItem(ResourceBundle.getBundle("translations/program_strings").getString("rph.nooffidgitstwo")); StartOnImgcomboBox.setSelectedIndex(1); </DeepExtract> setVisible(true); }
jExifToolGUI
positive
2,571
@Test public void chunkIteratorOverBitmapOfZerosAndOnes() { EWAHCompressedBitmap bitmap = EWAHCompressedBitmap.bitmapOf(); bitmap.setSizeInBits(WORD_IN_BITS + 10, false); bitmap.setSizeInBits(2 * WORD_IN_BITS, true); ChunkIterator iterator; EWAHCompressedBitmap bitmap = EWAHCompressedBitmap.bitmapOf(0, 1, 2, 3, 4, 7, 8, 9, 10); ChunkIterator iterator = bitmap.chunkIterator(); Assert.assertTrue(iterator.hasNext()); Assert.assertTrue(iterator.nextBit()); Assert.assertEquals(5, iterator.nextLength()); iterator.move(2); Assert.assertTrue(iterator.hasNext()); Assert.assertTrue(iterator.nextBit()); Assert.assertEquals(3, iterator.nextLength()); iterator.move(); Assert.assertTrue(iterator.hasNext()); Assert.assertFalse(iterator.nextBit()); Assert.assertEquals(2, iterator.nextLength()); iterator.move(5); Assert.assertTrue(iterator.hasNext()); Assert.assertTrue(iterator.nextBit()); Assert.assertEquals(1, iterator.nextLength()); iterator.move(); Assert.assertFalse(iterator.hasNext()); Assert.assertTrue(iterator.hasNext()); Assert.assertFalse(iterator.nextBit()); Assert.assertEquals(WORD_IN_BITS + 10.sizeInBits(), iterator.nextLength().sizeInBits()); assertEqualsPositions(WORD_IN_BITS + 10, iterator.nextLength()); iterator.move(); Assert.assertTrue(iterator.hasNext()); Assert.assertTrue(iterator.nextBit()); Assert.assertEquals(WORD_IN_BITS - 10.sizeInBits(), iterator.nextLength().sizeInBits()); assertEqualsPositions(WORD_IN_BITS - 10, iterator.nextLength()); iterator.move(); Assert.assertFalse(iterator.hasNext()); }
@Test public void chunkIteratorOverBitmapOfZerosAndOnes() { EWAHCompressedBitmap bitmap = EWAHCompressedBitmap.bitmapOf(); bitmap.setSizeInBits(WORD_IN_BITS + 10, false); bitmap.setSizeInBits(2 * WORD_IN_BITS, true); ChunkIterator iterator; EWAHCompressedBitmap bitmap = EWAHCompressedBitmap.bitmapOf(0, 1, 2, 3, 4, 7, 8, 9, 10); ChunkIterator iterator = bitmap.chunkIterator(); Assert.assertTrue(iterator.hasNext()); Assert.assertTrue(iterator.nextBit()); Assert.assertEquals(5, iterator.nextLength()); iterator.move(2); Assert.assertTrue(iterator.hasNext()); Assert.assertTrue(iterator.nextBit()); Assert.assertEquals(3, iterator.nextLength()); iterator.move(); Assert.assertTrue(iterator.hasNext()); Assert.assertFalse(iterator.nextBit()); Assert.assertEquals(2, iterator.nextLength()); iterator.move(5); Assert.assertTrue(iterator.hasNext()); Assert.assertTrue(iterator.nextBit()); Assert.assertEquals(1, iterator.nextLength()); iterator.move(); Assert.assertFalse(iterator.hasNext()); Assert.assertTrue(iterator.hasNext()); Assert.assertFalse(iterator.nextBit()); Assert.assertEquals(WORD_IN_BITS + 10.sizeInBits(), iterator.nextLength().sizeInBits()); assertEqualsPositions(WORD_IN_BITS + 10, iterator.nextLength()); iterator.move(); Assert.assertTrue(iterator.hasNext()); Assert.assertTrue(iterator.nextBit()); <DeepExtract> Assert.assertEquals(WORD_IN_BITS - 10.sizeInBits(), iterator.nextLength().sizeInBits()); assertEqualsPositions(WORD_IN_BITS - 10, iterator.nextLength()); </DeepExtract> iterator.move(); Assert.assertFalse(iterator.hasNext()); }
javaewah
positive
2,572
public static String getRelativePwdPath(File target) { if (target.getAbsolutePath().startsWith(new File("").getAbsolutePath())) { String relativePath = target.getAbsolutePath().substring(new File("").getAbsolutePath().length() + 1); relativePath = relativePath.replaceAll(Pattern.quote(File.separator), "/"); return relativePath; } else { return target.getAbsolutePath(); } }
public static String getRelativePwdPath(File target) { <DeepExtract> if (target.getAbsolutePath().startsWith(new File("").getAbsolutePath())) { String relativePath = target.getAbsolutePath().substring(new File("").getAbsolutePath().length() + 1); relativePath = relativePath.replaceAll(Pattern.quote(File.separator), "/"); return relativePath; } else { return target.getAbsolutePath(); } </DeepExtract> }
Repeat
positive
2,573
public boolean isIgnorable() { IsIgnorableIterator iterator = new IsIgnorableIterator(); iterator.onIterationStarted(); iterator.onElementGroupStarted(mNameData.getEntryLabel()); iterator.onElement(mNameData); iterator.onElementGroupEnded(); iterateOneList(mPhoneList, iterator); iterateOneList(mEmailList, iterator); iterateOneList(mPostalList, iterator); iterateOneList(mOrganizationList, iterator); iterateOneList(mImList, iterator); iterateOneList(mPhotoList, iterator); iterateOneList(mWebsiteList, iterator); iterateOneList(mSipList, iterator); iterateOneList(mNicknameList, iterator); iterateOneList(mNoteList, iterator); iterateOneList(mAndroidCustomDataList, iterator); if (mBirthday != null) { iterator.onElementGroupStarted(mBirthday.getEntryLabel()); iterator.onElement(mBirthday); iterator.onElementGroupEnded(); } if (mAnniversary != null) { iterator.onElementGroupStarted(mAnniversary.getEntryLabel()); iterator.onElement(mAnniversary); iterator.onElementGroupEnded(); } iterator.onIterationEnded(); return mEmpty; }
public boolean isIgnorable() { IsIgnorableIterator iterator = new IsIgnorableIterator(); iterator.onIterationStarted(); iterator.onElementGroupStarted(mNameData.getEntryLabel()); iterator.onElement(mNameData); iterator.onElementGroupEnded(); iterateOneList(mPhoneList, iterator); iterateOneList(mEmailList, iterator); iterateOneList(mPostalList, iterator); iterateOneList(mOrganizationList, iterator); iterateOneList(mImList, iterator); iterateOneList(mPhotoList, iterator); iterateOneList(mWebsiteList, iterator); iterateOneList(mSipList, iterator); iterateOneList(mNicknameList, iterator); iterateOneList(mNoteList, iterator); iterateOneList(mAndroidCustomDataList, iterator); if (mBirthday != null) { iterator.onElementGroupStarted(mBirthday.getEntryLabel()); iterator.onElement(mBirthday); iterator.onElementGroupEnded(); } if (mAnniversary != null) { iterator.onElementGroupStarted(mAnniversary.getEntryLabel()); iterator.onElement(mAnniversary); iterator.onElementGroupEnded(); } iterator.onIterationEnded(); <DeepExtract> return mEmpty; </DeepExtract> }
MyBluetoothDemo
positive
2,574
public Builder clearUserName() { bitField0_ = (bitField0_ & ~0x00000002); java.lang.Object ref = userName_; if (ref instanceof java.lang.String) { userName_ = (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { userName_ = s; } userName_ = s; } onChanged(); return this; }
public Builder clearUserName() { bitField0_ = (bitField0_ & ~0x00000002); <DeepExtract> java.lang.Object ref = userName_; if (ref instanceof java.lang.String) { userName_ = (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { userName_ = s; } userName_ = s; } </DeepExtract> onChanged(); return this; }
nettydemo
positive
2,577
@Override public void initialize() { bindings.put(ArticlesService.class, ArticlesServiceImpl.class); bindings.put(OrdersService.class, OrdersServiceImpl.class); bindings.put(SalesFunnelsService.class, SalesFunnelsServiceImpl.class); }
@Override public void initialize() { bindings.put(ArticlesService.class, ArticlesServiceImpl.class); bindings.put(OrdersService.class, OrdersServiceImpl.class); <DeepExtract> bindings.put(SalesFunnelsService.class, SalesFunnelsServiceImpl.class); </DeepExtract> }
shopee4j
positive
2,579
public void suspend() { if (mMediaPlayer != null) { mMediaPlayer.reset(); mMediaPlayer.release(); mMediaPlayer = null; mCurrentState = STATE_IDLE; if (false) { mTargetState = STATE_IDLE; } AudioManager am = (AudioManager) mAppContext.getSystemService(Context.AUDIO_SERVICE); am.abandonAudioFocus(null); } }
public void suspend() { <DeepExtract> if (mMediaPlayer != null) { mMediaPlayer.reset(); mMediaPlayer.release(); mMediaPlayer = null; mCurrentState = STATE_IDLE; if (false) { mTargetState = STATE_IDLE; } AudioManager am = (AudioManager) mAppContext.getSystemService(Context.AUDIO_SERVICE); am.abandonAudioFocus(null); } </DeepExtract> }
FastVideoPlayer
positive
2,580
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { JasDocument doc = new JasDocument(ErrorLabel, this); if (doc.open()) { addDocument(doc); } }
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> JasDocument doc = new JasDocument(ErrorLabel, this); if (doc.open()) { addDocument(doc); } </DeepExtract> }
Jasmin
positive
2,581
private void addRows(List<EmployeeAllocation> result, int failday) { int rows = getRowCount(); int c = 0; setWidget(rows, c++, new TableSetSortingButton(i18n.name(), TableSortCriteria.BY_NAME, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.shifts(), TableSortCriteria.BY_SHIFTS, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.morningsAndAfternoons(), TableSortCriteria.BY_SHIFTS, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.nights(), TableSortCriteria.BY_NIGHTS, this, ctx)); if (noSolutionPanelMode) { setWidget(rows, c++, new TableSetSortingButton(i18n.today(), TableSortCriteria.BY_NAME, this, ctx)); setWidget(rows, c++, new TableSetSortingButton("5 " + i18n.days(), TableSortCriteria.BY_NAME, this, ctx)); setWidget(rows, c++, new TableSetSortingButton("Y/N", TableSortCriteria.BY_NAME, this, ctx)); } setWidget(rows, c++, new TableSetSortingButton(i18n.role(), TableSortCriteria.BY_ROLE, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.fulltime(), TableSortCriteria.BY_FULLTIME, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.dayListing(), TableSortCriteria.BY_SHIFTS, this, ctx)); if (result != null) { for (EmployeeAllocation employeeAllocation : result) { addRow(employeeAllocation, failday); } } }
private void addRows(List<EmployeeAllocation> result, int failday) { <DeepExtract> int rows = getRowCount(); int c = 0; setWidget(rows, c++, new TableSetSortingButton(i18n.name(), TableSortCriteria.BY_NAME, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.shifts(), TableSortCriteria.BY_SHIFTS, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.morningsAndAfternoons(), TableSortCriteria.BY_SHIFTS, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.nights(), TableSortCriteria.BY_NIGHTS, this, ctx)); if (noSolutionPanelMode) { setWidget(rows, c++, new TableSetSortingButton(i18n.today(), TableSortCriteria.BY_NAME, this, ctx)); setWidget(rows, c++, new TableSetSortingButton("5 " + i18n.days(), TableSortCriteria.BY_NAME, this, ctx)); setWidget(rows, c++, new TableSetSortingButton("Y/N", TableSortCriteria.BY_NAME, this, ctx)); } setWidget(rows, c++, new TableSetSortingButton(i18n.role(), TableSortCriteria.BY_ROLE, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.fulltime(), TableSortCriteria.BY_FULLTIME, this, ctx)); setWidget(rows, c++, new TableSetSortingButton(i18n.dayListing(), TableSortCriteria.BY_SHIFTS, this, ctx)); </DeepExtract> if (result != null) { for (EmployeeAllocation employeeAllocation : result) { addRow(employeeAllocation, failday); } } }
shifts-solver
positive
2,582
public void actionPerformed(java.awt.event.ActionEvent evt) { Object obj1 = cbb_Search_LoaiSP.getSelectedItem(); Object obj2 = cbb_Search_NhaCC.getSelectedItem(); Object obj3 = cbb_Search_NhomKH.getSelectedItem(); loadCombobox_LoaiSP_Search(); loadCombobox_NhaCungCap_Search(); loadCombobox_NhomKhachHang_Search(); cbb_Search_LoaiSP.setSelectedItem(obj1); cbb_Search_NhaCC.setSelectedItem(obj2); cbb_Search_NhomKH.setSelectedItem(obj3); }
public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> Object obj1 = cbb_Search_LoaiSP.getSelectedItem(); Object obj2 = cbb_Search_NhaCC.getSelectedItem(); Object obj3 = cbb_Search_NhomKH.getSelectedItem(); loadCombobox_LoaiSP_Search(); loadCombobox_NhaCungCap_Search(); loadCombobox_NhomKhachHang_Search(); cbb_Search_LoaiSP.setSelectedItem(obj1); cbb_Search_NhaCC.setSelectedItem(obj2); cbb_Search_NhomKH.setSelectedItem(obj3); </DeepExtract> }
StoreManager
positive
2,583
public void requestVoteReply(Message message, int fromMemberId, int term, boolean isPrevote, boolean voteGranted) throws InterruptedException, GondolaException { logger.error("Handler not implemented: type={} size={} from={}", message.getType(), message.size(), fromMemberId); throw new IllegalStateException("not implemented"); }
public void requestVoteReply(Message message, int fromMemberId, int term, boolean isPrevote, boolean voteGranted) throws InterruptedException, GondolaException { <DeepExtract> logger.error("Handler not implemented: type={} size={} from={}", message.getType(), message.size(), fromMemberId); throw new IllegalStateException("not implemented"); </DeepExtract> }
gondola
positive
2,584
@Test public void testFindByWikiIdAndPathAndCommit() throws Exception { CommitId commitId = COMMIT_ID; RevCommit rc; File folder = temporaryFolder.newFolder(); try (Git git = Git.init().setDirectory(folder).call()) { rc = git.commit().setMessage(MESSAGE_PANIC.getValue()).setAuthor(DISPLAY_NAME_TRILLIAN.getValue(), EMAIL_TRILLIAN.getValue()).call(); } when(gitClient.getCommitFromId(commitId.getValue())).thenReturn(rc); when(gitClient.pathContentAtCommit(Pages.filepath(Path.valueOf("Home")), rc)).thenReturn(Optional.of("Content 0")); Optional<Page> optionalPage = pageRepository.findByWikiIdAndPathAndCommit(wikiId, Path.valueOf("Home"), commitId); assertEquals("Content 0", optionalPage.get().getContent().getValue()); }
@Test public void testFindByWikiIdAndPathAndCommit() throws Exception { CommitId commitId = COMMIT_ID; <DeepExtract> RevCommit rc; File folder = temporaryFolder.newFolder(); try (Git git = Git.init().setDirectory(folder).call()) { rc = git.commit().setMessage(MESSAGE_PANIC.getValue()).setAuthor(DISPLAY_NAME_TRILLIAN.getValue(), EMAIL_TRILLIAN.getValue()).call(); } </DeepExtract> when(gitClient.getCommitFromId(commitId.getValue())).thenReturn(rc); when(gitClient.pathContentAtCommit(Pages.filepath(Path.valueOf("Home")), rc)).thenReturn(Optional.of("Content 0")); Optional<Page> optionalPage = pageRepository.findByWikiIdAndPathAndCommit(wikiId, Path.valueOf("Home"), commitId); assertEquals("Content 0", optionalPage.get().getContent().getValue()); }
smeagol
positive
2,585
public static void drawOutlineBox(Box box, float r, float g, float b, float a) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glLineWidth(2.5F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LINE_SMOOTH); offsetRender(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(3, VertexFormats.POSITION_COLOR); buffer.vertex(box.minX, box.minY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.minY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.minY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.minY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.maxY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.maxY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.minY, box.maxZ).color(r, g, b, 0f).next(); buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, g, b, 0f).next(); buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.minY, box.minZ).color(r, g, b, 0f).next(); buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, g, b, a).next(); tessellator.draw(); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); }
public static void drawOutlineBox(Box box, float r, float g, float b, float a) { GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glLineWidth(2.5F); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LINE_SMOOTH); offsetRender(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); buffer.begin(3, VertexFormats.POSITION_COLOR); buffer.vertex(box.minX, box.minY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.minY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.minY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.minY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.maxY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.maxY, box.minZ).color(r, g, b, a).next(); buffer.vertex(box.minX, box.minY, box.maxZ).color(r, g, b, 0f).next(); buffer.vertex(box.minX, box.maxY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.minY, box.maxZ).color(r, g, b, 0f).next(); buffer.vertex(box.maxX, box.maxY, box.maxZ).color(r, g, b, a).next(); buffer.vertex(box.maxX, box.minY, box.minZ).color(r, g, b, 0f).next(); buffer.vertex(box.maxX, box.maxY, box.minZ).color(r, g, b, a).next(); tessellator.draw(); <DeepExtract> GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); </DeepExtract> }
BigRat
positive
2,586
public static void main(String[] args) { ValueIteration vi = new ValueIteration(Windygrid.createFour(), Windygrid.createFour()); vi.untilBelow(DecimalScalar.of(.001)); final Tensor values = vi.vs().values(); System.out.println("iterations=" + vi.iterations()); System.out.println(values); Policy policy = PolicyType.GREEDY.bestEquiprobable(Windygrid.createFour(), vi.vs(), null); EpisodeInterface episodeInterface = EpisodeKickoff.single(Windygrid.createFour(), policy); while (episodeInterface.hasNext()) { StepInterface stepInterface = episodeInterface.step(); System.out.println(stepInterface.prevState() + " + " + stepInterface.action() + " -> " + stepInterface.nextState()); } ValueIteration vi = new ValueIteration(Windygrid.createKing(), Windygrid.createKing()); vi.untilBelow(DecimalScalar.of(.001)); final Tensor values = vi.vs().values(); System.out.println("iterations=" + vi.iterations()); System.out.println(values); Policy policy = PolicyType.GREEDY.bestEquiprobable(Windygrid.createKing(), vi.vs(), null); EpisodeInterface episodeInterface = EpisodeKickoff.single(Windygrid.createKing(), policy); while (episodeInterface.hasNext()) { StepInterface stepInterface = episodeInterface.step(); System.out.println(stepInterface.prevState() + " + " + stepInterface.action() + " -> " + stepInterface.nextState()); } }
public static void main(String[] args) { ValueIteration vi = new ValueIteration(Windygrid.createFour(), Windygrid.createFour()); vi.untilBelow(DecimalScalar.of(.001)); final Tensor values = vi.vs().values(); System.out.println("iterations=" + vi.iterations()); System.out.println(values); Policy policy = PolicyType.GREEDY.bestEquiprobable(Windygrid.createFour(), vi.vs(), null); EpisodeInterface episodeInterface = EpisodeKickoff.single(Windygrid.createFour(), policy); while (episodeInterface.hasNext()) { StepInterface stepInterface = episodeInterface.step(); System.out.println(stepInterface.prevState() + " + " + stepInterface.action() + " -> " + stepInterface.nextState()); } <DeepExtract> ValueIteration vi = new ValueIteration(Windygrid.createKing(), Windygrid.createKing()); vi.untilBelow(DecimalScalar.of(.001)); final Tensor values = vi.vs().values(); System.out.println("iterations=" + vi.iterations()); System.out.println(values); Policy policy = PolicyType.GREEDY.bestEquiprobable(Windygrid.createKing(), vi.vs(), null); EpisodeInterface episodeInterface = EpisodeKickoff.single(Windygrid.createKing(), policy); while (episodeInterface.hasNext()) { StepInterface stepInterface = episodeInterface.step(); System.out.println(stepInterface.prevState() + " + " + stepInterface.action() + " -> " + stepInterface.nextState()); } </DeepExtract> }
subare
positive
2,587
public static void exportPngImage(DimensionData biomeData, DimensionMarkersData globalMarkers, DimensionMarkersData localMarkers, File file, boolean showMarkers) { getListener().setHeaderString("gui.antiqueatlas.export.setup"); int minX = (biomeData.getScope().minX - 1) * TILE_SIZE; int minY = (biomeData.getScope().minY - 1) * TILE_SIZE; int outWidth = (biomeData.getScope().maxX + 2) * TILE_SIZE - minX; int outHeight = (biomeData.getScope().maxY + 2) * TILE_SIZE - minY; Log.info("Image size: %dx%d", outWidth, outHeight); getListener().setStatusString("gui.antiqueatlas.export.makingbuffer", outWidth, outHeight); BufferedImage outImage = new BufferedImage(outWidth, outHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = outImage.createGraphics(); int scale = 2; int bgTilesX = Math.round((float) outWidth / (float) BG_TILE_SIZE / (float) scale); int bgTilesY = Math.round((float) outHeight / (float) BG_TILE_SIZE / (float) scale); getListener().setStatusString("gui.antiqueatlas.export.loadingtextures"); getListener().setProgressMax(-1); BufferedImage bg = null; Map<ResourceLocation, BufferedImage> textureImageMap = new HashMap<>(); try { InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(Textures.EXPORTED_BG).getInputStream(); bg = ImageIO.read(is); is.close(); List<ResourceLocation> allTextures = new ArrayList<>(64); allTextures.addAll(BiomeTextureMap.instance().getAllTextures()); if (showMarkers) { for (MarkerType type : MarkerRegistry.getValues()) { allTextures.addAll(Arrays.asList(type.getAllIcons())); } } for (ResourceLocation texture : allTextures) { try { is = Minecraft.getMinecraft().getResourceManager().getResource(texture).getInputStream(); BufferedImage tileImage = ImageIO.read(is); is.close(); textureImageMap.put(texture, tileImage); } catch (FileNotFoundException e) { Log.warn("Texture %s not found!", texture.toString()); } } } catch (IOException e) { e.printStackTrace(); } getListener().setHeaderString("gui.antiqueatlas.export.rendering"); getListener().setStatusString("gui.antiqueatlas.export.rendering.background"); getListener().setProgressMax(bgTilesX * bgTilesY); graphics.drawImage(bg, 0, 0, BG_TILE_SIZE * scale, BG_TILE_SIZE * scale, 0, 0, BG_TILE_SIZE, BG_TILE_SIZE, null); getListener().addProgress(1); for (int x = 1; x < bgTilesX; x++) { graphics.drawImage(bg, x * BG_TILE_SIZE * scale, 0, (x + 1) * BG_TILE_SIZE * scale, BG_TILE_SIZE * scale, BG_TILE_SIZE, 0, BG_TILE_SIZE * 2, BG_TILE_SIZE, null); getListener().addProgress(1); } for (int y = 1; y < bgTilesY; y++) { graphics.drawImage(bg, 0, y * BG_TILE_SIZE * scale, BG_TILE_SIZE * scale, (y + 1) * BG_TILE_SIZE * scale, 0, BG_TILE_SIZE, BG_TILE_SIZE, BG_TILE_SIZE * 2, null); getListener().addProgress(1); } for (int x = 1; x < bgTilesX; x++) { for (int y = 1; y < bgTilesY; y++) { graphics.drawImage(bg, x * BG_TILE_SIZE * scale, y * BG_TILE_SIZE * scale, (x + 1) * BG_TILE_SIZE * scale, (y + 1) * BG_TILE_SIZE * scale, BG_TILE_SIZE, BG_TILE_SIZE, BG_TILE_SIZE * 2, BG_TILE_SIZE * 2, null); getListener().addProgress(1); } } graphics.drawImage(bg, outWidth - BG_TILE_SIZE * scale, 0, outWidth, BG_TILE_SIZE * scale, BG_TILE_SIZE * 2, 0, BG_TILE_SIZE * 3, BG_TILE_SIZE, null); getListener().addProgress(1); for (int y = 1; y < bgTilesY; y++) { graphics.drawImage(bg, outWidth - BG_TILE_SIZE * scale, y * BG_TILE_SIZE * scale, outWidth, (y + 1) * BG_TILE_SIZE * scale, BG_TILE_SIZE * 2, BG_TILE_SIZE, BG_TILE_SIZE * 3, BG_TILE_SIZE * 2, null); getListener().addProgress(1); } graphics.drawImage(bg, 0, outHeight - BG_TILE_SIZE * scale, BG_TILE_SIZE * scale, outHeight, 0, BG_TILE_SIZE * 2, BG_TILE_SIZE, BG_TILE_SIZE * 3, null); getListener().addProgress(1); for (int x = 1; x < bgTilesX; x++) { graphics.drawImage(bg, x * BG_TILE_SIZE * scale, outHeight - BG_TILE_SIZE * scale, (x + 1) * BG_TILE_SIZE * scale, outHeight, BG_TILE_SIZE, BG_TILE_SIZE * 2, BG_TILE_SIZE * 2, BG_TILE_SIZE * 3, null); getListener().addProgress(1); } graphics.drawImage(bg, outWidth - BG_TILE_SIZE * scale, outHeight - BG_TILE_SIZE * scale, outWidth, outHeight, BG_TILE_SIZE * 2, BG_TILE_SIZE * 2, BG_TILE_SIZE * 3, BG_TILE_SIZE * 3, null); getListener().addProgress(1); Rect scope = biomeData.getScope(); getListener().setStatusString("gui.antiqueatlas.export.rendering.map"); getListener().setProgressMax(scope.getHeight() * scope.getWidth()); TileRenderIterator iter = new TileRenderIterator(biomeData); while (iter.hasNext()) { SubTileQuartet subtiles = iter.next(); for (SubTile subtile : subtiles) { if (subtile == null || subtile.tile == null) continue; ResourceLocation texture = BiomeTextureMap.instance().getTexture(subtile.tile); BufferedImage tileImage = textureImageMap.get(texture); if (tileImage == null) continue; graphics.drawImage(tileImage, TILE_SIZE + subtile.x * TILE_SIZE / 2, TILE_SIZE + subtile.y * TILE_SIZE / 2, TILE_SIZE + (subtile.x + 1) * TILE_SIZE / 2, TILE_SIZE + (subtile.y + 1) * TILE_SIZE / 2, subtile.getTextureU() * TILE_SIZE / 2, subtile.getTextureV() * TILE_SIZE / 2, (subtile.getTextureU() + 1) * TILE_SIZE / 2, (subtile.getTextureV() + 1) * TILE_SIZE / 2, null); } getListener().addProgress(1); } getListener().setStatusString("gui.antiqueatlas.export.rendering.markers"); getListener().setProgressMax(-1); List<Marker> markers = new ArrayList<>(); for (int x = biomeData.getScope().minX / MarkersData.CHUNK_STEP; x <= biomeData.getScope().maxX / MarkersData.CHUNK_STEP; x++) { for (int z = biomeData.getScope().minY / MarkersData.CHUNK_STEP; z <= biomeData.getScope().maxY / MarkersData.CHUNK_STEP; z++) { markers.clear(); List<Marker> globalMarkersAt = globalMarkers.getMarkersAtChunk(x, z); if (globalMarkersAt != null) { markers.addAll(globalMarkers.getMarkersAtChunk(x, z)); } if (localMarkers != null) { List<Marker> localMarkersAt = localMarkers.getMarkersAtChunk(x, z); if (localMarkersAt != null) { markers.addAll(localMarkersAt); } } for (Marker marker : markers) { MarkerType type = MarkerRegistry.find(marker.getType()); if (type == null) { Log.warn("Could not find marker data for type: ", marker.getType()); type = MarkerTypes.UNKNOWN; } if (!marker.isVisibleAhead() && !biomeData.hasTileAt(marker.getChunkX(), marker.getChunkZ())) { continue; } if (type.shouldHide(!showMarkers, 0)) { continue; } type.calculateMip(1, 1, 1); MarkerRenderInfo info = type.getRenderInfo(1, 1, 1); type.resetMip(); ResourceLocation texture = info.tex; BufferedImage markerImage = textureImageMap.get(texture); if (markerImage == null) continue; int markerX = marker.getX() - minX; int markerY = marker.getZ() - minY; graphics.drawImage(markerImage, (int) (markerX + info.x), (int) (markerY + info.y), info.width, info.height, null); } } } try { getListener().setHeaderString(""); getListener().setStatusString("gui.antiqueatlas.export.writing"); ImageIO.write(outImage, "PNG", file); Log.info("Done writing image"); } catch (IOException e) { e.printStackTrace(); } }
public static void exportPngImage(DimensionData biomeData, DimensionMarkersData globalMarkers, DimensionMarkersData localMarkers, File file, boolean showMarkers) { getListener().setHeaderString("gui.antiqueatlas.export.setup"); int minX = (biomeData.getScope().minX - 1) * TILE_SIZE; int minY = (biomeData.getScope().minY - 1) * TILE_SIZE; int outWidth = (biomeData.getScope().maxX + 2) * TILE_SIZE - minX; int outHeight = (biomeData.getScope().maxY + 2) * TILE_SIZE - minY; Log.info("Image size: %dx%d", outWidth, outHeight); getListener().setStatusString("gui.antiqueatlas.export.makingbuffer", outWidth, outHeight); BufferedImage outImage = new BufferedImage(outWidth, outHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = outImage.createGraphics(); int scale = 2; int bgTilesX = Math.round((float) outWidth / (float) BG_TILE_SIZE / (float) scale); int bgTilesY = Math.round((float) outHeight / (float) BG_TILE_SIZE / (float) scale); getListener().setStatusString("gui.antiqueatlas.export.loadingtextures"); getListener().setProgressMax(-1); BufferedImage bg = null; Map<ResourceLocation, BufferedImage> textureImageMap = new HashMap<>(); try { InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(Textures.EXPORTED_BG).getInputStream(); bg = ImageIO.read(is); is.close(); List<ResourceLocation> allTextures = new ArrayList<>(64); allTextures.addAll(BiomeTextureMap.instance().getAllTextures()); if (showMarkers) { for (MarkerType type : MarkerRegistry.getValues()) { allTextures.addAll(Arrays.asList(type.getAllIcons())); } } for (ResourceLocation texture : allTextures) { try { is = Minecraft.getMinecraft().getResourceManager().getResource(texture).getInputStream(); BufferedImage tileImage = ImageIO.read(is); is.close(); textureImageMap.put(texture, tileImage); } catch (FileNotFoundException e) { Log.warn("Texture %s not found!", texture.toString()); } } } catch (IOException e) { e.printStackTrace(); } getListener().setHeaderString("gui.antiqueatlas.export.rendering"); <DeepExtract> getListener().setStatusString("gui.antiqueatlas.export.rendering.background"); getListener().setProgressMax(bgTilesX * bgTilesY); graphics.drawImage(bg, 0, 0, BG_TILE_SIZE * scale, BG_TILE_SIZE * scale, 0, 0, BG_TILE_SIZE, BG_TILE_SIZE, null); getListener().addProgress(1); for (int x = 1; x < bgTilesX; x++) { graphics.drawImage(bg, x * BG_TILE_SIZE * scale, 0, (x + 1) * BG_TILE_SIZE * scale, BG_TILE_SIZE * scale, BG_TILE_SIZE, 0, BG_TILE_SIZE * 2, BG_TILE_SIZE, null); getListener().addProgress(1); } for (int y = 1; y < bgTilesY; y++) { graphics.drawImage(bg, 0, y * BG_TILE_SIZE * scale, BG_TILE_SIZE * scale, (y + 1) * BG_TILE_SIZE * scale, 0, BG_TILE_SIZE, BG_TILE_SIZE, BG_TILE_SIZE * 2, null); getListener().addProgress(1); } for (int x = 1; x < bgTilesX; x++) { for (int y = 1; y < bgTilesY; y++) { graphics.drawImage(bg, x * BG_TILE_SIZE * scale, y * BG_TILE_SIZE * scale, (x + 1) * BG_TILE_SIZE * scale, (y + 1) * BG_TILE_SIZE * scale, BG_TILE_SIZE, BG_TILE_SIZE, BG_TILE_SIZE * 2, BG_TILE_SIZE * 2, null); getListener().addProgress(1); } } graphics.drawImage(bg, outWidth - BG_TILE_SIZE * scale, 0, outWidth, BG_TILE_SIZE * scale, BG_TILE_SIZE * 2, 0, BG_TILE_SIZE * 3, BG_TILE_SIZE, null); getListener().addProgress(1); for (int y = 1; y < bgTilesY; y++) { graphics.drawImage(bg, outWidth - BG_TILE_SIZE * scale, y * BG_TILE_SIZE * scale, outWidth, (y + 1) * BG_TILE_SIZE * scale, BG_TILE_SIZE * 2, BG_TILE_SIZE, BG_TILE_SIZE * 3, BG_TILE_SIZE * 2, null); getListener().addProgress(1); } graphics.drawImage(bg, 0, outHeight - BG_TILE_SIZE * scale, BG_TILE_SIZE * scale, outHeight, 0, BG_TILE_SIZE * 2, BG_TILE_SIZE, BG_TILE_SIZE * 3, null); getListener().addProgress(1); for (int x = 1; x < bgTilesX; x++) { graphics.drawImage(bg, x * BG_TILE_SIZE * scale, outHeight - BG_TILE_SIZE * scale, (x + 1) * BG_TILE_SIZE * scale, outHeight, BG_TILE_SIZE, BG_TILE_SIZE * 2, BG_TILE_SIZE * 2, BG_TILE_SIZE * 3, null); getListener().addProgress(1); } graphics.drawImage(bg, outWidth - BG_TILE_SIZE * scale, outHeight - BG_TILE_SIZE * scale, outWidth, outHeight, BG_TILE_SIZE * 2, BG_TILE_SIZE * 2, BG_TILE_SIZE * 3, BG_TILE_SIZE * 3, null); getListener().addProgress(1); Rect scope = biomeData.getScope(); getListener().setStatusString("gui.antiqueatlas.export.rendering.map"); getListener().setProgressMax(scope.getHeight() * scope.getWidth()); TileRenderIterator iter = new TileRenderIterator(biomeData); while (iter.hasNext()) { SubTileQuartet subtiles = iter.next(); for (SubTile subtile : subtiles) { if (subtile == null || subtile.tile == null) continue; ResourceLocation texture = BiomeTextureMap.instance().getTexture(subtile.tile); BufferedImage tileImage = textureImageMap.get(texture); if (tileImage == null) continue; graphics.drawImage(tileImage, TILE_SIZE + subtile.x * TILE_SIZE / 2, TILE_SIZE + subtile.y * TILE_SIZE / 2, TILE_SIZE + (subtile.x + 1) * TILE_SIZE / 2, TILE_SIZE + (subtile.y + 1) * TILE_SIZE / 2, subtile.getTextureU() * TILE_SIZE / 2, subtile.getTextureV() * TILE_SIZE / 2, (subtile.getTextureU() + 1) * TILE_SIZE / 2, (subtile.getTextureV() + 1) * TILE_SIZE / 2, null); } getListener().addProgress(1); } getListener().setStatusString("gui.antiqueatlas.export.rendering.markers"); getListener().setProgressMax(-1); List<Marker> markers = new ArrayList<>(); for (int x = biomeData.getScope().minX / MarkersData.CHUNK_STEP; x <= biomeData.getScope().maxX / MarkersData.CHUNK_STEP; x++) { for (int z = biomeData.getScope().minY / MarkersData.CHUNK_STEP; z <= biomeData.getScope().maxY / MarkersData.CHUNK_STEP; z++) { markers.clear(); List<Marker> globalMarkersAt = globalMarkers.getMarkersAtChunk(x, z); if (globalMarkersAt != null) { markers.addAll(globalMarkers.getMarkersAtChunk(x, z)); } if (localMarkers != null) { List<Marker> localMarkersAt = localMarkers.getMarkersAtChunk(x, z); if (localMarkersAt != null) { markers.addAll(localMarkersAt); } } for (Marker marker : markers) { MarkerType type = MarkerRegistry.find(marker.getType()); if (type == null) { Log.warn("Could not find marker data for type: ", marker.getType()); type = MarkerTypes.UNKNOWN; } if (!marker.isVisibleAhead() && !biomeData.hasTileAt(marker.getChunkX(), marker.getChunkZ())) { continue; } if (type.shouldHide(!showMarkers, 0)) { continue; } type.calculateMip(1, 1, 1); MarkerRenderInfo info = type.getRenderInfo(1, 1, 1); type.resetMip(); ResourceLocation texture = info.tex; BufferedImage markerImage = textureImageMap.get(texture); if (markerImage == null) continue; int markerX = marker.getX() - minX; int markerY = marker.getZ() - minY; graphics.drawImage(markerImage, (int) (markerX + info.x), (int) (markerY + info.y), info.width, info.height, null); } } } </DeepExtract> try { getListener().setHeaderString(""); getListener().setStatusString("gui.antiqueatlas.export.writing"); ImageIO.write(outImage, "PNG", file); Log.info("Done writing image"); } catch (IOException e) { e.printStackTrace(); } }
AntiqueAtlas
positive
2,588
public void actionPerformed(java.awt.event.ActionEvent evt) { if (jToggleButton1.isSelected()) model.setColorized(true); else model.setColorized(false); }
public void actionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> if (jToggleButton1.isSelected()) model.setColorized(true); else model.setColorized(false); </DeepExtract> }
Kayak
positive
2,589
public static void main(String[] args) { Injector injector = Guice.createInjector(new FirstModule()); UserController userController = injector.getInstance(UserController.class); messageService.sendMessage("Provides Annotation Binding example"); }
public static void main(String[] args) { Injector injector = Guice.createInjector(new FirstModule()); UserController userController = injector.getInstance(UserController.class); <DeepExtract> messageService.sendMessage("Provides Annotation Binding example"); </DeepExtract> }
Design-Pattern-Tutorial
positive
2,590
@Override public void onValidValue(int value) { entity.setEnd(value); lblEsquiveTotale.setText("% (" + StatsEntity.DODGE_MODIFICATOR + "% / pt d'agilité) Total: " + entity.getDodgePercent() + "%"); lblArmureTotale.setText("Armure totale: " + entity.getArmor() + " (Dommages réduits: " + (entity.getDamagesReduction() * 100) + "%)"); lblParadeTotale.setText("% (+" + StatsEntity.PARRY_MODIFICATOR + "% / pt de force) Total: " + entity.getParryPercent() + "%"); lblDegatsTotal.setText("(+" + StatsEntity.DAMAGE_MODIFICATOR + " / pt de force) Total: " + entity.getDamages()); lblCcTotal.setText("(+" + StatsEntity.CRITICAL_MODIFICATOR + "% / pt d'agilité) Total: " + entity.getCriticalPercent() + "%"); lblHp.setText("HP: " + entity.getMaxHp() + " (+" + StatsEntity.HP_MODIFICATOR + " / pt Endurence)"); lblMana.setText("MP: " + entity.getMaxMana() + " (+" + StatsEntity.MANA_MODIFICATOR + " / pt Intelligence)"); }
@Override public void onValidValue(int value) { entity.setEnd(value); <DeepExtract> lblEsquiveTotale.setText("% (" + StatsEntity.DODGE_MODIFICATOR + "% / pt d'agilité) Total: " + entity.getDodgePercent() + "%"); lblArmureTotale.setText("Armure totale: " + entity.getArmor() + " (Dommages réduits: " + (entity.getDamagesReduction() * 100) + "%)"); lblParadeTotale.setText("% (+" + StatsEntity.PARRY_MODIFICATOR + "% / pt de force) Total: " + entity.getParryPercent() + "%"); lblDegatsTotal.setText("(+" + StatsEntity.DAMAGE_MODIFICATOR + " / pt de force) Total: " + entity.getDamages()); lblCcTotal.setText("(+" + StatsEntity.CRITICAL_MODIFICATOR + "% / pt d'agilité) Total: " + entity.getCriticalPercent() + "%"); lblHp.setText("HP: " + entity.getMaxHp() + " (+" + StatsEntity.HP_MODIFICATOR + " / pt Endurence)"); lblMana.setText("MP: " + entity.getMaxMana() + " (+" + StatsEntity.MANA_MODIFICATOR + " / pt Intelligence)"); </DeepExtract> }
MMO-Rulemasters-World
positive
2,591
public String toString() { StringBuffer buf = new StringBuffer("#"); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ASN1OutputStream aOut = new ASN1OutputStream(bOut); try { aOut.writeObject(this); } catch (IOException e) { throw new RuntimeException("internal error encoding BitString"); } byte[] string = bOut.toByteArray(); for (int i = 0; i != string.length; i++) { buf.append(table[(string[i] >>> 4) & 0xf]); buf.append(table[string[i] & 0xf]); } return buf.toString(); }
public String toString() { <DeepExtract> StringBuffer buf = new StringBuffer("#"); ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ASN1OutputStream aOut = new ASN1OutputStream(bOut); try { aOut.writeObject(this); } catch (IOException e) { throw new RuntimeException("internal error encoding BitString"); } byte[] string = bOut.toByteArray(); for (int i = 0; i != string.length; i++) { buf.append(table[(string[i] >>> 4) & 0xf]); buf.append(table[string[i] & 0xf]); } return buf.toString(); </DeepExtract> }
ESign
positive
2,592
public Criteria andCatidNotLike(String value) { if (value == null) { throw new RuntimeException("Value for " + "catid" + " cannot be null"); } criteria.add(new Criterion("catid not like", value)); return (Criteria) this; }
public Criteria andCatidNotLike(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "catid" + " cannot be null"); } criteria.add(new Criterion("catid not like", value)); </DeepExtract> return (Criteria) this; }
PetStore
positive
2,593
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quiz); mQuestionTextView = (TextView) findViewById(R.id.question_text_view); mTrueButton = (Button) findViewById(R.id.true_button); mTrueButton.setOnClickListener(v -> checkAnswer(true)); mFalseButton = (Button) findViewById(R.id.false_button); mFalseButton.setOnClickListener(v -> checkAnswer(false)); mNextButton = (ImageButton) findViewById(R.id.next_button); mNextButton.setOnClickListener(v -> { mCurrentIndex = (mCurrentIndex + 1) % mQuestionBank.length; updateQuestion(); }); mPreviousButton = (ImageButton) findViewById(R.id.previous_button); mPreviousButton.setOnClickListener(v -> { if (mCurrentIndex > 0) { mCurrentIndex = (mCurrentIndex - 1) % mQuestionBank.length; } else { mCurrentIndex = mQuestionBank.length - 1; } updateQuestion(); }); int question = mQuestionBank[mCurrentIndex].getTextResId(); mQuestionTextView.setText(question); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_quiz); mQuestionTextView = (TextView) findViewById(R.id.question_text_view); mTrueButton = (Button) findViewById(R.id.true_button); mTrueButton.setOnClickListener(v -> checkAnswer(true)); mFalseButton = (Button) findViewById(R.id.false_button); mFalseButton.setOnClickListener(v -> checkAnswer(false)); mNextButton = (ImageButton) findViewById(R.id.next_button); mNextButton.setOnClickListener(v -> { mCurrentIndex = (mCurrentIndex + 1) % mQuestionBank.length; updateQuestion(); }); mPreviousButton = (ImageButton) findViewById(R.id.previous_button); mPreviousButton.setOnClickListener(v -> { if (mCurrentIndex > 0) { mCurrentIndex = (mCurrentIndex - 1) % mQuestionBank.length; } else { mCurrentIndex = mQuestionBank.length - 1; } updateQuestion(); }); <DeepExtract> int question = mQuestionBank[mCurrentIndex].getTextResId(); mQuestionTextView.setText(question); </DeepExtract> }
Big-Nerd-Ranch-Android
positive
2,594
@Test public void testUpdateDruidClusterException() throws IOException, ClusterNotFoundException { req = mock(Request.class); res = mock(Response.class); qs = mock(DruidQueryService.class); ds = mock(DetectorService.class); jes = mock(JobExecutionService.class); sf = mock(ServiceFactory.class); ss = mock(SchedulerService.class); when(sf.newJobExecutionService()).thenReturn(jes); when(sf.newDetectorServiceInstance()).thenReturn(ds); when(sf.newDruidQueryServiceInstance()).thenReturn(qs); inject("serviceFactory", sf); tte = mock(ThymeleafTemplateEngine.class); inject("thymeleaf", tte); dca = mock(DruidClusterAccessor.class); inject("clusterAccessor", dca); jma = mock(JobMetadataAccessor.class); inject("jobAccessor", jma); ara = mock(AnomalyReportAccessor.class); inject("reportAccessor", ara); ema = mock(EmailMetadataAccessor.class); inject("emailMetadataAccessor", ema); @SuppressWarnings("unchecked") Map<String, Object> dp = (Map<String, Object>) mock(Map.class); inject("defaultParams", dp); CLISettingsTest.setField(CLISettingsTest.getField("clusterAccessor", Routes.class), dca); when(req.params(Constants.ID)).thenReturn("1"); when(dca.getDruidCluster(anyString())).thenThrow(new IOException("exception")); assertEquals(Routes.updateDruidCluster(req, res), "exception"); verify(res, times(1)).status(500); when(req.params(Constants.ID)).thenReturn("!%41"); assertEquals(Routes.updateDruidCluster(req, res), "Invalid Cluster!"); }
@Test public void testUpdateDruidClusterException() throws IOException, ClusterNotFoundException { req = mock(Request.class); res = mock(Response.class); qs = mock(DruidQueryService.class); ds = mock(DetectorService.class); jes = mock(JobExecutionService.class); sf = mock(ServiceFactory.class); ss = mock(SchedulerService.class); when(sf.newJobExecutionService()).thenReturn(jes); when(sf.newDetectorServiceInstance()).thenReturn(ds); when(sf.newDruidQueryServiceInstance()).thenReturn(qs); inject("serviceFactory", sf); tte = mock(ThymeleafTemplateEngine.class); inject("thymeleaf", tte); dca = mock(DruidClusterAccessor.class); inject("clusterAccessor", dca); jma = mock(JobMetadataAccessor.class); inject("jobAccessor", jma); ara = mock(AnomalyReportAccessor.class); inject("reportAccessor", ara); ema = mock(EmailMetadataAccessor.class); inject("emailMetadataAccessor", ema); @SuppressWarnings("unchecked") Map<String, Object> dp = (Map<String, Object>) mock(Map.class); inject("defaultParams", dp); <DeepExtract> CLISettingsTest.setField(CLISettingsTest.getField("clusterAccessor", Routes.class), dca); </DeepExtract> when(req.params(Constants.ID)).thenReturn("1"); when(dca.getDruidCluster(anyString())).thenThrow(new IOException("exception")); assertEquals(Routes.updateDruidCluster(req, res), "exception"); verify(res, times(1)).status(500); when(req.params(Constants.ID)).thenReturn("!%41"); assertEquals(Routes.updateDruidCluster(req, res), "Invalid Cluster!"); }
sherlock
positive
2,595
@Override public void stopNodeDiscovery() { super.stopNodeDiscovery(); mManager.removeListener(mUpdateDiscoverGui); mManager.removeListener(mAdapter); mStartStopButton.setImageResource(R.drawable.ic_search_24dp); mStartStopButton.startAnimation(animRotateButton); mTextView.setVisibility(View.VISIBLE); mSwipeLayout.post(() -> mSwipeLayout.setRefreshing(false)); }
@Override public void stopNodeDiscovery() { super.stopNodeDiscovery(); mManager.removeListener(mUpdateDiscoverGui); mManager.removeListener(mAdapter); mStartStopButton.setImageResource(R.drawable.ic_search_24dp); mStartStopButton.startAnimation(animRotateButton); mTextView.setVisibility(View.VISIBLE); <DeepExtract> mSwipeLayout.post(() -> mSwipeLayout.setRefreshing(false)); </DeepExtract> }
BlueSTSDK_GUI_Android
positive
2,596
@Test public void testValueOfPosTwo() { RatNum.valueOf("2").equals(two); RatNum.valueOf("2/1").equals(two); RatNum.valueOf("-4/-2").equals(two); }
@Test public void testValueOfPosTwo() { RatNum.valueOf("2").equals(two); RatNum.valueOf("2/1").equals(two); <DeepExtract> RatNum.valueOf("-4/-2").equals(two); </DeepExtract> }
CSE331
positive
2,597
private void doClear(List<String> parms) { config.clear(); "All properties removed%n".printStackTrace(); output("%n"); if (parms.size() > 0) { warn("Ignoring parameters: '%s'%n", String.join(",", parms)); } }
private void doClear(List<String> parms) { config.clear(); <DeepExtract> "All properties removed%n".printStackTrace(); output("%n"); </DeepExtract> if (parms.size() > 0) { warn("Ignoring parameters: '%s'%n", String.join(",", parms)); } }
pravega-samples
positive
2,598
@Override public Options setParanoidChecks(final boolean paranoidChecks) { return columnFamilyOptions.paranoidFileChecks(); dbOptions.setParanoidChecks(paranoidChecks); return this; }
@Override public Options setParanoidChecks(final boolean paranoidChecks) { <DeepExtract> return columnFamilyOptions.paranoidFileChecks(); </DeepExtract> dbOptions.setParanoidChecks(paranoidChecks); return this; }
kcache
positive
2,599
private void previousButtonActionPerformed(java.awt.event.ActionEvent evt) { if (currentTip - 1 < 0 || currentTip - 1 >= allTips.length) { return; } currentTip = currentTip - 1; tipCountLabel.setText("Tip " + (currentTip - 1 + 1) + "/" + allTips.length); tipTextLabel.setText(String.format("<html><div style=\"width:%dpx;\">%s</div><html>", 380, allTips[currentTip - 1])); previousButton.setEnabled(currentTip - 1 > 0); nextButton.setEnabled(currentTip - 1 < allTips.length - 1); pack(); }
private void previousButtonActionPerformed(java.awt.event.ActionEvent evt) { <DeepExtract> if (currentTip - 1 < 0 || currentTip - 1 >= allTips.length) { return; } currentTip = currentTip - 1; tipCountLabel.setText("Tip " + (currentTip - 1 + 1) + "/" + allTips.length); tipTextLabel.setText(String.format("<html><div style=\"width:%dpx;\">%s</div><html>", 380, allTips[currentTip - 1])); previousButton.setEnabled(currentTip - 1 > 0); nextButton.setEnabled(currentTip - 1 < allTips.length - 1); pack(); </DeepExtract> }
DeedPlanner-2
positive
2,600
public int findPeakElement(int[] num) { if (num == null) { return 0; } if (0 == num.length - 1) { return 0; } else if (0 + 1 == num.length - 1) { return num[0] > num[num.length - 1] ? 0 : num.length - 1; } else { int mid = 0 + (num.length - 1 - 0) / 2; if (num[mid - 1] < num[mid] && num[mid] > num[mid + 1]) { return mid; } else if (num[mid - 1] < num[mid] && num[mid] < num[mid + 1]) { return helper(mid + 1, num.length - 1, num); } else { return helper(0, mid - 1, num); } } }
public int findPeakElement(int[] num) { if (num == null) { return 0; } <DeepExtract> if (0 == num.length - 1) { return 0; } else if (0 + 1 == num.length - 1) { return num[0] > num[num.length - 1] ? 0 : num.length - 1; } else { int mid = 0 + (num.length - 1 - 0) / 2; if (num[mid - 1] < num[mid] && num[mid] > num[mid + 1]) { return mid; } else if (num[mid - 1] < num[mid] && num[mid] < num[mid + 1]) { return helper(mid + 1, num.length - 1, num); } else { return helper(0, mid - 1, num); } } </DeepExtract> }
leetCodeInterview
positive
2,601
public boolean attachDuck(DuckFreight duck) { if (attachedDuck != null) return false; attachedDuck = duck; this.onField = false; if (false) { if (!world.containsBody(carouselBody)) world.addBody(carouselBody); if (!world.containsBody(anchorBody)) world.addBody(anchorBody); if (!world.containsJoint(anchorJoint)) world.addJoint(anchorJoint); } else { if (world.containsBody(carouselBody)) world.removeBody(carouselBody); if (world.containsBody(anchorBody)) world.removeBody(anchorBody); if (world.containsJoint(anchorJoint)) world.removeJoint(anchorJoint); } if (false) addToDisplay(); else removeFromDisplay(); Vector2 anchor = this == redCarousel ? new Vector2(71.0 / VirtualField.INCHES_PER_METER, -66.0 / VirtualField.INCHES_PER_METER) : new Vector2(-71.0 / VirtualField.INCHES_PER_METER, -66.0 / VirtualField.INCHES_PER_METER); attachedDuck.setLocationMeters(anchor); if (duckJoint != null) world.removeJoint(duckJoint); duckJoint = new WeldJoint(attachedDuck.getElementBody(), this.getElementBody(), anchor); attachedDuck.setCategoryFilter(Freight.ON_CAROUSEL_FILTER); this.onField = true; if (true) { if (!world.containsBody(carouselBody)) world.addBody(carouselBody); if (!world.containsBody(anchorBody)) world.addBody(anchorBody); if (!world.containsJoint(anchorJoint)) world.addJoint(anchorJoint); } else { if (world.containsBody(carouselBody)) world.removeBody(carouselBody); if (world.containsBody(anchorBody)) world.removeBody(anchorBody); if (world.containsJoint(anchorJoint)) world.removeJoint(anchorJoint); } if (true) addToDisplay(); else removeFromDisplay(); world.addJoint(duckJoint); headingOnAttach = getHeadingRadians(); return true; }
public boolean attachDuck(DuckFreight duck) { if (attachedDuck != null) return false; attachedDuck = duck; this.onField = false; if (false) { if (!world.containsBody(carouselBody)) world.addBody(carouselBody); if (!world.containsBody(anchorBody)) world.addBody(anchorBody); if (!world.containsJoint(anchorJoint)) world.addJoint(anchorJoint); } else { if (world.containsBody(carouselBody)) world.removeBody(carouselBody); if (world.containsBody(anchorBody)) world.removeBody(anchorBody); if (world.containsJoint(anchorJoint)) world.removeJoint(anchorJoint); } if (false) addToDisplay(); else removeFromDisplay(); Vector2 anchor = this == redCarousel ? new Vector2(71.0 / VirtualField.INCHES_PER_METER, -66.0 / VirtualField.INCHES_PER_METER) : new Vector2(-71.0 / VirtualField.INCHES_PER_METER, -66.0 / VirtualField.INCHES_PER_METER); attachedDuck.setLocationMeters(anchor); if (duckJoint != null) world.removeJoint(duckJoint); duckJoint = new WeldJoint(attachedDuck.getElementBody(), this.getElementBody(), anchor); attachedDuck.setCategoryFilter(Freight.ON_CAROUSEL_FILTER); <DeepExtract> this.onField = true; if (true) { if (!world.containsBody(carouselBody)) world.addBody(carouselBody); if (!world.containsBody(anchorBody)) world.addBody(anchorBody); if (!world.containsJoint(anchorJoint)) world.addJoint(anchorJoint); } else { if (world.containsBody(carouselBody)) world.removeBody(carouselBody); if (world.containsBody(anchorBody)) world.removeBody(anchorBody); if (world.containsJoint(anchorJoint)) world.removeJoint(anchorJoint); } if (true) addToDisplay(); else removeFromDisplay(); </DeepExtract> world.addJoint(duckJoint); headingOnAttach = getHeadingRadians(); return true; }
virtual_robot
positive
2,602
public static void main(String[] args) { String input = "qwwwwwwweeeeerrtyyyyyqqqqwEErTTT"; System.out.println(algorithmRunLength(input)); }
public static void main(String[] args) { <DeepExtract> String input = "qwwwwwwweeeeerrtyyyyyqqqqwEErTTT"; System.out.println(algorithmRunLength(input)); </DeepExtract> }
Study-Book
positive
2,604
@Override public String getTemplateEncoding() { return compositeConfiguration.getString(TEMPLATE_ENCODING.getKey()); }
@Override public String getTemplateEncoding() { <DeepExtract> return compositeConfiguration.getString(TEMPLATE_ENCODING.getKey()); </DeepExtract> }
jbake
positive
2,605
private Type getElementType() { int len; switch(buf[off + getDimensions()]) { case 'V': return VOID_TYPE; case 'Z': return BOOLEAN_TYPE; case 'C': return CHAR_TYPE; case 'B': return BYTE_TYPE; case 'S': return SHORT_TYPE; case 'I': return INT_TYPE; case 'F': return FLOAT_TYPE; case 'J': return LONG_TYPE; case 'D': return DOUBLE_TYPE; case '[': len = 1; while (buf[off + getDimensions() + len] == '[') { ++len; } if (buf[off + getDimensions() + len] == 'L') { ++len; while (buf[off + getDimensions() + len] != ';') { ++len; } } return new Type(ARRAY, buf, off + getDimensions(), len + 1); default: len = 1; while (buf[off + getDimensions() + len] != ';') { ++len; } return new Type(OBJECT, buf, off + getDimensions() + 1, len - 1); } }
private Type getElementType() { <DeepExtract> int len; switch(buf[off + getDimensions()]) { case 'V': return VOID_TYPE; case 'Z': return BOOLEAN_TYPE; case 'C': return CHAR_TYPE; case 'B': return BYTE_TYPE; case 'S': return SHORT_TYPE; case 'I': return INT_TYPE; case 'F': return FLOAT_TYPE; case 'J': return LONG_TYPE; case 'D': return DOUBLE_TYPE; case '[': len = 1; while (buf[off + getDimensions() + len] == '[') { ++len; } if (buf[off + getDimensions() + len] == 'L') { ++len; while (buf[off + getDimensions() + len] != ';') { ++len; } } return new Type(ARRAY, buf, off + getDimensions(), len + 1); default: len = 1; while (buf[off + getDimensions() + len] != ';') { ++len; } return new Type(OBJECT, buf, off + getDimensions() + 1, len - 1); } </DeepExtract> }
rapid-generator-3.9.2
positive
2,606
public Criteria andStockGreaterThan(Integer value) { if (value == null) { throw new RuntimeException("Value for " + "stock" + " cannot be null"); } criteria.add(new Criterion("stock >", value)); return (Criteria) this; }
public Criteria andStockGreaterThan(Integer value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "stock" + " cannot be null"); } criteria.add(new Criterion("stock >", value)); </DeepExtract> return (Criteria) this; }
Tmall_SSM-master
positive
2,607
public static void main(String[] args) { EProperties properties = EProperties.getInstance(); for (int i = 0; i < args.length; ++i) { String[] keyVal = args[i].split("="); if (!properties.containsKey(keyVal[0])) { System.out.println("Warning: Property \"" + keyVal[0] + "\" is unknown. Mistyping?"); } properties.setProperty(keyVal[0], keyVal[1]); } Manager.getInstance().setIOAccess(true); EProperties pts = EProperties.getInstance(); for (String key : pts.stringPropertyNames()) { String value = getParameter(key); if (value != null) { pts.setProperty(key, value); } } if (pts.getProperty("RUN_TYPE").equals("APPLET_SIGNED")) { try { new SecurityManager() { public void checkPermission(Permission permission) { } public void checkPermission(Permission permission, Object obj) { } }; Manager.getInstance().setIOAccess(true); } catch (AccessControlException ace) { Log.log(LogWords.NO_PRIVILEGES_GRANTED, JOptionPane.INFORMATION_MESSAGE, ace.getMessage(), true); Manager.getInstance().setIOAccess(false); } } else if (pts.getProperty("RUN_TYPE").equals("APPLET_UNSIGNED")) { Manager.getInstance().setIOAccess(false); Manager.getInstance().setApplet(this); } else { System.out.println("unknown RUN_TYPE"); } Manager.getInstance().init(); Manager.getInstance().start(); }
public static void main(String[] args) { EProperties properties = EProperties.getInstance(); for (int i = 0; i < args.length; ++i) { String[] keyVal = args[i].split("="); if (!properties.containsKey(keyVal[0])) { System.out.println("Warning: Property \"" + keyVal[0] + "\" is unknown. Mistyping?"); } properties.setProperty(keyVal[0], keyVal[1]); } Manager.getInstance().setIOAccess(true); EProperties pts = EProperties.getInstance(); for (String key : pts.stringPropertyNames()) { String value = getParameter(key); if (value != null) { pts.setProperty(key, value); } } if (pts.getProperty("RUN_TYPE").equals("APPLET_SIGNED")) { try { new SecurityManager() { public void checkPermission(Permission permission) { } public void checkPermission(Permission permission, Object obj) { } }; Manager.getInstance().setIOAccess(true); } catch (AccessControlException ace) { Log.log(LogWords.NO_PRIVILEGES_GRANTED, JOptionPane.INFORMATION_MESSAGE, ace.getMessage(), true); Manager.getInstance().setIOAccess(false); } } else if (pts.getProperty("RUN_TYPE").equals("APPLET_UNSIGNED")) { Manager.getInstance().setIOAccess(false); Manager.getInstance().setApplet(this); } else { System.out.println("unknown RUN_TYPE"); } Manager.getInstance().init(); <DeepExtract> Manager.getInstance().start(); </DeepExtract> }
eniac
positive
2,608
public List<String> generateParenthesis(int n) { List<String> ans = new ArrayList<>(); if (0 == n) { ans.add(""); return; } if (0 < n) { dfs(ans, "" + "(", n, 0 + 1, 0); } if (0 < 0) { dfs(ans, "" + ")", n, 0, 0 + 1); } return ans; }
public List<String> generateParenthesis(int n) { List<String> ans = new ArrayList<>(); <DeepExtract> if (0 == n) { ans.add(""); return; } if (0 < n) { dfs(ans, "" + "(", n, 0 + 1, 0); } if (0 < 0) { dfs(ans, "" + ")", n, 0, 0 + 1); } </DeepExtract> return ans; }
CodingInterview
positive
2,609
public void setRepaintEnable(boolean value) { repaintEnable = value; if (repaintEnable) { super.repaint(); } }
public void setRepaintEnable(boolean value) { repaintEnable = value; <DeepExtract> if (repaintEnable) { super.repaint(); } </DeepExtract> }
cncgcodecontroller
positive
2,610
public void addListener(DNSListener listener, DNSQuestion question) { final long now = System.currentTimeMillis(); if (listener == null || this.contains(listener)) { return false; } _entrySet.add(new SubTypeEntry(listener)); return true; if (question != null) { Collection<? extends DNSEntry> entryList = this.getCache().getDNSEntryList(question.getName().toLowerCase()); if (entryList != null) { synchronized (entryList) { for (DNSEntry dnsEntry : entryList) { if (question.answeredBy(dnsEntry) && !dnsEntry.isExpired(now)) { listener.updateRecord(this.getCache(), now, dnsEntry); } } } } } }
public void addListener(DNSListener listener, DNSQuestion question) { final long now = System.currentTimeMillis(); <DeepExtract> if (listener == null || this.contains(listener)) { return false; } _entrySet.add(new SubTypeEntry(listener)); return true; </DeepExtract> if (question != null) { Collection<? extends DNSEntry> entryList = this.getCache().getDNSEntryList(question.getName().toLowerCase()); if (entryList != null) { synchronized (entryList) { for (DNSEntry dnsEntry : entryList) { if (question.answeredBy(dnsEntry) && !dnsEntry.isExpired(now)) { listener.updateRecord(this.getCache(), now, dnsEntry); } } } } } }
jmdns
positive
2,611
@Override public void initViews() { mBottomNavigationView.setOnMenuItemClickListener(this); mBottomNavigationView.setDefaultSelectedIndex(0); mBadgeProvider = mBottomNavigationView.getBadgeProvider(); boolean hasNewMsg = getIntent().getBooleanExtra(EXTRA_NEW_MSG, false); if (hasNewMsg) { mBadgeProvider.show(R.id.action_message); } }
@Override public void initViews() { mBottomNavigationView.setOnMenuItemClickListener(this); mBottomNavigationView.setDefaultSelectedIndex(0); mBadgeProvider = mBottomNavigationView.getBadgeProvider(); <DeepExtract> boolean hasNewMsg = getIntent().getBooleanExtra(EXTRA_NEW_MSG, false); if (hasNewMsg) { mBadgeProvider.show(R.id.action_message); } </DeepExtract> }
xifan
positive
2,612
public Builder addFp32FalseTrue(float value) { if (!((bitField0_ & 0x00000004) == 0x00000004)) { fp32FalseTrue_ = new java.util.ArrayList<Float>(fp32FalseTrue_); bitField0_ |= 0x00000004; } fp32FalseTrue_.add(value); onChanged(); return this; }
public Builder addFp32FalseTrue(float value) { <DeepExtract> if (!((bitField0_ & 0x00000004) == 0x00000004)) { fp32FalseTrue_ = new java.util.ArrayList<Float>(fp32FalseTrue_); bitField0_ |= 0x00000004; } </DeepExtract> fp32FalseTrue_.add(value); onChanged(); return this; }
dl_inference
positive
2,613
@Override public boolean ready() throws IOException { if (buf == null) throw new IOException("Stream closed"); return (count - pos) > 0; }
@Override public boolean ready() throws IOException { <DeepExtract> if (buf == null) throw new IOException("Stream closed"); </DeepExtract> return (count - pos) > 0; }
jetbrick-template-1x
positive
2,614
public int stoneGame(int[] A) { if (A.length == 0) { return 0; } int[][] dp = new int[A.length][A.length]; int[] sums = new int[A.length + 1]; sums[0] = 0; for (int i = 0; i < A.length; i++) { for (int j = i; j < A.length; j++) { dp[i][j] = Integer.MAX_VALUE; } } for (int i = 0; i < A.length; i++) { dp[i][i] = 0; sums[i + 1] = sums[i] + A[i]; } if (dp[0][A.length - 1] != Integer.MAX_VALUE) { return dp[0][A.length - 1]; } int min = Integer.MAX_VALUE; for (int k = 0; k < A.length - 1; k++) { int left = search(0, k, dp, sums); int right = search(k + 1, A.length - 1, dp, sums); int now = sums[A.length - 1 + 1] - sums[0]; min = Math.min(min, left + right + now); } dp[0][A.length - 1] = min; return min; }
public int stoneGame(int[] A) { if (A.length == 0) { return 0; } int[][] dp = new int[A.length][A.length]; int[] sums = new int[A.length + 1]; sums[0] = 0; for (int i = 0; i < A.length; i++) { for (int j = i; j < A.length; j++) { dp[i][j] = Integer.MAX_VALUE; } } for (int i = 0; i < A.length; i++) { dp[i][i] = 0; sums[i + 1] = sums[i] + A[i]; } <DeepExtract> if (dp[0][A.length - 1] != Integer.MAX_VALUE) { return dp[0][A.length - 1]; } int min = Integer.MAX_VALUE; for (int k = 0; k < A.length - 1; k++) { int left = search(0, k, dp, sums); int right = search(k + 1, A.length - 1, dp, sums); int now = sums[A.length - 1 + 1] - sums[0]; min = Math.min(min, left + right + now); } dp[0][A.length - 1] = min; return min; </DeepExtract> }
Leetcode-for-Fun
positive
2,615
@Override public void run() { ensureEnabled(); relay.set(convertValue(d)); }
@Override public void run() { <DeepExtract> ensureEnabled(); relay.set(convertValue(d)); </DeepExtract> }
atalibj
positive
2,616
public int get(int index) { if (index < 0 || index >= numElements) { throw new ArrayIndexOutOfBoundsException(index); } return backingArray[index]; }
public int get(int index) { if (index < 0 || index >= numElements) { throw new ArrayIndexOutOfBoundsException(index); } <DeepExtract> return backingArray[index]; </DeepExtract> }
fractal
positive
2,617
@Override public V get(Object key) { Node<K, V> node; try { node = key != null ? find((K) key, false) : null; } catch (ClassCastException e) { node = null; } return node != null ? node.value : null; }
@Override public V get(Object key) { <DeepExtract> Node<K, V> node; try { node = key != null ? find((K) key, false) : null; } catch (ClassCastException e) { node = null; } </DeepExtract> return node != null ? node.value : null; }
JJEvent
positive
2,618
@Override public void onResponse(JSONArray response) { Type listType = new TypeToken<List<Torrent>>() { }.getType(); torrents.addAll((List<Torrent>) new Gson().fromJson(response.toString(), listType)); List<Torrent> listTorrent = (List<Torrent>) new Gson().fromJson(response.toString(), listType); if (torrents != null && !torrents.equals("")) { int api; try { api = Integer.parseInt(torrents.replace(".", "")); } catch (Exception e) { api = 0; } if (api >= 201) { qb_version = "4.1.x"; cookie = null; getCookie(); } if (api >= 230) { qb_version = "4.2.x"; cookie = null; getCookie(); } qb_api = api; qbittorrentServer = torrents; } }
@Override public void onResponse(JSONArray response) { Type listType = new TypeToken<List<Torrent>>() { }.getType(); torrents.addAll((List<Torrent>) new Gson().fromJson(response.toString(), listType)); List<Torrent> listTorrent = (List<Torrent>) new Gson().fromJson(response.toString(), listType); <DeepExtract> if (torrents != null && !torrents.equals("")) { int api; try { api = Integer.parseInt(torrents.replace(".", "")); } catch (Exception e) { api = 0; } if (api >= 201) { qb_version = "4.1.x"; cookie = null; getCookie(); } if (api >= 230) { qb_version = "4.2.x"; cookie = null; getCookie(); } qb_api = api; qbittorrentServer = torrents; } </DeepExtract> }
qBittorrent-Controller
positive
2,620
public void humanTaskStarted(final NodeInstance nodeInstance) { try { final Transaction tx = tm.getTransaction(); tx.registerSynchronization(new UpdateNodeCounterSynchronization(XmlBPMNProcessDumper.getUniqueNodeId(nodeInstance.getNode()), 1)); } catch (final RollbackException re) { throw new IllegalStateException("Transaction management exception", re); } catch (final SystemException se) { throw new IllegalStateException("Transaction management exception", se); } }
public void humanTaskStarted(final NodeInstance nodeInstance) { <DeepExtract> try { final Transaction tx = tm.getTransaction(); tx.registerSynchronization(new UpdateNodeCounterSynchronization(XmlBPMNProcessDumper.getUniqueNodeId(nodeInstance.getNode()), 1)); } catch (final RollbackException re) { throw new IllegalStateException("Transaction management exception", re); } catch (final SystemException se) { throw new IllegalStateException("Transaction management exception", se); } </DeepExtract> }
jboss-keynote-2012
positive
2,621
@Test public void signCallGetSignatureWithTransactionModified_thenFailWithDeserializeTransactionError() throws TransactionSignError { exceptionRule.expect(TransactionSignError.class); exceptionRule.expectMessage(ErrorConstants.TRANSACTION_PROCESSOR_GET_SIGN_DESERIALIZE_TRANS_ERROR); exceptionRule.expectCause(IsInstanceOf.<EosioError>instanceOf(TransactionGetSignatureDeserializationError.class)); try { when(this.mockedRpcProvider.getInfo()).thenReturn(Utils.getGson(DateFormatter.BACKEND_DATE_PATTERN).fromJson(mockedGetInfoResponse, GetInfoResponse.class)); } catch (GetInfoRpcError getInfoRpcError) { getInfoRpcError.printStackTrace(); fail("Exception should not be thrown here for mocking getInfo"); } try { when(this.mockedRpcProvider.getBlockInfo(any(GetBlockInfoRequest.class))).thenReturn(Utils.getGson(DateFormatter.BACKEND_DATE_PATTERN).fromJson(mockedGetBlockInfoResponse, GetBlockInfoResponse.class)); } catch (GetBlockInfoRpcError getBlockInfoRpcError) { getBlockInfoRpcError.printStackTrace(); fail("Exception should not be thrown here for mocking getBlockInfo"); } try { when(this.mockedRpcProvider.getRequiredKeys(any(GetRequiredKeysRequest.class))).thenReturn(Utils.getGson(DateFormatter.BACKEND_DATE_PATTERN).fromJson(mockedGetRequiredKeysResponse, GetRequiredKeysResponse.class)); } catch (GetRequiredKeysRpcError getRequiredKeysRpcError) { getRequiredKeysRpcError.printStackTrace(); fail("Exception should not be thrown here for mocking getRequiredKeys"); } try { when(this.mockedABIProvider.getAbi(any(String.class), any(EOSIOName.class))).thenReturn(EOSIOTOKENABIJSON); } catch (GetAbiError getAbiError) { getAbiError.printStackTrace(); fail("Exception should not be thrown here for mocking getAbi"); } try { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocationOnMock) { Object[] args = invocationOnMock.getArguments(); ((AbiEosSerializationObject) args[0]).setHex(MOCKED_ACTION_HEX); return null; } }).when(this.mockedSerializationProvider).serialize(any(AbiEosSerializationObject.class)); } catch (SerializeError serializeError) { serializeError.printStackTrace(); fail("Exception should not be thrown here for mocking serialize"); } try { when(this.mockedSerializationProvider.serializeTransaction(any(String.class))).thenReturn(MOCKED_TRANSACTION_HEX); } catch (SerializeTransactionError serializeTransactionError) { serializeTransactionError.printStackTrace(); fail("Exception should not be thrown here for mocking serializeTransaction"); } try { when(this.mockedSerializationProvider.deserializeTransaction(any(String.class))).thenThrow(new DeserializeTransactionError()); } catch (DeserializeTransactionError deserializeTransactionError) { deserializeTransactionError.printStackTrace(); fail("Exception should not be thrown here for mocking deserializeTransaction"); } try { when(this.mockedSignatureProvider.getAvailableKeys()).thenReturn(Arrays.asList("Key1", "Key2")); } catch (GetAvailableKeysError getAvailableKeysError) { getAvailableKeysError.printStackTrace(); fail("Exception should not be thrown here for mocking getAvailableKeys"); } try { when(this.mockedSignatureProvider.signTransaction(any(EosioTransactionSignatureRequest.class))).thenReturn(Utils.getGson(DateFormatter.BACKEND_DATE_PATTERN).fromJson(mockedEosioTransactionSignatureResponseModifiedTransactionJSON, EosioTransactionSignatureResponse.class)); } catch (SignTransactionError signTransactionError) { signTransactionError.printStackTrace(); fail("Exception should not be thrown here for mocking signTransaction"); } TransactionProcessor processor = session.getTransactionProcessor(); processor.setIsTransactionModificationAllowed(true); try { processor.prepare(this.defaultActions()); } catch (TransactionPrepareError transactionPrepareError) { transactionPrepareError.printStackTrace(); fail("Exception should not be thrown here for calling prepare"); } processor.sign(); }
@Test public void signCallGetSignatureWithTransactionModified_thenFailWithDeserializeTransactionError() throws TransactionSignError { exceptionRule.expect(TransactionSignError.class); exceptionRule.expectMessage(ErrorConstants.TRANSACTION_PROCESSOR_GET_SIGN_DESERIALIZE_TRANS_ERROR); exceptionRule.expectCause(IsInstanceOf.<EosioError>instanceOf(TransactionGetSignatureDeserializationError.class)); try { when(this.mockedRpcProvider.getInfo()).thenReturn(Utils.getGson(DateFormatter.BACKEND_DATE_PATTERN).fromJson(mockedGetInfoResponse, GetInfoResponse.class)); } catch (GetInfoRpcError getInfoRpcError) { getInfoRpcError.printStackTrace(); fail("Exception should not be thrown here for mocking getInfo"); } try { when(this.mockedRpcProvider.getBlockInfo(any(GetBlockInfoRequest.class))).thenReturn(Utils.getGson(DateFormatter.BACKEND_DATE_PATTERN).fromJson(mockedGetBlockInfoResponse, GetBlockInfoResponse.class)); } catch (GetBlockInfoRpcError getBlockInfoRpcError) { getBlockInfoRpcError.printStackTrace(); fail("Exception should not be thrown here for mocking getBlockInfo"); } try { when(this.mockedRpcProvider.getRequiredKeys(any(GetRequiredKeysRequest.class))).thenReturn(Utils.getGson(DateFormatter.BACKEND_DATE_PATTERN).fromJson(mockedGetRequiredKeysResponse, GetRequiredKeysResponse.class)); } catch (GetRequiredKeysRpcError getRequiredKeysRpcError) { getRequiredKeysRpcError.printStackTrace(); fail("Exception should not be thrown here for mocking getRequiredKeys"); } try { when(this.mockedABIProvider.getAbi(any(String.class), any(EOSIOName.class))).thenReturn(EOSIOTOKENABIJSON); } catch (GetAbiError getAbiError) { getAbiError.printStackTrace(); fail("Exception should not be thrown here for mocking getAbi"); } try { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocationOnMock) { Object[] args = invocationOnMock.getArguments(); ((AbiEosSerializationObject) args[0]).setHex(MOCKED_ACTION_HEX); return null; } }).when(this.mockedSerializationProvider).serialize(any(AbiEosSerializationObject.class)); } catch (SerializeError serializeError) { serializeError.printStackTrace(); fail("Exception should not be thrown here for mocking serialize"); } try { when(this.mockedSerializationProvider.serializeTransaction(any(String.class))).thenReturn(MOCKED_TRANSACTION_HEX); } catch (SerializeTransactionError serializeTransactionError) { serializeTransactionError.printStackTrace(); fail("Exception should not be thrown here for mocking serializeTransaction"); } try { when(this.mockedSerializationProvider.deserializeTransaction(any(String.class))).thenThrow(new DeserializeTransactionError()); } catch (DeserializeTransactionError deserializeTransactionError) { deserializeTransactionError.printStackTrace(); fail("Exception should not be thrown here for mocking deserializeTransaction"); } try { when(this.mockedSignatureProvider.getAvailableKeys()).thenReturn(Arrays.asList("Key1", "Key2")); } catch (GetAvailableKeysError getAvailableKeysError) { getAvailableKeysError.printStackTrace(); fail("Exception should not be thrown here for mocking getAvailableKeys"); } <DeepExtract> try { when(this.mockedSignatureProvider.signTransaction(any(EosioTransactionSignatureRequest.class))).thenReturn(Utils.getGson(DateFormatter.BACKEND_DATE_PATTERN).fromJson(mockedEosioTransactionSignatureResponseModifiedTransactionJSON, EosioTransactionSignatureResponse.class)); } catch (SignTransactionError signTransactionError) { signTransactionError.printStackTrace(); fail("Exception should not be thrown here for mocking signTransaction"); } </DeepExtract> TransactionProcessor processor = session.getTransactionProcessor(); processor.setIsTransactionModificationAllowed(true); try { processor.prepare(this.defaultActions()); } catch (TransactionPrepareError transactionPrepareError) { transactionPrepareError.printStackTrace(); fail("Exception should not be thrown here for calling prepare"); } processor.sign(); }
eosio-java
positive
2,623
public void setupSubmoduleUrls(String remote, TaskListener listener) throws GitException { launchCommand("submodule", "init"); launchCommand("submodule", "sync"); boolean is_bare = true; URI origin; try { String url = getRemoteUrl(remote); String gitEnd = pathJoin("", ".git"); if (url.endsWith(gitEnd)) { url = url.substring(0, url.length() - gitEnd.length()); is_bare = false; } origin = new URI(url); } catch (URISyntaxException e) { return; } catch (Exception e) { throw new GitException("Could determine remote.origin.url", e); } if (origin.getScheme() == null || ("file".equalsIgnoreCase(origin.getScheme()) && (origin.getHost() == null || "".equals(origin.getHost())))) { List<String> paths = new ArrayList<String>(); paths.add(origin.getPath()); paths.add(pathJoin(origin.getPath(), ".git")); for (String path : paths) { try { is_bare = isBareRepository(path); break; } catch (GitException e) { LOGGER.log(Level.FINEST, "Exception occurred while detecting repository type by path: " + path); } } } if (!is_bare) { try { List<IndexEntry> submodules = getSubmodules("HEAD"); for (IndexEntry submodule : submodules) { String sUrl = pathJoin(origin.getPath(), submodule.getFile()); setSubmoduleUrl(submodule.getFile(), sUrl); String subGitDir = pathJoin(submodule.getFile(), ".git"); if (hasGitRepo(subGitDir) && !"".equals(getRemoteUrl("origin", subGitDir))) { setRemoteUrl("origin", sUrl, subGitDir); } } } catch (GitException e) { LOGGER.log(Level.FINEST, "Exception occurred while working with git repo."); } } else { LOGGER.log(Level.FINER, "The origin is non-bare."); } }
public void setupSubmoduleUrls(String remote, TaskListener listener) throws GitException { launchCommand("submodule", "init"); launchCommand("submodule", "sync"); <DeepExtract> boolean is_bare = true; URI origin; try { String url = getRemoteUrl(remote); String gitEnd = pathJoin("", ".git"); if (url.endsWith(gitEnd)) { url = url.substring(0, url.length() - gitEnd.length()); is_bare = false; } origin = new URI(url); } catch (URISyntaxException e) { return; } catch (Exception e) { throw new GitException("Could determine remote.origin.url", e); } if (origin.getScheme() == null || ("file".equalsIgnoreCase(origin.getScheme()) && (origin.getHost() == null || "".equals(origin.getHost())))) { List<String> paths = new ArrayList<String>(); paths.add(origin.getPath()); paths.add(pathJoin(origin.getPath(), ".git")); for (String path : paths) { try { is_bare = isBareRepository(path); break; } catch (GitException e) { LOGGER.log(Level.FINEST, "Exception occurred while detecting repository type by path: " + path); } } } if (!is_bare) { try { List<IndexEntry> submodules = getSubmodules("HEAD"); for (IndexEntry submodule : submodules) { String sUrl = pathJoin(origin.getPath(), submodule.getFile()); setSubmoduleUrl(submodule.getFile(), sUrl); String subGitDir = pathJoin(submodule.getFile(), ".git"); if (hasGitRepo(subGitDir) && !"".equals(getRemoteUrl("origin", subGitDir))) { setRemoteUrl("origin", sUrl, subGitDir); } } } catch (GitException e) { LOGGER.log(Level.FINEST, "Exception occurred while working with git repo."); } } else { LOGGER.log(Level.FINER, "The origin is non-bare."); } </DeepExtract> }
git-plugin
positive
2,624
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); java.io.PrintWriter out = res.getWriter(); String userID = null; StringBuffer output = new StringBuffer(100); output.append("<html><head><title>Servlet2Session2CMROne20ne</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Session2CMROne2Many<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\"><BR>PingServlet2Session2CMROne2Many uses the Trade Session EJB" + " to get the orders for a user using an EJB 3.0 Entity CMR one to many relationship"); try { Collection orderDataBeans = null; int iter = TradeConfig.getPrimIterations(); for (int ii = 0; ii < iter; ii++) { userID = TradeConfig.rndUserID(); orderDataBeans = tradeSLSBRemote.getOrders(userID); } output.append("<HR>initTime: " + initTime + "<BR>Hit Count: ").append(hitCount++); output.append("<HR>One to Many CMR access of Account Orders from Account Entity<BR> "); output.append("<HR>User: " + userID + " currently has " + orderDataBeans.size() + " stock orders:"); Iterator it = orderDataBeans.iterator(); while (it.hasNext()) { OrderDataBean orderData = (OrderDataBean) it.next(); output.append("<BR>" + orderData.toHTML()); } output.append("</font><HR></body></html>"); out.println(output.toString()); } catch (Exception e) { Log.error(e, "PingServlet2Session2CMROne2Many.doGet(...): error"); res.sendError(500, "PingServlet2Session2CMROne2Many.doGet(...): error" + e.toString()); } }
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { <DeepExtract> res.setContentType("text/html"); java.io.PrintWriter out = res.getWriter(); String userID = null; StringBuffer output = new StringBuffer(100); output.append("<html><head><title>Servlet2Session2CMROne20ne</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Session2CMROne2Many<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\"><BR>PingServlet2Session2CMROne2Many uses the Trade Session EJB" + " to get the orders for a user using an EJB 3.0 Entity CMR one to many relationship"); try { Collection orderDataBeans = null; int iter = TradeConfig.getPrimIterations(); for (int ii = 0; ii < iter; ii++) { userID = TradeConfig.rndUserID(); orderDataBeans = tradeSLSBRemote.getOrders(userID); } output.append("<HR>initTime: " + initTime + "<BR>Hit Count: ").append(hitCount++); output.append("<HR>One to Many CMR access of Account Orders from Account Entity<BR> "); output.append("<HR>User: " + userID + " currently has " + orderDataBeans.size() + " stock orders:"); Iterator it = orderDataBeans.iterator(); while (it.hasNext()) { OrderDataBean orderData = (OrderDataBean) it.next(); output.append("<BR>" + orderData.toHTML()); } output.append("</font><HR></body></html>"); out.println(output.toString()); } catch (Exception e) { Log.error(e, "PingServlet2Session2CMROne2Many.doGet(...): error"); res.sendError(500, "PingServlet2Session2CMROne2Many.doGet(...): error" + e.toString()); } </DeepExtract> }
jboss-daytrader
positive
2,625
public void manual() { switch(state) { case autoBatch: switch(Event.manual) { case manual: setState(State.gettingManualBatch); isBatchAvailable(); createSelector(); break; case select: setState(State.gettingAutoBatch); getNextAutoBatch(); createSelector(); break; case itemChanged: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); workTypeItemChanged(); break; case redisplay: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); displayThumbnailAuto(); break; case exit: setState(State.end); exitProgram(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case batchSplashAuto: switch(Event.manual) { case ok: setState(State.processingAutoBatch); hideBatchSplashScreen(); allMode(); initBatch(); displayAutoThumbnailProcessing(); break; case complete: setState(State.gettingAutoBatch); hideBatchSplashScreen(); getNextAutoBatch(); completeBatch(); hideThumbnailScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case batchSplashManual: switch(Event.manual) { case ok: setState(State.processingManualBatch); hideBatchSplashScreen(); allMode(); initBatch(); displayManualThumbnailProcessing(); break; case complete: setState(State.determiningUserMode); hideBatchSplashScreen(); cleanupThumbnails(); checkUserState(); completeBatch(); hideThumbnailScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case determiningUserMode: switch(Event.manual) { case auto: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); break; case manual: setState(State.gettingManualBatch); isBatchAvailable(); createSelector(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case end: switch(Event.manual) { default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case gettingAutoBatch: switch(Event.manual) { case nextBatchFound: setState(State.batchSplashAuto); displayBatchSplashScreen(); break; case noBatchFound: setState(State.determiningUserMode); cleanupThumbnails(); checkUserState(); noBatchDialog(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case gettingManualBatch: switch(Event.manual) { case batchesFound: setState(State.manualBatch); setUserManual(); displayThumbnailManual(); break; case noBatchFound: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case init: switch(Event.manual) { case init: setState(State.login); displayLoginScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case login: switch(Event.manual) { case login: setState(State.determiningUserMode); hideLoginScreen(); cleanupThumbnails(); checkUserState(); break; case cancel: setState(State.end); hideLoginScreen(); exitProgram(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case manualBatch: switch(Event.manual) { case auto: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); break; case refresh: setState(State.gettingManualBatch); isBatchAvailable(); break; case select: setState(State.batchSplashManual); displayBatchSplashScreen(); selectManualBatch(); break; case redisplay: setState(State.manualBatch); setUserManual(); displayThumbnailManual(); displayThumbnailManual(); break; case exit: setState(State.end); exitProgram(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case pageAutoBatch: switch(Event.manual) { case goBack: setState(State.processingAutoBatch); hidePageScreen(); displayAutoThumbnailProcessing(); break; case assign: setState(State.page); hidePageScreen(); displayPageScreen(); assignPage(); redisplayPageScreen(); break; case setZone: setState(State.page); hidePageScreen(); displayPageScreen(); assignZone(); redisplayPageScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case pageAutoBatchStopped: switch(Event.manual) { case goBack: setState(State.processingAutoBatchStopped); hidePageScreen(); displayAutoThumbnailProcessing(); break; case assign: setState(State.page); hidePageScreen(); displayPageScreen(); assignPage(); redisplayPageScreen(); break; case setZone: setState(State.page); hidePageScreen(); displayPageScreen(); assignZone(); redisplayPageScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case pageManualBatch: switch(Event.manual) { case goBack: setState(State.processingManualBatch); hidePageScreen(); displayManualThumbnailProcessing(); break; case assign: setState(State.page); hidePageScreen(); displayPageScreen(); assignPage(); redisplayPageScreen(); break; case setZone: setState(State.page); hidePageScreen(); displayPageScreen(); assignZone(); redisplayPageScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case processingAutoBatch: switch(Event.manual) { case stop: setState(State.processingAutoBatchStopped); hideThumbnailScreen(); break; case complete: setState(State.gettingAutoBatch); hideThumbnailScreen(); getNextAutoBatch(); completeBatch(); cleanupBatch(); break; case reject: setState(State.gettingAutoBatch); hideThumbnailScreen(); getNextAutoBatch(); rejectBatch(); cleanupBatch(); break; case openPage: setState(State.pageAutoBatch); hideThumbnailScreen(); displayPageScreen(); break; case redisplay: setState(State.processingAutoBatch); hideThumbnailScreen(); displayAutoThumbnailProcessing(); break; case ok: setState(State.processingBatch); hideThumbnailScreen(); break; case cancel: setState(State.processingBatch); hideThumbnailScreen(); break; case requeue: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); requeueBatch(); cleanupBatch(); break; case assign: setState(State.processingBatch); hideThumbnailScreen(); assignPage(); break; case exit: setState(State.end); hideThumbnailScreen(); exitProgram(); requeueBatch(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case processingAutoBatchStopped: switch(Event.manual) { case complete: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); completeBatch(); cleanupBatch(); break; case reject: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); rejectBatch(); cleanupBatch(); break; case openPage: setState(State.pageAutoBatchStopped); hideThumbnailScreen(); displayPageScreen(); break; case stop: setState(State.processingAutoBatch); hideThumbnailScreen(); break; case redisplay: setState(State.processingAutoBatchStopped); hideThumbnailScreen(); displayAutoThumbnailProcessing(); break; case ok: setState(State.processingBatch); hideThumbnailScreen(); break; case cancel: setState(State.processingBatch); hideThumbnailScreen(); break; case requeue: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); requeueBatch(); cleanupBatch(); break; case assign: setState(State.processingBatch); hideThumbnailScreen(); assignPage(); break; case exit: setState(State.end); hideThumbnailScreen(); exitProgram(); requeueBatch(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case processingManualBatch: switch(Event.manual) { case openPage: setState(State.pageManualBatch); hideThumbnailScreen(); displayPageScreen(); break; case redisplay: setState(State.processingManualBatch); hideThumbnailScreen(); displayManualThumbnailProcessing(); break; case ok: setState(State.processingBatch); hideThumbnailScreen(); break; case cancel: setState(State.processingBatch); hideThumbnailScreen(); break; case complete: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); completeBatch(); cleanupBatch(); break; case requeue: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); requeueBatch(); cleanupBatch(); break; case reject: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); rejectBatch(); cleanupBatch(); break; case assign: setState(State.processingBatch); hideThumbnailScreen(); assignPage(); break; case exit: setState(State.end); hideThumbnailScreen(); exitProgram(); requeueBatch(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; } }
public void manual() { <DeepExtract> switch(state) { case autoBatch: switch(Event.manual) { case manual: setState(State.gettingManualBatch); isBatchAvailable(); createSelector(); break; case select: setState(State.gettingAutoBatch); getNextAutoBatch(); createSelector(); break; case itemChanged: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); workTypeItemChanged(); break; case redisplay: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); displayThumbnailAuto(); break; case exit: setState(State.end); exitProgram(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case batchSplashAuto: switch(Event.manual) { case ok: setState(State.processingAutoBatch); hideBatchSplashScreen(); allMode(); initBatch(); displayAutoThumbnailProcessing(); break; case complete: setState(State.gettingAutoBatch); hideBatchSplashScreen(); getNextAutoBatch(); completeBatch(); hideThumbnailScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case batchSplashManual: switch(Event.manual) { case ok: setState(State.processingManualBatch); hideBatchSplashScreen(); allMode(); initBatch(); displayManualThumbnailProcessing(); break; case complete: setState(State.determiningUserMode); hideBatchSplashScreen(); cleanupThumbnails(); checkUserState(); completeBatch(); hideThumbnailScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case determiningUserMode: switch(Event.manual) { case auto: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); break; case manual: setState(State.gettingManualBatch); isBatchAvailable(); createSelector(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case end: switch(Event.manual) { default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case gettingAutoBatch: switch(Event.manual) { case nextBatchFound: setState(State.batchSplashAuto); displayBatchSplashScreen(); break; case noBatchFound: setState(State.determiningUserMode); cleanupThumbnails(); checkUserState(); noBatchDialog(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case gettingManualBatch: switch(Event.manual) { case batchesFound: setState(State.manualBatch); setUserManual(); displayThumbnailManual(); break; case noBatchFound: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case init: switch(Event.manual) { case init: setState(State.login); displayLoginScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case login: switch(Event.manual) { case login: setState(State.determiningUserMode); hideLoginScreen(); cleanupThumbnails(); checkUserState(); break; case cancel: setState(State.end); hideLoginScreen(); exitProgram(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case manualBatch: switch(Event.manual) { case auto: setState(State.autoBatch); setUserAuto(); displayThumbnailAuto(); break; case refresh: setState(State.gettingManualBatch); isBatchAvailable(); break; case select: setState(State.batchSplashManual); displayBatchSplashScreen(); selectManualBatch(); break; case redisplay: setState(State.manualBatch); setUserManual(); displayThumbnailManual(); displayThumbnailManual(); break; case exit: setState(State.end); exitProgram(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case pageAutoBatch: switch(Event.manual) { case goBack: setState(State.processingAutoBatch); hidePageScreen(); displayAutoThumbnailProcessing(); break; case assign: setState(State.page); hidePageScreen(); displayPageScreen(); assignPage(); redisplayPageScreen(); break; case setZone: setState(State.page); hidePageScreen(); displayPageScreen(); assignZone(); redisplayPageScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case pageAutoBatchStopped: switch(Event.manual) { case goBack: setState(State.processingAutoBatchStopped); hidePageScreen(); displayAutoThumbnailProcessing(); break; case assign: setState(State.page); hidePageScreen(); displayPageScreen(); assignPage(); redisplayPageScreen(); break; case setZone: setState(State.page); hidePageScreen(); displayPageScreen(); assignZone(); redisplayPageScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case pageManualBatch: switch(Event.manual) { case goBack: setState(State.processingManualBatch); hidePageScreen(); displayManualThumbnailProcessing(); break; case assign: setState(State.page); hidePageScreen(); displayPageScreen(); assignPage(); redisplayPageScreen(); break; case setZone: setState(State.page); hidePageScreen(); displayPageScreen(); assignZone(); redisplayPageScreen(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case processingAutoBatch: switch(Event.manual) { case stop: setState(State.processingAutoBatchStopped); hideThumbnailScreen(); break; case complete: setState(State.gettingAutoBatch); hideThumbnailScreen(); getNextAutoBatch(); completeBatch(); cleanupBatch(); break; case reject: setState(State.gettingAutoBatch); hideThumbnailScreen(); getNextAutoBatch(); rejectBatch(); cleanupBatch(); break; case openPage: setState(State.pageAutoBatch); hideThumbnailScreen(); displayPageScreen(); break; case redisplay: setState(State.processingAutoBatch); hideThumbnailScreen(); displayAutoThumbnailProcessing(); break; case ok: setState(State.processingBatch); hideThumbnailScreen(); break; case cancel: setState(State.processingBatch); hideThumbnailScreen(); break; case requeue: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); requeueBatch(); cleanupBatch(); break; case assign: setState(State.processingBatch); hideThumbnailScreen(); assignPage(); break; case exit: setState(State.end); hideThumbnailScreen(); exitProgram(); requeueBatch(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case processingAutoBatchStopped: switch(Event.manual) { case complete: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); completeBatch(); cleanupBatch(); break; case reject: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); rejectBatch(); cleanupBatch(); break; case openPage: setState(State.pageAutoBatchStopped); hideThumbnailScreen(); displayPageScreen(); break; case stop: setState(State.processingAutoBatch); hideThumbnailScreen(); break; case redisplay: setState(State.processingAutoBatchStopped); hideThumbnailScreen(); displayAutoThumbnailProcessing(); break; case ok: setState(State.processingBatch); hideThumbnailScreen(); break; case cancel: setState(State.processingBatch); hideThumbnailScreen(); break; case requeue: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); requeueBatch(); cleanupBatch(); break; case assign: setState(State.processingBatch); hideThumbnailScreen(); assignPage(); break; case exit: setState(State.end); hideThumbnailScreen(); exitProgram(); requeueBatch(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; case processingManualBatch: switch(Event.manual) { case openPage: setState(State.pageManualBatch); hideThumbnailScreen(); displayPageScreen(); break; case redisplay: setState(State.processingManualBatch); hideThumbnailScreen(); displayManualThumbnailProcessing(); break; case ok: setState(State.processingBatch); hideThumbnailScreen(); break; case cancel: setState(State.processingBatch); hideThumbnailScreen(); break; case complete: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); completeBatch(); cleanupBatch(); break; case requeue: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); requeueBatch(); cleanupBatch(); break; case reject: setState(State.determiningUserMode); hideThumbnailScreen(); cleanupThumbnails(); checkUserState(); rejectBatch(); cleanupBatch(); break; case assign: setState(State.processingBatch); hideThumbnailScreen(); assignPage(); break; case exit: setState(State.end); hideThumbnailScreen(); exitProgram(); requeueBatch(); break; default: unhandledTransition(state.name(), Event.manual.name()); break; } break; } </DeepExtract> }
CC_SMC
positive
2,627
void enter(String text) { current().clearEdited(); if (mEntries.size() >= MAX_ENTRIES) { mEntries.remove(0); } if (mEntries.size() < 2 || !text.equals(mEntries.elementAt(mEntries.size() - 2).getBase())) { mEntries.insertElementAt(new HistoryEntry(text), mEntries.size() - 1); } mPos = mEntries.size() - 1; if (mObserver != null) { mObserver.notifyDataSetChanged(); } }
void enter(String text) { current().clearEdited(); if (mEntries.size() >= MAX_ENTRIES) { mEntries.remove(0); } if (mEntries.size() < 2 || !text.equals(mEntries.elementAt(mEntries.size() - 2).getBase())) { mEntries.insertElementAt(new HistoryEntry(text), mEntries.size() - 1); } mPos = mEntries.size() - 1; <DeepExtract> if (mObserver != null) { mObserver.notifyDataSetChanged(); } </DeepExtract> }
daily-money
positive
2,628
public void handleEvent(Event e) { stepname = null; input.setChanged(changed); dispose(); }
public void handleEvent(Event e) { <DeepExtract> stepname = null; input.setChanged(changed); dispose(); </DeepExtract> }
kettle-beam
positive
2,629
@Override public void setValue(K cacheKey, V cacheValue) { SoftReferenceEntry<K, V> entry; while (Objects.nonNull(entry = (SoftReferenceEntry<K, V>) garbageQueue.poll())) { cache.remove(entry.key); } if (Objects.isNull(cacheValue)) { removeValue(cacheKey); } else { cache.put(cacheKey, new SoftReferenceEntry<>(cacheKey, cacheValue, garbageQueue)); } }
@Override public void setValue(K cacheKey, V cacheValue) { <DeepExtract> SoftReferenceEntry<K, V> entry; while (Objects.nonNull(entry = (SoftReferenceEntry<K, V>) garbageQueue.poll())) { cache.remove(entry.key); } </DeepExtract> if (Objects.isNull(cacheValue)) { removeValue(cacheKey); } else { cache.put(cacheKey, new SoftReferenceEntry<>(cacheKey, cacheValue, garbageQueue)); } }
qiuyj-code
positive
2,631
@Override public void onDestroyView() { super.onDestroyView(); RefWatcher refWatcher = HawkularApplication.getRefWatcher(getActivity()); refWatcher.watch(this); }
@Override public void onDestroyView() { super.onDestroyView(); <DeepExtract> RefWatcher refWatcher = HawkularApplication.getRefWatcher(getActivity()); refWatcher.watch(this); </DeepExtract> }
hawkular-android-client
positive
2,632
private void setupBitGrid(int size) { int i, toggle = 1; for (i = 0; i < size; i++) { if (toggle == 1) { grid[i] = 0x21; grid[(i * size)] = 0x21; toggle = 0; } else { grid[i] = 0x20; grid[(i * size)] = 0x20; toggle = 1; } } int xp, yp; int[] finder = { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 }; for (xp = 0; xp < 7; xp++) { for (yp = 0; yp < 7; yp++) { if (finder[xp + (7 * yp)] == 1) { grid[((yp + 0) * size) + (xp + 0)] = 0x11; } else { grid[((yp + 0) * size) + (xp + 0)] = 0x10; } } } for (i = 0; i < 7; i++) { grid[(7 * size) + i] = 0x10; grid[(i * size) + 7] = 0x10; } grid[(7 * size) + 7] = 0x10; for (i = 0; i < 8; i++) { grid[(8 * size) + i] += 0x20; grid[(i * size) + 8] += 0x20; } grid[(8 * size) + 8] += 0x20; }
private void setupBitGrid(int size) { int i, toggle = 1; for (i = 0; i < size; i++) { if (toggle == 1) { grid[i] = 0x21; grid[(i * size)] = 0x21; toggle = 0; } else { grid[i] = 0x20; grid[(i * size)] = 0x20; toggle = 1; } } <DeepExtract> int xp, yp; int[] finder = { 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 }; for (xp = 0; xp < 7; xp++) { for (yp = 0; yp < 7; yp++) { if (finder[xp + (7 * yp)] == 1) { grid[((yp + 0) * size) + (xp + 0)] = 0x11; } else { grid[((yp + 0) * size) + (xp + 0)] = 0x10; } } } </DeepExtract> for (i = 0; i < 7; i++) { grid[(7 * size) + i] = 0x10; grid[(i * size) + 7] = 0x10; } grid[(7 * size) + 7] = 0x10; for (i = 0; i < 8; i++) { grid[(8 * size) + i] += 0x20; grid[(i * size) + 8] += 0x20; } grid[(8 * size) + 8] += 0x20; }
OkapiBarcode
positive
2,633
protected void listTopics(Function<Consumer<String, String>, Map<String, List<PartitionInfo>>> partitionInfoFetcher) throws InterruptedException { Properties properties = new Properties(); properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); try (Producer<String, String> producer = getClientFactory().newProducer(properties)) { ExecutorService executorService = Executors.newFixedThreadPool(_topics.size()); AtomicInteger failedCount = new AtomicInteger(); CountDownLatch latch = new CountDownLatch(_topics.size()); try { _topics.forEach(t -> { executorService.submit(() -> { try { produceMessages(producer, t); } catch (Throwable e) { failedCount.incrementAndGet(); System.out.println("produce messages failed for " + t); e.printStackTrace(); } finally { latch.countDown(); } }); }); } finally { executorService.shutdown(); } if (!latch.await(_waitTimeout, TimeUnit.MILLISECONDS)) Assert.fail("produce message timeout: " + _waitTimeout); Assert.assertEquals(0, failedCount.get()); } try (Consumer<String, String> consumer = createConsumer()) { consumer.subscribe(_topics); pollDurationTimeout(consumer); Map<String, List<PartitionInfo>> partitionInfoMap = partitionInfoFetcher.apply(consumer); System.out.println("partitionInfoMap: " + partitionInfoMap); Assert.assertFalse(CollectionExtension.isEmpty(partitionInfoMap)); } }
protected void listTopics(Function<Consumer<String, String>, Map<String, List<PartitionInfo>>> partitionInfoFetcher) throws InterruptedException { <DeepExtract> Properties properties = new Properties(); properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); try (Producer<String, String> producer = getClientFactory().newProducer(properties)) { ExecutorService executorService = Executors.newFixedThreadPool(_topics.size()); AtomicInteger failedCount = new AtomicInteger(); CountDownLatch latch = new CountDownLatch(_topics.size()); try { _topics.forEach(t -> { executorService.submit(() -> { try { produceMessages(producer, t); } catch (Throwable e) { failedCount.incrementAndGet(); System.out.println("produce messages failed for " + t); e.printStackTrace(); } finally { latch.countDown(); } }); }); } finally { executorService.shutdown(); } if (!latch.await(_waitTimeout, TimeUnit.MILLISECONDS)) Assert.fail("produce message timeout: " + _waitTimeout); Assert.assertEquals(0, failedCount.get()); } </DeepExtract> try (Consumer<String, String> consumer = createConsumer()) { consumer.subscribe(_topics); pollDurationTimeout(consumer); Map<String, List<PartitionInfo>> partitionInfoMap = partitionInfoFetcher.apply(consumer); System.out.println("partitionInfoMap: " + partitionInfoMap); Assert.assertFalse(CollectionExtension.isEmpty(partitionInfoMap)); } }
kbear
positive
2,634
@java.lang.Deprecated public static Type valueOf(int value) { switch(value) { case 1: return P1A; case 2: return P1B; case 3: return P2A; case 4: return P2B; case 5: return REQUEST; case 6: return RESPONSE; case 7: return PROPOSE; case 8: return DECISION; case 9: return ADOPTED; case 10: return PREEMPTED; default: return null; } }
@java.lang.Deprecated public static Type valueOf(int value) { <DeepExtract> switch(value) { case 1: return P1A; case 2: return P1B; case 3: return P2A; case 4: return P2B; case 5: return REQUEST; case 6: return RESPONSE; case 7: return PROPOSE; case 8: return DECISION; case 9: return ADOPTED; case 10: return PREEMPTED; default: return null; } </DeepExtract> }
Paxos-log-replication-Java
positive
2,635
@Test public void numberOfWays5() throws Exception { expected = 70; n = 5; m = 5; assertEquals(expected, CountPossibleTraversals.numberOfWays(n, m)); }
@Test public void numberOfWays5() throws Exception { expected = 70; n = 5; m = 5; <DeepExtract> assertEquals(expected, CountPossibleTraversals.numberOfWays(n, m)); </DeepExtract> }
Elements-of-programming-interviews
positive
2,636
public static void e(String tag, String message, int methodCount) { if (methodCount < 0 || methodCount > MAX_METHOD_COUNT) { throw new IllegalStateException("methodCount must be > 0 and < 5"); } e(tag, message, null, methodCount); }
public static void e(String tag, String message, int methodCount) { <DeepExtract> if (methodCount < 0 || methodCount > MAX_METHOD_COUNT) { throw new IllegalStateException("methodCount must be > 0 and < 5"); } </DeepExtract> e(tag, message, null, methodCount); }
JianDan_OkHttpWithVolley
positive
2,637
private void writeBoolean(final boolean b, final boolean tag) throws IOException { if (tag) writeTypeTag(TAG_BOOL); m_buffer.write(b ? 1 : 0); checkFlush(); }
private void writeBoolean(final boolean b, final boolean tag) throws IOException { if (tag) writeTypeTag(TAG_BOOL); <DeepExtract> m_buffer.write(b ? 1 : 0); checkFlush(); </DeepExtract> }
mgen
positive
2,638
public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields; switch(fieldId) { case 1: fields = KNOBS; default: fields = null; } if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; }
public static _Fields findByThriftIdOrThrow(int fieldId) { <DeepExtract> _Fields fields; switch(fieldId) { case 1: fields = KNOBS; default: fields = null; } </DeepExtract> if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; }
android-wlan
positive
2,639
@Override public void visitPOP2(InstructionHandle instructionHandle) { result = Const.getOpcodeName(instructionHandle.getInstruction().getOpcode()) + " // [" + instructionHandle.getPosition() + "]"; }
@Override public void visitPOP2(InstructionHandle instructionHandle) { <DeepExtract> result = Const.getOpcodeName(instructionHandle.getInstruction().getOpcode()) + " // [" + instructionHandle.getPosition() + "]"; </DeepExtract> }
Java-Bytecode-Editor
positive
2,640
@RequestMapping(value = "query", method = RequestMethod.GET) public List<MockDto> queryList() { List<MockDto> mockDtoList = new ArrayList<>(8); System.out.println("add userModel = " + new MockDto(1, "张一").toString()); return 1; return mockDtoList; }
@RequestMapping(value = "query", method = RequestMethod.GET) public List<MockDto> queryList() { List<MockDto> mockDtoList = new ArrayList<>(8); <DeepExtract> System.out.println("add userModel = " + new MockDto(1, "张一").toString()); return 1; </DeepExtract> return mockDtoList; }
component
positive
2,642
@Override public void registryListener() { this.addListener(e -> { RequestContext context = e.getValue(); executorManager.commonExecute(new HeartbeatAction(context)); }, MessageType.HEARTBEAT_REQUEST); this.addListener(e -> { RequestContext context = e.getValue(); executorManager.execute(new JobExecuteAction(context, properties, jobExecutionPersistence, jobRegistrar)); }, MessageType.JOB_EXEC_REQUEST); this.addListener(e -> { RequestContext context = e.getValue(); executorManager.commonExecute(new KillRunningJobAction(context, jobExecutionPersistence)); }, MessageType.KILL_JOB_REQUEST); this.addListener(e -> { RequestContext context = e.getValue(); executorManager.commonExecute(new JobExecuteStatusAction(context, jobExecutionPersistence)); }, MessageType.FETCH_JOB_STATUS_REQUEST); this.addListener(e -> { RequestContext context = e.getValue(); executorManager.commonExecute(new JobExecuteLogAction(context, properties)); }, MessageType.FETCH_JOB_LOG_REQUEST); }
@Override public void registryListener() { this.addListener(e -> { RequestContext context = e.getValue(); executorManager.commonExecute(new HeartbeatAction(context)); }, MessageType.HEARTBEAT_REQUEST); this.addListener(e -> { RequestContext context = e.getValue(); executorManager.execute(new JobExecuteAction(context, properties, jobExecutionPersistence, jobRegistrar)); }, MessageType.JOB_EXEC_REQUEST); this.addListener(e -> { RequestContext context = e.getValue(); executorManager.commonExecute(new KillRunningJobAction(context, jobExecutionPersistence)); }, MessageType.KILL_JOB_REQUEST); this.addListener(e -> { RequestContext context = e.getValue(); executorManager.commonExecute(new JobExecuteStatusAction(context, jobExecutionPersistence)); }, MessageType.FETCH_JOB_STATUS_REQUEST); <DeepExtract> this.addListener(e -> { RequestContext context = e.getValue(); executorManager.commonExecute(new JobExecuteLogAction(context, properties)); }, MessageType.FETCH_JOB_LOG_REQUEST); </DeepExtract> }
hodor
positive
2,643
public <T, K> ModelMember<T, K> getByModelClass(Class<? extends Model<T, K>> modelClass) { return getByModelClass(ObjectUtils.typeCast(modelClass.getClass())); if (null == result) { result = persistence.modelIndexMap.get(modelClass); if (null == result) { if (loadModel(modelClass)) { result = persistence.modelProxyIndexMap.get(modelClass); if (null == result) { result = persistence.modelIndexMap.get(modelClass); } } } } if (null == result) { throw new ModelInvalidException(modelClass); } return ObjectUtils.typeCast(result); }
public <T, K> ModelMember<T, K> getByModelClass(Class<? extends Model<T, K>> modelClass) { <DeepExtract> return getByModelClass(ObjectUtils.typeCast(modelClass.getClass())); </DeepExtract> if (null == result) { result = persistence.modelIndexMap.get(modelClass); if (null == result) { if (loadModel(modelClass)) { result = persistence.modelProxyIndexMap.get(modelClass); if (null == result) { result = persistence.modelIndexMap.get(modelClass); } } } } if (null == result) { throw new ModelInvalidException(modelClass); } return ObjectUtils.typeCast(result); }
database-all
positive
2,644
private void init() { View view = inflater.inflate(R.layout.danmuview, this, true); danmuItem0 = view.findViewById(R.id.danmuitem0); danmuItem1 = view.findViewById(R.id.danmuitem1); setOrientation(VERTICAL); danmuItem0.setVisibility(View.INVISIBLE); danmuItem1.setVisibility(View.INVISIBLE); WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); Display defaultDisplay = windowManager.getDefaultDisplay(); screenWidth = defaultDisplay.getWidth(); }
private void init() { View view = inflater.inflate(R.layout.danmuview, this, true); danmuItem0 = view.findViewById(R.id.danmuitem0); danmuItem1 = view.findViewById(R.id.danmuitem1); <DeepExtract> setOrientation(VERTICAL); danmuItem0.setVisibility(View.INVISIBLE); danmuItem1.setVisibility(View.INVISIBLE); </DeepExtract> WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE); Display defaultDisplay = windowManager.getDefaultDisplay(); screenWidth = defaultDisplay.getWidth(); }
AdouLive
positive
2,646
public static Class<?> getNmsClass(String className) throws Exception { try { return Class.forName("net.minecraft.server." + API_VERSION + "." + className); } catch (ClassNotFoundException e) { return null; } }
public static Class<?> getNmsClass(String className) throws Exception { <DeepExtract> try { return Class.forName("net.minecraft.server." + API_VERSION + "." + className); } catch (ClassNotFoundException e) { return null; } </DeepExtract> }
CombatTagPlus
positive
2,648
public static void setRoleToCollectionResource(EndpointContract endpoint) { if (endpoint.getPrimaryRole() != null && !endpoint.getPrimaryRole().isEmpty()) { System.err.println("[W] A primary endpoint role is already defined and will be overwritten."); } if (COLLECTION_RESOURCE != null && COLLECTION_RESOURCE.equals(COLLECTION_RESOURCE)) { endpoint.setPrimaryRole(INFORMATION_HOLDER_RESOURCE); endpoint.getOtherRoles().add(COLLECTION_RESOURCE); } else if (COLLECTION_RESOURCE != null && COLLECTION_RESOURCE.equals(MUTABLE_COLLECTION_RESOURCE)) { endpoint.setPrimaryRole(INFORMATION_HOLDER_RESOURCE); endpoint.getOtherRoles().add('"' + COLLECTION_RESOURCE + '"'); } else { endpoint.setPrimaryRole(COLLECTION_RESOURCE); } }
public static void setRoleToCollectionResource(EndpointContract endpoint) { <DeepExtract> if (endpoint.getPrimaryRole() != null && !endpoint.getPrimaryRole().isEmpty()) { System.err.println("[W] A primary endpoint role is already defined and will be overwritten."); } if (COLLECTION_RESOURCE != null && COLLECTION_RESOURCE.equals(COLLECTION_RESOURCE)) { endpoint.setPrimaryRole(INFORMATION_HOLDER_RESOURCE); endpoint.getOtherRoles().add(COLLECTION_RESOURCE); } else if (COLLECTION_RESOURCE != null && COLLECTION_RESOURCE.equals(MUTABLE_COLLECTION_RESOURCE)) { endpoint.setPrimaryRole(INFORMATION_HOLDER_RESOURCE); endpoint.getOtherRoles().add('"' + COLLECTION_RESOURCE + '"'); } else { endpoint.setPrimaryRole(COLLECTION_RESOURCE); } </DeepExtract> }
MDSL-Specification
positive
2,649
public void processStarted(final ProcessInstance processInstance) { try { final Transaction tx = tm.getTransaction(); tx.registerSynchronization(new ProcessStartedSynchronization()); } catch (final RollbackException re) { throw new IllegalStateException("Transaction management exception", re); } catch (final SystemException se) { throw new IllegalStateException("Transaction management exception", se); } }
public void processStarted(final ProcessInstance processInstance) { <DeepExtract> try { final Transaction tx = tm.getTransaction(); tx.registerSynchronization(new ProcessStartedSynchronization()); } catch (final RollbackException re) { throw new IllegalStateException("Transaction management exception", re); } catch (final SystemException se) { throw new IllegalStateException("Transaction management exception", se); } </DeepExtract> }
jboss-keynote-2012
positive
2,650
public void subscribeCandle(String symbol) throws APICommunicationException { CandlesSubscribe cs = new CandlesSubscribe(symbol, streamSessionId); try { this.writeMessageHelper(cs.toJSONString(), true); } catch (APICommunicationException ex) { this.disconnectStream(); throw ex; } }
public void subscribeCandle(String symbol) throws APICommunicationException { CandlesSubscribe cs = new CandlesSubscribe(symbol, streamSessionId); <DeepExtract> try { this.writeMessageHelper(cs.toJSONString(), true); } catch (APICommunicationException ex) { this.disconnectStream(); throw ex; } </DeepExtract> }
AI_Trader
positive
2,651
@VisibleForTesting public void flushAndVerify() throws IOException, InterruptedException { writer.flush(); synchronized (this) { while (this.pendingWritesCount.get() > 0) { this.wait(); } } Throwable error = writeError.getAndSet(null); if (error != null) { throw new IOException("Write failure", error); } }
@VisibleForTesting public void flushAndVerify() throws IOException, InterruptedException { writer.flush(); synchronized (this) { while (this.pendingWritesCount.get() > 0) { this.wait(); } } <DeepExtract> Throwable error = writeError.getAndSet(null); if (error != null) { throw new IOException("Write failure", error); } </DeepExtract> }
flink-connectors
positive
2,653
public Criteria andGoodsImgIsNull() { if ("goods_img is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("goods_img is null")); return (Criteria) this; }
public Criteria andGoodsImgIsNull() { <DeepExtract> if ("goods_img is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("goods_img is null")); </DeepExtract> return (Criteria) this; }
ssmxiaomi
positive
2,654
public static void notifyIMEEnabled(int state, String typeHint, String actionHint, boolean landscapeFS) { if (GeckoApp.surfaceView == null) return; GeckoApp.surfaceView.mIMEState = state; GeckoApp.surfaceView.mIMETypeHint = typeHint; GeckoApp.surfaceView.mIMEActionHint = actionHint; GeckoApp.surfaceView.mIMELandscapeFS = landscapeFS; getInstance().mEnable = true; }
public static void notifyIMEEnabled(int state, String typeHint, String actionHint, boolean landscapeFS) { if (GeckoApp.surfaceView == null) return; GeckoApp.surfaceView.mIMEState = state; GeckoApp.surfaceView.mIMETypeHint = typeHint; GeckoApp.surfaceView.mIMEActionHint = actionHint; GeckoApp.surfaceView.mIMELandscapeFS = landscapeFS; <DeepExtract> getInstance().mEnable = true; </DeepExtract> }
DOMinator
positive
2,655
private void addSpan(int type, int color) { Span span = spans[type]; if (span != null) { spans[type] = null; span.end = out.length(); if (span.start != span.end) { if (DEBUG) logger.debug("finalizeSpan(...): type={}, start={}, end={}, color={}", span.type, span.start, span.end, span.color); spanList.add(span); } } int pos = out.length(); Span span = null; boolean found = false; for (Iterator<Span> it = spanList.iterator(); it.hasNext(); ) { span = it.next(); if (span.end == pos && span.type == type && span.color == color) { it.remove(); found = true; break; } } if (!found) { span = new Span(); span.type = type; span.start = pos; span.color = color; } spans[type] = span; }
private void addSpan(int type, int color) { <DeepExtract> Span span = spans[type]; if (span != null) { spans[type] = null; span.end = out.length(); if (span.start != span.end) { if (DEBUG) logger.debug("finalizeSpan(...): type={}, start={}, end={}, color={}", span.type, span.start, span.end, span.color); spanList.add(span); } } </DeepExtract> int pos = out.length(); Span span = null; boolean found = false; for (Iterator<Span> it = spanList.iterator(); it.hasNext(); ) { span = it.next(); if (span.end == pos && span.type == type && span.color == color) { it.remove(); found = true; break; } } if (!found) { span = new Span(); span.type = type; span.start = pos; span.color = color; } spans[type] = span; }
weechat-android
positive
2,656