_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q23400 | MessageDialogBuilder.setExtraWindowHints | train | public MessageDialogBuilder setExtraWindowHints(Collection<Window.Hint> extraWindowHints) {
this.extraWindowHints.clear();
this.extraWindowHints.addAll(extraWindowHints);
return this;
} | java | {
"resource": ""
} |
q23401 | WaitingDialog.showDialog | train | public static WaitingDialog showDialog(WindowBasedTextGUI textGUI, String title, String text) {
WaitingDialog waitingDialog = createDialog(title, text);
waitingDialog.showDialog(textGUI, false);
return waitingDialog;
} | java | {
"resource": ""
} |
q23402 | GridLayout.createHorizontallyFilledLayoutData | train | public static LayoutData createHorizontallyFilledLayoutData(int horizontalSpan) {
return createLayoutData(
Alignment.FILL,
Alignment.CENTER,
true,
false,
horizontalSpan,
1);
} | java | {
"resource": ""
} |
q23403 | GridLayout.createHorizontallyEndAlignedLayoutData | train | public static LayoutData createHorizontallyEndAlignedLayoutData(int horizontalSpan) {
return createLayoutData(
Alignment.END,
Alignment.CENTER,
true,
false,
horizontalSpan,
1);
} | java | {
"resource": ""
} |
q23404 | CheckBox.setChecked | train | public synchronized CheckBox setChecked(final boolean checked) {
this.checked = checked;
runOnGUIThreadIfExistsOtherwiseRunDirect(new Runnable() {
@Override
public void run() {
for(Listener listener : listeners) {
listener.onStatusChanged(check... | java | {
"resource": ""
} |
q23405 | CheckBox.setLabel | train | public synchronized CheckBox setLabel(String label) {
if(label == null) {
throw new IllegalArgumentException("Cannot set CheckBox label to null");
}
this.label = label;
invalidate();
return this;
} | java | {
"resource": ""
} |
q23406 | CheckBox.addListener | train | public CheckBox addListener(Listener listener) {
if(listener != null && !listeners.contains(listener)) {
listeners.add(listener);
}
return this;
} | java | {
"resource": ""
} |
q23407 | GraphicalTerminalImplementation.startBlinkTimer | train | synchronized void startBlinkTimer() {
if(blinkTimer != null) {
// Already on!
return;
}
blinkTimer = new Timer("LanternaTerminalBlinkTimer", true);
blinkTimer.schedule(new TimerTask() {
@Override
public void run() {
blinkOn ... | java | {
"resource": ""
} |
q23408 | GraphicalTerminalImplementation.getPreferredSize | train | synchronized Dimension getPreferredSize() {
return new Dimension(getFontWidth() * virtualTerminal.getTerminalSize().getColumns(),
getFontHeight() * virtualTerminal.getTerminalSize().getRows());
} | java | {
"resource": ""
} |
q23409 | GraphicalTerminalImplementation.clearBackBuffer | train | private void clearBackBuffer() {
// Manually clear the backbuffer
if(backbuffer != null) {
Graphics2D graphics = backbuffer.createGraphics();
Color backgroundColor = colorConfiguration.toAWTColor(TextColor.ANSI.DEFAULT, false, false);
graphics.setColor(backgroundColor... | java | {
"resource": ""
} |
q23410 | SimpleTheme.makeTheme | train | public static SimpleTheme makeTheme(
boolean activeIsBold,
TextColor baseForeground,
TextColor baseBackground,
TextColor editableForeground,
TextColor editableBackground,
TextColor selectedForeground,
TextColor selectedBackground,
... | java | {
"resource": ""
} |
q23411 | SimpleTheme.addOverride | train | public synchronized Definition addOverride(Class<?> clazz, TextColor foreground, TextColor background, SGR... styles) {
Definition definition = new Definition(new Style(foreground, background, styles));
overrideDefinitions.put(clazz, definition);
return definition;
} | java | {
"resource": ""
} |
q23412 | TableModel.getRows | train | public synchronized List<List<V>> getRows() {
List<List<V>> copy = new ArrayList<List<V>>();
for(List<V> row: rows) {
copy.add(new ArrayList<V>(row));
}
return copy;
} | java | {
"resource": ""
} |
q23413 | TableModel.insertRow | train | public synchronized TableModel<V> insertRow(int index, Collection<V> values) {
ArrayList<V> list = new ArrayList<V>(values);
rows.add(index, list);
for(Listener<V> listener: listeners) {
listener.onRowAdded(this, index);
}
return this;
} | java | {
"resource": ""
} |
q23414 | TableModel.removeRow | train | public synchronized TableModel<V> removeRow(int index) {
List<V> removedRow = rows.remove(index);
for(Listener<V> listener: listeners) {
listener.onRowRemoved(this, index, removedRow);
}
return this;
} | java | {
"resource": ""
} |
q23415 | TableModel.setColumnLabel | train | public synchronized TableModel<V> setColumnLabel(int index, String newLabel) {
columns.set(index, newLabel);
return this;
} | java | {
"resource": ""
} |
q23416 | TableModel.removeColumn | train | public synchronized TableModel<V> removeColumn(int index) {
String removedColumnHeader = columns.remove(index);
List<V> removedColumn = new ArrayList<V>();
for(List<V> row : rows) {
removedColumn.add(row.remove(index));
}
for(Listener<V> listener: listeners) {
... | java | {
"resource": ""
} |
q23417 | TerminalEmulatorPalette.get | train | public Color get(TextColor.ANSI color, boolean isForeground, boolean useBrightTones) {
if(useBrightTones) {
switch(color) {
case BLACK:
return brightBlack;
case BLUE:
return brightBlue;
case CYAN:
... | java | {
"resource": ""
} |
q23418 | InteractableLookupMap.add | train | @SuppressWarnings("ConstantConditions")
public synchronized void add(Interactable interactable) {
TerminalPosition topLeft = interactable.toBasePane(TerminalPosition.TOP_LEFT_CORNER);
TerminalSize size = interactable.getSize();
interactables.add(interactable);
int index = interactabl... | java | {
"resource": ""
} |
q23419 | InteractableLookupMap.getInteractableAt | train | public synchronized Interactable getInteractableAt(TerminalPosition position) {
if (position.getRow() < 0 || position.getColumn() < 0) {
return null;
}
if(position.getRow() >= lookupMap.length) {
return null;
}
else if(position.getColumn() >= lookupMap[0].... | java | {
"resource": ""
} |
q23420 | ListSelectDialogBuilder.addListItems | train | public ListSelectDialogBuilder<T> addListItems(T... items) {
this.content.addAll(Arrays.asList(items));
return this;
} | java | {
"resource": ""
} |
q23421 | CheckBoxList.addItem | train | public synchronized CheckBoxList<V> addItem(V object, boolean checkedState) {
itemStatus.add(checkedState);
return super.addItem(object);
} | java | {
"resource": ""
} |
q23422 | CheckBoxList.setChecked | train | public synchronized CheckBoxList<V> setChecked(V object, boolean checked) {
int index = indexOf(object);
if(index != -1) {
setChecked(index, checked);
}
return self();
} | java | {
"resource": ""
} |
q23423 | CheckBoxList.getCheckedItems | train | public synchronized List<V> getCheckedItems() {
List<V> result = new ArrayList<V>();
for(int i = 0; i < itemStatus.size(); i++) {
if(itemStatus.get(i)) {
result.add(getItemAt(i));
}
}
return result;
} | java | {
"resource": ""
} |
q23424 | InputDecoder.addProfile | train | public void addProfile(KeyDecodingProfile profile) {
for (CharacterPattern pattern : profile.getPatterns()) {
synchronized(bytePatterns) {
//If an equivalent pattern already exists, remove it first
bytePatterns.remove(pattern);
bytePatterns.add(pattern... | java | {
"resource": ""
} |
q23425 | InputDecoder.getNextCharacter | train | public synchronized KeyStroke getNextCharacter(boolean blockingIO) throws IOException {
KeyStroke bestMatch = null;
int bestLen = 0;
int curLen = 0;
while(true) {
if ( curLen < currentMatching.size() ) {
// (re-)consume characters previously read:
... | java | {
"resource": ""
} |
q23426 | MessageDialog.showMessageDialog | train | public static MessageDialogButton showMessageDialog(
WindowBasedTextGUI textGUI,
String title,
String text,
MessageDialogButton... buttons) {
MessageDialogBuilder builder = new MessageDialogBuilder()
.setTitle(title)
.setText(text);... | java | {
"resource": ""
} |
q23427 | Panel.addComponent | train | public Panel addComponent(int index, Component component) {
if(component == null) {
throw new IllegalArgumentException("Cannot add null component");
}
synchronized(components) {
if(components.contains(component)) {
return this;
}
if... | java | {
"resource": ""
} |
q23428 | Panel.removeAllComponents | train | public Panel removeAllComponents() {
synchronized(components) {
for(Component component : new ArrayList<Component>(components)) {
removeComponent(component);
}
}
return this;
} | java | {
"resource": ""
} |
q23429 | Panel.setLayoutManager | train | public synchronized Panel setLayoutManager(LayoutManager layoutManager) {
if(layoutManager == null) {
layoutManager = new AbsoluteLayout();
}
this.layoutManager = layoutManager;
invalidate();
return this;
} | java | {
"resource": ""
} |
q23430 | ComboBox.addItem | train | public synchronized ComboBox<V> addItem(V item) {
if(item == null) {
throw new IllegalArgumentException("Cannot add null elements to a ComboBox");
}
items.add(item);
if(selectedIndex == -1 && items.size() == 1) {
setSelectedIndex(0);
}
invalidate()... | java | {
"resource": ""
} |
q23431 | ComboBox.removeItem | train | public synchronized ComboBox<V> removeItem(V item) {
int index = items.indexOf(item);
if(index == -1) {
return this;
}
return remoteItem(index);
} | java | {
"resource": ""
} |
q23432 | ComboBox.remoteItem | train | public synchronized ComboBox<V> remoteItem(int index) {
items.remove(index);
if(index < selectedIndex) {
setSelectedIndex(selectedIndex - 1);
}
else if(index == selectedIndex) {
setSelectedIndex(-1);
}
invalidate();
return this;
} | java | {
"resource": ""
} |
q23433 | ComboBox.setSelectedIndex | train | public synchronized void setSelectedIndex(final int selectedIndex) {
if(items.size() <= selectedIndex || selectedIndex < -1) {
throw new IndexOutOfBoundsException("Illegal argument to ComboBox.setSelectedIndex: " + selectedIndex);
}
final int oldSelection = this.selectedIndex;
... | java | {
"resource": ""
} |
q23434 | TerminalTextUtils.getANSIControlSequenceAt | train | public static String getANSIControlSequenceAt(String string, int index) {
int len = getANSIControlSequenceLength(string, index);
return len == 0 ? null : string.substring(index,index+len);
} | java | {
"resource": ""
} |
q23435 | TerminalTextUtils.getANSIControlSequenceLength | train | public static int getANSIControlSequenceLength(String string, int index) {
int len = 0, restlen = string.length() - index;
if (restlen >= 3) { // Control sequences require a minimum of three characters
char esc = string.charAt(index),
bracket = string.charAt(index+1);
... | java | {
"resource": ""
} |
q23436 | TerminalTextUtils.getWordWrappedText | train | public static List<String> getWordWrappedText(int maxWidth, String... lines) {
//Bounds checking
if(maxWidth <= 0) {
return Arrays.asList(lines);
}
List<String> result = new ArrayList<String>();
LinkedList<String> linesToBeWrapped = new LinkedList<String>(Arrays.asLi... | java | {
"resource": ""
} |
q23437 | AbstractTerminal.onResized | train | protected synchronized void onResized(TerminalSize newSize) {
if (lastKnownSize == null || !lastKnownSize.equals(newSize)) {
lastKnownSize = newSize;
for (TerminalResizeListener resizeListener : resizeListeners) {
resizeListener.onResized(this, lastKnownSize);
... | java | {
"resource": ""
} |
q23438 | TerminalEmulatorColorConfiguration.toAWTColor | train | public Color toAWTColor(TextColor color, boolean isForeground, boolean inBoldContext) {
if(color instanceof TextColor.ANSI) {
return colorPalette.get((TextColor.ANSI)color, isForeground, inBoldContext && useBrightColorsOnBold);
}
return color.toColor();
} | java | {
"resource": ""
} |
q23439 | AWTTerminalFontConfiguration.getFontSize | train | private static int getFontSize() {
if (Toolkit.getDefaultToolkit().getScreenResolution() >= 110) {
// Rely on DPI if it is a high value.
return Toolkit.getDefaultToolkit().getScreenResolution() / 7 + 1;
} else {
// Otherwise try to guess it from the monitor size:
... | java | {
"resource": ""
} |
q23440 | AWTTerminalFontConfiguration.selectDefaultFont | train | protected static Font[] selectDefaultFont() {
String osName = System.getProperty("os.name", "").toLowerCase();
if(osName.contains("win")) {
List<Font> windowsFonts = getDefaultWindowsFonts();
return windowsFonts.toArray(new Font[windowsFonts.size()]);
}
else if(os... | java | {
"resource": ""
} |
q23441 | AWTTerminalFontConfiguration.filterMonospaced | train | public static Font[] filterMonospaced(Font... fonts) {
List<Font> result = new ArrayList<Font>(fonts.length);
for(Font font: fonts) {
if (isFontMonospaced(font)) {
result.add(font);
}
}
return result.toArray(new Font[result.size()]);
} | java | {
"resource": ""
} |
q23442 | TextInputDialogBuilder.setValidationPattern | train | public TextInputDialogBuilder setValidationPattern(final Pattern pattern, final String errorMessage) {
return setValidator(new TextInputDialogResultValidator() {
@Override
public String validate(String content) {
Matcher matcher = pattern.matcher(content);
... | java | {
"resource": ""
} |
q23443 | BundleLocator.getBundleKeyValue | train | protected String getBundleKeyValue(Locale locale, String key, Object... parameters) {
String value = null;
try {
value = getBundle(locale).getString(key);
} catch (Exception ignore) {
}
return value != null ? MessageFormat.format(value, parameters) : null;
} | java | {
"resource": ""
} |
q23444 | AnimatedLabel.createClassicSpinningLine | train | public static AnimatedLabel createClassicSpinningLine(int speed) {
AnimatedLabel animatedLabel = new AnimatedLabel("-");
animatedLabel.addFrame("\\");
animatedLabel.addFrame("|");
animatedLabel.addFrame("/");
animatedLabel.startAnimation(speed);
return animatedLabel;
... | java | {
"resource": ""
} |
q23445 | AnimatedLabel.addFrame | train | public synchronized AnimatedLabel addFrame(String text) {
String[] lines = splitIntoMultipleLines(text);
frames.add(lines);
ensurePreferredSize(lines);
return this;
} | java | {
"resource": ""
} |
q23446 | AnimatedLabel.nextFrame | train | public synchronized void nextFrame() {
currentFrame++;
if(currentFrame >= frames.size()) {
currentFrame = 0;
}
super.setLines(frames.get(currentFrame));
invalidate();
} | java | {
"resource": ""
} |
q23447 | VirtualScreen.setMinimumSize | train | public void setMinimumSize(TerminalSize minimumSize) {
this.minimumSize = minimumSize;
TerminalSize virtualSize = minimumSize.max(realScreen.getTerminalSize());
if(!minimumSize.equals(virtualSize)) {
addResizeRequest(virtualSize);
super.doResizeIfNecessary();
}
... | java | {
"resource": ""
} |
q23448 | TerminalSize.withColumns | train | public TerminalSize withColumns(int columns) {
if(this.columns == columns) {
return this;
}
if(columns == 0 && this.rows == 0) {
return ZERO;
}
return new TerminalSize(columns, this.rows);
} | java | {
"resource": ""
} |
q23449 | TerminalSize.withRows | train | public TerminalSize withRows(int rows) {
if(this.rows == rows) {
return this;
}
if(rows == 0 && this.columns == 0) {
return ZERO;
}
return new TerminalSize(this.columns, rows);
} | java | {
"resource": ""
} |
q23450 | TerminalSize.max | train | public TerminalSize max(TerminalSize other) {
return withColumns(Math.max(columns, other.columns))
.withRows(Math.max(rows, other.rows));
} | java | {
"resource": ""
} |
q23451 | TerminalSize.min | train | public TerminalSize min(TerminalSize other) {
return withColumns(Math.min(columns, other.columns))
.withRows(Math.min(rows, other.rows));
} | java | {
"resource": ""
} |
q23452 | RadioBoxList.isChecked | train | public synchronized Boolean isChecked(V object) {
if(object == null)
return null;
if(indexOf(object) == -1)
return null;
return checkedIndex == indexOf(object);
} | java | {
"resource": ""
} |
q23453 | DefaultVirtualTerminal.moveCursorToNextLine | train | private void moveCursorToNextLine() {
cursorPosition = cursorPosition.withColumn(0).withRelativeRow(1);
if(cursorPosition.getRow() >= currentTextBuffer.getLineCount()) {
currentTextBuffer.newLine();
}
trimBufferBacklog();
correctCursor();
} | java | {
"resource": ""
} |
q23454 | TerminalScreen.scrollLines | train | @Override
public void scrollLines(int firstLine, int lastLine, int distance) {
// just ignore certain kinds of garbage:
if (distance == 0 || firstLine > lastLine) { return; }
super.scrollLines(firstLine, lastLine, distance);
// Save scroll hint for next refresh:
ScrollHint ... | java | {
"resource": ""
} |
q23455 | AbstractDialogBuilder.setTitle | train | public B setTitle(String title) {
if(title == null) {
title = "";
}
this.title = title;
return self();
} | java | {
"resource": ""
} |
q23456 | AbstractDialogBuilder.build | train | public final T build() {
T dialog = buildDialog();
if(!extraWindowHints.isEmpty()) {
Set<Window.Hint> combinedHints = new HashSet<Window.Hint>(dialog.getHints());
combinedHints.addAll(extraWindowHints);
dialog.setHints(combinedHints);
}
return dialog;
... | java | {
"resource": ""
} |
q23457 | AbstractListBox.addItem | train | public synchronized T addItem(V item) {
if(item == null) {
return self();
}
items.add(item);
if(selectedIndex == -1) {
selectedIndex = 0;
}
invalidate();
return self();
} | java | {
"resource": ""
} |
q23458 | AbstractListBox.removeItem | train | public synchronized V removeItem(int index) {
V existing = items.remove(index);
if(index < selectedIndex) {
selectedIndex--;
}
while(selectedIndex >= items.size()) {
selectedIndex--;
}
invalidate();
return existing;
} | java | {
"resource": ""
} |
q23459 | IOSafeTerminalAdapter.createRuntimeExceptionConvertingAdapter | train | public static IOSafeTerminal createRuntimeExceptionConvertingAdapter(Terminal terminal) {
if (terminal instanceof ExtendedTerminal) { // also handle Runtime-type:
return createRuntimeExceptionConvertingAdapter((ExtendedTerminal)terminal);
} else {
return new IOSafeTerminalAdapter... | java | {
"resource": ""
} |
q23460 | IOSafeTerminalAdapter.createDoNothingOnExceptionAdapter | train | public static IOSafeTerminal createDoNothingOnExceptionAdapter(Terminal terminal) {
if (terminal instanceof ExtendedTerminal) { // also handle Runtime-type:
return createDoNothingOnExceptionAdapter((ExtendedTerminal)terminal);
} else {
return new IOSafeTerminalAdapter(terminal, n... | java | {
"resource": ""
} |
q23461 | Button.setLabel | train | public final synchronized void setLabel(String label) {
if(label == null) {
throw new IllegalArgumentException("null label to a button is not allowed");
}
if(label.isEmpty()) {
label = " ";
}
this.label = label;
invalidate();
} | java | {
"resource": ""
} |
q23462 | AbstractTheme.findRedundantDeclarations | train | public List<String> findRedundantDeclarations() {
List<String> result = new ArrayList<String>();
for(ThemeTreeNode node: rootNode.childMap.values()) {
findRedundantDeclarations(result, node);
}
Collections.sort(result);
return result;
} | java | {
"resource": ""
} |
q23463 | ScreenBuffer.copyFrom | train | public void copyFrom(TextImage source, int startRowIndex, int rows, int startColumnIndex, int columns, int destinationRowOffset, int destinationColumnOffset) {
source.copyTo(backend, startRowIndex, rows, startColumnIndex, columns, destinationRowOffset, destinationColumnOffset);
} | java | {
"resource": ""
} |
q23464 | TextCharacter.withCharacter | train | @SuppressWarnings("SameParameterValue")
public TextCharacter withCharacter(char character) {
if(this.character == character) {
return this;
}
return new TextCharacter(character, foregroundColor, backgroundColor, modifiers);
} | java | {
"resource": ""
} |
q23465 | TextCharacter.withForegroundColor | train | public TextCharacter withForegroundColor(TextColor foregroundColor) {
if(this.foregroundColor == foregroundColor || this.foregroundColor.equals(foregroundColor)) {
return this;
}
return new TextCharacter(character, foregroundColor, backgroundColor, modifiers);
} | java | {
"resource": ""
} |
q23466 | TextCharacter.withBackgroundColor | train | public TextCharacter withBackgroundColor(TextColor backgroundColor) {
if(this.backgroundColor == backgroundColor || this.backgroundColor.equals(backgroundColor)) {
return this;
}
return new TextCharacter(character, foregroundColor, backgroundColor, modifiers);
} | java | {
"resource": ""
} |
q23467 | TextCharacter.withModifiers | train | public TextCharacter withModifiers(Collection<SGR> modifiers) {
EnumSet<SGR> newSet = EnumSet.copyOf(modifiers);
if(modifiers.equals(newSet)) {
return this;
}
return new TextCharacter(character, foregroundColor, backgroundColor, newSet);
} | java | {
"resource": ""
} |
q23468 | TextCharacter.withModifier | train | public TextCharacter withModifier(SGR modifier) {
if(modifiers.contains(modifier)) {
return this;
}
EnumSet<SGR> newSet = EnumSet.copyOf(this.modifiers);
newSet.add(modifier);
return new TextCharacter(character, foregroundColor, backgroundColor, newSet);
} | java | {
"resource": ""
} |
q23469 | TextCharacter.withoutModifier | train | public TextCharacter withoutModifier(SGR modifier) {
if(!modifiers.contains(modifier)) {
return this;
}
EnumSet<SGR> newSet = EnumSet.copyOf(this.modifiers);
newSet.remove(modifier);
return new TextCharacter(character, foregroundColor, backgroundColor, newSet);
} | java | {
"resource": ""
} |
q23470 | DefaultTerminalFactory.createTerminalEmulator | train | public Terminal createTerminalEmulator() {
Window window;
if(!forceAWTOverSwing && hasSwing()) {
window = createSwingTerminal();
}
else {
window = createAWTTerminal();
}
if(autoOpenTerminalFrame) {
window.setVisible(true);
}
... | java | {
"resource": ""
} |
q23471 | DefaultTerminalFactory.createTelnetTerminal | train | public TelnetTerminal createTelnetTerminal() {
try {
System.err.print("Waiting for incoming telnet connection on port "+telnetPort+" ... ");
System.err.flush();
TelnetTerminalServer tts = new TelnetTerminalServer(telnetPort);
TelnetTerminal rawTerminal = tts.acce... | java | {
"resource": ""
} |
q23472 | Table.setTableModel | train | public synchronized Table<V> setTableModel(TableModel<V> tableModel) {
if(tableModel == null) {
throw new IllegalArgumentException("Cannot assign a null TableModel");
}
this.tableModel.removeListener(tableModelListener);
this.tableModel = tableModel;
this.tableModel.a... | java | {
"resource": ""
} |
q23473 | TelnetTerminalServer.acceptConnection | train | public TelnetTerminal acceptConnection() throws IOException {
Socket clientSocket = serverSocket.accept();
clientSocket.setTcpNoDelay(true);
return new TelnetTerminal(clientSocket, charset);
} | java | {
"resource": ""
} |
q23474 | ScrollBar.getViewSize | train | public int getViewSize() {
if(viewSize > 0) {
return viewSize;
}
if(direction == Direction.HORIZONTAL) {
return getSize().getColumns();
}
else {
return getSize().getRows();
}
} | java | {
"resource": ""
} |
q23475 | Label.setText | train | public synchronized void setText(String text) {
setLines(splitIntoMultipleLines(text));
this.labelSize = getBounds(lines, labelSize);
invalidate();
} | java | {
"resource": ""
} |
q23476 | Label.getText | train | public synchronized String getText() {
if(lines.length == 0) {
return "";
}
StringBuilder bob = new StringBuilder(lines[0]);
for(int i = 1; i < lines.length; i++) {
bob.append("\n").append(lines[i]);
}
return bob.toString();
} | java | {
"resource": ""
} |
q23477 | Label.getBounds | train | protected TerminalSize getBounds(String[] lines, TerminalSize currentBounds) {
if(currentBounds == null) {
currentBounds = TerminalSize.ZERO;
}
currentBounds = currentBounds.withRows(lines.length);
if(labelWidth == null || labelWidth == 0) {
int preferredWidth = 0... | java | {
"resource": ""
} |
q23478 | EscapeSequenceCharacterPattern.getKeyStroke | train | protected KeyStroke getKeyStroke(KeyType key, int mods) {
boolean bShift = false, bCtrl = false, bAlt = false;
if (key == null) { return null; } // alternative: key = KeyType.Unknown;
if (mods >= 0) { // only use when non-negative!
bShift = (mods & SHIFT) != 0;
bAlt = (... | java | {
"resource": ""
} |
q23479 | EscapeSequenceCharacterPattern.getKeyStrokeRaw | train | protected KeyStroke getKeyStrokeRaw(char first,int num1,int num2,char last,boolean bEsc) {
KeyType kt;
boolean bPuttyCtrl = false;
if (last == '~' && stdMap.containsKey(num1)) {
kt = stdMap.get(num1);
} else if (finMap.containsKey(last)) {
kt = finMap.get(last);
... | java | {
"resource": ""
} |
q23480 | ActionListBox.addItem | train | public ActionListBox addItem(final String label, final Runnable action) {
return addItem(new Runnable() {
@Override
public void run() {
action.run();
}
@Override
public String toString() {
return label;
}
... | java | {
"resource": ""
} |
q23481 | CircularProgressDrawable.initDelegate | train | private void initDelegate() {
boolean powerSaveMode = Utils.isPowerSaveModeEnabled(mPowerManager);
if (powerSaveMode) {
if (mPBDelegate == null || !(mPBDelegate instanceof PowerSaveModeDelegate)) {
if (mPBDelegate != null) mPBDelegate.stop();
mPBDelegate = new PowerSaveModeDelegate(this);
... | java | {
"resource": ""
} |
q23482 | ContentLoadingSmoothProgressBar.hide | train | public void hide() {
mDismissed = true;
removeCallbacks(mDelayedShow);
long diff = System.currentTimeMillis() - mStartTime;
if (diff >= MIN_SHOW_TIME || mStartTime == -1) {
// The progress spinner has been shown long enough
// OR was not shown yet. If it wasn't shown yet,
// it will ju... | java | {
"resource": ""
} |
q23483 | AccessClassLoader.loadAccessClass | train | Class loadAccessClass (String name) {
// No need to check the parent class loader if the access class hasn't been defined yet.
if (localClassNames.contains(name)) {
try {
return loadClass(name, false);
} catch (ClassNotFoundException ex) {
throw new RuntimeException(ex); // Should not happen, si... | java | {
"resource": ""
} |
q23484 | MethodAccess.invoke | train | public Object invoke (Object object, String methodName, Class[] paramTypes, Object... args) {
return invoke(object, getIndex(methodName, paramTypes), args);
} | java | {
"resource": ""
} |
q23485 | MethodAccess.invoke | train | public Object invoke (Object object, String methodName, Object... args) {
return invoke(object, getIndex(methodName, args == null ? 0 : args.length), args);
} | java | {
"resource": ""
} |
q23486 | MethodAccess.getIndex | train | public int getIndex (String methodName) {
for (int i = 0, n = methodNames.length; i < n; i++)
if (methodNames[i].equals(methodName)) return i;
throw new IllegalArgumentException("Unable to find non-private method: " + methodName);
} | java | {
"resource": ""
} |
q23487 | MethodAccess.getIndex | train | public int getIndex (String methodName, Class... paramTypes) {
for (int i = 0, n = methodNames.length; i < n; i++)
if (methodNames[i].equals(methodName) && Arrays.equals(paramTypes, parameterTypes[i])) return i;
throw new IllegalArgumentException("Unable to find non-private method: " + methodName + " " + Arra... | java | {
"resource": ""
} |
q23488 | MurmurHash3.MurmurHash3_x64_128 | train | public static long[] MurmurHash3_x64_128(final long[] key, final int seed) {
State state = new State();
state.h1 = 0x9368e53c2f6af274L ^ seed;
state.h2 = 0x586dcd208f7cd3fdL ^ seed;
state.c1 = 0x87c37b91114253d5L;
state.c2 = 0x4cf5ad432745937fL;
for (int i = 0; i < key.length / 2;... | java | {
"resource": ""
} |
q23489 | SingletonCacheWriter.pushState | train | protected void pushState(final Cache<?, ?> cache) throws Exception {
DataContainer<?, ?> dc = cache.getAdvancedCache().getDataContainer();
dc.forEach(entry -> {
MarshallableEntry me = ctx.getMarshallableEntryFactory().create(entry.getKey(), entry.getValue(), entry.getMetadata(),
entr... | java | {
"resource": ""
} |
q23490 | SingletonCacheWriter.awaitForPushToFinish | train | protected void awaitForPushToFinish(Future<?> future, long timeout, TimeUnit unit) {
final boolean debugEnabled = log.isDebugEnabled();
try {
if (debugEnabled) log.debug("wait for state push to cache loader to finish");
future.get(timeout, unit);
} catch (TimeoutException e) {
... | java | {
"resource": ""
} |
q23491 | SingletonCacheWriter.doPushState | train | private void doPushState() throws PushStateException {
if (pushStateFuture == null || pushStateFuture.isDone()) {
Callable<?> task = createPushStateTask();
pushStateFuture = executor.submit(task);
try {
waitForTaskToFinish(pushStateFuture, singletonConfiguration.pushStateTim... | java | {
"resource": ""
} |
q23492 | SingletonCacheWriter.waitForTaskToFinish | train | private void waitForTaskToFinish(Future<?> future, long timeout, TimeUnit unit) throws Exception {
try {
future.get(timeout, unit);
} catch (TimeoutException e) {
throw new Exception("task timed out", e);
} catch (InterruptedException e) {
/* Re-assert the thread's interrupt... | java | {
"resource": ""
} |
q23493 | WeakValueHashMap.create | train | private ValueRef<K, V> create(K key, V value, ReferenceQueue<V> q) {
return WeakValueRef.create(key, value, q);
} | java | {
"resource": ""
} |
q23494 | WeakValueHashMap.processQueue | train | @SuppressWarnings("unchecked")
private void processQueue() {
ValueRef<K, V> ref = (ValueRef<K, V>) queue.poll();
while (ref != null) {
// only remove if it is the *exact* same WeakValueRef
if (ref == map.get(ref.getKey()))
map.remove(ref.getKey());
ref = (ValueRef<... | java | {
"resource": ""
} |
q23495 | ClusteringConfigurationBuilder.biasLifespan | train | public ClusteringConfigurationBuilder biasLifespan(long l, TimeUnit unit) {
attributes.attribute(BIAS_LIFESPAN).set(unit.toMillis(l));
return this;
} | java | {
"resource": ""
} |
q23496 | SingleFileStore.rebuildIndex | train | private void rebuildIndex() throws Exception {
ByteBuffer buf = ByteBuffer.allocate(KEY_POS);
for (; ; ) {
// read FileEntry fields from file (size, keyLen etc.)
buf.clear().limit(KEY_POS);
channel.read(buf, filePos);
// return if end of file is reached
if (buf.r... | java | {
"resource": ""
} |
q23497 | SingleFileStore.allocate | train | private FileEntry allocate(int len) {
synchronized (freeList) {
// lookup a free entry of sufficient size
SortedSet<FileEntry> candidates = freeList.tailSet(new FileEntry(0, len));
for (Iterator<FileEntry> it = candidates.iterator(); it.hasNext(); ) {
FileEntry free = it.nex... | java | {
"resource": ""
} |
q23498 | SingleFileStore.addNewFreeEntry | train | private void addNewFreeEntry(FileEntry fe) throws IOException {
ByteBuffer buf = ByteBuffer.allocate(KEY_POS);
buf.putInt(fe.size);
buf.putInt(0);
buf.putInt(0);
buf.putInt(0);
buf.putLong(-1);
buf.flip();
channel.write(buf, fe.offset);
freeList.add(fe);
} | java | {
"resource": ""
} |
q23499 | SingleFileStore.evict | train | private FileEntry evict() {
if (configuration.maxEntries() > 0) {
synchronized (entries) {
if (entries.size() > configuration.maxEntries()) {
Iterator<FileEntry> it = entries.values().iterator();
FileEntry fe = it.next();
it.remove();
... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.