Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
297,300
CharsetDecoder () { return new Native2AsciiCharsetDecoder(this); }
newDecoder
297,301
CharsetEncoder () { return new Native2AsciiCharsetEncoder(this); }
newEncoder
297,302
String (String baseCharsetName) { if (baseCharsetName == null) baseCharsetName = DEFAULT_ENCODING_NAME; return NAME_PREFIX + baseCharsetName; }
makeNative2AsciiEncodingName
297,303
Charset (String charsetName) { if (charsetName.startsWith(NAME_PREFIX)) { Native2AsciiCharset cached = cache.get(charsetName); if (cached == null) { cached = new Native2AsciiCharset(charsetName); Native2AsciiCharset prev = cache.putIfAbsent(charsetName, cached); if (prev != null) cached = prev; } return cached; } retur...
forName
297,304
Charset (Charset baseCharset) { return forName(NAME_PREFIX + baseCharset.name()); }
wrap
297,305
Charset (Charset charset) { if (charset instanceof Native2AsciiCharset) { return ((Native2AsciiCharset)charset).getBaseCharset(); } return charset; }
nativeToBaseCharset
297,306
CoderResult (CharBuffer in, ByteBuffer out) { while (in.position() < in.limit()) { in.mark(); try { char c = in.get(); if (c < '\u0080') { ByteBuffer byteBuffer = myBaseCharset.encode(Character.toString(c)); out.put(byteBuffer); } else { if (out.remaining() < 6) throw new BufferOverflowException(); out.put((byte)'\\');...
encodeLoop
297,307
byte (int digit) { if (digit < 10) { return (byte)('0' + digit); } return (byte)(ANCHOR - 10 + digit); }
toHexChar
297,308
void () { super.implReset(); myOutBuffer = new StringBuilder(); }
implReset
297,309
CoderResult (CharBuffer out) { return doFlush(out); }
implFlush
297,310
CoderResult (final CharBuffer out) { if (myOutBuffer.length() != 0) { int remaining = out.remaining(); int outLen = Math.min(remaining, myOutBuffer.length()); out.append(myOutBuffer, 0, outLen); myOutBuffer.delete(0, outLen); if (myOutBuffer.length() != 0) return CoderResult.OVERFLOW; } return CoderResult.UNDERFLOW; }
doFlush
297,311
CoderResult (ByteBuffer in, CharBuffer out) { try { CoderResult coderResult = doFlush(out); if (coderResult == CoderResult.OVERFLOW) return CoderResult.OVERFLOW; int start = in.position(); byte[] buf = new byte[4]; while (in.position() < in.limit()) { in.mark(); final byte b = in.get(); if (b == '\\') { decodeArray(in....
decodeLoop
297,312
void (final byte[] buf, int start, int end) { if (end <= start) return; ByteBuffer byteBuffer = ByteBuffer.wrap(buf, start, end-start); CharBuffer charBuffer = myBaseCharset.decode(byteBuffer); myOutBuffer.append(charBuffer); }
decodeArray
297,313
char (byte[] ord) { int d1 = Character.digit((char)ord[0], 16); if (d1 == -1) return INVALID_CHAR; int d2 = Character.digit((char)ord[1], 16); if (d2 == -1) return INVALID_CHAR; int d3 = Character.digit((char)ord[2], 16); if (d3 == -1) return INVALID_CHAR; int d4 = Character.digit((char)ord[3], 16); if (d4 == -1) retur...
unicode
297,314
void (boolean headless) { System.setProperty("java.util.concurrent.ForkJoinPool.common.threadFactory", IdeaForkJoinWorkerThreadFactory.class.getName()); boolean parallelismWasNotSpecified = System.getProperty("java.util.concurrent.ForkJoinPool.common.parallelism") == null; if (parallelismWasNotSpecified) { int N_CPU = ...
setupForkJoinCommonPool
297,315
ForkJoinWorkerThread (ForkJoinPool pool) { final int n = setNextBit(); //System.out.println("New FJP thread "+n); ForkJoinWorkerThread thread = new ForkJoinWorkerThread(pool) { @Override protected void onTermination(Throwable exception) { //System.out.println("Exit FJP thread "+n); clearBit(n); super.onTermination(exce...
newThread
297,316
void (Throwable exception) { //System.out.println("Exit FJP thread "+n); clearBit(n); super.onTermination(exception); }
onTermination
297,317
int () { long oldValue = bits.getAndUpdate(value -> value + 1 | value); return Long.numberOfTrailingZeros(oldValue + 1); }
setNextBit
297,318
void (int n) { bits.updateAndGet(value -> value & ~(1L << n)); }
clearBit
297,319
Icon (@NotNull String path, int cacheKey, int flags) { return IconManager.getInstance().loadRasterizedIcon(path, VisualisationIcons.class.getClassLoader(), cacheKey, flags); }
load
297,320
boolean (RowFilter.Entry rowEntry) { return !isEnabled() || !super.include(rowEntry); }
include
297,321
Set<IFilterObserver> () { return new HashSet<>(observers); }
getFilterObservers
297,322
void () { for (IFilterObserver obs : new ArrayList<>(observers)) { obs.filterUpdated(this); } }
reportFilterUpdatedToObservers
297,323
void (IFilter... filtersToAdd) { for (IFilter filter : filtersToAdd) { if (filters.add(filter)) { filter.addFilterObserver(this); if (filter.isEnabled()) { super.setEnabled(true); } else { disabledFilters.add(filter); } } } }
addFilter
297,324
void (IFilter... filtersToRemove) { boolean report = false; for (IFilter filter : filtersToRemove) { if (filters.remove(filter)) { filter.removeFilterObserver(this); disabledFilters.remove(filter); report = true; } } if (report) { if (isEnabled() && !filters.isEmpty() && (disabledFilters.size() == filters.size())) { su...
removeFilter
297,325
Set<IFilter> () { return new HashSet<>(filters); }
getFilters
297,326
boolean (IFilter filter) { return disabledFilters.contains(filter); }
isDisabled
297,327
DateComparator (Format dateFormat) { // the idea is to build a date instance, change then each field // (milliseconds / seconds / etc) and check the change on the // parsed instance. If changing, for example, the seconds, does // not produce a different formatted string, the comparator will // not pay attention to the ...
getDateComparator
297,328
boolean (Calendar c, Format f, int field) { c.set(field, 10); String sf = f.format(c.getTime()); c.set(field, 11); return !sf.equals(f.format(c.getTime())); }
change
297,329
String (String expression) { return instantOperand.getAppliedExpression(expression); }
getInstantAppliedExpression
297,330
IOperand () { return instantOperand; }
getDefaultOperator
297,331
String (String expression) { return htmlHandler.stripHtml(expression); }
stripHtml
297,332
String (String expression) { expression = expression.trim(); Matcher matcher = expressionMatcher.matcher(expression); if (matcher.matches()) { String operator = matcher.group(1); int lastAdded = 0; if (operator != null) { escapeBuffer.append('\\').append(operator); expression = matcher.group(2); } int total = expressio...
escape
297,333
String () { boolean gt = matches(1); boolean eq = matches(0); boolean ls = matches(-1); if (gt) { if (eq) return ">="; if (ls) return "!="; return ">"; } if (ls) { if (eq) return "<="; return "<"; } return "=="; }
getOperator
297,334
RowFilter (final Object right, final int modelIndex, final Comparator comparator) { return new RowFilter() { @Override public boolean include(Entry entry) { Object left = entry.getValue(modelIndex); if (left instanceof String) { left = htmlHandler.stripHtml((String)left); } return (left != null) && matches(comparator.c...
createOperator
297,335
boolean (Entry entry) { Object left = entry.getValue(modelIndex); if (left instanceof String) { left = htmlHandler.stripHtml((String)left); } return (left != null) && matches(comparator.compare(left, right)); }
include
297,336
RowFilter ( final String right, final int modelIndex, final FormatWrapper format, final Comparator stringComparator) { return new RowFilter() { @Override public boolean include(Entry entry) { Object left = entry.getValue(modelIndex); if (left == null) { return false; } String s = format.format(left); return (s.length()...
createStringOperator
297,337
boolean (Entry entry) { Object left = entry.getValue(modelIndex); if (left == null) { return false; } String s = format.format(left); return (s.length() > 0) && matches(stringComparator.compare(s, right)); }
include
297,338
RowFilter (final Object right, final int modelIndex, final Comparator comparator) { return new RowFilter() { @Override public boolean include(Entry entry) { Object left = entry.getValue(modelIndex); if (left instanceof String) { left = htmlHandler.stripHtml((String)left); } boolean value = (left != null) && (0 == compa...
createOperator
297,339
boolean (Entry entry) { Object left = entry.getValue(modelIndex); if (left instanceof String) { left = htmlHandler.stripHtml((String)left); } boolean value = (left != null) && (0 == comparator.compare(left, right)); return value == expected; }
include
297,340
RowFilter (final int modelIndex) { return new RowFilter() { @Override public boolean include(Entry entry) { Object left = entry.getValue(modelIndex); return expected == (left == null); } }; }
createNullOperator
297,341
boolean (Entry entry) { Object left = entry.getValue(modelIndex); return expected == (left == null); }
include
297,342
RowFilter ( final String right, final int modelIndex, final FormatWrapper format, final Comparator stringComparator) { return new RowFilter() { @Override public boolean include(Entry entry) { Object left = entry.getValue(modelIndex); String value = format.format(left); return expected == (stringComparator.compare(value...
createStringOperator
297,343
boolean (Entry entry) { Object left = entry.getValue(modelIndex); String value = format.format(left); return expected == (stringComparator.compare(value, right) == 0); }
include
297,344
boolean (Entry entry) { Object o = entry.getValue(modelIndex); String left = format.format(o); return equals == pattern.matcher(left).matches(); }
include
297,345
void (boolean instantMode) { this.instantMode = instantMode; }
setInstantMode
297,346
String (String baseExpression) { return switch (instantApplied) { case 0 -> baseExpression; case 1 -> "*" + baseExpression; case 2 -> baseExpression + "*"; case 3 -> "*" + baseExpression + "*"; default -> baseExpression; }; }
getAppliedExpression
297,347
String (String s) { StringBuilder sb = new StringBuilder(); boolean escaped = false; instantApplied = 0; for (char c : s.toCharArray()) { if (c == '*') { if (escaped) { sb.append("\\*"); escaped = false; } else { sb.append(".*"); } } else if (c == '?') { if (escaped) { sb.append("\\?"); escaped = false; } else { sb.app...
convertToRE
297,348
String (Object o) { if (format == null) { return (o == null) ? "" : htmlHandler.stripHtml(o.toString()); } return format.format(o).trim(); }
format
297,349
int (String entity) { Integer value = ents.get(entity); return value==null? -1 : value; }
getEntityValue
297,350
String (String s) { String inner = getSubstringUnderHtmlTag(s); return (inner == null ? s : removeHtmlInfo(inner)).trim(); }
stripHtml
297,351
String (String inner) { boolean inTag = false, inQuoteInTag = false; char quoteChar = '"'; int entityPos = -1; buffer.delete(0, buffer.length()); for (char c : inner.toCharArray()) { if (c == '<') { inTag = true; entityPos = -1; } else if (c == '>') { // not anymore tag, unless is inside a quote inTag = inTag && inQuot...
removeHtmlInfo
297,352
int (int start) { if (buffer.charAt(start) == '#') { char hex = buffer.charAt(start); try { if (hex == 'x' || hex == 'X') { return Integer.valueOf(buffer.substring(start + 2), 16); } return Integer.parseInt(buffer.substring(start + 1)); } catch (NumberFormatException nfe) { return -1; } } return HtmlEntities.getEntityV...
getEntityValue
297,353
String (String s) { int l = s.length(); if (l >= 6 && (s.charAt(0) == '<') && (s.charAt(5) == '>') && (s.charAt(1) == 'h' || s.charAt(1) == 'H') && (s.charAt(2) == 't' || s.charAt(2) == 'T') && (s.charAt(3) == 'm' || s.charAt(3) == 'M') && (s.charAt(4) == 'l' || s.charAt(4) == 'L')) { // it is enough if the string star...
getSubstringUnderHtmlTag
297,354
void () { Collection<FilterEditor> eds = handler.getEditors(); FilterEditor[] array = eds.toArray(new FilterEditor[0]); adaptiveSupport = new AdaptiveChoicesSupport(handler.getTable() .getModel(), array, handler.getFilters()); setEnableTableModelEvents(true); }
createAdaptiveChoicesSupport
297,355
boolean () { if (adaptiveSupport == null) { return false; } adaptiveSupport = null; setEnableTableModelEvents(false); return true; }
removeAdaptiveChoicesSupport
297,356
void (int event, int firstRow, int lastRow, int column) { if (column != TableModelEvent.ALL_COLUMNS) { rowsUpdated(firstRow, lastRow, column); } else if (event == TableModelEvent.UPDATE) { // an update can signal that all cells have changed // https://bitbucket.org/coderazzi/tablefilter-swing/issue/ // 8/enabled-adapti...
tableChanged
297,357
void (int firstRow, int lastRow) { rows.ensureCapacity(rows.size() + lastRow - firstRow + 1); for (int r = firstRow; r <= lastRow; r++) { RowInfo row = new RowInfo(filters.length); rows.add(r, row); rowEntry.row = r; for (RowInfo.Filter filter : filters) { if ((filter != null) && !filter.include(rowEntry)) { filter.set...
rowsAdded
297,358
void (int firstRow, int lastRow, int column) { RowInfo.Filter filter = (column == TableModelEvent.ALL_COLUMNS) ? null : filters[column]; while (firstRow <= lastRow) { RowInfo row = rows.get(firstRow); rowEntry.row = firstRow++; if (filter == null) { for (RowInfo.Filter f : filters) { if (f != null) { f.set(row, f.inclu...
rowsUpdated
297,359
void (int firstRow, int lastRow) { rows.subList(firstRow, lastRow + 1).clear(); extractChoices(editorHandles.length, 0, -1); }
rowsDeleted
297,360
boolean (IFilter iFilter) { RowInfo.Filter filter = getFilter(iFilter); int update = updateRowInfo(filter, iFilter); boolean changed = 1 == (update & 1); if (changed) { // only propagate changes if this is not an editor // or the editor has no focus (is still editing) // https://bitbucket.org/coderazzi/tablefilter-swin...
update
297,361
void (int modelPosition) { int width = editorHandles.length; int handle = getEditorHandle(modelPosition); if (handle >= 0) { switchHandle(handle, --width); } extractChoices(width, 0, -1); }
propagateChanges
297,362
void (FilterEditor fe) { int column = fe.getModelIndex(); int editorHandle = getEditorHandle(column); // invoke the editor update call editorHandles[editorHandle].updateFormatter(rowEntry.getModel(), rowEntry.getFormatters()); int width; // and update the filter for this editor int updateRowInfo = updateRowInfo(filters...
editorUpdated
297,363
int (RowInfo.Filter filter, IFilter iFilter) { int changedBit = 0; int anyBitSet = 1; rowEntry.row = 0; for (RowInfo ri : rows) { boolean set = !iFilter.isEnabled() || iFilter.include(rowEntry); if (filter.set(ri, set)) { changedBit = 1; } if (set) { anyBitSet = 2; } rowEntry.row++; } return changedBit | anyBitSet; }
updateRowInfo
297,364
void (IFilter iFilter) { RowInfo.Filter filter = getFilter(iFilter); if (filter.column < editorHandles.length) { // update only the associated editor, move it at the beginning switchHandle(getEditorHandle(filter.column), 0); extractChoices(1, 0, -1); } }
initChoices
297,365
void (int handles, int firstRow, int lastRow) { int rows = rowEntry.getModelRowCount() - 1; if (lastRow == -1) { lastRow = rows; } boolean fullMode = (firstRow == 0) && (lastRow == rows); int check = handles; for (int i = 0; i < check;) { if (editorHandles[i].startIteration(fullMode)) { // if startIteration returns tru...
extractChoices
297,366
void (int handles, int firstRow, int lastRow) { for (; firstRow <= lastRow; firstRow++) { rowEntry.row = firstRow; RowInfo row = rows.get(firstRow); for (int i = 0; i < handles;) { EditorHandle handle = editorHandles[i++]; if (filters[handle.column].is(row)) { if (handle.handleRow(rowEntry)) { // if handleRow returns t...
iterateRows
297,367
void (int source, int target) { if (target != source) { EditorHandle move = editorHandles[target]; editorHandles[target] = editorHandles[source]; editorHandles[source] = move; } }
switchHandle
297,368
int (int column) { int len = editorHandles.length; while (len-- > 0) { if (editorHandles[len].column == column) { return len; } } return len; }
getEditorHandle
297,369
boolean (int row) { return rows.get(row).is(); }
include
297,370
void (TableModel model, Format[] formatters) { formatters[column] = editor.getFormat(); init(model); }
updateFormatter
297,371
void (TableModel model) { Set<CustomChoice> choices = editor.getCustomChoices(); if (AutoChoices.DISABLED == editor.getAutoChoices()) { maxChoices = 0; } else { Class<?> c = model.getColumnClass(column); if (c.equals(Boolean.class)) { // consider true and false (plus null!) maxChoices = 3; } else { // consider enum con...
init
297,372
boolean (boolean fullMode) { if (!editor.isEnabled()) { // do nothing if not enabled return true; } choices.clear(); maxIterationChoices = maxChoices; if (fullMode) { missingChoices = (customChoices == null) ? Collections.emptyMap() : new HashMap<>(customChoices); } else { maxIterationChoices -= editor.getChoicesSize()...
startIteration
297,373
boolean (RowEntry entry) { if (!missingChoices.isEmpty()) { Iterator<Map.Entry<CustomChoice, RowFilter>> it = missingChoices.entrySet().iterator(); while (it.hasNext()) { Map.Entry<CustomChoice, RowFilter> o = it.next(); if (o.getValue().include(entry)) { choices.add(o.getKey()); it.remove(); } } } if (autoOptions) { /...
handleRow
297,374
void (boolean fullMode) { if (editor.isEnabled()) { if (fullMode) { editor.setChoices(choices); } else { editor.addChoices(choices); } } }
iterationCompleted
297,375
boolean () { int length = info.length; while (length-- > 0) { if (info[length] != SET) { return false; } } return true; }
is
297,376
boolean (Entry rowEntry) { return !filter.isEnabled() || filter.include(rowEntry); }
include
297,377
boolean (RowInfo row, boolean set) { byte[] info = row.info; byte now = info[col]; if (set) { info[col] |= bit; } else { info[col] &= (SET ^ bit); } return now != info[col]; }
set
297,378
boolean (RowInfo row) { byte[] info = row.info; boolean now = 0 != (info[col] & bit); set(row, true); boolean ret = row.is(); set(row, now); return ret; }
is
297,379
boolean (Entry entry) { return true; }
include
297,380
RowFilter (IFilterEditor editor) { return passAllRawFilter; }
getFilter
297,381
RowFilter (final IFilterEditor editor) { final int modelIndex = editor.getModelIndex(); return new RowFilter() { @Override public boolean include(Entry entry) { Object o = entry.getValue(modelIndex); if (o == null) { return true; } if (editor.getRenderer() != null) { return false; } Format fmt = editor.getFormat(); Str...
getFilter
297,382
boolean (Entry entry) { Object o = entry.getValue(modelIndex); if (o == null) { return true; } if (editor.getRenderer() != null) { return false; } Format fmt = editor.getFormat(); String s = (fmt == null) ? o.toString() : fmt.format(o); return (s == null) || (s.trim().length() == 0); }
include
297,383
Set<CustomChoice> (Object[] choices) { Set<CustomChoice> ret = new HashSet<>(); for (Object o : choices) { ret.add(create(o, o.toString())); } return ret; }
createSet
297,384
Set<CustomChoice> (Collection choices) { Set<CustomChoice> ret = new HashSet<>(); for (Object o : choices) { ret.add(create(o, o.toString())); } return ret; }
createSet
297,385
CustomChoice (Object choice) { return create(choice, choice.toString()); }
create
297,386
CustomChoice (final Object choice, String repr) { if (choice instanceof Pattern) { return new CustomChoice(repr) { private static final long serialVersionUID = -3239105477862513930L; @Override public RowFilter getFilter(final IFilterEditor ed) { final int index = ed.getModelIndex(); final Pattern pattern = (Pattern)cho...
create
297,387
RowFilter (final IFilterEditor ed) { final int index = ed.getModelIndex(); final Pattern pattern = (Pattern)choice; return new RowFilter() { @Override public boolean include(Entry entry) { Object o = entry.getValue(index); if (o == null) { return false; } Format fmt = ed.getFormat(); String s = (fmt == null) ? o.toStri...
getFilter
297,388
boolean (Entry entry) { Object o = entry.getValue(index); if (o == null) { return false; } Format fmt = ed.getFormat(); String s = (fmt == null) ? o.toString() : fmt.format(o); return pattern.matcher(s).matches(); }
include
297,389
RowFilter (final IFilterEditor editor) { final int index = editor.getModelIndex(); final String string = (choice instanceof String) ? (String)choice : null; return new RowFilter() { @Override public boolean include(Entry entry) { Object o = entry.getValue(index); if ((string != null) && (o instanceof String) && editor....
getFilter
297,390
boolean (Entry entry) { Object o = entry.getValue(index); if ((string != null) && (o instanceof String) && editor.isIgnoreCase()) { return string.equalsIgnoreCase((String)o); } return choice.equals(o); }
include
297,391
Color (IFilterEditor editor, boolean isSelected) { return null; }
getBackground
297,392
Color (IFilterEditor editor, boolean isSelected) { return null; }
getForeground
297,393
Font (IFilterEditor editor, boolean isSelected) { return null; }
getFont
297,394
Icon () { return icon; }
getIcon
297,395
void (Icon icon) { this.icon = icon; }
setIcon
297,396
void (IFilterEditor editor, boolean isSelected, JComponent c, Graphics g) { if (icon != null) { Icon use; if (c.isEnabled()) { use = icon; } else { use = UIManager.getLookAndFeel().getDisabledIcon(c, icon); } FontMetrics metrics = g.getFontMetrics(); // FontMetrics metrics = g.getFontMetrics(editor.getLook().getCustomC...
decorateComponent
297,397
int () { return precedence; }
getPrecedence
297,398
void (int precedence) { this.precedence = precedence; }
setPrecedence
297,399
String () { return str; }
getRepresentation