method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
private static void initialize() {
if (initialized)
return;
Sys.initialize();
initialized = true;
}
| static void function() { if (initialized) return; Sys.initialize(); initialized = true; } | /**
* Static initialization
*/ | Static initialization | initialize | {
"repo_name": "andrewmcvearry/mille-bean",
"path": "lwjgl/src/java/org/lwjgl/input/Keyboard.java",
"license": "mit",
"size": 23298
} | [
"org.lwjgl.Sys"
] | import org.lwjgl.Sys; | import org.lwjgl.*; | [
"org.lwjgl"
] | org.lwjgl; | 1,055,177 |
public static InputStream post(URL url, String name1, Object value1, String name2,
Object value2, String name3, Object value3) throws IOException {
return new ClientHttpRequest(url).post(name1, value1, name2, value2, name3, value3);
} | static InputStream function(URL url, String name1, Object value1, String name2, Object value2, String name3, Object value3) throws IOException { return new ClientHttpRequest(url).post(name1, value1, name2, value2, name3, value3); } | /**
* post the POST request to specified URL, with the specified parameters
*
* @param name1 first parameter name
* @param value1 first parameter value
* @param name2 second parameter name
* @param value2 second parameter value
* @param name3 third parameter name
* @param value3 third parameter value
* @return input stream with the server response
* @see setParameter
*/ | post the POST request to specified URL, with the specified parameters | post | {
"repo_name": "medic/SMSSync",
"path": "smssync/src/main/java/org/addhen/smssync/net/ClientHttpRequest.java",
"license": "lgpl-3.0",
"size": 18423
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,182,988 |
public void flush(long mod) {
Log.i(AnkiDroidApp.TAG, "flush - Saving information to DB...");
mMod = (mod == 0 ? Utils.intNow(1000) : mod);
ContentValues values = new ContentValues();
values.put("crt", mCrt);
values.put("mod", mMod);
values.put("scm", mScm);
values.put("dty", mDty ? 1 : 0);
values.put("usn", mUsn);
values.put("ls", mLs);
values.put("conf", Utils.jsonToString(mConf));
mDb.update("col", values);
} | void function(long mod) { Log.i(AnkiDroidApp.TAG, STR); mMod = (mod == 0 ? Utils.intNow(1000) : mod); ContentValues values = new ContentValues(); values.put("crt", mCrt); values.put("mod", mMod); values.put("scm", mScm); values.put("dty", mDty ? 1 : 0); values.put("usn", mUsn); values.put("ls", mLs); values.put("conf", Utils.jsonToString(mConf)); mDb.update("col", values); } | /**
* Flush state to DB, updating mod time.
*/ | Flush state to DB, updating mod time | flush | {
"repo_name": "socialpercon/anki",
"path": "src/com/ichi2/libanki/Collection.java",
"license": "gpl-3.0",
"size": 47783
} | [
"android.content.ContentValues",
"android.util.Log",
"com.ichi2.anki.AnkiDroidApp"
] | import android.content.ContentValues; import android.util.Log; import com.ichi2.anki.AnkiDroidApp; | import android.content.*; import android.util.*; import com.ichi2.anki.*; | [
"android.content",
"android.util",
"com.ichi2.anki"
] | android.content; android.util; com.ichi2.anki; | 2,645,750 |
Transformer<F, T> setTo(QName toType); | Transformer<F, T> setTo(QName toType); | /**
* Set the name of the to, or target, message type.
* @param toType To type.
* @return a reference to the current Transformer.
*/ | Set the name of the to, or target, message type | setTo | {
"repo_name": "tadayosi/switchyard",
"path": "core/api/src/main/java/org/switchyard/transform/Transformer.java",
"license": "apache-2.0",
"size": 2397
} | [
"javax.xml.namespace.QName"
] | import javax.xml.namespace.QName; | import javax.xml.namespace.*; | [
"javax.xml"
] | javax.xml; | 2,353,170 |
public static InputFormatBuilder.ClientParams<JobConf> configure() {
return new InputFormatBuilderImpl<>(CLASS);
} | static InputFormatBuilder.ClientParams<JobConf> function() { return new InputFormatBuilderImpl<>(CLASS); } | /**
* Sets all the information required for this map reduce job.
*/ | Sets all the information required for this map reduce job | configure | {
"repo_name": "apache/accumulo",
"path": "hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapred/AccumuloInputFormat.java",
"license": "apache-2.0",
"size": 3518
} | [
"org.apache.accumulo.hadoop.mapreduce.InputFormatBuilder",
"org.apache.accumulo.hadoopImpl.mapreduce.InputFormatBuilderImpl",
"org.apache.hadoop.mapred.JobConf"
] | import org.apache.accumulo.hadoop.mapreduce.InputFormatBuilder; import org.apache.accumulo.hadoopImpl.mapreduce.InputFormatBuilderImpl; import org.apache.hadoop.mapred.JobConf; | import org.apache.accumulo.*; import org.apache.accumulo.hadoop.mapreduce.*; import org.apache.hadoop.mapred.*; | [
"org.apache.accumulo",
"org.apache.hadoop"
] | org.apache.accumulo; org.apache.hadoop; | 2,652,419 |
private void writeOutCache( final long pointer ) throws IOException {
if ( DEBUG ) System.err.println( "Entered writeOutCache() with cache=" + cache + " (H is " + ( 1L << height ) + ", B is " + w + ")" );
cacheDataLength[ (int)( ( ( cache + quantum - 1 ) >>> quantumDivisionShift ) - 1 ) ] = cacheDataOut.writtenBits();
long toTheEnd;
// Record the new document pointer for the highest tower
int nextAfter = (int)( ( ( cache + quantum ) - 1 ) >>> quantumDivisionShift ); // This is ceil( cache / q )
if ( pointer >= 0 ) {
skipPointer[nextAfter] = pointer;
toTheEnd = writeOutPointer( bitCount, pointer );
} else {
skipPointer[nextAfter] = currentDocument + 1; // Fake: just for the last block
toTheEnd = 0;
}
distance[nextAfter] = 0;
int k, s;
long d;
// Compute quantum length in bits (without towers)
int quantumBitLength = 0, entryBitLength = 0;
for ( d = k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) d += ( cachePointer[k].writtenBits() + cacheDataLength[ k ] );
quantumBitLength = (int)( ( ( d * quantum ) + ( cache - 1 ) ) / cache );
final TowerData td = new TowerData();
final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap();
tryTower( quantumBitLength, 0, toTheEnd, cacheSkipBitCount, td, false );
if ( td.numberOfSkipTowers > 0 ) { // There actually is at least a tower.
while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) {
td.clear();
tryTower( quantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false );
candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength );
}
if ( ASSERTS ) assert candidates.size() < MAX_TRY;
entryBitLength = candidates.get( candidates.firstIntKey() );
if ( STATS ) if ( System.getProperty( "freq" ) != null ) {
final double freq = Double.parseDouble( System.getProperty( "freq" ) );
final double error = Integer.getInteger( "error" ).intValue() / 100.0;
final double relativeFrequency = (double)frequency / numberOfDocuments;
if ( ( writeStats = ( relativeFrequency >= freq * ( 1 - error ) && relativeFrequency <= freq * ( 1 + error ) ) ) ) {
pointerSkipStats.println( "# " + currentTerm );
pointerTopSkipStats.println( "# " + currentTerm );
bitSkipStats.println( "# " + currentTerm + " " + quantumBitLength + " " + entryBitLength );
bitTopSkipStats.println( "# " + currentTerm + " " + quantumBitLength + " " + entryBitLength );
}
}
if ( DEBUG ) System.err.println( "Going to write tower at position " + obs.writtenBits() );
tryTower( quantumBitLength, entryBitLength, toTheEnd, cacheSkip, towerData, true );
}
// Ready to write out cache
long maxCacheDataLength = 0;
for ( k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) if ( cacheDataLength[ k ] > maxCacheDataLength ) maxCacheDataLength = cacheDataLength[ k ];
final byte[] buffer;
final boolean direct;
int pos = 0;
cacheDataOut.align();
if ( cacheDataOut.buffer() != null ) {
buffer = cacheDataOut.buffer();
direct = true;
}
else {
cacheDataOut.flush();
assert ( maxCacheDataLength + 7 ) / 8 <= Integer.MAX_VALUE : ( maxCacheDataLength + 7 ) / 8 + " (" + maxCacheDataLength + ")";
buffer = new byte[ (int)( ( maxCacheDataLength + 7 ) / 8 ) ];
direct = false;
cacheDataIn.flush();
cacheDataIn.position( 0 );
}
for ( k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) {
s = ( k == 0 ) ? height : Integer.numberOfTrailingZeros( k );
if ( cache < w ) s = Math.min( s, Fast.mostSignificantBit( ( cache >>> quantumDivisionShift ) - k ) );
d = cachePointer[k].writtenBits();
cachePointer[k].flush();
obs.write( cachePointerByte[k].array, d );
d = cacheSkip[k].writtenBits();
cacheSkip[k].flush();
if ( s >= 0 ) {
if ( k == 0 ) {
if ( prevQuantumBitLength < 0 ) {
bitsForQuantumBitLengths += obs.writeLongDelta( quantumBitLength );
bitsForEntryBitLengths += obs.writeLongDelta( entryBitLength );
}
else {
bitsForQuantumBitLengths += obs.writeLongDelta( Fast.int2nat( quantumBitLength - prevQuantumBitLength ) );
bitsForEntryBitLengths += obs.writeLongDelta( Fast.int2nat( entryBitLength - prevEntryBitLength ) );
}
prevQuantumBitLength = quantumBitLength;
prevEntryBitLength = entryBitLength;
numberOfBlocks++;
}
if ( s > 0 ) obs.writeDelta( Fast.int2nat( (int)d - entryBitLength * ( s + 1 ) ) ); // No length for single-entry towers.
} else if ( ASSERTS ) assert d == 0;
obs.write( cacheSkipByte[k].array, d );
if ( direct ) {
obs.write( buffer, pos * 8, cacheDataLength[ k ] );
pos += ( cacheDataLength[ k ] + 7 ) / 8;
}
else {
assert ( cacheDataLength[ k ] + 7 ) / 8 <= Integer.MAX_VALUE : ( cacheDataLength[ k ] + 7 ) / 8 + " (" + cacheDataLength[ k ] + ")";
cacheDataIn.read( buffer, 0, (int)( ( cacheDataLength[ k ] + 7 ) / 8 ) );
obs.write( buffer, cacheDataLength[ k ] );
}
}
// Clean used caches
for ( k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) {
cachePointerByte[k].reset();
cachePointer[k].writtenBits( 0 );
cacheSkipByte[k].reset();
cacheSkip[k].writtenBits( 0 );
cacheDataOut.position( 0 );
cacheDataOut.writtenBits( 0 );
}
cache = 0;
if ( ASSERTS ) assert obs.writtenBits() == writtenBits();
} | void function( final long pointer ) throws IOException { if ( DEBUG ) System.err.println( STR + cache + STR + ( 1L << height ) + STR + w + ")" ); cacheDataLength[ (int)( ( ( cache + quantum - 1 ) >>> quantumDivisionShift ) - 1 ) ] = cacheDataOut.writtenBits(); long toTheEnd; int nextAfter = (int)( ( ( cache + quantum ) - 1 ) >>> quantumDivisionShift ); if ( pointer >= 0 ) { skipPointer[nextAfter] = pointer; toTheEnd = writeOutPointer( bitCount, pointer ); } else { skipPointer[nextAfter] = currentDocument + 1; toTheEnd = 0; } distance[nextAfter] = 0; int k, s; long d; int quantumBitLength = 0, entryBitLength = 0; for ( d = k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) d += ( cachePointer[k].writtenBits() + cacheDataLength[ k ] ); quantumBitLength = (int)( ( ( d * quantum ) + ( cache - 1 ) ) / cache ); final TowerData td = new TowerData(); final Int2IntRBTreeMap candidates = new Int2IntRBTreeMap(); tryTower( quantumBitLength, 0, toTheEnd, cacheSkipBitCount, td, false ); if ( td.numberOfSkipTowers > 0 ) { while( candidates.size() < MAX_TRY && ! candidates.containsValue( entryBitLength = (int)( td.bitsForTowers() / td.numberOfEntries() ) ) ) { td.clear(); tryTower( quantumBitLength, entryBitLength, toTheEnd, cacheSkipBitCount, td, false ); candidates.put( (int)( td.bitsForTowers() / td.numberOfEntries() ), entryBitLength ); } if ( ASSERTS ) assert candidates.size() < MAX_TRY; entryBitLength = candidates.get( candidates.firstIntKey() ); if ( STATS ) if ( System.getProperty( "freq" ) != null ) { final double freq = Double.parseDouble( System.getProperty( "freq" ) ); final double error = Integer.getInteger( "error" ).intValue() / 100.0; final double relativeFrequency = (double)frequency / numberOfDocuments; if ( ( writeStats = ( relativeFrequency >= freq * ( 1 - error ) && relativeFrequency <= freq * ( 1 + error ) ) ) ) { pointerSkipStats.println( STR + currentTerm ); pointerTopSkipStats.println( STR + currentTerm ); bitSkipStats.println( STR + currentTerm + " " + quantumBitLength + " " + entryBitLength ); bitTopSkipStats.println( STR + currentTerm + " " + quantumBitLength + " " + entryBitLength ); } } if ( DEBUG ) System.err.println( STR + obs.writtenBits() ); tryTower( quantumBitLength, entryBitLength, toTheEnd, cacheSkip, towerData, true ); } long maxCacheDataLength = 0; for ( k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) if ( cacheDataLength[ k ] > maxCacheDataLength ) maxCacheDataLength = cacheDataLength[ k ]; final byte[] buffer; final boolean direct; int pos = 0; cacheDataOut.align(); if ( cacheDataOut.buffer() != null ) { buffer = cacheDataOut.buffer(); direct = true; } else { cacheDataOut.flush(); assert ( maxCacheDataLength + 7 ) / 8 <= Integer.MAX_VALUE : ( maxCacheDataLength + 7 ) / 8 + STR + maxCacheDataLength + ")"; buffer = new byte[ (int)( ( maxCacheDataLength + 7 ) / 8 ) ]; direct = false; cacheDataIn.flush(); cacheDataIn.position( 0 ); } for ( k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) { s = ( k == 0 ) ? height : Integer.numberOfTrailingZeros( k ); if ( cache < w ) s = Math.min( s, Fast.mostSignificantBit( ( cache >>> quantumDivisionShift ) - k ) ); d = cachePointer[k].writtenBits(); cachePointer[k].flush(); obs.write( cachePointerByte[k].array, d ); d = cacheSkip[k].writtenBits(); cacheSkip[k].flush(); if ( s >= 0 ) { if ( k == 0 ) { if ( prevQuantumBitLength < 0 ) { bitsForQuantumBitLengths += obs.writeLongDelta( quantumBitLength ); bitsForEntryBitLengths += obs.writeLongDelta( entryBitLength ); } else { bitsForQuantumBitLengths += obs.writeLongDelta( Fast.int2nat( quantumBitLength - prevQuantumBitLength ) ); bitsForEntryBitLengths += obs.writeLongDelta( Fast.int2nat( entryBitLength - prevEntryBitLength ) ); } prevQuantumBitLength = quantumBitLength; prevEntryBitLength = entryBitLength; numberOfBlocks++; } if ( s > 0 ) obs.writeDelta( Fast.int2nat( (int)d - entryBitLength * ( s + 1 ) ) ); } else if ( ASSERTS ) assert d == 0; obs.write( cacheSkipByte[k].array, d ); if ( direct ) { obs.write( buffer, pos * 8, cacheDataLength[ k ] ); pos += ( cacheDataLength[ k ] + 7 ) / 8; } else { assert ( cacheDataLength[ k ] + 7 ) / 8 <= Integer.MAX_VALUE : ( cacheDataLength[ k ] + 7 ) / 8 + STR + cacheDataLength[ k ] + ")"; cacheDataIn.read( buffer, 0, (int)( ( cacheDataLength[ k ] + 7 ) / 8 ) ); obs.write( buffer, cacheDataLength[ k ] ); } } for ( k = 0; k <= ( ( cache - 1 ) >>> quantumDivisionShift ); k++ ) { cachePointerByte[k].reset(); cachePointer[k].writtenBits( 0 ); cacheSkipByte[k].reset(); cacheSkip[k].writtenBits( 0 ); cacheDataOut.position( 0 ); cacheDataOut.writtenBits( 0 ); } cache = 0; if ( ASSERTS ) assert obs.writtenBits() == writtenBits(); } | /** Write out the cache content.
*
* @param pointer the first pointer of the next block, or -1 if this is the last block.
*/ | Write out the cache content | writeOutCache | {
"repo_name": "JC-R/mg4j",
"path": "src/it/unimi/di/big/mg4j/index/SkipBitStreamIndexWriter.java",
"license": "gpl-3.0",
"size": 37434
} | [
"it.unimi.dsi.bits.Fast",
"it.unimi.dsi.fastutil.ints.Int2IntRBTreeMap",
"java.io.IOException"
] | import it.unimi.dsi.bits.Fast; import it.unimi.dsi.fastutil.ints.Int2IntRBTreeMap; import java.io.IOException; | import it.unimi.dsi.bits.*; import it.unimi.dsi.fastutil.ints.*; import java.io.*; | [
"it.unimi.dsi",
"java.io"
] | it.unimi.dsi; java.io; | 2,421,283 |
public void setCategoryMargin(double margin) {
this.categoryMargin = margin;
notifyListeners(new AxisChangeEvent(this));
}
| void function(double margin) { this.categoryMargin = margin; notifyListeners(new AxisChangeEvent(this)); } | /**
* Sets the category margin and sends an {@link AxisChangeEvent} to all
* registered listeners. The overall category margin is distributed over
* N-1 gaps, where N is the number of categories on the axis.
*
* @param margin the margin as a percentage of the axis length (for
* example, 0.05 is five percent).
*
* @see #getCategoryMargin()
*/ | Sets the category margin and sends an <code>AxisChangeEvent</code> to all registered listeners. The overall category margin is distributed over N-1 gaps, where N is the number of categories on the axis | setCategoryMargin | {
"repo_name": "apetresc/JFreeChart",
"path": "src/main/java/org/jfree/chart/axis/CategoryAxis.java",
"license": "lgpl-2.1",
"size": 58999
} | [
"org.jfree.chart.event.AxisChangeEvent"
] | import org.jfree.chart.event.AxisChangeEvent; | import org.jfree.chart.event.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 786,519 |
private static String getIcons(SimpleItypeConfig sic, int level, int rowNum, int maxRows, int spRowNum, int maxSp, boolean canDelete) {
String html = "";
// Right Arrow
if ( (level==1 && rowNum>0)
|| (level>1 && spRowNum>0) )
html += "<IMG border=\"0\" alt=\""+ MSG.titleMoveToChildLevel() + "\" title=\"" + MSG.titleMoveToChildLevel() + "\" align=\"absmiddle\" src=\"images/arrow_right.png\" " +
"onClick=\"doClick('shiftRight', " + sic.getId() + ");\" onMouseOver=\"this.style.cursor='hand';this.style.cursor='pointer';\">";
else
html += "<IMG align=\"top\" src=\"images/blank.png\">";
// Left Arrow
if (level>1)
html += "<IMG border=\"0\" alt=\""+ MSG.titleMoveToParentLevel()+"\" title=\""+MSG.titleMoveToParentLevel() +"\" align=\"absmiddle\" src=\"images/arrow_left.png\" " +
"onClick=\"doClick('shiftLeft', " + sic.getId() + ");\" onMouseOver=\"this.style.cursor='hand';this.style.cursor='pointer';\">";
else
html += "<IMG align=\"top\" src=\"images/blank.png\">";
// Up Arrow
if( (level==1 && rowNum>0 )
|| (level>1 && spRowNum>0) )
html += "<IMG border=\"0\" alt=\""+MSG.altMoveUp()+"\" align=\"absmiddle\" src=\"images/arrow_up.png\" " +
"onClick=\"doClick('shiftUp', " + sic.getId() + ");\" onMouseOver=\"this.style.cursor='hand';this.style.cursor='pointer';\">";
else
html += "<IMG align=\"absmiddle\" src=\"images/blank.png\">";
// Down Arrow
if ( (level==1 && (rowNum+1)<maxRows)
|| (level>1 && (spRowNum+1)<maxSp) )
html += "<IMG border=\"0\" alt=\""+MSG.altMoveDown()+"\" align=\"absmiddle\" src=\"images/arrow_down.png\" " +
"onClick=\"doClick('shiftDown', " + sic.getId() + ");\" onMouseOver=\"this.style.cursor='hand';this.style.cursor='pointer';\">";
else
html += "<IMG align=\"absmiddle\" src=\"images/blank.png\">";
// Delete
if (canDelete) {
html += "<IMG border=\"0\" alt=\""+MSG.altDelete()+"\" title=\""+MSG.titleDeleteInstructionalType()+"\" align=\"absmiddle\" src=\"images/action_delete.png\" " +
"onClick=\"doClick('delete', " + sic.getId() + ");\" onMouseOver=\"this.style.cursor='hand';this.style.cursor='pointer';\"> ";
}
html += " ";
return html;
}
| static String function(SimpleItypeConfig sic, int level, int rowNum, int maxRows, int spRowNum, int maxSp, boolean canDelete) { String html = STR<IMG border=\"0\" alt=\STR\STRSTR\STRabsmiddle\STRimages/arrow_right.png\" " + STRdoClick('shiftRight', STR);\STRthis.style.cursor='hand';this.style.cursor='pointer';\">"; else html += STRtop\STRimages/blank.png\">"; if (level>1) html += STR0\STRSTR\STRSTR\STRabsmiddle\STRimages/arrow_left.png\" " + STRdoClick('shiftLeft', STR);\STRthis.style.cursor='hand';this.style.cursor='pointer';\">"; else html += STRtop\STRimages/blank.png\">"; if( (level==1 && rowNum>0 ) (level>1 && spRowNum>0) ) html += STR0\STRSTR\STRabsmiddle\STRimages/arrow_up.png\" " + STRdoClick('shiftUp', STR);\STRthis.style.cursor='hand';this.style.cursor='pointer';\">"; else html += STRabsmiddle\STRimages/blank.png\">"; if ( (level==1 && (rowNum+1)<maxRows) (level>1 && (spRowNum+1)<maxSp) ) html += STR0\STRSTR\STRabsmiddle\STRimages/arrow_down.png\" " + STRdoClick('shiftDown', STR);\STRthis.style.cursor='hand';this.style.cursor='pointer';\">"; else html += STRabsmiddle\STRimages/blank.png\">"; if (canDelete) { html += STR0\STRSTR\STRSTR\STRabsmiddle\STRimages/action_delete.png\" " + STRdoClick('delete', STR);\STRthis.style.cursor='hand';this.style.cursor='pointer';\STR; } html += STR; return html; } | /**
* Generates icons for shifting and deleting operations on itype config elements
* @param sic SimpleItypeConfig object
* @param level Recurse Level
* @param rowNum Row Number (in config)
* @param maxRows Max elements in config
* @param uid Unique Id of course offering
* @param spRowNum row number of subpart
* @param maxSp Max subparts
* @return Html code for arrow images
*/ | Generates icons for shifting and deleting operations on itype config elements | getIcons | {
"repo_name": "maciej-zygmunt/unitime",
"path": "JavaSource/org/unitime/timetable/webutil/SchedulingSubpartTableBuilder.java",
"license": "apache-2.0",
"size": 22262
} | [
"org.unitime.timetable.model.SimpleItypeConfig"
] | import org.unitime.timetable.model.SimpleItypeConfig; | import org.unitime.timetable.model.*; | [
"org.unitime.timetable"
] | org.unitime.timetable; | 2,829,557 |
@Nullable
public static <T> T getAnnotation(@Nonnull Annotation[] annotations, @Nonnull Class<T> annotation) {
if(annotations == null || annotations.length == 0) {
return null;
}
for(Annotation a: annotations) {
if(annotation.isAssignableFrom(a.getClass())) {
return (T) a;
}
}
return null;
} | static <T> T function(@Nonnull Annotation[] annotations, @Nonnull Class<T> annotation) { if(annotations == null annotations.length == 0) { return null; } for(Annotation a: annotations) { if(annotation.isAssignableFrom(a.getClass())) { return (T) a; } } return null; } | /**
* Retrieve the annotation of given type from array of annotations
*
* @param annotations
* @param annotation
* @return
*/ | Retrieve the annotation of given type from array of annotations | getAnnotation | {
"repo_name": "Mak-Sym/dbg4j",
"path": "dbg4j-core/src/main/java/org/dbg4j/core/DebugUtils.java",
"license": "apache-2.0",
"size": 8596
} | [
"java.lang.annotation.Annotation",
"javax.annotation.Nonnull"
] | import java.lang.annotation.Annotation; import javax.annotation.Nonnull; | import java.lang.annotation.*; import javax.annotation.*; | [
"java.lang",
"javax.annotation"
] | java.lang; javax.annotation; | 2,111,155 |
private void testTransactionMixed0(IgniteCache<Integer, Object>[] caches, TransactionConcurrency concurrency,
Integer key1, byte[] val1, @Nullable Integer key2, @Nullable Object val2) throws Exception {
for (IgniteCache<Integer, Object> cache : caches) {
Transaction tx = cache.unwrap(Ignite.class).transactions().txStart(concurrency, REPEATABLE_READ);
try {
cache.put(key1, val1);
if (key2 != null)
cache.put(key2, val2);
tx.commit();
}
finally {
tx.close();
}
for (IgniteCache<Integer, Object> cacheInner : caches) {
tx = cacheInner.unwrap(Ignite.class).transactions().txStart(concurrency, REPEATABLE_READ);
try {
assertArrayEquals(val1, (byte[])cacheInner.get(key1));
if (key2 != null) {
Object actual = cacheInner.get(key2);
assertEquals(val2, actual);
}
tx.commit();
}
finally {
tx.close();
}
}
tx = cache.unwrap(Ignite.class).transactions().txStart(concurrency, REPEATABLE_READ);
try {
cache.remove(key1);
if (key2 != null)
cache.remove(key2);
tx.commit();
}
finally {
tx.close();
}
assertNull(cache.get(key1));
}
} | void function(IgniteCache<Integer, Object>[] caches, TransactionConcurrency concurrency, Integer key1, byte[] val1, @Nullable Integer key2, @Nullable Object val2) throws Exception { for (IgniteCache<Integer, Object> cache : caches) { Transaction tx = cache.unwrap(Ignite.class).transactions().txStart(concurrency, REPEATABLE_READ); try { cache.put(key1, val1); if (key2 != null) cache.put(key2, val2); tx.commit(); } finally { tx.close(); } for (IgniteCache<Integer, Object> cacheInner : caches) { tx = cacheInner.unwrap(Ignite.class).transactions().txStart(concurrency, REPEATABLE_READ); try { assertArrayEquals(val1, (byte[])cacheInner.get(key1)); if (key2 != null) { Object actual = cacheInner.get(key2); assertEquals(val2, actual); } tx.commit(); } finally { tx.close(); } } tx = cache.unwrap(Ignite.class).transactions().txStart(concurrency, REPEATABLE_READ); try { cache.remove(key1); if (key2 != null) cache.remove(key2); tx.commit(); } finally { tx.close(); } assertNull(cache.get(key1)); } } | /**
* Test transaction behavior.
*
* @param caches Caches.
* @param concurrency Concurrency.
* @param key1 Key 1.
* @param val1 Value 1.
* @param key2 Key 2.
* @param val2 Value 2.
* @throws Exception If failed.
*/ | Test transaction behavior | testTransactionMixed0 | {
"repo_name": "agoncharuk/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/GridCacheAbstractDistributedByteArrayValuesSelfTest.java",
"license": "apache-2.0",
"size": 12255
} | [
"org.apache.ignite.Ignite",
"org.apache.ignite.IgniteCache",
"org.apache.ignite.transactions.Transaction",
"org.apache.ignite.transactions.TransactionConcurrency",
"org.jetbrains.annotations.Nullable",
"org.junit.Assert"
] | import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.jetbrains.annotations.Nullable; import org.junit.Assert; | import org.apache.ignite.*; import org.apache.ignite.transactions.*; import org.jetbrains.annotations.*; import org.junit.*; | [
"org.apache.ignite",
"org.jetbrains.annotations",
"org.junit"
] | org.apache.ignite; org.jetbrains.annotations; org.junit; | 2,272,498 |
public static LabeledSymmetricMatrix<StructuralMotif> calculateRmsdMatrix(List<StructuralMotif> structuralMotifs,
Predicate<Atom> atomFilter,
boolean idealSuperimposition) {
// check for correct input of same size
if (structuralMotifs.stream()
.map(StructuralMotif::size)
.distinct()
.count() != 1) {
throw new IllegalArgumentException("RMSD matrix can only be calculated for structural motifs of same size");
}
double[][] temporaryDistanceMatrix = new double[structuralMotifs.size()][structuralMotifs.size()];
List<StructuralMotif> matrixLabels = new ArrayList<>();
// initially append first label
matrixLabels.add(structuralMotifs.get(0));
for (int i = 0; i < structuralMotifs.size() - 1; i++) {
for (int j = i + 1; j < structuralMotifs.size(); j++) {
StructuralMotif reference = structuralMotifs.get(i);
StructuralMotif candidate = structuralMotifs.get(j);
// calculate superimposition
SubstructureSuperimposition superimposition = idealSuperimposition ?
SubstructureSuperimposer.calculateIdealSubstructureSuperimposition(reference, candidate, atomFilter) :
SubstructureSuperimposer.calculateSubstructureSuperimposition(reference, candidate, atomFilter);
// store distance matrix
temporaryDistanceMatrix[i][j] = superimposition.getRmsd();
temporaryDistanceMatrix[j][i] = superimposition.getRmsd();
}
// store label
matrixLabels.add(structuralMotifs.get(i + 1));
}
LabeledSymmetricMatrix<StructuralMotif> rmsdMatrix = new LabeledSymmetricMatrix<>(temporaryDistanceMatrix);
rmsdMatrix.setColumnLabels(matrixLabels);
return rmsdMatrix;
} | static LabeledSymmetricMatrix<StructuralMotif> function(List<StructuralMotif> structuralMotifs, Predicate<Atom> atomFilter, boolean idealSuperimposition) { if (structuralMotifs.stream() .map(StructuralMotif::size) .distinct() .count() != 1) { throw new IllegalArgumentException(STR); } double[][] temporaryDistanceMatrix = new double[structuralMotifs.size()][structuralMotifs.size()]; List<StructuralMotif> matrixLabels = new ArrayList<>(); matrixLabels.add(structuralMotifs.get(0)); for (int i = 0; i < structuralMotifs.size() - 1; i++) { for (int j = i + 1; j < structuralMotifs.size(); j++) { StructuralMotif reference = structuralMotifs.get(i); StructuralMotif candidate = structuralMotifs.get(j); SubstructureSuperimposition superimposition = idealSuperimposition ? SubstructureSuperimposer.calculateIdealSubstructureSuperimposition(reference, candidate, atomFilter) : SubstructureSuperimposer.calculateSubstructureSuperimposition(reference, candidate, atomFilter); temporaryDistanceMatrix[i][j] = superimposition.getRmsd(); temporaryDistanceMatrix[j][i] = superimposition.getRmsd(); } matrixLabels.add(structuralMotifs.get(i + 1)); } LabeledSymmetricMatrix<StructuralMotif> rmsdMatrix = new LabeledSymmetricMatrix<>(temporaryDistanceMatrix); rmsdMatrix.setColumnLabels(matrixLabels); return rmsdMatrix; } | /**
* Performs a superimposition of given {@link StructuralMotif}s using the specified {@link
* StructuralEntityFilter.AtomFilter} and returns the RMSD distance matrix between all elements.
*
* @param structuralMotifs The input structural motifs.
* @param atomFilter The {@link StructuralEntityFilter.AtomFilter} used for the superimposition.
* @param idealSuperimposition If ideal superimposition should be performed.
* @return A {@link LabeledSymmetricMatrix} that contains all-against-all RMSD values.
*/ | Performs a superimposition of given <code>StructuralMotif</code>s using the specified <code>StructuralEntityFilter.AtomFilter</code> and returns the RMSD distance matrix between all elements | calculateRmsdMatrix | {
"repo_name": "cleberecht/singa",
"path": "singa-structure/src/main/java/bio/singa/structure/model/oak/StructuralMotifs.java",
"license": "gpl-3.0",
"size": 4970
} | [
"bio.singa.mathematics.matrices.LabeledSymmetricMatrix",
"bio.singa.structure.algorithms.superimposition.SubstructureSuperimposer",
"bio.singa.structure.algorithms.superimposition.SubstructureSuperimposition",
"bio.singa.structure.model.interfaces.Atom",
"java.util.ArrayList",
"java.util.List",
"java.ut... | import bio.singa.mathematics.matrices.LabeledSymmetricMatrix; import bio.singa.structure.algorithms.superimposition.SubstructureSuperimposer; import bio.singa.structure.algorithms.superimposition.SubstructureSuperimposition; import bio.singa.structure.model.interfaces.Atom; import java.util.ArrayList; import java.util.List; import java.util.function.Predicate; | import bio.singa.mathematics.matrices.*; import bio.singa.structure.algorithms.superimposition.*; import bio.singa.structure.model.interfaces.*; import java.util.*; import java.util.function.*; | [
"bio.singa.mathematics",
"bio.singa.structure",
"java.util"
] | bio.singa.mathematics; bio.singa.structure; java.util; | 606,095 |
@Test
public void testCopyPasteNoSettingsUsingApplySettingsToImage() throws Exception {
EventContext ctx = newUserAndGroup("rwra--");
Image image = createBinaryImage();
Image image2 = createBinaryImage();
Pixels pixels = image.getPrimaryPixels();
IRenderingSettingsPrx prx = factory.getRenderingSettingsService();
//Image has no settings
disconnect();
//Add log in as a new user
newUserInGroup(ctx);
// Same image
prx = factory.getRenderingSettingsService();
boolean v = prx.applySettingsToImage(pixels.getId().getValue(),
image2.getId().getValue());
Assert.assertFalse(v);
ParametersI param = new ParametersI();
param.addLong("pid", pixels.getId().getValue());
String sql = "select rdef from RenderingDef as rdef "
+ "where rdef.pixels.id = :pid";
List<IObject> values = iQuery.findAllByQuery(sql, param);
Assert.assertNotNull(values);
Assert.assertEquals(values.size(), 0);
} | void function() throws Exception { EventContext ctx = newUserAndGroup(STR); Image image = createBinaryImage(); Image image2 = createBinaryImage(); Pixels pixels = image.getPrimaryPixels(); IRenderingSettingsPrx prx = factory.getRenderingSettingsService(); disconnect(); newUserInGroup(ctx); prx = factory.getRenderingSettingsService(); boolean v = prx.applySettingsToImage(pixels.getId().getValue(), image2.getId().getValue()); Assert.assertFalse(v); ParametersI param = new ParametersI(); param.addLong("pid", pixels.getId().getValue()); String sql = STR + STR; List<IObject> values = iQuery.findAllByQuery(sql, param); Assert.assertNotNull(values); Assert.assertEquals(values.size(), 0); } | /**
* Test the copying of rendering settings by a user who do not have rendering
* settings for that image.
* The source image does not have any settings.
* No copy occurs
* Use the applySettingsToImage
* @throws Exception
*/ | Test the copying of rendering settings by a user who do not have rendering settings for that image. The source image does not have any settings. No copy occurs Use the applySettingsToImage | testCopyPasteNoSettingsUsingApplySettingsToImage | {
"repo_name": "knabar/openmicroscopy",
"path": "components/tools/OmeroJava/test/integration/RenderingSettingsServicePermissionsTest.java",
"license": "gpl-2.0",
"size": 51046
} | [
"java.util.List",
"org.testng.Assert"
] | import java.util.List; import org.testng.Assert; | import java.util.*; import org.testng.*; | [
"java.util",
"org.testng"
] | java.util; org.testng; | 323,753 |
public void navigateToStudyFlashcardsActivity(Context context, Long lessonId) {
Intent intent = StudyFlashcardsActivity.createIntent(context, lessonId);
context.startActivity(intent);
} | void function(Context context, Long lessonId) { Intent intent = StudyFlashcardsActivity.createIntent(context, lessonId); context.startActivity(intent); } | /**
* Navigate to study flashcards activity
*/ | Navigate to study flashcards activity | navigateToStudyFlashcardsActivity | {
"repo_name": "Eagles2F/words4you",
"path": "app/src/main/java/com/dbychkov/words/navigator/Navigator.java",
"license": "apache-2.0",
"size": 2438
} | [
"android.content.Context",
"android.content.Intent",
"com.dbychkov.words.activity.StudyFlashcardsActivity"
] | import android.content.Context; import android.content.Intent; import com.dbychkov.words.activity.StudyFlashcardsActivity; | import android.content.*; import com.dbychkov.words.activity.*; | [
"android.content",
"com.dbychkov.words"
] | android.content; com.dbychkov.words; | 643,297 |
private int readImpl() throws IOException {
final int c = super.read();
final int rc;
switch (state) {
case NORMAL:
if (c == '/') {
state = State.SLASH;
rc = -2;
} else if (c == '\\') {
state = State.ESCAPE;
rc = c;
} else if (c == '"') {
state = State.STRING;
rc = c;
} else if (c == '\'') {
state = State.CHAR;
rc = c;
} else {
state = State.NORMAL;
rc = c;
}
break;
case SLASH:
if (c == '/') {
state = State.EOL_COMMENT;
cachedChar = (int) ' ';
rc = ' ';
} else if (c == '*') {
state = State.ML_COMMENT;
cachedChar = (int) ' ';
rc = ' ';
} else {
state = State.NORMAL;
cachedChar = c;
rc = '/';
}
break;
case EOL_COMMENT:
if (c == '\n') {
state = State.NORMAL;
rc = c;
} else if (c == '\r') {
state = State.NORMAL;
rc = c;
} else if (c == '\\') {
state = State.ESCAPE_IN_EOL_COMMENT;
rc = ' ';
} else {
state = State.EOL_COMMENT;
rc = c == -1 ? c : ' ';
}
break;
case ML_COMMENT:
if (c == '\n') {
state = State.ML_COMMENT;
rc = c;
} else if (c == '\r') {
state = State.ML_COMMENT;
rc = c;
} else if (c == '*') {
state = State.MAYBE_END_OF_ML_COMMENT;
rc = ' ';
} else {
state = State.ML_COMMENT;
rc = c == -1 ? c : ' ';
}
break;
case MAYBE_END_OF_ML_COMMENT:
if (c == '\n') {
state = State.ML_COMMENT;
rc = c;
} else if (c == '\r') {
state = State.ML_COMMENT;
rc = c;
} else if (c == '*') {
state = State.MAYBE_END_OF_ML_COMMENT;
rc = ' ';
} else if (c == '/') {
state = State.NORMAL;
rc = ' ';
} else {
state = State.ML_COMMENT;
rc = ' ';
}
break;
case ESCAPE:
state = State.NORMAL;
rc = c;
break;
case CHAR:
if (c == '\'') {
state = State.NORMAL;
rc = c;
} else if (c == '\\') {
state = State.ESCAPE_IN_CHAR;
rc = c;
} else {
state = State.CHAR;
rc = c;
}
break;
case ESCAPE_IN_CHAR:
state = State.CHAR;
rc = c;
break;
case STRING:
if (c == '"') {
state = State.NORMAL;
rc = c;
} else if (c == '\\') {
state = State.ESCAPE_IN_STRING;
rc = c;
} else {
state = State.STRING;
rc = c;
}
break;
case ESCAPE_IN_STRING:
state = State.STRING;
rc = c;
break;
case ESCAPE_IN_EOL_COMMENT:
if (c == '\n') {
state = State.EOL_COMMENT;
rc = c;
} else if (c == '\r') {
rc = c;
} else {
state = State.EOL_COMMENT;
rc = ' ';
}
break;
default:
throw new AssertionError("Missing case in above switch.");
}
return rc;
} | int function() throws IOException { final int c = super.read(); final int rc; switch (state) { case NORMAL: if (c == '/') { state = State.SLASH; rc = -2; } else if (c == '\\') { state = State.ESCAPE; rc = c; } else if (c == 'STR') { state = State.NORMAL; rc = c; } else if (c == '\\') { state = State.ESCAPE_IN_STRING; rc = c; } else { state = State.STRING; rc = c; } break; case ESCAPE_IN_STRING: state = State.STRING; rc = c; break; case ESCAPE_IN_EOL_COMMENT: if (c == '\n') { state = State.EOL_COMMENT; rc = c; } else if (c == '\r') { rc = c; } else { state = State.EOL_COMMENT; rc = ' '; } break; default: throw new AssertionError(STR); } return rc; } | /**
* Implementation of {@link #read()}.
*
* @return read character.
* @throws IOException In case of I/O problems.
* @retval -1 in case of end of file.
* @retval -2 in case this function needs to be invoked again.
*/ | Implementation of <code>#read()</code> | readImpl | {
"repo_name": "christianhujer/aceunit",
"path": "generator/src/prj/net/sf/aceunit/CommentToWhitespaceReader.java",
"license": "bsd-3-clause",
"size": 9410
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,265,245 |
public void send(Resource resource, String metric, Object value) {
if (!started) {
logger.error("The DCAgent is not started, data won't be sent");
return;
}
if (!shouldMonitor(resource, metric)) {
logger.error(
"Monitoring is not required for the given resource and the given metric, datum [{},{},{}] won't be sent",
resource.getId(), metric, value.toString());
return;
}
JsonObject jsonDatum = new JsonObject();
jsonDatum.addProperty(MOVocabulary.resourceId, resource.getId());
jsonDatum.addProperty(MOVocabulary.metric, metric);
if (value instanceof String) {
jsonDatum.addProperty(MOVocabulary.value, (String) value);
} else if (value instanceof Number) {
jsonDatum.addProperty(MOVocabulary.value, (Number) value);
} else if (value instanceof Boolean) {
jsonDatum.addProperty(MOVocabulary.value, (Boolean) value);
} else if (value instanceof Character) {
jsonDatum.addProperty(MOVocabulary.value, (Character) value);
} else {
logger.error(
"Value cannot be a {}. Only String, Number, Boolean or Character are allowed",
value.getClass());
return;
}
addToBuffer(metric, jsonDatum);
startTimerIfNotStarted();
} | void function(Resource resource, String metric, Object value) { if (!started) { logger.error(STR); return; } if (!shouldMonitor(resource, metric)) { logger.error( STR, resource.getId(), metric, value.toString()); return; } JsonObject jsonDatum = new JsonObject(); jsonDatum.addProperty(MOVocabulary.resourceId, resource.getId()); jsonDatum.addProperty(MOVocabulary.metric, metric); if (value instanceof String) { jsonDatum.addProperty(MOVocabulary.value, (String) value); } else if (value instanceof Number) { jsonDatum.addProperty(MOVocabulary.value, (Number) value); } else if (value instanceof Boolean) { jsonDatum.addProperty(MOVocabulary.value, (Boolean) value); } else if (value instanceof Character) { jsonDatum.addProperty(MOVocabulary.value, (Character) value); } else { logger.error( STR, value.getClass()); return; } addToBuffer(metric, jsonDatum); startTimerIfNotStarted(); } | /**
* Send a metric to the data analyzer. Note that {@code value} should have the actual data type,
* serialization is managed by the library. Sending Strings, for example, won't allow the data analyzer
* to compute aggregations such as the average.
*
* @param resource
* @param metric
* @param value
*/ | Send a metric to the data analyzer. Note that value should have the actual data type, serialization is managed by the library. Sending Strings, for example, won't allow the data analyzer to compute aggregations such as the average | send | {
"repo_name": "deib-polimi/tower4clouds",
"path": "data-collector-library/src/main/java/it/polimi/tower4clouds/data_collector_library/DCAgent.java",
"license": "apache-2.0",
"size": 13522
} | [
"com.google.gson.JsonObject",
"it.polimi.tower4clouds.model.ontology.MOVocabulary",
"it.polimi.tower4clouds.model.ontology.Resource"
] | import com.google.gson.JsonObject; import it.polimi.tower4clouds.model.ontology.MOVocabulary; import it.polimi.tower4clouds.model.ontology.Resource; | import com.google.gson.*; import it.polimi.tower4clouds.model.ontology.*; | [
"com.google.gson",
"it.polimi.tower4clouds"
] | com.google.gson; it.polimi.tower4clouds; | 908,338 |
private static void grantPermissionToHierarchyLevel(UserRealm userRealm, String topicId, String role)
throws UserStoreException {
//tokenize resource path
StringTokenizer tokenizer = new StringTokenizer(topicId, "/");
StringBuilder resourcePathBuilder = new StringBuilder();
//get token count
int tokenCount = tokenizer.countTokens();
int count = 0;
Pattern pattern = Pattern.compile(PARENT_RESOURCE_PATH);
while (tokenizer.hasMoreElements()) {
//get each element in topicId resource path
String resource = tokenizer.nextElement().toString();
//build resource path again
resourcePathBuilder.append(resource);
//we want to give permission to any resource after event/topics/ in build resource path
Matcher matcher = pattern.matcher(resourcePathBuilder.toString());
if (matcher.find()) {
userRealm.getAuthorizationManager().authorizeRole(role, resourcePathBuilder.toString(),
TreeNode.Permission.SUBSCRIBE.toString().toLowerCase());
userRealm.getAuthorizationManager().authorizeRole(role, resourcePathBuilder.toString(),
TreeNode.Permission.PUBLISH.toString().toLowerCase());
userRealm.getAuthorizationManager().authorizeRole(role, resourcePathBuilder.toString(),
PERMISSION_CHANGE_PERMISSION);
}
count++;
if (count < tokenCount) {
resourcePathBuilder.append("/");
}
}
}
| static void function(UserRealm userRealm, String topicId, String role) throws UserStoreException { StringTokenizer tokenizer = new StringTokenizer(topicId, "/"); StringBuilder resourcePathBuilder = new StringBuilder(); int tokenCount = tokenizer.countTokens(); int count = 0; Pattern pattern = Pattern.compile(PARENT_RESOURCE_PATH); while (tokenizer.hasMoreElements()) { String resource = tokenizer.nextElement().toString(); resourcePathBuilder.append(resource); Matcher matcher = pattern.matcher(resourcePathBuilder.toString()); if (matcher.find()) { userRealm.getAuthorizationManager().authorizeRole(role, resourcePathBuilder.toString(), TreeNode.Permission.SUBSCRIBE.toString().toLowerCase()); userRealm.getAuthorizationManager().authorizeRole(role, resourcePathBuilder.toString(), TreeNode.Permission.PUBLISH.toString().toLowerCase()); userRealm.getAuthorizationManager().authorizeRole(role, resourcePathBuilder.toString(), PERMISSION_CHANGE_PERMISSION); } count++; if (count < tokenCount) { resourcePathBuilder.append("/"); } } } | /**
* Admin user and user who had add topic permission create the hierarchy topic get permission to all level by default
*
* @param userRealm User's Realm
* @param topicId topic id
* @param role admin role
* @throws UserStoreException
*/ | Admin user and user who had add topic permission create the hierarchy topic get permission to all level by default | grantPermissionToHierarchyLevel | {
"repo_name": "hemikak/carbon-business-messaging",
"path": "components/andes/org.wso2.carbon.andes.authorization/src/main/java/org/wso2/carbon/andes/authorization/andes/AndesAuthorizationHandler.java",
"license": "apache-2.0",
"size": 57226
} | [
"java.util.StringTokenizer",
"java.util.regex.Matcher",
"java.util.regex.Pattern",
"org.wso2.carbon.user.api.UserRealm",
"org.wso2.carbon.user.api.UserStoreException",
"org.wso2.carbon.user.core.authorization.TreeNode"
] | import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.authorization.TreeNode; | import java.util.*; import java.util.regex.*; import org.wso2.carbon.user.api.*; import org.wso2.carbon.user.core.authorization.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 2,099,653 |
public void sort()
{
Collections.sort(list);
} | void function() { Collections.sort(list); } | /**
* Will sort the elements in the list
*/ | Will sort the elements in the list | sort | {
"repo_name": "Navaneethsen/Astar_Java",
"path": "src/components/SortedList.java",
"license": "gpl-2.0",
"size": 1545
} | [
"java.util.Collections"
] | import java.util.Collections; | import java.util.*; | [
"java.util"
] | java.util; | 1,788,745 |
private void initialize() {
frame = new JFrame(APP_TITLE);
frame.setBounds(100, 100, 890, 601);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(getLeftPanel());
frame.getContentPane().add(getPanel_1_1());
frame.getContentPane().add(getMessagePanel());
JPanel resultPanel = new JPanel();
resultPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "RECOM", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
resultPanel.setBounds(4, 443, 849, 86);
frame.getContentPane().add(resultPanel);
resultPanel.setLayout(new BorderLayout(0, 0));
JScrollPane scrollPane_4 = new JScrollPane();
resultPanel.add(scrollPane_4, BorderLayout.CENTER);
resultArea = new JTextArea();
resultArea.setBorder(null);
resultArea.setBackground(SystemColor.menu);
scrollPane_4.setViewportView(resultArea);
frame.setResizable(false);
// . loading rules and facts
loadRules();
loadFacts();
loadRuleModel();
loadFactModel();
} | void function() { frame = new JFrame(APP_TITLE); frame.setBounds(100, 100, 890, 601); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); frame.getContentPane().add(getLeftPanel()); frame.getContentPane().add(getPanel_1_1()); frame.getContentPane().add(getMessagePanel()); JPanel resultPanel = new JPanel(); resultPanel.setBorder(new TitledBorder(UIManager.getBorder(STR), "RECOM", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0))); resultPanel.setBounds(4, 443, 849, 86); frame.getContentPane().add(resultPanel); resultPanel.setLayout(new BorderLayout(0, 0)); JScrollPane scrollPane_4 = new JScrollPane(); resultPanel.add(scrollPane_4, BorderLayout.CENTER); resultArea = new JTextArea(); resultArea.setBorder(null); resultArea.setBackground(SystemColor.menu); scrollPane_4.setViewportView(resultArea); frame.setResizable(false); loadRules(); loadFacts(); loadRuleModel(); loadFactModel(); } | /**
* Initialize the contents of the frame.
*/ | Initialize the contents of the frame | initialize | {
"repo_name": "intelligent-decision-support-systems/knowledge-based-reasoning-framework",
"path": "src/main/java/org/uclab/mm/kcl/edket/krf/ui/ReasonerGui.java",
"license": "apache-2.0",
"size": 23265
} | [
"java.awt.BorderLayout",
"java.awt.Color",
"java.awt.SystemColor",
"javax.swing.JFrame",
"javax.swing.JPanel",
"javax.swing.JScrollPane",
"javax.swing.JTextArea",
"javax.swing.UIManager",
"javax.swing.border.TitledBorder"
] | import java.awt.BorderLayout; import java.awt.Color; import java.awt.SystemColor; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.UIManager; import javax.swing.border.TitledBorder; | import java.awt.*; import javax.swing.*; import javax.swing.border.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,027,705 |
public ServerConfiguration killBookie(int index) throws Exception {
if (index >= bs.size()) {
throw new IOException("Bookie does not exist");
}
BookieServer server = bs.get(index);
server.shutdown();
stopAutoRecoveryService(server);
bs.remove(server);
return bsConfs.remove(index);
} | ServerConfiguration function(int index) throws Exception { if (index >= bs.size()) { throw new IOException(STR); } BookieServer server = bs.get(index); server.shutdown(); stopAutoRecoveryService(server); bs.remove(server); return bsConfs.remove(index); } | /**
* Kill a bookie by index. Also, stops the respective auto recovery process
* for this bookie, if isAutoRecoveryEnabled is true.
*
* @param index
* Bookie Index
* @return the configuration of killed bookie
* @throws InterruptedException
* @throws IOException
*/ | Kill a bookie by index. Also, stops the respective auto recovery process for this bookie, if isAutoRecoveryEnabled is true | killBookie | {
"repo_name": "robindh/bookkeeper",
"path": "bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookKeeperClusterTestCase.java",
"license": "apache-2.0",
"size": 22013
} | [
"java.io.IOException",
"org.apache.bookkeeper.conf.ServerConfiguration",
"org.apache.bookkeeper.proto.BookieServer"
] | import java.io.IOException; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.proto.BookieServer; | import java.io.*; import org.apache.bookkeeper.conf.*; import org.apache.bookkeeper.proto.*; | [
"java.io",
"org.apache.bookkeeper"
] | java.io; org.apache.bookkeeper; | 2,302,192 |
@Test
public void testEventIDPrapogationOnServerDuringRegionDestroy() {
destroyRegion();
Boolean pass = (Boolean) vm0.invoke(() -> EventIDVerificationDUnitTest.verifyResult());
assertTrue(pass.booleanValue());
pass = (Boolean) vm1.invoke(() -> EventIDVerificationDUnitTest.verifyResult());
assertTrue(pass.booleanValue());
} | void function() { destroyRegion(); Boolean pass = (Boolean) vm0.invoke(() -> EventIDVerificationDUnitTest.verifyResult()); assertTrue(pass.booleanValue()); pass = (Boolean) vm1.invoke(() -> EventIDVerificationDUnitTest.verifyResult()); assertTrue(pass.booleanValue()); } | /**
* Verify that EventId is prapogated to server in case of region destroy. It also checks that peer
* nodes also get the same EventID.
*
*/ | Verify that EventId is prapogated to server in case of region destroy. It also checks that peer nodes also get the same EventID | testEventIDPrapogationOnServerDuringRegionDestroy | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/EventIDVerificationDUnitTest.java",
"license": "apache-2.0",
"size": 15972
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,697,794 |
void getUserFromServer(String userSelfLink, DataLoadListenerImpl dataLoadListener); | void getUserFromServer(String userSelfLink, DataLoadListenerImpl dataLoadListener); | /**
* Gets user from server.
*/ | Gets user from server | getUserFromServer | {
"repo_name": "yonadev/yona-app-android",
"path": "app/src/main/java/nu/yona/app/api/manager/AuthenticateManager.java",
"license": "mpl-2.0",
"size": 2853
} | [
"nu.yona.app.listener.DataLoadListenerImpl"
] | import nu.yona.app.listener.DataLoadListenerImpl; | import nu.yona.app.listener.*; | [
"nu.yona.app"
] | nu.yona.app; | 1,908,347 |
private void createPhoneNumberUI()
{
Label phoneNumberLabel = new Label(this, SWT.NONE);
phoneNumberLabel.setText(phoneNumberLabelStr);
GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false);
data.widthHint = getLabelWidthHint(phoneNumberLabel);
phoneNumberLabel.setLayoutData(data);
this.phoneNumberText = new Text(this, SWT.BORDER);
data = new GridData(SWT.FILL, SWT.FILL, true, false);
this.phoneNumberText.setLayoutData(data);
this.phoneNumberText.setTextLimit(40);
} | void function() { Label phoneNumberLabel = new Label(this, SWT.NONE); phoneNumberLabel.setText(phoneNumberLabelStr); GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false); data.widthHint = getLabelWidthHint(phoneNumberLabel); phoneNumberLabel.setLayoutData(data); this.phoneNumberText = new Text(this, SWT.BORDER); data = new GridData(SWT.FILL, SWT.FILL, true, false); this.phoneNumberText.setLayoutData(data); this.phoneNumberText.setTextLimit(40); } | /**
* Build the phone number part controls
*/ | Build the phone number part controls | createPhoneNumberUI | {
"repo_name": "DmitryADP/diff_qc750",
"path": "tools/motodev/src/plugins/emulator/src/com/motorola/studio/android/emulator/core/emulationui/SrcDestComposite.java",
"license": "gpl-2.0",
"size": 14637
} | [
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.widgets.Label",
"org.eclipse.swt.widgets.Text"
] | import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; | import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 1,607,828 |
List<RdfTriple> getInsertStateAndServiceAndValueInstances(); | List<RdfTriple> getInsertStateAndServiceAndValueInstances(); | /**
* Method returns instance information of ALL services and states.
*
* @return a list with rdf triples to insert the services and states.
*/ | Method returns instance information of ALL services and states | getInsertStateAndServiceAndValueInstances | {
"repo_name": "openbase/bco.ontology",
"path": "lib/src/main/java/org/openbase/bco/ontology/lib/manager/abox/configuration/OntInstanceMapping.java",
"license": "lgpl-3.0",
"size": 3959
} | [
"java.util.List",
"org.openbase.bco.ontology.lib.utility.sparql.RdfTriple"
] | import java.util.List; import org.openbase.bco.ontology.lib.utility.sparql.RdfTriple; | import java.util.*; import org.openbase.bco.ontology.lib.utility.sparql.*; | [
"java.util",
"org.openbase.bco"
] | java.util; org.openbase.bco; | 1,483,750 |
public void initiateTracking(final String allocationId) {
assert assertPrimaryMode();
replicationTracker.initiateTracking(allocationId);
}
/**
* Marks the shard with the provided allocation ID as in-sync with the primary shard. See
* {@link ReplicationTracker#markAllocationIdAsInSync(String, long)} | void function(final String allocationId) { assert assertPrimaryMode(); replicationTracker.initiateTracking(allocationId); } /** * Marks the shard with the provided allocation ID as in-sync with the primary shard. See * {@link ReplicationTracker#markAllocationIdAsInSync(String, long)} | /**
* Called when the recovery process for a shard has opened the engine on the target shard. Ensures that the right data structures
* have been set up locally to track local checkpoint information for the shard and that the shard is added to the replication group.
*
* @param allocationId the allocation ID of the shard for which recovery was initiated
*/ | Called when the recovery process for a shard has opened the engine on the target shard. Ensures that the right data structures have been set up locally to track local checkpoint information for the shard and that the shard is added to the replication group | initiateTracking | {
"repo_name": "scorpionvicky/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/index/shard/IndexShard.java",
"license": "apache-2.0",
"size": 175161
} | [
"org.elasticsearch.index.seqno.ReplicationTracker"
] | import org.elasticsearch.index.seqno.ReplicationTracker; | import org.elasticsearch.index.seqno.*; | [
"org.elasticsearch.index"
] | org.elasticsearch.index; | 720,813 |
public void draw() {
int state = game.getCurrentStateID();
boolean mousePressed =
(((state == Opsu.STATE_GAME || state == Opsu.STATE_GAMEPAUSEMENU) && Utils.isGameKeyPressed()) ||
((input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON) || input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON)) &&
!(state == Opsu.STATE_GAME && Options.isMouseDisabled())));
draw(input.getMouseX(), input.getMouseY(), mousePressed);
} | void function() { int state = game.getCurrentStateID(); boolean mousePressed = (((state == Opsu.STATE_GAME state == Opsu.STATE_GAMEPAUSEMENU) && Utils.isGameKeyPressed()) ((input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON) input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON)) && !(state == Opsu.STATE_GAME && Options.isMouseDisabled()))); draw(input.getMouseX(), input.getMouseY(), mousePressed); } | /**
* Draws the cursor.
*/ | Draws the cursor | draw | {
"repo_name": "kanekikun420/opsu",
"path": "src/itdelatrisu/opsu/ui/Cursor.java",
"license": "gpl-3.0",
"size": 8582
} | [
"org.newdawn.slick.Input"
] | import org.newdawn.slick.Input; | import org.newdawn.slick.*; | [
"org.newdawn.slick"
] | org.newdawn.slick; | 489,602 |
@Test
public void testSelectTracksWithNoSampleRendererWithNullOverride() throws ExoPlaybackException {
TrackSelection[] expectedTrackSelection = TRACK_SELECTIONS_WITH_NO_SAMPLE_RENDERER;
FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(expectedTrackSelection);
trackSelector.setSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP), null);
TrackSelectorResult result = trackSelector.selectTracks(
RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER, TRACK_GROUPS);
assertThat(result.selections.get(0)).isNull();
assertThat(result.selections.get(1)).isEqualTo(expectedTrackSelection[1]);
assertThat(result.selections.get(2)).isNull();
assertThat(new boolean[] {false, true, true}).isEqualTo(result.renderersEnabled);
assertThat(new RendererConfiguration[] {null, DEFAULT, DEFAULT})
.isEqualTo(result.rendererConfigurations);
} | void function() throws ExoPlaybackException { TrackSelection[] expectedTrackSelection = TRACK_SELECTIONS_WITH_NO_SAMPLE_RENDERER; FakeMappingTrackSelector trackSelector = new FakeMappingTrackSelector(expectedTrackSelection); trackSelector.setSelectionOverride(0, new TrackGroupArray(VIDEO_TRACK_GROUP), null); TrackSelectorResult result = trackSelector.selectTracks( RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER, TRACK_GROUPS); assertThat(result.selections.get(0)).isNull(); assertThat(result.selections.get(1)).isEqualTo(expectedTrackSelection[1]); assertThat(result.selections.get(2)).isNull(); assertThat(new boolean[] {false, true, true}).isEqualTo(result.renderersEnabled); assertThat(new RendererConfiguration[] {null, DEFAULT, DEFAULT}) .isEqualTo(result.rendererConfigurations); } | /**
* Tests that a null override clears a track selection when there is no-sample renderer.
*/ | Tests that a null override clears a track selection when there is no-sample renderer | testSelectTracksWithNoSampleRendererWithNullOverride | {
"repo_name": "kiall/ExoPlayer",
"path": "library/core/src/test/java/com/google/android/exoplayer2/trackselection/MappingTrackSelectorTest.java",
"license": "apache-2.0",
"size": 17126
} | [
"com.google.android.exoplayer2.ExoPlaybackException",
"com.google.android.exoplayer2.RendererConfiguration",
"com.google.android.exoplayer2.source.TrackGroupArray",
"com.google.common.truth.Truth"
] | import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.RendererConfiguration; import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.common.truth.Truth; | import com.google.android.exoplayer2.*; import com.google.android.exoplayer2.source.*; import com.google.common.truth.*; | [
"com.google.android",
"com.google.common"
] | com.google.android; com.google.common; | 1,809,181 |
public void loginToAdminConsole(String userName, String pwd)
throws MalformedURLException, XPathExpressionException {
getDriver().get(getBaseUrl() + ADMIN_CONSOLE_SUFFIX);
getDriver().findElement(By.id("txtUserName")).clear();
getDriver().findElement(By.id("txtUserName")).sendKeys(userName);
getDriver().findElement(By.id("txtPassword")).clear();
getDriver().findElement(By.id("txtPassword")).sendKeys(pwd);
getDriver().findElement(By.cssSelector("input.button")).click();
} | void function(String userName, String pwd) throws MalformedURLException, XPathExpressionException { getDriver().get(getBaseUrl() + ADMIN_CONSOLE_SUFFIX); getDriver().findElement(By.id(STR)).clear(); getDriver().findElement(By.id(STR)).sendKeys(userName); getDriver().findElement(By.id(STR)).clear(); getDriver().findElement(By.id(STR)).sendKeys(pwd); getDriver().findElement(By.cssSelector(STR)).click(); } | /**
* To login to admin console DashBoard server.
*
* @param userName user name
* @param pwd password
* @throws MalformedURLException
* @throws XPathExpressionException
*/ | To login to admin console DashBoard server | loginToAdminConsole | {
"repo_name": "wso2/product-ues",
"path": "modules/integration/tests-ui-integration/ui-test-utils/src/main/java/org/wso2/ds/ui/integration/util/DSUIIntegrationTest.java",
"license": "apache-2.0",
"size": 32053
} | [
"java.net.MalformedURLException",
"javax.xml.xpath.XPathExpressionException",
"org.openqa.selenium.By"
] | import java.net.MalformedURLException; import javax.xml.xpath.XPathExpressionException; import org.openqa.selenium.By; | import java.net.*; import javax.xml.xpath.*; import org.openqa.selenium.*; | [
"java.net",
"javax.xml",
"org.openqa.selenium"
] | java.net; javax.xml; org.openqa.selenium; | 2,295,669 |
@SuppressWarnings("unchecked")
public void done(final Resolve<T> resolve, final Reject reject) {
callActual(resolve, reject);
} | @SuppressWarnings(STR) void function(final Resolve<T> resolve, final Reject reject) { callActual(resolve, reject); } | /**
* Start route and process result and exception.
*
* @param resolve Result callback
* @param reject Exception callback
*/ | Start route and process result and exception | done | {
"repo_name": "TangXiaoLv/Android-Router",
"path": "androidrouter/src/main/java/com/tangxiaolv/router/operators/CPromise.java",
"license": "apache-2.0",
"size": 6489
} | [
"com.tangxiaolv.router.Reject",
"com.tangxiaolv.router.Resolve"
] | import com.tangxiaolv.router.Reject; import com.tangxiaolv.router.Resolve; | import com.tangxiaolv.router.*; | [
"com.tangxiaolv.router"
] | com.tangxiaolv.router; | 403,477 |
protected ParameterService getParameterService() {
if (this.parameterService == null) {
this.parameterService = KcServiceLocator.getService(ParameterService.class);
}
return this.parameterService;
} | ParameterService function() { if (this.parameterService == null) { this.parameterService = KcServiceLocator.getService(ParameterService.class); } return this.parameterService; } | /**
* Looks up and returns the ParameterService.
* @return the parameter service.
*/ | Looks up and returns the ParameterService | getParameterService | {
"repo_name": "mukadder/kc",
"path": "coeus-impl/src/main/java/org/kuali/kra/award/web/struts/action/AwardHomeAction.java",
"license": "agpl-3.0",
"size": 29497
} | [
"org.kuali.coeus.sys.framework.service.KcServiceLocator",
"org.kuali.rice.coreservice.framework.parameter.ParameterService"
] | import org.kuali.coeus.sys.framework.service.KcServiceLocator; import org.kuali.rice.coreservice.framework.parameter.ParameterService; | import org.kuali.coeus.sys.framework.service.*; import org.kuali.rice.coreservice.framework.parameter.*; | [
"org.kuali.coeus",
"org.kuali.rice"
] | org.kuali.coeus; org.kuali.rice; | 767,332 |
@RequestMapping(value = "/search", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<UserGroupResource>> getUserGroups(@RequestBody final UserGroupSearchCriteria userGroupSearchCriteria) throws BusinessException {
final List<UserGroup> userGroups = userGroupService.findUserGroupsBySearchCriteria(userGroupSearchCriteria);
List<UserGroupResource> userGroupResources = new ArrayList<UserGroupResource>();
if (userGroupResources != null) {
userGroupResources = new UserGroupResourceAssembler().toResources(userGroups);
}
return new ResponseEntity<List<UserGroupResource>>(userGroupResources,
HttpStatus.OK);
}
| @RequestMapping(value = STR, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<List<UserGroupResource>> function(@RequestBody final UserGroupSearchCriteria userGroupSearchCriteria) throws BusinessException { final List<UserGroup> userGroups = userGroupService.findUserGroupsBySearchCriteria(userGroupSearchCriteria); List<UserGroupResource> userGroupResources = new ArrayList<UserGroupResource>(); if (userGroupResources != null) { userGroupResources = new UserGroupResourceAssembler().toResources(userGroups); } return new ResponseEntity<List<UserGroupResource>>(userGroupResources, HttpStatus.OK); } | /**
* Retrieve Financial year by Id.
*
* @param id
* id of Financial year to be retrieved.
* @return
*/ | Retrieve Financial year by Id | getUserGroups | {
"repo_name": "karreypradeep/BlueSpaceTechEmailApp",
"path": "EmailApp/src/main/java/com/bluespacetech/security/controller/UserGroupController.java",
"license": "apache-2.0",
"size": 6595
} | [
"com.bluespacetech.core.exceptions.BusinessException",
"com.bluespacetech.security.model.UserGroup",
"com.bluespacetech.security.resources.UserGroupResource",
"com.bluespacetech.security.resources.assembler.UserGroupResourceAssembler",
"com.bluespacetech.security.searchcriterias.UserGroupSearchCriteria",
... | import com.bluespacetech.core.exceptions.BusinessException; import com.bluespacetech.security.model.UserGroup; import com.bluespacetech.security.resources.UserGroupResource; import com.bluespacetech.security.resources.assembler.UserGroupResourceAssembler; import com.bluespacetech.security.searchcriterias.UserGroupSearchCriteria; import java.util.ArrayList; import java.util.List; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; | import com.bluespacetech.core.exceptions.*; import com.bluespacetech.security.model.*; import com.bluespacetech.security.resources.*; import com.bluespacetech.security.resources.assembler.*; import com.bluespacetech.security.searchcriterias.*; import java.util.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*; | [
"com.bluespacetech.core",
"com.bluespacetech.security",
"java.util",
"org.springframework.http",
"org.springframework.web"
] | com.bluespacetech.core; com.bluespacetech.security; java.util; org.springframework.http; org.springframework.web; | 928,513 |
@Override
public String[] keys() throws IOException {
ResultSet rst = null;
String keys[] = null;
synchronized (this) {
int numberOfTries = 2;
while (numberOfTries > 0) {
Connection _conn = getConnection();
if (_conn == null) {
return (new String[0]);
}
try {
if (preparedKeysSql == null) {
String keysSql = "SELECT " + sessionIdCol + " FROM "
+ sessionTable + " WHERE " + sessionAppCol
+ " = ?";
preparedKeysSql = _conn.prepareStatement(keysSql);
}
preparedKeysSql.setString(1, getName());
rst = preparedKeysSql.executeQuery();
ArrayList<String> tmpkeys = new ArrayList<String>();
if (rst != null) {
while (rst.next()) {
tmpkeys.add(rst.getString(1));
}
}
keys = tmpkeys.toArray(new String[tmpkeys.size()]);
// Break out after the finally block
numberOfTries = 0;
} catch (SQLException e) {
manager.getContainer().getLogger().error(sm.getString(getStoreName() + ".SQLException", e));
keys = new String[0];
// Close the connection so that it gets reopened next time
if (dbConnection != null)
close(dbConnection);
} finally {
try {
if (rst != null) {
rst.close();
}
} catch (SQLException e) {
// Ignore
}
release(_conn);
}
numberOfTries--;
}
}
return (keys);
}
| String[] function() throws IOException { ResultSet rst = null; String keys[] = null; synchronized (this) { int numberOfTries = 2; while (numberOfTries > 0) { Connection _conn = getConnection(); if (_conn == null) { return (new String[0]); } try { if (preparedKeysSql == null) { String keysSql = STR + sessionIdCol + STR + sessionTable + STR + sessionAppCol + STR; preparedKeysSql = _conn.prepareStatement(keysSql); } preparedKeysSql.setString(1, getName()); rst = preparedKeysSql.executeQuery(); ArrayList<String> tmpkeys = new ArrayList<String>(); if (rst != null) { while (rst.next()) { tmpkeys.add(rst.getString(1)); } } keys = tmpkeys.toArray(new String[tmpkeys.size()]); numberOfTries = 0; } catch (SQLException e) { manager.getContainer().getLogger().error(sm.getString(getStoreName() + STR, e)); keys = new String[0]; if (dbConnection != null) close(dbConnection); } finally { try { if (rst != null) { rst.close(); } } catch (SQLException e) { } release(_conn); } numberOfTries--; } } return (keys); } | /**
* Return an array containing the session identifiers of all Sessions
* currently saved in this Store. If there are no such Sessions, a
* zero-length array is returned.
*
* @exception IOException if an input/output error occurred
*/ | Return an array containing the session identifiers of all Sessions currently saved in this Store. If there are no such Sessions, a zero-length array is returned | keys | {
"repo_name": "pistolove/sourcecode4junit",
"path": "Source4Tomcat/src/org/apache/catalina/session/JDBCStore.java",
"license": "apache-2.0",
"size": 36727
} | [
"java.io.IOException",
"java.sql.Connection",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.util.ArrayList"
] | import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; | import java.io.*; import java.sql.*; import java.util.*; | [
"java.io",
"java.sql",
"java.util"
] | java.io; java.sql; java.util; | 1,801,729 |
private boolean isDefaultProperty(String name, Properties properties) {
return (properties.get(name) == null);
} | boolean function(String name, Properties properties) { return (properties.get(name) == null); } | /**
* Checks if a given output property is default (2nd layer only)
*/ | Checks if a given output property is default (2nd layer only) | isDefaultProperty | {
"repo_name": "JetBrains/jdk8u_jaxp",
"path": "src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java",
"license": "gpl-2.0",
"size": 53558
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 151,497 |
public static Range findDefaultRange( Context context )
{
if ( mDefaultName == null )
listRanges( context );
return findRange( context, mDefaultName );
}
| static Range function( Context context ) { if ( mDefaultName == null ) listRanges( context ); return findRange( context, mDefaultName ); } | /**
* Answers the Range object set as the default one in the
* ranges XML source file.
*
* @param context Context used to find the XML file
* @return
*/ | Answers the Range object set as the default one in the ranges XML source file | findDefaultRange | {
"repo_name": "derekfountain/android-depth-of-field-gpl",
"path": "src/org/derekfountain/dofc/m/Range.java",
"license": "gpl-3.0",
"size": 5192
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 2,094,821 |
public boolean isTypeVariable() {
return type instanceof TypeVariable<?>;
} | boolean function() { return type instanceof TypeVariable<?>; } | /**
* True if this is a type variable
*
* @return
*/ | True if this is a type variable | isTypeVariable | {
"repo_name": "sefaakca/EvoSuite-Sefa",
"path": "client/src/main/java/org/evosuite/utils/generic/GenericClass.java",
"license": "lgpl-3.0",
"size": 54610
} | [
"java.lang.reflect.TypeVariable"
] | import java.lang.reflect.TypeVariable; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,776,281 |
List<FieldValueGetter> generateGetters(Class clazz); | List<FieldValueGetter> generateGetters(Class clazz); | /**
* Generates getters for {@code clazz}.
*/ | Generates getters for clazz | generateGetters | {
"repo_name": "tgroh/incubator-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/values/reflect/GetterFactory.java",
"license": "apache-2.0",
"size": 1200
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,593,864 |
@Generated
@CVariable()
@MappedReturn(ObjCStringMapper.class)
public static native String NSPersonNameComponentDelimiter(); | @CVariable() @MappedReturn(ObjCStringMapper.class) static native String function(); | /**
* The delimiter is the character or characters used to separate name components.
* For CJK languages there is no delimiter.
*/ | The delimiter is the character or characters used to separate name components. For CJK languages there is no delimiter | NSPersonNameComponentDelimiter | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/foundation/c/Foundation.java",
"license": "apache-2.0",
"size": 156135
} | [
"org.moe.natj.c.ann.CVariable",
"org.moe.natj.general.ann.MappedReturn",
"org.moe.natj.objc.map.ObjCStringMapper"
] | import org.moe.natj.c.ann.CVariable; import org.moe.natj.general.ann.MappedReturn; import org.moe.natj.objc.map.ObjCStringMapper; | import org.moe.natj.c.ann.*; import org.moe.natj.general.ann.*; import org.moe.natj.objc.map.*; | [
"org.moe.natj"
] | org.moe.natj; | 2,657,939 |
@Override
public List<TClusterNodeBean> loadByIP(String ip) {
Criteria crit = new Criteria();
crit.add(NODEADDRESS, ip);
try {
return convertTorqueListToBeanList(doSelect(crit));
} catch(Exception e) {
LOGGER.error("Loading node by ip " + ip + " failed with " + e.getMessage());
return null;
}
}
| List<TClusterNodeBean> function(String ip) { Criteria crit = new Criteria(); crit.add(NODEADDRESS, ip); try { return convertTorqueListToBeanList(doSelect(crit)); } catch(Exception e) { LOGGER.error(STR + ip + STR + e.getMessage()); return null; } } | /**
* Loads all entity changes for a cluster node
* @return
*/ | Loads all entity changes for a cluster node | loadByIP | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/TClusterNodePeer.java",
"license": "gpl-3.0",
"size": 13325
} | [
"com.aurel.track.beans.TClusterNodeBean",
"java.util.List",
"org.apache.torque.util.Criteria"
] | import com.aurel.track.beans.TClusterNodeBean; import java.util.List; import org.apache.torque.util.Criteria; | import com.aurel.track.beans.*; import java.util.*; import org.apache.torque.util.*; | [
"com.aurel.track",
"java.util",
"org.apache.torque"
] | com.aurel.track; java.util; org.apache.torque; | 1,782,927 |
public void addRow(ResultSetRow row) throws SQLException {
notSupported();
} | void function(ResultSetRow row) throws SQLException { notSupported(); } | /**
* Adds a row to this row data.
*
* @param row
* the row to add
* @throws SQLException
* if a database error occurs
*/ | Adds a row to this row data | addRow | {
"repo_name": "yyuu/libmysql-java",
"path": "src/com/mysql/jdbc/RowDataCursor.java",
"license": "gpl-2.0",
"size": 11889
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 886,774 |
public @Nullable UUID lookupUuid(String username) {
Set<UUID> uuids = this.lookupMap.lookupUuid(username);
return Iterables.getFirst(uuids, null);
} | @Nullable UUID function(String username) { Set<UUID> uuids = this.lookupMap.lookupUuid(username); return Iterables.getFirst(uuids, null); } | /**
* Gets the most recent uuid which connected with the given username, or null
*
* @param username the username to lookup with
* @return a uuid, or null
*/ | Gets the most recent uuid which connected with the given username, or null | lookupUuid | {
"repo_name": "lucko/LuckPerms",
"path": "common/src/main/java/me/lucko/luckperms/common/storage/implementation/file/FileUuidCache.java",
"license": "mit",
"size": 7924
} | [
"com.google.common.collect.Iterables",
"java.util.Set",
"org.checkerframework.checker.nullness.qual.Nullable"
] | import com.google.common.collect.Iterables; import java.util.Set; import org.checkerframework.checker.nullness.qual.Nullable; | import com.google.common.collect.*; import java.util.*; import org.checkerframework.checker.nullness.qual.*; | [
"com.google.common",
"java.util",
"org.checkerframework.checker"
] | com.google.common; java.util; org.checkerframework.checker; | 2,431,660 |
@SimpleFunction(description = "This searches Twitter for the given String query."
+ "<p><u>Requirements</u>: This should only be called after the "
+ "<code>IsAuthorized</code> event has been raised, indicating that the "
+ "user has successfully logged in to Twitter.</p>")
public void SearchTwitter(final String query) {
if (twitter == null || userName.length() == 0) {
form.dispatchErrorOccurredEvent(this, "SearchTwitter",
ErrorMessages.ERROR_TWITTER_SEARCH_FAILED, "Need to login?");
return;
}
AsynchUtil.runAsynchronously(new Runnable() {
List<Status> tweets = Collections.emptyList(); | @SimpleFunction(description = STR + STR + STR + STR) void function(final String query) { if (twitter == null userName.length() == 0) { form.dispatchErrorOccurredEvent(this, STR, ErrorMessages.ERROR_TWITTER_SEARCH_FAILED, STR); return; } AsynchUtil.runAsynchronously(new Runnable() { List<Status> tweets = Collections.emptyList(); | /**
* Search for tweets or labels
*/ | Search for tweets or labels | SearchTwitter | {
"repo_name": "anseo/friedgerAI24BLE",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/Twitter.java",
"license": "mit",
"size": 38565
} | [
"com.google.appinventor.components.annotations.SimpleFunction",
"com.google.appinventor.components.runtime.util.AsynchUtil",
"com.google.appinventor.components.runtime.util.ErrorMessages",
"java.util.Collections",
"java.util.List"
] | import com.google.appinventor.components.annotations.SimpleFunction; import com.google.appinventor.components.runtime.util.AsynchUtil; import com.google.appinventor.components.runtime.util.ErrorMessages; import java.util.Collections; import java.util.List; | import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.runtime.util.*; import java.util.*; | [
"com.google.appinventor",
"java.util"
] | com.google.appinventor; java.util; | 1,364,008 |
public static L0ModificationInstruction modL0Lambda(Lambda lambda) {
checkNotNull(lambda, "L0 OCh signal cannot be null");
if (lambda instanceof IndexedLambda) {
return new ModLambdaInstruction(L0SubType.LAMBDA, (short) ((IndexedLambda) lambda).index());
} else if (lambda instanceof OchSignal) {
return new ModOchSignalInstruction((OchSignal) lambda);
} else {
throw new UnsupportedOperationException(String.format("Unsupported type: %s", lambda));
}
} | static L0ModificationInstruction function(Lambda lambda) { checkNotNull(lambda, STR); if (lambda instanceof IndexedLambda) { return new ModLambdaInstruction(L0SubType.LAMBDA, (short) ((IndexedLambda) lambda).index()); } else if (lambda instanceof OchSignal) { return new ModOchSignalInstruction((OchSignal) lambda); } else { throw new UnsupportedOperationException(String.format(STR, lambda)); } } | /**
* Creates an L0 modification with the specified OCh signal.
*
* @param lambda OCh signal
* @return an L0 modification
*/ | Creates an L0 modification with the specified OCh signal | modL0Lambda | {
"repo_name": "CNlukai/onos-gerrit-test",
"path": "core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java",
"license": "apache-2.0",
"size": 17125
} | [
"com.google.common.base.Preconditions",
"org.onosproject.net.IndexedLambda",
"org.onosproject.net.Lambda",
"org.onosproject.net.OchSignal",
"org.onosproject.net.flow.instructions.L0ModificationInstruction"
] | import com.google.common.base.Preconditions; import org.onosproject.net.IndexedLambda; import org.onosproject.net.Lambda; import org.onosproject.net.OchSignal; import org.onosproject.net.flow.instructions.L0ModificationInstruction; | import com.google.common.base.*; import org.onosproject.net.*; import org.onosproject.net.flow.instructions.*; | [
"com.google.common",
"org.onosproject.net"
] | com.google.common; org.onosproject.net; | 595,421 |
public Action chooseAction(Map<Direction, Occupant> neighbors) {
List<Direction> empties = getNeighborsOfType(neighbors, "empty");
if (empties.size() == 1) {
Direction moveDir = empties.get(0);
return new Action(Action.ActionType.MOVE, moveDir);
}
if (empties.size() > 1) {
if (HugLifeUtils.random() < moveProbability) {
Direction moveDir = HugLifeUtils.randomEntry(empties);
return new Action(Action.ActionType.MOVE, moveDir);
}
}
return new Action(Action.ActionType.STAY);
} | Action function(Map<Direction, Occupant> neighbors) { List<Direction> empties = getNeighborsOfType(neighbors, "empty"); if (empties.size() == 1) { Direction moveDir = empties.get(0); return new Action(Action.ActionType.MOVE, moveDir); } if (empties.size() > 1) { if (HugLifeUtils.random() < moveProbability) { Direction moveDir = HugLifeUtils.randomEntry(empties); return new Action(Action.ActionType.MOVE, moveDir); } } return new Action(Action.ActionType.STAY); } | /** Sample Creatures take actions according to the following rules about
* NEIGHBORS:
* 1. If surrounded on three sides, move into the empty space.
* 2. Otherwise, if there are any empty spaces, move into one of them with
* probabiltiy given by moveProbability.
* 3. Otherwise, stay.
*
* Returns the action selected.
*/ | Sample Creatures take actions according to the following rules about 1. If surrounded on three sides, move into the empty space. 2. Otherwise, if there are any empty spaces, move into one of them with probabiltiy given by moveProbability. 3. Otherwise, stay. Returns the action selected | chooseAction | {
"repo_name": "hardfist/CS61b",
"path": "lab9/huglifeSavable/huglife/SampleCreature.java",
"license": "mit",
"size": 4264
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,863,633 |
Observable<ServiceResponse<Void>> postOptionalArrayHeaderWithServiceResponseAsync(List<String> headerParameter); | Observable<ServiceResponse<Void>> postOptionalArrayHeaderWithServiceResponseAsync(List<String> headerParameter); | /**
* Test explicitly optional integer. Please put a header 'headerParameter' => null.
*
* @param headerParameter the List<String> value
* @return the {@link ServiceResponse} object if successful.
*/ | Test explicitly optional integer. Please put a header 'headerParameter' => null | postOptionalArrayHeaderWithServiceResponseAsync | {
"repo_name": "anudeepsharma/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/requiredoptional/Explicits.java",
"license": "mit",
"size": 43451
} | [
"com.microsoft.rest.ServiceResponse",
"java.util.List"
] | import com.microsoft.rest.ServiceResponse; import java.util.List; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 775,741 |
private TypeFlow lookupFlow(ValueNode node) {
ValueNode unproxiedNode = GraphUtil.unproxify(node);
TypeFlow result = typeFlows.get(unproxiedNode);
if (result == null) {
throw error("Node is not supported yet by static analysis: " + node.getClass().getName());
}
return result;
} | TypeFlow function(ValueNode node) { ValueNode unproxiedNode = GraphUtil.unproxify(node); TypeFlow result = typeFlows.get(unproxiedNode); if (result == null) { throw error(STR + node.getClass().getName()); } return result; } | /**
* Lookup the type flow node for a Graal node.
*/ | Lookup the type flow node for a Graal node | lookupFlow | {
"repo_name": "graalvm/graal-core",
"path": "graal/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/StaticAnalysis.java",
"license": "gpl-2.0",
"size": 26206
} | [
"org.graalvm.compiler.nodes.ValueNode",
"org.graalvm.compiler.nodes.util.GraphUtil"
] | import org.graalvm.compiler.nodes.ValueNode; import org.graalvm.compiler.nodes.util.GraphUtil; | import org.graalvm.compiler.nodes.*; import org.graalvm.compiler.nodes.util.*; | [
"org.graalvm.compiler"
] | org.graalvm.compiler; | 1,240,320 |
public boolean unregisterServices(NodeConfig nodeConfig) {
LOG.info("Removing service xml configuration file",
Constant.Component.Name.HADOOP, nodeConfig.getHost());
return com.impetus.ankush2.agent.AgentUtils.removeServiceXml(
nodeConfig.getConnection(), Constant.Component.Name.HADOOP);
} | boolean function(NodeConfig nodeConfig) { LOG.info(STR, Constant.Component.Name.HADOOP, nodeConfig.getHost()); return com.impetus.ankush2.agent.AgentUtils.removeServiceXml( nodeConfig.getConnection(), Constant.Component.Name.HADOOP); } | /**
* Unregister services.
*
* @param nodeConfig
* the node config
* @return true, if successful
*/ | Unregister services | unregisterServices | {
"repo_name": "zengzhaozheng/ankush",
"path": "ankush/src/main/java/com/impetus/ankush2/hadoop/deployer/servicemanager/HadoopServiceManager.java",
"license": "lgpl-3.0",
"size": 16372
} | [
"com.impetus.ankush2.agent.AgentUtils",
"com.impetus.ankush2.constant.Constant",
"com.impetus.ankush2.framework.config.NodeConfig"
] | import com.impetus.ankush2.agent.AgentUtils; import com.impetus.ankush2.constant.Constant; import com.impetus.ankush2.framework.config.NodeConfig; | import com.impetus.ankush2.agent.*; import com.impetus.ankush2.constant.*; import com.impetus.ankush2.framework.config.*; | [
"com.impetus.ankush2"
] | com.impetus.ankush2; | 1,570,366 |
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
SyncPoller<PollResult<Void>, Void> beginSuspend(
String resourceGroupName, String cacheName, String storageTargetName); | @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<Void>, Void> beginSuspend( String resourceGroupName, String cacheName, String storageTargetName); | /**
* Suspends client access to a storage target.
*
* @param resourceGroupName Target resource group.
* @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from the
* [-0-9a-zA-Z_] char class.
* @param storageTargetName Name of Storage Target.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/ | Suspends client access to a storage target | beginSuspend | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/storagecache/azure-resourcemanager-storagecache/src/main/java/com/azure/resourcemanager/storagecache/fluent/StorageTargetOperationsClient.java",
"license": "mit",
"size": 11541
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.polling.SyncPoller"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; | import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; | [
"com.azure.core"
] | com.azure.core; | 730,801 |
protected void configureProperties(final List<ScanCommandProperty> properties)
{
properties.add(
new ScanCommandProperty("error_handler", "Error Handler", String.class));
} | void function(final List<ScanCommandProperty> properties) { properties.add( new ScanCommandProperty(STR, STR, String.class)); } | /** Declare properties of this command
*
* <p>Derived classes should add their properties and
* call the base implementation to declare inherited properties.
*
* @param properties List to which to add properties
*/ | Declare properties of this command Derived classes should add their properties and call the base implementation to declare inherited properties | configureProperties | {
"repo_name": "ControlSystemStudio/cs-studio",
"path": "applications/scan/scan-plugins/org.csstudio.scan/src/org/csstudio/scan/command/ScanCommand.java",
"license": "epl-1.0",
"size": 14255
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,563,039 |
public String getOfficial()
{
final String ret;
if (docTypeName == null) {
ret = DBProperties.getProperty(AccountFundsToBeSettledReport.class.getName() + ".NotWithDocument");
} else {
ret = DBProperties.getProperty(AccountFundsToBeSettledReport.class.getName() + ".WithDocument");
}
return ret;
} | String function() { final String ret; if (docTypeName == null) { ret = DBProperties.getProperty(AccountFundsToBeSettledReport.class.getName() + STR); } else { ret = DBProperties.getProperty(AccountFundsToBeSettledReport.class.getName() + STR); } return ret; } | /**
* Gets the official.
*
* @return the official
*/ | Gets the official | getOfficial | {
"repo_name": "eFaps/eFapsApp-Sales",
"path": "src/main/efaps/ESJP/org/efaps/esjp/sales/report/AccountFundsToBeSettledReport_Base.java",
"license": "apache-2.0",
"size": 38204
} | [
"org.efaps.admin.dbproperty.DBProperties"
] | import org.efaps.admin.dbproperty.DBProperties; | import org.efaps.admin.dbproperty.*; | [
"org.efaps.admin"
] | org.efaps.admin; | 2,499,497 |
public Set<PacketType> getClientPackets() {
return Collections.unmodifiableSet(register.clientPackets);
}
| Set<PacketType> function() { return Collections.unmodifiableSet(register.clientPackets); } | /**
* Retrieve every known client packet, from every protocol.
* @return Every client packet.
*/ | Retrieve every known client packet, from every protocol | getClientPackets | {
"repo_name": "ewized/ProtocolLib",
"path": "ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/NettyProtocolRegistry.java",
"license": "gpl-2.0",
"size": 7760
} | [
"com.comphenix.protocol.PacketType",
"java.util.Collections",
"java.util.Set"
] | import com.comphenix.protocol.PacketType; import java.util.Collections; import java.util.Set; | import com.comphenix.protocol.*; import java.util.*; | [
"com.comphenix.protocol",
"java.util"
] | com.comphenix.protocol; java.util; | 2,012,119 |
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component renderer = getDrawComponent(value);
if (table.isCellEditable(row, column)) {
// If the cell is editable, returns a comboBox
combo.removeAllItems();
if (value != null) {
combo.addItem(renderer);
combo.setSelectedItem(value);
}
if (!isSelected) {
combo.setBackground(table.getBackground());
combo.setForeground(table.getForeground());
} else {
combo.setBackground(table.getSelectionBackground());
combo.setForeground(table.getSelectionForeground());
}
return combo;
} else {
// Otherwise returns the label only.
if (!isSelected) {
renderer.setBackground(table.getBackground());
renderer.setForeground(table.getForeground());
} else {
renderer.setBackground(table.getSelectionBackground());
renderer.setForeground(table.getSelectionForeground());
}
return renderer;
}
}
}
protected class ImagedComboEditor extends DefaultCellEditor {
private static final long serialVersionUID = 1L;
protected JComboBox combo;
public ImagedComboEditor() {
super(new JComboBox());
combo = (JComboBox) super.getComponent();
combo.setRenderer(new ComboImageRenderer());
} | Component function(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component renderer = getDrawComponent(value); if (table.isCellEditable(row, column)) { combo.removeAllItems(); if (value != null) { combo.addItem(renderer); combo.setSelectedItem(value); } if (!isSelected) { combo.setBackground(table.getBackground()); combo.setForeground(table.getForeground()); } else { combo.setBackground(table.getSelectionBackground()); combo.setForeground(table.getSelectionForeground()); } return combo; } else { if (!isSelected) { renderer.setBackground(table.getBackground()); renderer.setForeground(table.getForeground()); } else { renderer.setBackground(table.getSelectionBackground()); renderer.setForeground(table.getSelectionForeground()); } return renderer; } } } protected class ImagedComboEditor extends DefaultCellEditor { private static final long serialVersionUID = 1L; protected JComboBox combo; public ImagedComboEditor() { super(new JComboBox()); combo = (JComboBox) super.getComponent(); combo.setRenderer(new ComboImageRenderer()); } | /**
* Returns the component used for drawing the cell. This method is
* used to configure the renderer appropriately before drawing.
*
* @param table the <code>JTable</code> that is asking the
* renderer to draw; can be <code>null</code>
* @param value the value of the cell to be rendered. It is
* up to the specific renderer to interpret
* and draw the value. For example, if
* <code>value</code>
* is the string "true", it could be rendered as a
* string or it could be rendered as a check
* box that is checked. <code>null</code> is a
* valid value
* @param isSelected true if the cell is to be rendered with the
* selection highlighted; otherwise false
* @param hasFocus if true, render cell appropriately. For
* example, put a special border on the cell, if
* the cell can be edited, render in the color used
* to indicate editing
* @param row the row index of the cell being drawn. When
* drawing the header, the value of
* <code>row</code> is -1
* @param column the column index of the cell being drawn
*/ | Returns the component used for drawing the cell. This method is used to configure the renderer appropriately before drawing | getTableCellRendererComponent | {
"repo_name": "HOMlab/QN-ACTR-Release",
"path": "QN-ACTR Java/src/jmt/gui/common/editors/ImagedComboBoxCellEditorFactory.java",
"license": "lgpl-3.0",
"size": 14784
} | [
"java.awt.Component",
"javax.swing.DefaultCellEditor",
"javax.swing.JComboBox",
"javax.swing.JTable"
] | import java.awt.Component; import javax.swing.DefaultCellEditor; import javax.swing.JComboBox; import javax.swing.JTable; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,008,980 |
public void addTargetFields(Set<String> targetFields) {
for (String tf : targetFields)
{
this.targetFields.add(tf);
}
} | void function(Set<String> targetFields) { for (String tf : targetFields) { this.targetFields.add(tf); } } | /**
* Set target fields
*
* @param targetFields
*/ | Set target fields | addTargetFields | {
"repo_name": "jamie-dryad/dryad-repo",
"path": "dspace-api/src/main/java/org/dspace/app/itemupdate/UpdateMetadataAction.java",
"license": "bsd-3-clause",
"size": 1513
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 369,305 |
public List<Expression> getArguments() {
return arguments;
} | List<Expression> function() { return arguments; } | /**
* Gets arguments of this function call
*
* @return list of expressions representing arguments of function call
*/ | Gets arguments of this function call | getArguments | {
"repo_name": "turn/camino",
"path": "src/main/java/com/turn/camino/lang/ast/FunctionCall.java",
"license": "apache-2.0",
"size": 1946
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,468,632 |
public static Uint8ClampedArray create(JsArrayInteger array) {
if (!isSupported()) {
return null;
}
return createImpl(array);
}
| static Uint8ClampedArray function(JsArrayInteger array) { if (!isSupported()) { return null; } return createImpl(array); } | /**
* Creates a new instance of the {@link Uint8ClampedArray} of the length of the given array in
* values. The values contained in the given array are set to the newly created
* {@link Uint8ClampedArray}.
*
* @param array the array to get the values from
* @return the created {@link Uint8ClampedArray} or null if it isn't supported by the browser.
*/ | Creates a new instance of the <code>Uint8ClampedArray</code> of the length of the given array in values. The values contained in the given array are set to the newly created <code>Uint8ClampedArray</code> | create | {
"repo_name": "syntelos/gwtcc-gwtgl",
"path": "src/com/google/gwt/typedarrays/client/Uint8ClampedArray.java",
"license": "apache-2.0",
"size": 12627
} | [
"com.google.gwt.core.client.JsArrayInteger"
] | import com.google.gwt.core.client.JsArrayInteger; | import com.google.gwt.core.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 367,963 |
public static boolean validateHITSPMedicationsSectionMedication(MedicationsSection medicationsSection, DiagnosticChain diagnostics, Map<Object, Object> context) {
if (VALIDATE_HITSP_MEDICATIONS_SECTION_MEDICATION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) {
OCL.Helper helper = EOCL_ENV.createOCLHelper();
helper.setContext(HITSPPackage.Literals.MEDICATIONS_SECTION);
try {
VALIDATE_HITSP_MEDICATIONS_SECTION_MEDICATION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_HITSP_MEDICATIONS_SECTION_MEDICATION__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP);
}
catch (ParserException pe) {
throw new UnsupportedOperationException(pe.getLocalizedMessage());
}
}
if (!EOCL_ENV.createQuery(VALIDATE_HITSP_MEDICATIONS_SECTION_MEDICATION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(medicationsSection)) {
if (diagnostics != null) {
diagnostics.add
(new BasicDiagnostic
(Diagnostic.ERROR,
HITSPValidator.DIAGNOSTIC_SOURCE,
HITSPValidator.MEDICATIONS_SECTION__HITSP_MEDICATIONS_SECTION_MEDICATION,
HITSPPlugin.INSTANCE.getString("HITSPMedicationsSectionMedication"),
new Object [] { medicationsSection }));
}
return false;
}
return true;
}
protected static final String GET_HITSP_MEDICATIONS__EOCL_EXP = "self.getSubstanceAdministrations()->select(substanceAdministration : cda::SubstanceAdministration | not substanceAdministration.oclIsUndefined() and substanceAdministration.oclIsKindOf(hitsp::Medication)).oclAsType(hitsp::Medication)";
protected static OCLExpression<EClassifier> GET_HITSP_MEDICATIONS__EOCL_QRY;
| static boolean function(MedicationsSection medicationsSection, DiagnosticChain diagnostics, Map<Object, Object> context) { if (VALIDATE_HITSP_MEDICATIONS_SECTION_MEDICATION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { OCL.Helper helper = EOCL_ENV.createOCLHelper(); helper.setContext(HITSPPackage.Literals.MEDICATIONS_SECTION); try { VALIDATE_HITSP_MEDICATIONS_SECTION_MEDICATION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(VALIDATE_HITSP_MEDICATIONS_SECTION_MEDICATION__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); } catch (ParserException pe) { throw new UnsupportedOperationException(pe.getLocalizedMessage()); } } if (!EOCL_ENV.createQuery(VALIDATE_HITSP_MEDICATIONS_SECTION_MEDICATION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(medicationsSection)) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, HITSPValidator.DIAGNOSTIC_SOURCE, HITSPValidator.MEDICATIONS_SECTION__HITSP_MEDICATIONS_SECTION_MEDICATION, HITSPPlugin.INSTANCE.getString(STR), new Object [] { medicationsSection })); } return false; } return true; } protected static final String GET_HITSP_MEDICATIONS__EOCL_EXP = STR; protected static OCLExpression<EClassifier> GET_HITSP_MEDICATIONS__EOCL_QRY; | /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* self.entry->exists(entry : cda::Entry | not entry.substanceAdministration.oclIsUndefined() and entry.substanceAdministration.oclIsKindOf(hitsp::Medication))
* @param medicationsSection The receiving '<em><b>Medications Section</b></em>' model object.
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @generated
*/ | self.entry->exists(entry : cda::Entry | not entry.substanceAdministration.oclIsUndefined() and entry.substanceAdministration.oclIsKindOf(hitsp::Medication)) | validateHITSPMedicationsSectionMedication | {
"repo_name": "drbgfc/mdht",
"path": "cda/deprecated/org.openhealthtools.mdht.uml.cda.hitsp/src/org/openhealthtools/mdht/uml/cda/hitsp/operations/MedicationsSectionOperations.java",
"license": "epl-1.0",
"size": 10589
} | [
"java.util.Map",
"org.eclipse.emf.common.util.BasicDiagnostic",
"org.eclipse.emf.common.util.Diagnostic",
"org.eclipse.emf.common.util.DiagnosticChain",
"org.eclipse.emf.ecore.EClassifier",
"org.eclipse.ocl.ParserException",
"org.eclipse.ocl.expressions.OCLExpression",
"org.openhealthtools.mdht.uml.cd... | import java.util.Map; import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.DiagnosticChain; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.ocl.ParserException; import org.eclipse.ocl.expressions.OCLExpression; import org.openhealthtools.mdht.uml.cda.hitsp.HITSPPackage; import org.openhealthtools.mdht.uml.cda.hitsp.HITSPPlugin; import org.openhealthtools.mdht.uml.cda.hitsp.MedicationsSection; import org.openhealthtools.mdht.uml.cda.hitsp.util.HITSPValidator; | import java.util.*; import org.eclipse.emf.common.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.ocl.*; import org.eclipse.ocl.expressions.*; import org.openhealthtools.mdht.uml.cda.hitsp.*; import org.openhealthtools.mdht.uml.cda.hitsp.util.*; | [
"java.util",
"org.eclipse.emf",
"org.eclipse.ocl",
"org.openhealthtools.mdht"
] | java.util; org.eclipse.emf; org.eclipse.ocl; org.openhealthtools.mdht; | 1,319,401 |
public int calcSampleSize(View parent, int srcWidth, int srcHeight, TiDimension destWidthDimension, TiDimension destHeightDimension)
{
int destWidth, destHeight;
destWidth = destHeight = TiDrawableReference.UNKNOWN;
Bounds destBounds = calcDestSize(srcWidth, srcHeight, destWidthDimension, destHeightDimension, parent);
destWidth = destBounds.width;
destHeight = destBounds.height;
return calcSampleSize(srcWidth, srcHeight, destWidth, destHeight);
} | int function(View parent, int srcWidth, int srcHeight, TiDimension destWidthDimension, TiDimension destHeightDimension) { int destWidth, destHeight; destWidth = destHeight = TiDrawableReference.UNKNOWN; Bounds destBounds = calcDestSize(srcWidth, srcHeight, destWidthDimension, destHeightDimension, parent); destWidth = destBounds.width; destHeight = destBounds.height; return calcSampleSize(srcWidth, srcHeight, destWidth, destHeight); } | /**
* Calculates a value for the BitmapFactory.Options .inSampleSize property.
*
* @see <a href="http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html#inSampleSize">BitmapFactory.Options.inSampleSize</a>
* @param srcWidth int
* @param srcHeight int
* @param destWidthDimension TiDimension holding the destination width. If null, the TiContext's Activity's Window's decor width is used
* as the destWidth.
* @param destHeightDimension TiDimension holding the destination height. If null, the destHeight will be proportional to destWidth as srcHeight
* is to srcWidth.
* @return max of srcWidth/destWidth or srcHeight/destHeight
*/ | Calculates a value for the BitmapFactory.Options .inSampleSize property | calcSampleSize | {
"repo_name": "smit1625/titanium_mobile",
"path": "android/titanium/src/java/org/appcelerator/titanium/view/TiDrawableReference.java",
"license": "apache-2.0",
"size": 31660
} | [
"android.view.View",
"org.appcelerator.titanium.TiDimension"
] | import android.view.View; import org.appcelerator.titanium.TiDimension; | import android.view.*; import org.appcelerator.titanium.*; | [
"android.view",
"org.appcelerator.titanium"
] | android.view; org.appcelerator.titanium; | 955,289 |
public final void setRepeatedMeasuresList(
final List<RepeatedMeasuresNode> repeatedMeasuresList) {
this.repeatedMeasuresList = repeatedMeasuresList;
}
| final void function( final List<RepeatedMeasuresNode> repeatedMeasuresList) { this.repeatedMeasuresList = repeatedMeasuresList; } | /**
* Sets the repeated measures list.
*
* @param repeatedMeasuresList the new repeated measures list
*/ | Sets the repeated measures list | setRepeatedMeasuresList | {
"repo_name": "SampleSizeShop/WebServiceCommon",
"path": "src/edu/ucdenver/bios/webservice/common/domain/RepeatedMeasuresNodeList.java",
"license": "gpl-2.0",
"size": 3775
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,675,171 |
public static void main(Iterable<Class<? extends BlazeModule>> moduleClasses, String[] args) {
setupUncaughtHandlerAtStartup(args);
List<BlazeModule> modules = createModules(moduleClasses);
// blaze.cc will put --batch first if the user set it.
if (args.length >= 1 && args[0].equals("--batch")) {
// Run Blaze in batch mode.
System.exit(batchMain(modules, args));
}
logger.atInfo().log(
"Starting Bazel server with %s, args %s", maybeGetPidString(), Arrays.toString(args));
try {
// Run Blaze in server mode.
System.exit(serverMain(modules, OutErr.SYSTEM_OUT_ERR, args));
} catch (RuntimeException | Error e) { // A definite bug...
BugReport.printBug(OutErr.SYSTEM_OUT_ERR, e, null);
BugReport.sendBugReport(e, Arrays.asList(args));
CustomFailureDetailPublisher.maybeWriteFailureDetailFile(CrashFailureDetails.forThrowable(e));
System.exit(ExitCode.BLAZE_INTERNAL_ERROR.getNumericExitCode());
throw e; // Shouldn't get here.
}
} | static void function(Iterable<Class<? extends BlazeModule>> moduleClasses, String[] args) { setupUncaughtHandlerAtStartup(args); List<BlazeModule> modules = createModules(moduleClasses); if (args.length >= 1 && args[0].equals(STR)) { System.exit(batchMain(modules, args)); } logger.atInfo().log( STR, maybeGetPidString(), Arrays.toString(args)); try { System.exit(serverMain(modules, OutErr.SYSTEM_OUT_ERR, args)); } catch (RuntimeException Error e) { BugReport.printBug(OutErr.SYSTEM_OUT_ERR, e, null); BugReport.sendBugReport(e, Arrays.asList(args)); CustomFailureDetailPublisher.maybeWriteFailureDetailFile(CrashFailureDetails.forThrowable(e)); System.exit(ExitCode.BLAZE_INTERNAL_ERROR.getNumericExitCode()); throw e; } } | /**
* Main method for the Blaze server startup. Note: This method logs exceptions to remote servers.
* Do not add this to a unittest.
*/ | Main method for the Blaze server startup. Note: This method logs exceptions to remote servers. Do not add this to a unittest | main | {
"repo_name": "davidzchen/bazel",
"path": "src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java",
"license": "apache-2.0",
"size": 68600
} | [
"com.google.devtools.build.lib.bugreport.BugReport",
"com.google.devtools.build.lib.util.CrashFailureDetails",
"com.google.devtools.build.lib.util.CustomFailureDetailPublisher",
"com.google.devtools.build.lib.util.ExitCode",
"com.google.devtools.build.lib.util.io.OutErr",
"java.util.Arrays",
"java.util.... | import com.google.devtools.build.lib.bugreport.BugReport; import com.google.devtools.build.lib.util.CrashFailureDetails; import com.google.devtools.build.lib.util.CustomFailureDetailPublisher; import com.google.devtools.build.lib.util.ExitCode; import com.google.devtools.build.lib.util.io.OutErr; import java.util.Arrays; import java.util.List; | import com.google.devtools.build.lib.bugreport.*; import com.google.devtools.build.lib.util.*; import com.google.devtools.build.lib.util.io.*; import java.util.*; | [
"com.google.devtools",
"java.util"
] | com.google.devtools; java.util; | 595,382 |
private void doRenameEncryptionZone(FSTestWrapper wrapper) throws Exception {
final Path testRoot = new Path("/tmp/TestEncryptionZones");
final Path pathFoo = new Path(testRoot, "foo");
final Path pathFooBaz = new Path(pathFoo, "baz");
final Path pathFooBazFile = new Path(pathFooBaz, "file");
final Path pathFooBar = new Path(pathFoo, "bar");
final Path pathFooBarFile = new Path(pathFooBar, "file");
final int len = 8192;
wrapper.mkdir(pathFoo, FsPermission.getDirDefault(), true);
dfsAdmin.createEncryptionZone(pathFoo, TEST_KEY, NO_TRASH);
wrapper.mkdir(pathFooBaz, FsPermission.getDirDefault(), true);
DFSTestUtil.createFile(fs, pathFooBazFile, len, (short) 1, 0xFEED);
String contents = DFSTestUtil.readFile(fs, pathFooBazFile);
try {
wrapper.rename(pathFooBaz, testRoot);
} catch (IOException e) {
assertExceptionContains(pathFooBaz.toString() + " can't be moved from" +
" an encryption zone.", e
);
}
// Verify that we can rename dir and files within an encryption zone.
assertTrue(fs.rename(pathFooBaz, pathFooBar));
assertTrue("Rename of dir and file within ez failed",
!wrapper.exists(pathFooBaz) && wrapper.exists(pathFooBar));
assertEquals("Renamed file contents not the same",
contents, DFSTestUtil.readFile(fs, pathFooBarFile));
// Verify that we can rename an EZ root
final Path newFoo = new Path(testRoot, "newfoo");
assertTrue("Rename of EZ root", fs.rename(pathFoo, newFoo));
assertTrue("Rename of EZ root failed",
!wrapper.exists(pathFoo) && wrapper.exists(newFoo));
// Verify that we can't rename an EZ root onto itself
try {
wrapper.rename(newFoo, newFoo);
} catch (IOException e) {
assertExceptionContains("are the same", e);
}
} | void function(FSTestWrapper wrapper) throws Exception { final Path testRoot = new Path(STR); final Path pathFoo = new Path(testRoot, "foo"); final Path pathFooBaz = new Path(pathFoo, "baz"); final Path pathFooBazFile = new Path(pathFooBaz, "file"); final Path pathFooBar = new Path(pathFoo, "bar"); final Path pathFooBarFile = new Path(pathFooBar, "file"); final int len = 8192; wrapper.mkdir(pathFoo, FsPermission.getDirDefault(), true); dfsAdmin.createEncryptionZone(pathFoo, TEST_KEY, NO_TRASH); wrapper.mkdir(pathFooBaz, FsPermission.getDirDefault(), true); DFSTestUtil.createFile(fs, pathFooBazFile, len, (short) 1, 0xFEED); String contents = DFSTestUtil.readFile(fs, pathFooBazFile); try { wrapper.rename(pathFooBaz, testRoot); } catch (IOException e) { assertExceptionContains(pathFooBaz.toString() + STR + STR, e ); } assertTrue(fs.rename(pathFooBaz, pathFooBar)); assertTrue(STR, !wrapper.exists(pathFooBaz) && wrapper.exists(pathFooBar)); assertEquals(STR, contents, DFSTestUtil.readFile(fs, pathFooBarFile)); final Path newFoo = new Path(testRoot, STR); assertTrue(STR, fs.rename(pathFoo, newFoo)); assertTrue(STR, !wrapper.exists(pathFoo) && wrapper.exists(newFoo)); try { wrapper.rename(newFoo, newFoo); } catch (IOException e) { assertExceptionContains(STR, e); } } | /**
* Test success of Rename EZ on a directory which is already an EZ.
*/ | Test success of Rename EZ on a directory which is already an EZ | doRenameEncryptionZone | {
"repo_name": "nandakumar131/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestEncryptionZones.java",
"license": "apache-2.0",
"size": 99544
} | [
"java.io.IOException",
"org.apache.hadoop.fs.FSTestWrapper",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.fs.permission.FsPermission",
"org.apache.hadoop.test.GenericTestUtils",
"org.junit.Assert"
] | import java.io.IOException; import org.apache.hadoop.fs.FSTestWrapper; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.test.GenericTestUtils; import org.junit.Assert; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.test.*; import org.junit.*; | [
"java.io",
"org.apache.hadoop",
"org.junit"
] | java.io; org.apache.hadoop; org.junit; | 1,163,681 |
ExtensibleHardwareMap hardwareMap(); | ExtensibleHardwareMap hardwareMap(); | /**
* Returns the Hardware Map
*
* @return the <code>ExtensibleHardwareMap</code> currently in use
*/ | Returns the Hardware Map | hardwareMap | {
"repo_name": "MHS-FIRSTrobotics/TeamClutch-FTC2016",
"path": "FtcXtensible/src/main/java/org/ftccommunity/ftcxtensible/interfaces/AbstractRobotContext.java",
"license": "mit",
"size": 5983
} | [
"org.ftccommunity.ftcxtensible.robot.ExtensibleHardwareMap"
] | import org.ftccommunity.ftcxtensible.robot.ExtensibleHardwareMap; | import org.ftccommunity.ftcxtensible.robot.*; | [
"org.ftccommunity.ftcxtensible"
] | org.ftccommunity.ftcxtensible; | 2,559,097 |
@Override public void enterBetweenOperator(@NotNull AQLParser.BetweenOperatorContext ctx) { } | @Override public void enterBetweenOperator(@NotNull AQLParser.BetweenOperatorContext ctx) { } | /**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/ | The default implementation does nothing | exitSubquery | {
"repo_name": "chriswhite199/jdbc-driver",
"path": "src/main/java/com/ibm/si/jaql/aql/AQLBaseListener.java",
"license": "apache-2.0",
"size": 13047
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,190,125 |
@Override
public void delete( Collection<? extends T> entities )
{
for ( T obj : entities )
{
delete( obj );
}
}
/**
* Gets the {@link Class} of the entity that this repository is managing.
*
* @return the entity {@link Class} | void function( Collection<? extends T> entities ) { for ( T obj : entities ) { delete( obj ); } } /** * Gets the {@link Class} of the entity that this repository is managing. * * @return the entity {@link Class} | /**
* Delete a collection of objects.
*
* @param entities the objects to be deleted
*/ | Delete a collection of objects | delete | {
"repo_name": "csnemeti/fim",
"path": "src/main/java/pfa/alliance/fim/dao/impl/AbstractJpaRepository.java",
"license": "apache-2.0",
"size": 3809
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 327,387 |
void resetUserPin(String newPin) throws PinModeLockedException, IOException; | void resetUserPin(String newPin) throws PinModeLockedException, IOException; | /**
* Re-sets and unblocks the user PIN. Can be used if the user PIN is lost.
* Requires admin mode to be unlocked.
*
* @param newPin The new user PIN to set.
* @throws PinModeLockedException
* @throws IOException
*/ | Re-sets and unblocks the user PIN. Can be used if the user PIN is lost. Requires admin mode to be unlocked | resetUserPin | {
"repo_name": "Yubico/yubico-bitcoin-java",
"path": "yubico-bitcoin-java-core/src/main/java/com/yubico/bitcoin/api/YkneoBitcoin.java",
"license": "apache-2.0",
"size": 9009
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,512,363 |
public boolean delNodes(int mot1, int mot2) {
int nmots = mots.size();
ArrayList<Mot> mots2del = new ArrayList<Mot>();
for (int i=mot1;i<=mot2;i++) {
mots2del.add(getMot(i));
}
// on detruit d'abord les dependances
for (int i=deps.size()-1;i>=0;i--) {
Dep dep = deps.get(i);
if (mots2del.contains(dep.gov)||mots2del.contains(dep.head)) {
deps.remove(i);
}
}
// on decale/detruit les groupes
if (groups!=null) {
for (int i=groups.size()-1;i>=0;i--) {
ArrayList<Mot> gr = groups.get(i);
for (int j=gr.size()-1;j>=0;j--) {
int w=gr.get(j).getIndexInUtt()-1;
if (w>=mot1&&w<=mot2) {
gr.remove(j);
}
}
if (gr.size()==0) {
groups.remove(i);
groupnoms.remove(i);
}
}
}
// on detruit ensuite les noeuds
for (int i=mots2del.size()-1;i>=0;i--) {
Mot m = mots2del.get(i);
mots.remove(m.getIndexInUtt()-1);
}
// on decale les indices suivants
int delta = mot2-mot1+1;
for (int i=mot2+1;i<nmots;i++) {
Mot m = mots.remove(i);
m.setIndexInUtt(m.getIndexInUtt()-delta);
mots.put(m.getIndexInUtt()-1, m);
}
if (mots.size()==0) return true;
else return false;
} | boolean function(int mot1, int mot2) { int nmots = mots.size(); ArrayList<Mot> mots2del = new ArrayList<Mot>(); for (int i=mot1;i<=mot2;i++) { mots2del.add(getMot(i)); } for (int i=deps.size()-1;i>=0;i--) { Dep dep = deps.get(i); if (mots2del.contains(dep.gov) mots2del.contains(dep.head)) { deps.remove(i); } } if (groups!=null) { for (int i=groups.size()-1;i>=0;i--) { ArrayList<Mot> gr = groups.get(i); for (int j=gr.size()-1;j>=0;j--) { int w=gr.get(j).getIndexInUtt()-1; if (w>=mot1&&w<=mot2) { gr.remove(j); } } if (gr.size()==0) { groups.remove(i); groupnoms.remove(i); } } } for (int i=mots2del.size()-1;i>=0;i--) { Mot m = mots2del.get(i); mots.remove(m.getIndexInUtt()-1); } int delta = mot2-mot1+1; for (int i=mot2+1;i<nmots;i++) { Mot m = mots.remove(i); m.setIndexInUtt(m.getIndexInUtt()-delta); mots.put(m.getIndexInUtt()-1, m); } if (mots.size()==0) return true; else return false; } | /**
* supprime les noeuds (et leurs arcs) de mot1 a mot2 inclus
* retourne true ssi il ne reste aucun noeud
*/ | supprime les noeuds (et leurs arcs) de mot1 a mot2 inclus retourne true ssi il ne reste aucun noeud | delNodes | {
"repo_name": "cerisara/jsafran",
"path": "src/jsafran/DetGraph.java",
"license": "gpl-2.0",
"size": 28612
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 451,469 |
@Override
public List<MapEntry> getResolveMaps() {
final List<MapEntry> entries = new ArrayList<MapEntry>();
for (final List<MapEntry> list : this.resolveMapsMap.values()) {
entries.addAll(list);
}
Collections.sort(entries);
return Collections.unmodifiableList(entries);
} | List<MapEntry> function() { final List<MapEntry> entries = new ArrayList<MapEntry>(); for (final List<MapEntry> list : this.resolveMapsMap.values()) { entries.addAll(list); } Collections.sort(entries); return Collections.unmodifiableList(entries); } | /**
* This is for the web console plugin
*/ | This is for the web console plugin | getResolveMaps | {
"repo_name": "cleliameneghin/sling",
"path": "bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java",
"license": "apache-2.0",
"size": 59449
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 915,406 |
public static Resource getCanonicalResourceEL(Resource res) {
if (res == null) return res;
try {
return res.getCanonicalResource();
}
catch (IOException e) {
return res.getAbsoluteResource();
}
} | static Resource function(Resource res) { if (res == null) return res; try { return res.getCanonicalResource(); } catch (IOException e) { return res.getAbsoluteResource(); } } | /**
* Returns the canonical form of this abstract pathname.
*
* @param res file to get canonical form from it
*
* @return The canonical pathname string denoting the same file or directory as this abstract
* pathname
*
* @throws SecurityException If a required system property value cannot be accessed.
*/ | Returns the canonical form of this abstract pathname | getCanonicalResourceEL | {
"repo_name": "jzuijlek/Lucee",
"path": "core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java",
"license": "lgpl-2.1",
"size": 48568
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,871,459 |
public void setCommunitiesCreated(List<Community> communitiesCreated) {
this.communitiesCreated = communitiesCreated;
}
| void function(List<Community> communitiesCreated) { this.communitiesCreated = communitiesCreated; } | /**
* Sets the communities created.
*
* @param communitiesCreated the new communities created
*/ | Sets the communities created | setCommunitiesCreated | {
"repo_name": "hibernate/hibernate-demos",
"path": "hibernate-orm/core/Basic/src/main/java/org/hibernate/brmeyer/demo/entity/User.java",
"license": "apache-2.0",
"size": 7776
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,504,034 |
@SuppressWarnings("deprecation")
public synchronized Session getHibernateSession() throws UNISoNException {
HibernateHelper.logger.debug("getHibernateSession");
if (null == HibernateHelper.sessionFactory) {
try {
final Configuration config = this.getHibernateConfig();
// FIXME - couldn't stop the NoInitialContext warning so this
// hack will stop it being displayed
final Level level = Category.getRoot().getLevel();
Category.getRoot().setLevel(Level.FATAL);
HibernateHelper.sessionFactory = config.buildSessionFactory();
Category.getRoot().setLevel(level);
}
catch (final Throwable e) {
e.printStackTrace();
throw new UNISoNException("Failed to connect to DB", e);
}
}
HibernateHelper.logger.debug("getHibernateSession");
return HibernateHelper.sessionFactory.openSession();
} | @SuppressWarnings(STR) synchronized Session function() throws UNISoNException { HibernateHelper.logger.debug(STR); if (null == HibernateHelper.sessionFactory) { try { final Configuration config = this.getHibernateConfig(); final Level level = Category.getRoot().getLevel(); Category.getRoot().setLevel(Level.FATAL); HibernateHelper.sessionFactory = config.buildSessionFactory(); Category.getRoot().setLevel(level); } catch (final Throwable e) { e.printStackTrace(); throw new UNISoNException(STR, e); } } HibernateHelper.logger.debug(STR); return HibernateHelper.sessionFactory.openSession(); } | /**
* Gets the hibernate session.
*
* @return the hibernate session
* @throws UNISoNException
* the UNI so n exception
*/ | Gets the hibernate session | getHibernateSession | {
"repo_name": "leonarduk/unison",
"path": "src/main/java/uk/co/sleonard/unison/datahandling/HibernateHelper.java",
"license": "apache-2.0",
"size": 24694
} | [
"org.apache.log4j.Category",
"org.apache.log4j.Level",
"org.hibernate.Session",
"org.hibernate.cfg.Configuration",
"uk.co.sleonard.unison.UNISoNException"
] | import org.apache.log4j.Category; import org.apache.log4j.Level; import org.hibernate.Session; import org.hibernate.cfg.Configuration; import uk.co.sleonard.unison.UNISoNException; | import org.apache.log4j.*; import org.hibernate.*; import org.hibernate.cfg.*; import uk.co.sleonard.unison.*; | [
"org.apache.log4j",
"org.hibernate",
"org.hibernate.cfg",
"uk.co.sleonard"
] | org.apache.log4j; org.hibernate; org.hibernate.cfg; uk.co.sleonard; | 187,249 |
public Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
{
log.debug("call getConnection");
return null;
} | Object function(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException { log.debug(STR); return null; } | /** Creates a new connection handle for the underlying physical connection
* represented by the ManagedConnection instance.
*
* @param subject security context as JAAS subject
* @param cxRequestInfo ConnectionRequestInfo instance
* @return generic Object instance representing the connection handle.
* @throws ResourceException generic exception if operation fails
*
**/ | Creates a new connection handle for the underlying physical connection represented by the ManagedConnection instance | getConnection | {
"repo_name": "ironjacamar/ironjacamar",
"path": "validator/tests/src/test/java/org/jboss/jca/validator/rules/base/BaseManagedConnection.java",
"license": "lgpl-2.1",
"size": 6068
} | [
"javax.resource.ResourceException",
"javax.resource.spi.ConnectionRequestInfo",
"javax.security.auth.Subject"
] | import javax.resource.ResourceException; import javax.resource.spi.ConnectionRequestInfo; import javax.security.auth.Subject; | import javax.resource.*; import javax.resource.spi.*; import javax.security.auth.*; | [
"javax.resource",
"javax.security"
] | javax.resource; javax.security; | 2,688,395 |
public String createToken(final Principal principal, final List<Permission> permissions) {
return createToken(principal, permissions, null);
} | String function(final Principal principal, final List<Permission> permissions) { return createToken(principal, permissions, null); } | /**
* Creates a new JWT for the specified principal. Token is signed using
* the SecretKey with an HMAC 256 algorithm.
*
* @param principal the Principal to create the token for
* @param permissions the effective list of permissions for the principal
* @return a String representation of the generated token
* @since 1.1.0
*/ | Creates a new JWT for the specified principal. Token is signed using the SecretKey with an HMAC 256 algorithm | createToken | {
"repo_name": "stevespringett/Alpine",
"path": "alpine/src/main/java/alpine/auth/JsonWebToken.java",
"license": "apache-2.0",
"size": 8823
} | [
"java.security.Principal",
"java.util.List"
] | import java.security.Principal; import java.util.List; | import java.security.*; import java.util.*; | [
"java.security",
"java.util"
] | java.security; java.util; | 786,752 |
public void setJschLoggingLevel(LoggingLevel jschLoggingLevel) {
this.jschLoggingLevel = jschLoggingLevel;
} | void function(LoggingLevel jschLoggingLevel) { this.jschLoggingLevel = jschLoggingLevel; } | /**
* The logging level to use for JSCH activity logging.
* As JSCH is verbose at by default at INFO level the threshold is WARN by default.
*/ | The logging level to use for JSCH activity logging. As JSCH is verbose at by default at INFO level the threshold is WARN by default | setJschLoggingLevel | {
"repo_name": "Fabryprog/camel",
"path": "components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java",
"license": "apache-2.0",
"size": 9575
} | [
"org.apache.camel.LoggingLevel"
] | import org.apache.camel.LoggingLevel; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,874,803 |
private void add(PdfTable table, boolean onlyFirstPage) throws DocumentException {
// before every table, we flush all lines
flushLines();
// initialisation of parameters
float pagetop = indentTop();
float oldHeight = currentHeight;
float cellDisplacement;
PdfCell cell;
PdfContentByte cellGraphics = new PdfContentByte(writer);
boolean tableHasToFit =
table.hasToFitPageTable() ? table.bottom() < indentBottom() : false;
if (pageEmpty)
tableHasToFit = false;
boolean cellsHaveToFit = table.hasToFitPageCells();
// drawing the table
ArrayList cells = table.getCells();
ArrayList headercells = table.getHeaderCells();
// Check if we have removed header cells in a previous call
if (headercells.size() > 0 && (cells.size() == 0 || cells.get(0) != headercells.get(0))) {
ArrayList allCells = new ArrayList(cells.size()+headercells.size());
allCells.addAll(headercells);
allCells.addAll(cells);
cells = allCells;
}
while (!cells.isEmpty()) {
// initialisation of some extra parameters;
float lostTableBottom = 0;
// loop over the cells
boolean cellsShown = false;
int currentGroupNumber = 0;
boolean headerChecked = false;
for (ListIterator iterator = cells.listIterator(); iterator.hasNext() && !tableHasToFit;) {
cell = (PdfCell) iterator.next();
if( cellsHaveToFit ) {
if( !cell.isHeader() ) {
if (cell.getGroupNumber() != currentGroupNumber) {
boolean cellsFit = true;
currentGroupNumber = cell.getGroupNumber();
int cellCount = 0;
while (cell.getGroupNumber() == currentGroupNumber && cellsFit && iterator.hasNext()) {
if (cell.bottom() < indentBottom()) {
cellsFit = false;
}
cell = (PdfCell) iterator.next();
cellCount++;
}
if (!cellsFit) {
break;
}
for (int i = cellCount; i >= 0; i--) {
cell = (PdfCell) iterator.previous();
}
}
}
else {
if( !headerChecked ) {
headerChecked = true;
boolean cellsFit = true;
int cellCount = 0;
float firstTop = cell.top();
while (cell.isHeader() && cellsFit && iterator.hasNext()) {
if (firstTop - cell.bottom(0) > indentTop() - currentHeight - indentBottom()) {
cellsFit = false;
}
cell = (PdfCell) iterator.next();
cellCount++;
}
currentGroupNumber = cell.getGroupNumber();
while (cell.getGroupNumber() == currentGroupNumber && cellsFit && iterator.hasNext()) {
if (firstTop - cell.bottom(0) > indentTop() - currentHeight - indentBottom() - 10.0) {
cellsFit = false;
}
cell = (PdfCell) iterator.next();
cellCount++;
}
for (int i = cellCount; i >= 0; i--) {
cell = (PdfCell) iterator.previous();
}
if (!cellsFit) {
while( cell.isHeader() ) {
iterator.remove();
cell = (PdfCell) iterator.next();
}
break;
}
}
}
}
lines = cell.getLines(pagetop, indentBottom());
// if there are lines to add, add them
if (lines != null && lines.size() > 0) {
// we paint the borders of the cells
cellsShown = true;
cellGraphics.rectangle(cell.rectangle(pagetop, indentBottom()));
lostTableBottom = Math.max(cell.bottom(), indentBottom());
// we write the text
float cellTop = cell.top(pagetop - oldHeight);
text.moveText(0, cellTop);
cellDisplacement = flushLines() - cellTop;
text.moveText(0, cellDisplacement);
if (oldHeight + cellDisplacement > currentHeight) {
currentHeight = oldHeight + cellDisplacement;
}
}
ArrayList images = cell.getImages(pagetop, indentBottom());
for (Iterator i = images.iterator(); i.hasNext();) {
cellsShown = true;
Image image = (Image) i.next();
addImage(graphics, image, 0, 0, 0, 0, 0, 0);
}
// if a cell is allready added completely, remove it
if (cell.mayBeRemoved()) {
iterator.remove();
}
}
tableHasToFit = false;
// we paint the graphics of the table after looping through all the cells
if (cellsShown) {
Rectangle tablerec = new Rectangle(table);
tablerec.setBorder(table.border());
tablerec.setBorderWidth(table.borderWidth());
tablerec.setBorderColor(table.borderColor());
tablerec.setBackgroundColor(table.backgroundColor());
tablerec.setGrayFill(table.grayFill());
PdfContentByte under = writer.getDirectContentUnder();
under.rectangle(tablerec.rectangle(top(), indentBottom()));
under.add(cellGraphics);
// bugfix by Gerald Fehringer: now again add the border for the table
// since it might have been covered by cell backgrounds
tablerec.setGrayFill(0);
tablerec.setBackgroundColor(null);
under.rectangle(tablerec.rectangle(top(), indentBottom()));
// end bugfix
}
cellGraphics = new PdfContentByte(null);
// if the table continues on the next page
if (!cells.isEmpty()) {
graphics.setLineWidth(table.borderWidth());
if (cellsShown && (table.border() & Rectangle.BOTTOM) == Rectangle.BOTTOM) {
// Draw the bottom line
// the color is set to the color of the element
Color tColor = table.borderColor();
if (tColor != null) {
graphics.setColorStroke(tColor);
}
graphics.moveTo(table.left(), Math.max(table.bottom(), indentBottom()));
graphics.lineTo(table.right(), Math.max(table.bottom(), indentBottom()));
graphics.stroke();
if (tColor != null) {
graphics.resetRGBColorStroke();
}
}
// old page
pageEmpty = false;
float difference = lostTableBottom;
// new page
newPage();
// G.F.: if something added in page event i.e. currentHeight > 0
float heightCorrection = 0;
boolean somethingAdded = false;
if (currentHeight > 0) {
heightCorrection = 6;
currentHeight += heightCorrection;
somethingAdded = true;
newLine();
flushLines();
indentTop = currentHeight - leading;
currentHeight = 0;
}
else {
flushLines();
}
// this part repeats the table headers (if any)
int size = headercells.size();
if (size > 0) {
// this is the top of the headersection
cell = (PdfCell) headercells.get(0);
float oldTop = cell.top(0);
// loop over all the cells of the table header
for (int i = 0; i < size; i++) {
cell = (PdfCell) headercells.get(i);
// calculation of the new cellpositions
cell.setTop(indentTop() - oldTop + cell.top(0));
cell.setBottom(indentTop() - oldTop + cell.bottom(0));
pagetop = cell.bottom();
// we paint the borders of the cell
cellGraphics.rectangle(cell.rectangle(indentTop(), indentBottom()));
// we write the text of the cell
ArrayList images = cell.getImages(indentTop(), indentBottom());
for (Iterator im = images.iterator(); im.hasNext();) {
cellsShown = true;
Image image = (Image) im.next();
addImage(graphics, image, 0, 0, 0, 0, 0, 0);
}
lines = cell.getLines(indentTop(), indentBottom());
float cellTop = cell.top(indentTop());
text.moveText(0, cellTop-heightCorrection);
cellDisplacement = flushLines() - cellTop+heightCorrection;
text.moveText(0, cellDisplacement);
}
currentHeight = indentTop() - pagetop + table.cellspacing();
text.moveText(0, pagetop - indentTop() - currentHeight);
}
else {
if (somethingAdded) {
pagetop = indentTop();
text.moveText(0, -table.cellspacing());
}
}
oldHeight = currentHeight - heightCorrection;
// calculating the new positions of the table and the cells
size = Math.min(cells.size(), table.columns());
int i = 0;
while (i < size) {
cell = (PdfCell) cells.get(i);
if (cell.top(-table.cellspacing()) > lostTableBottom) {
float newBottom = pagetop - difference + cell.bottom();
float neededHeight = cell.remainingHeight();
if (newBottom > pagetop - neededHeight) {
difference += newBottom - (pagetop - neededHeight);
}
}
i++;
}
size = cells.size();
table.setTop(indentTop());
table.setBottom(pagetop - difference + table.bottom(table.cellspacing()));
for (i = 0; i < size; i++) {
cell = (PdfCell) cells.get(i);
float newBottom = pagetop - difference + cell.bottom();
float newTop = pagetop - difference + cell.top(-table.cellspacing());
if (newTop > indentTop() - currentHeight) {
newTop = indentTop() - currentHeight;
}
//float newBottom = newTop - cell.height();
cell.setTop(newTop );
cell.setBottom(newBottom );
}
if (onlyFirstPage) {
break;
}
}
}
float tableHeight = table.top() - table.bottom();
currentHeight = oldHeight + tableHeight;
text.moveText(0, -tableHeight );
pageEmpty = false;
}
| void function(PdfTable table, boolean onlyFirstPage) throws DocumentException { flushLines(); float pagetop = indentTop(); float oldHeight = currentHeight; float cellDisplacement; PdfCell cell; PdfContentByte cellGraphics = new PdfContentByte(writer); boolean tableHasToFit = table.hasToFitPageTable() ? table.bottom() < indentBottom() : false; if (pageEmpty) tableHasToFit = false; boolean cellsHaveToFit = table.hasToFitPageCells(); ArrayList cells = table.getCells(); ArrayList headercells = table.getHeaderCells(); if (headercells.size() > 0 && (cells.size() == 0 cells.get(0) != headercells.get(0))) { ArrayList allCells = new ArrayList(cells.size()+headercells.size()); allCells.addAll(headercells); allCells.addAll(cells); cells = allCells; } while (!cells.isEmpty()) { float lostTableBottom = 0; boolean cellsShown = false; int currentGroupNumber = 0; boolean headerChecked = false; for (ListIterator iterator = cells.listIterator(); iterator.hasNext() && !tableHasToFit;) { cell = (PdfCell) iterator.next(); if( cellsHaveToFit ) { if( !cell.isHeader() ) { if (cell.getGroupNumber() != currentGroupNumber) { boolean cellsFit = true; currentGroupNumber = cell.getGroupNumber(); int cellCount = 0; while (cell.getGroupNumber() == currentGroupNumber && cellsFit && iterator.hasNext()) { if (cell.bottom() < indentBottom()) { cellsFit = false; } cell = (PdfCell) iterator.next(); cellCount++; } if (!cellsFit) { break; } for (int i = cellCount; i >= 0; i--) { cell = (PdfCell) iterator.previous(); } } } else { if( !headerChecked ) { headerChecked = true; boolean cellsFit = true; int cellCount = 0; float firstTop = cell.top(); while (cell.isHeader() && cellsFit && iterator.hasNext()) { if (firstTop - cell.bottom(0) > indentTop() - currentHeight - indentBottom()) { cellsFit = false; } cell = (PdfCell) iterator.next(); cellCount++; } currentGroupNumber = cell.getGroupNumber(); while (cell.getGroupNumber() == currentGroupNumber && cellsFit && iterator.hasNext()) { if (firstTop - cell.bottom(0) > indentTop() - currentHeight - indentBottom() - 10.0) { cellsFit = false; } cell = (PdfCell) iterator.next(); cellCount++; } for (int i = cellCount; i >= 0; i--) { cell = (PdfCell) iterator.previous(); } if (!cellsFit) { while( cell.isHeader() ) { iterator.remove(); cell = (PdfCell) iterator.next(); } break; } } } } lines = cell.getLines(pagetop, indentBottom()); if (lines != null && lines.size() > 0) { cellsShown = true; cellGraphics.rectangle(cell.rectangle(pagetop, indentBottom())); lostTableBottom = Math.max(cell.bottom(), indentBottom()); float cellTop = cell.top(pagetop - oldHeight); text.moveText(0, cellTop); cellDisplacement = flushLines() - cellTop; text.moveText(0, cellDisplacement); if (oldHeight + cellDisplacement > currentHeight) { currentHeight = oldHeight + cellDisplacement; } } ArrayList images = cell.getImages(pagetop, indentBottom()); for (Iterator i = images.iterator(); i.hasNext();) { cellsShown = true; Image image = (Image) i.next(); addImage(graphics, image, 0, 0, 0, 0, 0, 0); } if (cell.mayBeRemoved()) { iterator.remove(); } } tableHasToFit = false; if (cellsShown) { Rectangle tablerec = new Rectangle(table); tablerec.setBorder(table.border()); tablerec.setBorderWidth(table.borderWidth()); tablerec.setBorderColor(table.borderColor()); tablerec.setBackgroundColor(table.backgroundColor()); tablerec.setGrayFill(table.grayFill()); PdfContentByte under = writer.getDirectContentUnder(); under.rectangle(tablerec.rectangle(top(), indentBottom())); under.add(cellGraphics); tablerec.setGrayFill(0); tablerec.setBackgroundColor(null); under.rectangle(tablerec.rectangle(top(), indentBottom())); } cellGraphics = new PdfContentByte(null); if (!cells.isEmpty()) { graphics.setLineWidth(table.borderWidth()); if (cellsShown && (table.border() & Rectangle.BOTTOM) == Rectangle.BOTTOM) { Color tColor = table.borderColor(); if (tColor != null) { graphics.setColorStroke(tColor); } graphics.moveTo(table.left(), Math.max(table.bottom(), indentBottom())); graphics.lineTo(table.right(), Math.max(table.bottom(), indentBottom())); graphics.stroke(); if (tColor != null) { graphics.resetRGBColorStroke(); } } pageEmpty = false; float difference = lostTableBottom; newPage(); float heightCorrection = 0; boolean somethingAdded = false; if (currentHeight > 0) { heightCorrection = 6; currentHeight += heightCorrection; somethingAdded = true; newLine(); flushLines(); indentTop = currentHeight - leading; currentHeight = 0; } else { flushLines(); } int size = headercells.size(); if (size > 0) { cell = (PdfCell) headercells.get(0); float oldTop = cell.top(0); for (int i = 0; i < size; i++) { cell = (PdfCell) headercells.get(i); cell.setTop(indentTop() - oldTop + cell.top(0)); cell.setBottom(indentTop() - oldTop + cell.bottom(0)); pagetop = cell.bottom(); cellGraphics.rectangle(cell.rectangle(indentTop(), indentBottom())); ArrayList images = cell.getImages(indentTop(), indentBottom()); for (Iterator im = images.iterator(); im.hasNext();) { cellsShown = true; Image image = (Image) im.next(); addImage(graphics, image, 0, 0, 0, 0, 0, 0); } lines = cell.getLines(indentTop(), indentBottom()); float cellTop = cell.top(indentTop()); text.moveText(0, cellTop-heightCorrection); cellDisplacement = flushLines() - cellTop+heightCorrection; text.moveText(0, cellDisplacement); } currentHeight = indentTop() - pagetop + table.cellspacing(); text.moveText(0, pagetop - indentTop() - currentHeight); } else { if (somethingAdded) { pagetop = indentTop(); text.moveText(0, -table.cellspacing()); } } oldHeight = currentHeight - heightCorrection; size = Math.min(cells.size(), table.columns()); int i = 0; while (i < size) { cell = (PdfCell) cells.get(i); if (cell.top(-table.cellspacing()) > lostTableBottom) { float newBottom = pagetop - difference + cell.bottom(); float neededHeight = cell.remainingHeight(); if (newBottom > pagetop - neededHeight) { difference += newBottom - (pagetop - neededHeight); } } i++; } size = cells.size(); table.setTop(indentTop()); table.setBottom(pagetop - difference + table.bottom(table.cellspacing())); for (i = 0; i < size; i++) { cell = (PdfCell) cells.get(i); float newBottom = pagetop - difference + cell.bottom(); float newTop = pagetop - difference + cell.top(-table.cellspacing()); if (newTop > indentTop() - currentHeight) { newTop = indentTop() - currentHeight; } cell.setTop(newTop ); cell.setBottom(newBottom ); } if (onlyFirstPage) { break; } } } float tableHeight = table.top() - table.bottom(); currentHeight = oldHeight + tableHeight; text.moveText(0, -tableHeight ); pageEmpty = false; } | /**
* Adds a new table to
* @param table Table to add. Rendered rows will be deleted after processing.
* @param onlyFirstPage Render only the first full page
* @throws DocumentException
*/ | Adds a new table to | add | {
"repo_name": "MesquiteProject/MesquiteArchive",
"path": "trunk/Mesquite Project/LibrarySource/com/lowagie/text/pdf/PdfDocument.java",
"license": "lgpl-3.0",
"size": 115660
} | [
"com.lowagie.text.DocumentException",
"com.lowagie.text.Image",
"com.lowagie.text.Rectangle",
"java.util.ArrayList",
"java.util.Iterator",
"java.util.ListIterator"
] | import com.lowagie.text.DocumentException; import com.lowagie.text.Image; import com.lowagie.text.Rectangle; import java.util.ArrayList; import java.util.Iterator; import java.util.ListIterator; | import com.lowagie.text.*; import java.util.*; | [
"com.lowagie.text",
"java.util"
] | com.lowagie.text; java.util; | 2,801,988 |
public void loadSegs(Node node, Map<String, List<String>> segs) {
int type = node.getNodeType();
is_ref = false;
switch(type) {
case Node.DOCUMENT_NODE:
loadSegs(((Document) node).getDocumentElement(), segs);
break;
case Node.ELEMENT_NODE:
loadSegsElement(node, segs);
NodeList children = node.getChildNodes();
if(children != null) {
int len = children.getLength();
for(int i = 0; i < len; ++i)
loadSegs(children.item(i), segs);
}
break;
case Node.ENTITY_REFERENCE_NODE:
break;
case Node.CDATA_SECTION_NODE:
break;
case Node.TEXT_NODE:
String text = node.getNodeValue().trim();
if(id != null && text != null) {
List<String> val = segs.get(id);
List<String> al;
if(val == null) {
al = new ArrayList<String>(6);
al.add(text);
segs.put(id, al);
} else {
al = val;
al.add(text);
}
}
id = null;
break;
case Node.PROCESSING_INSTRUCTION_NODE:
break;
}
} | void function(Node node, Map<String, List<String>> segs) { int type = node.getNodeType(); is_ref = false; switch(type) { case Node.DOCUMENT_NODE: loadSegs(((Document) node).getDocumentElement(), segs); break; case Node.ELEMENT_NODE: loadSegsElement(node, segs); NodeList children = node.getChildNodes(); if(children != null) { int len = children.getLength(); for(int i = 0; i < len; ++i) loadSegs(children.item(i), segs); } break; case Node.ENTITY_REFERENCE_NODE: break; case Node.CDATA_SECTION_NODE: break; case Node.TEXT_NODE: String text = node.getNodeValue().trim(); if(id != null && text != null) { List<String> val = segs.get(id); List<String> al; if(val == null) { al = new ArrayList<String>(6); al.add(text); segs.put(id, al); } else { al = val; al.add(text); } } id = null; break; case Node.PROCESSING_INSTRUCTION_NODE: break; } } | /********************************************************
* Name: loadSegs
* Desc: Loads the segments from the document objects.
* This document object do NOT assumes the existence of sysid
* field.
* Segment text and sysids are put into the given hashmaps.
********************************************************/ | Name: loadSegs Desc: Loads the segments from the document objects. This document object do NOT assumes the existence of sysid field. Segment text and sysids are put into the given hashmaps | loadSegs | {
"repo_name": "jhclark/tercom",
"path": "src/ter/io/SgmlProcessor.java",
"license": "lgpl-2.1",
"size": 33189
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.w3c.dom.Document",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
] | import java.util.ArrayList; import java.util.List; import java.util.Map; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import java.util.*; import org.w3c.dom.*; | [
"java.util",
"org.w3c.dom"
] | java.util; org.w3c.dom; | 107,776 |
EMap<Tuple<DeployedOperation, DeployedStorage>, AggregatedStorageAccess> getAggregatedStorageAccesses(); | EMap<Tuple<DeployedOperation, DeployedStorage>, AggregatedStorageAccess> getAggregatedStorageAccesses(); | /**
* Returns the value of the '<em><b>Aggregated Storage Accesses</b></em>' map.
* The key is of type {@link kieker.model.analysismodel.execution.Tuple<kieker.model.analysismodel.deployment.DeployedOperation, kieker.model.analysismodel.deployment.DeployedStorage>},
* and the value is of type {@link kieker.model.analysismodel.execution.AggregatedStorageAccess},
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Aggregated Storage Accesses</em>' map.
* @see kieker.model.analysismodel.execution.ExecutionPackage#getExecutionModel_AggregatedStorageAccesses()
* @model mapType="kieker.model.analysismodel.execution.DeployedOperationsPairToAggregatedStorageAccessMapEntry<kieker.model.analysismodel.execution.Tuple<kieker.model.analysismodel.deployment.DeployedOperation, kieker.model.analysismodel.deployment.DeployedStorage>, kieker.model.analysismodel.execution.AggregatedStorageAccess>" ordered="false"
* @generated
*/ | Returns the value of the 'Aggregated Storage Accesses' map. The key is of type <code>kieker.model.analysismodel.execution.Tuple</code>, and the value is of type <code>kieker.model.analysismodel.execution.AggregatedStorageAccess</code>, | getAggregatedStorageAccesses | {
"repo_name": "kieker-monitoring/kieker",
"path": "kieker-model/src-gen/kieker/model/analysismodel/execution/ExecutionModel.java",
"license": "apache-2.0",
"size": 3078
} | [
"org.eclipse.emf.common.util.EMap"
] | import org.eclipse.emf.common.util.EMap; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,163,423 |
@Deprecated
public Future<CommandResult> getCreditPaymentCommand(Calendar latestEndTime, Integer numberOfRecords) {
GetCreditPaymentCommand command = new GetCreditPaymentCommand();
// Set the fields
command.setLatestEndTime(latestEndTime);
command.setNumberOfRecords(numberOfRecords);
return sendCommand(command);
} | Future<CommandResult> function(Calendar latestEndTime, Integer numberOfRecords) { GetCreditPaymentCommand command = new GetCreditPaymentCommand(); command.setLatestEndTime(latestEndTime); command.setNumberOfRecords(numberOfRecords); return sendCommand(command); } | /**
* The Get Credit Payment Command
* <p>
* This command initiates PublishCreditPayment commands for the requested credit
* payment information.
*
* @param latestEndTime {@link Calendar} Latest End Time
* @param numberOfRecords {@link Integer} Number Of Records
* @return the {@link Future<CommandResult>} command result future
* @deprecated As of release 1.3.0.
* Use extended ZclCommand class constructors to instantiate the command
* and {@link #sendCommand} or {@link #sendResponse} to send the command.
* This provides further control when sending the command by allowing customisation
* of the command (for example by disabling the <i>DefaultResponse</i>.
* <p>
* e.g. replace <code>cluster.getCreditPaymentCommand(parameters ...)</code>
* with <code>cluster.sendCommand(new getCreditPaymentCommand(parameters ...))</code>
*/ | The Get Credit Payment Command This command initiates PublishCreditPayment commands for the requested credit payment information | getCreditPaymentCommand | {
"repo_name": "zsmartsystems/com.zsmartsystems.zigbee",
"path": "com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclPriceCluster.java",
"license": "epl-1.0",
"size": 846624
} | [
"com.zsmartsystems.zigbee.CommandResult",
"com.zsmartsystems.zigbee.zcl.clusters.price.GetCreditPaymentCommand",
"java.util.Calendar",
"java.util.concurrent.Future"
] | import com.zsmartsystems.zigbee.CommandResult; import com.zsmartsystems.zigbee.zcl.clusters.price.GetCreditPaymentCommand; import java.util.Calendar; import java.util.concurrent.Future; | import com.zsmartsystems.zigbee.*; import com.zsmartsystems.zigbee.zcl.clusters.price.*; import java.util.*; import java.util.concurrent.*; | [
"com.zsmartsystems.zigbee",
"java.util"
] | com.zsmartsystems.zigbee; java.util; | 2,303,670 |
@Test(dependsOnMethods = "testReadEmptyBaseline")
public void testAvoidingRedundantWrite() {
Map<String, ResourceAssignment> dummyAssignment = getDummyAssignment();
// Call persist functions
_store.persistBaseline(dummyAssignment);
_store.persistBestPossibleAssignment(dummyAssignment);
// Check that only one version exists
Assert.assertEquals(getExistingVersionNumbers(BASELINE_KEY).size(), 1);
Assert.assertEquals(getExistingVersionNumbers(BEST_POSSIBLE_KEY).size(), 1);
// Call persist functions again
_store.persistBaseline(dummyAssignment);
_store.persistBestPossibleAssignment(dummyAssignment);
// Check that only one version exists still
Assert.assertEquals(getExistingVersionNumbers(BASELINE_KEY).size(), 1);
Assert.assertEquals(getExistingVersionNumbers(BEST_POSSIBLE_KEY).size(), 1);
} | @Test(dependsOnMethods = STR) void function() { Map<String, ResourceAssignment> dummyAssignment = getDummyAssignment(); _store.persistBaseline(dummyAssignment); _store.persistBestPossibleAssignment(dummyAssignment); Assert.assertEquals(getExistingVersionNumbers(BASELINE_KEY).size(), 1); Assert.assertEquals(getExistingVersionNumbers(BEST_POSSIBLE_KEY).size(), 1); _store.persistBaseline(dummyAssignment); _store.persistBestPossibleAssignment(dummyAssignment); Assert.assertEquals(getExistingVersionNumbers(BASELINE_KEY).size(), 1); Assert.assertEquals(getExistingVersionNumbers(BEST_POSSIBLE_KEY).size(), 1); } | /**
* Test that if the old assignment and new assignment are the same,
*/ | Test that if the old assignment and new assignment are the same | testAvoidingRedundantWrite | {
"repo_name": "dasahcc/helix",
"path": "helix-core/src/test/java/org/apache/helix/controller/rebalancer/waged/TestAssignmentMetadataStore.java",
"license": "apache-2.0",
"size": 8720
} | [
"java.util.Map",
"org.apache.helix.model.ResourceAssignment",
"org.testng.Assert",
"org.testng.annotations.Test"
] | import java.util.Map; import org.apache.helix.model.ResourceAssignment; import org.testng.Assert; import org.testng.annotations.Test; | import java.util.*; import org.apache.helix.model.*; import org.testng.*; import org.testng.annotations.*; | [
"java.util",
"org.apache.helix",
"org.testng",
"org.testng.annotations"
] | java.util; org.apache.helix; org.testng; org.testng.annotations; | 568,211 |
Cvss vector = Cvss.fromVector("CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:H/E:X/RL:X/RC:X/CR:X/IR:H/AR:H/MAV:A/MAC:H/MPR:H/MUI:X/MS:U/MC:H/MI:H/MA:H");
double environmentalScore = vector.calculateScore().getEnvironmentalScore();
assertEquals("CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:H/E:X/RL:X/RC:X/CR:X/IR:H/AR:H/MAV:A/MAC:H/MPR:H/MUI:X/MS:U/MC:H/MI:H/MA:H", vector.getVector());
assertEquals(6.4, environmentalScore, 0.01);
} | Cvss vector = Cvss.fromVector(STR); double environmentalScore = vector.calculateScore().getEnvironmentalScore(); assertEquals(STR, vector.getVector()); assertEquals(6.4, environmentalScore, 0.01); } | /**
* Regression for CVSS Vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:H/E:X/RL:X/RC:X/CR:X/IR:H/AR:H/MAV:A/MAC:H/MPR:H/MUI:X/MS:U/MC:H/MI:H/MA:H
* Correct environmental score is 6.4 according to https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:H/IR:H/AR:H/MAV:A/MAC:H/MPR:H/MS:U/MC:H/MI:H/MA:H
* Problem: If MUI is NOT_DEFINED the modifiedExploitabilitySubScore is calculated wrongly (multiplication with 0 instead of using the UI-value)
*/ | Problem: If MUI is NOT_DEFINED the modifiedExploitabilitySubScore is calculated wrongly (multiplication with 0 instead of using the UI-value) | regressionForEnvironmentalScore1 | {
"repo_name": "stevespringett/cvss-calculator",
"path": "src/test/java/us/springett/cvss/CvssV3_1NotDefinedRegression.java",
"license": "apache-2.0",
"size": 6735
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,106,194 |
@Override
public void doPostDeleteWorkflows(int tenantId) throws WorkflowException {
} | void function(int tenantId) throws WorkflowException { } | /**
* Trigger after deleting workflows by tenant id.
*
* @param tenantId The id of the tenant.
* @throws WorkflowException
*/ | Trigger after deleting workflows by tenant id | doPostDeleteWorkflows | {
"repo_name": "wso2/carbon-identity-framework",
"path": "components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/AbstractWorkflowListener.java",
"license": "apache-2.0",
"size": 19381
} | [
"org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException"
] | import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException; | import org.wso2.carbon.identity.workflow.mgt.exception.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 2,262,601 |
public final ImmutableSet<E> toSet() {
return ImmutableSet.copyOf(iterable);
}
/**
* Returns an {@code ImmutableSortedSet} containing all of the elements from this {@code Sequence} | final ImmutableSet<E> function() { return ImmutableSet.copyOf(iterable); } /** * Returns an {@code ImmutableSortedSet} containing all of the elements from this {@code Sequence} | /**
* Returns an {@code ImmutableSet} containing all of the elements from this fluent iterable with
* duplicates removed.
* @return the immutable set
* @since 14.0 (since 12.0 as {@code toImmutableSet()}).
*/ | Returns an ImmutableSet containing all of the elements from this fluent iterable with duplicates removed | toSet | {
"repo_name": "immutables/miscellaneous",
"path": "sequence/src/org/immutables/sequence/Sequence.java",
"license": "apache-2.0",
"size": 21792
} | [
"com.google.common.collect.ImmutableSet",
"com.google.common.collect.ImmutableSortedSet"
] | import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSortedSet; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 2,905,440 |
private void createPartitionsDirectoriesOnFS(Table table, int numPartitions, boolean reverseOrder) throws IOException {
String path = table.getDataLocation().toString();
fs = table.getPath().getFileSystem(hive.getConf());
int numPartKeys = table.getPartitionKeys().size();
for (int i = 0; i < numPartitions; i++) {
StringBuilder partPath = new StringBuilder(path);
partPath.append(Path.SEPARATOR);
if (!reverseOrder) {
for (int j = 0; j < numPartKeys; j++) {
FieldSchema field = table.getPartitionKeys().get(j);
partPath.append(field.getName());
partPath.append('=');
partPath.append("val_");
partPath.append(i);
if (j < (numPartKeys - 1)) {
partPath.append(Path.SEPARATOR);
}
}
} else {
for (int j = numPartKeys - 1; j >= 0; j--) {
FieldSchema field = table.getPartitionKeys().get(j);
partPath.append(field.getName());
partPath.append('=');
partPath.append("val_");
partPath.append(i);
if (j > 0) {
partPath.append(Path.SEPARATOR);
}
}
}
createDirectory(partPath.toString());
}
} | void function(Table table, int numPartitions, boolean reverseOrder) throws IOException { String path = table.getDataLocation().toString(); fs = table.getPath().getFileSystem(hive.getConf()); int numPartKeys = table.getPartitionKeys().size(); for (int i = 0; i < numPartitions; i++) { StringBuilder partPath = new StringBuilder(path); partPath.append(Path.SEPARATOR); if (!reverseOrder) { for (int j = 0; j < numPartKeys; j++) { FieldSchema field = table.getPartitionKeys().get(j); partPath.append(field.getName()); partPath.append('='); partPath.append("val_"); partPath.append(i); if (j < (numPartKeys - 1)) { partPath.append(Path.SEPARATOR); } } } else { for (int j = numPartKeys - 1; j >= 0; j--) { FieldSchema field = table.getPartitionKeys().get(j); partPath.append(field.getName()); partPath.append('='); partPath.append("val_"); partPath.append(i); if (j > 0) { partPath.append(Path.SEPARATOR); } } } createDirectory(partPath.toString()); } } | /**
* Creates partition sub-directories for a given table on the file system. Used to test the
* use-cases when partitions for the table are not present in the metastore db
*
* @param table - Table which provides the base locations and partition specs for creating the
* sub-directories
* @param numPartitions - Number of partitions to be created
* @param reverseOrder - If set to true creates the partition sub-directories in the reverse order
* of specified by partition keys defined for the table
* @throws IOException
*/ | Creates partition sub-directories for a given table on the file system. Used to test the use-cases when partitions for the table are not present in the metastore db | createPartitionsDirectoriesOnFS | {
"repo_name": "b-slim/hive",
"path": "ql/src/test/org/apache/hadoop/hive/ql/metadata/TestHiveMetaStoreChecker.java",
"license": "apache-2.0",
"size": 31411
} | [
"java.io.IOException",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hive.metastore.api.FieldSchema"
] | import java.io.IOException; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.metastore.api.FieldSchema; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.metastore.api.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,091,412 |
public List findAll (int x0, int y0, int x1, int y1)
{
List objects = new ArrayList();
findAll (x0, y0, x1, y1, objects);
return objects;
} | List function (int x0, int y0, int x1, int y1) { List objects = new ArrayList(); findAll (x0, y0, x1, y1, objects); return objects; } | /**
* Find all objects intersecting a specified rectangle. Objects are
* returned with front most object on screen last in list. Seacrh is
* done in the subtree of this object (including this). If no objects
* intersects, an empty list is returned.
*
* @param x0 X coordinate of upper left corner of rectangle.
* @param y0 Y coordinate of upper left corner of rectangle.
* @param x1 X coordinate of lower right corner of rectangle.
* @param y1 Y coordinate of lower right corner of rectangle.
* @return All objects intersecting the specified rectangle.
*/ | Find all objects intersecting a specified rectangle. Objects are returned with front most object on screen last in list. Seacrh is done in the subtree of this object (including this). If no objects intersects, an empty list is returned | findAll | {
"repo_name": "ys880526/Test",
"path": "Simulators/GateBar/src/main/java/no/geosoft/cc/graphics/GObject.java",
"license": "lgpl-3.0",
"size": 50218
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 830,036 |
public static java.util.List extractAdmissionDetailList(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.AdmissionDetailForPatientCodingListVoCollection voCollection)
{
return extractAdmissionDetailList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.AdmissionDetailForPatientCodingListVoCollection voCollection) { return extractAdmissionDetailList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.core.admin.pas.domain.objects.AdmissionDetail list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.core.admin.pas.domain.objects.AdmissionDetail list from the value object collection | extractAdmissionDetailList | {
"repo_name": "FreudianNM/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/refman/vo/domain/AdmissionDetailForPatientCodingListVoAssembler.java",
"license": "agpl-3.0",
"size": 29176
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 300,616 |
public BesGetRenewListResponse getRenewList(BesGetRenewListRequest request) {
checkNotNull(request, "request should not be null.");
String json = null;
try {
json = request.toJson();
} catch (IOException e) {
throw new BceClientException("Fail to generate json", e);
}
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.POST, BASE_PATH, RENEW, LIST);
addCommonHeader(internalRequest, json);
BesGetRenewListResponse besGetRenewListResponse =
this.invokeHttpClient(internalRequest, BesGetRenewListResponse.class);
return besGetRenewListResponse;
} | BesGetRenewListResponse function(BesGetRenewListRequest request) { checkNotNull(request, STR); String json = null; try { json = request.toJson(); } catch (IOException e) { throw new BceClientException(STR, e); } InternalRequest internalRequest = this.createRequest( request, HttpMethodName.POST, BASE_PATH, RENEW, LIST); addCommonHeader(internalRequest, json); BesGetRenewListResponse besGetRenewListResponse = this.invokeHttpClient(internalRequest, BesGetRenewListResponse.class); return besGetRenewListResponse; } | /**
* Get BES renew list owned by the authenticated user.
* Users must authenticate with a valid BCE Access Key ID, and the response
* contains all the BES clusters owned by the user.
*
* @param request
* @return Returns a request response code or error message
*/ | Get BES renew list owned by the authenticated user. Users must authenticate with a valid BCE Access Key ID, and the response contains all the BES clusters owned by the user | getRenewList | {
"repo_name": "baidubce/bce-sdk-java",
"path": "src/main/java/com/baidubce/services/bes/BesClient.java",
"license": "apache-2.0",
"size": 26806
} | [
"com.baidubce.BceClientException",
"com.baidubce.http.HttpMethodName",
"com.baidubce.internal.InternalRequest",
"com.baidubce.services.bes.model.BesGetRenewListRequest",
"com.baidubce.services.bes.model.BesGetRenewListResponse",
"com.google.common.base.Preconditions",
"java.io.IOException"
] | import com.baidubce.BceClientException; import com.baidubce.http.HttpMethodName; import com.baidubce.internal.InternalRequest; import com.baidubce.services.bes.model.BesGetRenewListRequest; import com.baidubce.services.bes.model.BesGetRenewListResponse; import com.google.common.base.Preconditions; import java.io.IOException; | import com.baidubce.*; import com.baidubce.http.*; import com.baidubce.internal.*; import com.baidubce.services.bes.model.*; import com.google.common.base.*; import java.io.*; | [
"com.baidubce",
"com.baidubce.http",
"com.baidubce.internal",
"com.baidubce.services",
"com.google.common",
"java.io"
] | com.baidubce; com.baidubce.http; com.baidubce.internal; com.baidubce.services; com.google.common; java.io; | 2,651,492 |
@RequestMapping(value = "/nuevo", method = RequestMethod.GET)
public String nuevo(Model model) {
logger.info("Iniciamos usuario/nuevo [GET]");
// Creamos un nuevo usuario que actuará como formulario en la vista.
model.addAttribute("usuario", new Usuario());
logger.info("Pasamos un usuario nuevo a la vista, para vincularlo al form.");
return "usuario/nuevo";
} | @RequestMapping(value = STR, method = RequestMethod.GET) String function(Model model) { logger.info(STR); model.addAttribute(STR, new Usuario()); logger.info(STR); return STR; } | /**
* Formulario de nuevo usuario [GET]
*
* @param model
* @return
*/ | Formulario de nuevo usuario [GET] | nuevo | {
"repo_name": "gales2015/BibliotecaAlejandria",
"path": "src/main/java/org/alexandrialibrary/spring/controller/UsuarioController.java",
"license": "mit",
"size": 8787
} | [
"org.alexandrialibrary.spring.model.Usuario",
"org.springframework.ui.Model",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod"
] | import org.alexandrialibrary.spring.model.Usuario; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; | import org.alexandrialibrary.spring.model.*; import org.springframework.ui.*; import org.springframework.web.bind.annotation.*; | [
"org.alexandrialibrary.spring",
"org.springframework.ui",
"org.springframework.web"
] | org.alexandrialibrary.spring; org.springframework.ui; org.springframework.web; | 432,283 |
@WebMethod
@WebResult(name = "rval", targetNamespace = "https://www.google.com/apis/ads/publisher/v202111")
@RequestWrapper(localName = "performLiveStreamEventAction", targetNamespace = "https://www.google.com/apis/ads/publisher/v202111", className = "com.google.api.ads.admanager.jaxws.v202111.LiveStreamEventServiceInterfaceperformLiveStreamEventAction")
@ResponseWrapper(localName = "performLiveStreamEventActionResponse", targetNamespace = "https://www.google.com/apis/ads/publisher/v202111", className = "com.google.api.ads.admanager.jaxws.v202111.LiveStreamEventServiceInterfaceperformLiveStreamEventActionResponse")
public UpdateResult performLiveStreamEventAction(
@WebParam(name = "liveStreamEventAction", targetNamespace = "https://www.google.com/apis/ads/publisher/v202111")
LiveStreamEventAction liveStreamEventAction,
@WebParam(name = "filterStatement", targetNamespace = "https://www.google.com/apis/ads/publisher/v202111")
Statement filterStatement)
throws ApiException_Exception
; | @WebResult(name = "rval", targetNamespace = STRperformLiveStreamEventActionSTRhttps: @ResponseWrapper(localName = "performLiveStreamEventActionResponseSTRhttps: UpdateResult function( @WebParam(name = "liveStreamEventActionSTRhttps: LiveStreamEventAction liveStreamEventAction, @WebParam(name = "filterStatementSTRhttps: Statement filterStatement) throws ApiException_Exception ; | /**
*
* Performs actions on {@link LiveStreamEvent} objects that match the given
* {@link Statement#query}.
*
* @param liveStreamEventAction the action to perform
* @param filterStatement a Publisher Query Language statement used to filter
* a set of live stream events
* @return the result of the action performed
*
*
* @param liveStreamEventAction
* @param filterStatement
* @return
* returns com.google.api.ads.admanager.jaxws.v202111.UpdateResult
* @throws ApiException_Exception
*/ | Performs actions on <code>LiveStreamEvent</code> objects that match the given <code>Statement#query</code> | performLiveStreamEventAction | {
"repo_name": "googleads/googleads-java-lib",
"path": "modules/dfp_appengine/src/main/java/com/google/api/ads/admanager/jaxws/v202111/LiveStreamEventServiceInterface.java",
"license": "apache-2.0",
"size": 15748
} | [
"javax.jws.WebParam",
"javax.jws.WebResult",
"javax.xml.ws.ResponseWrapper"
] | import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.ResponseWrapper; | import javax.jws.*; import javax.xml.ws.*; | [
"javax.jws",
"javax.xml"
] | javax.jws; javax.xml; | 988,336 |
TestSuite suite = new TestSuite("Runs all GWT based tests");
suite.addTest(org.opencms.acacia.client.entity.AllTests.suite());
return suite;
} | TestSuite suite = new TestSuite(STR); suite.addTest(org.opencms.acacia.client.entity.AllTests.suite()); return suite; } | /**
* Creates the test suite.<p>
*
* @return the test suite
*/ | Creates the test suite | suite | {
"repo_name": "ggiudetti/opencms-core",
"path": "test-gwt/org/opencms/client/test/AllTests.java",
"license": "lgpl-2.1",
"size": 1659
} | [
"junit.framework.TestSuite"
] | import junit.framework.TestSuite; | import junit.framework.*; | [
"junit.framework"
] | junit.framework; | 1,845,409 |
public void setWidget(Widget widget) {
this.content = widget;
this.type = GridStaticCellType.WIDGET;
section.requestSectionRefresh();
} | void function(Widget widget) { this.content = widget; this.type = GridStaticCellType.WIDGET; section.requestSectionRefresh(); } | /**
* Set widget as the content of the cell. The type of the cell
* becomes {@link GridStaticCellType#WIDGET}. All previous content
* is discarded.
*
* @param widget
* The widget to add to the cell. Should not be
* previously attached anywhere (widget.getParent ==
* null).
*/ | Set widget as the content of the cell. The type of the cell becomes <code>GridStaticCellType#WIDGET</code>. All previous content is discarded | setWidget | {
"repo_name": "travisfw/vaadin",
"path": "client/src/com/vaadin/client/widgets/Grid.java",
"license": "apache-2.0",
"size": 285859
} | [
"com.google.gwt.user.client.ui.Widget",
"com.vaadin.shared.ui.grid.GridStaticCellType"
] | import com.google.gwt.user.client.ui.Widget; import com.vaadin.shared.ui.grid.GridStaticCellType; | import com.google.gwt.user.client.ui.*; import com.vaadin.shared.ui.grid.*; | [
"com.google.gwt",
"com.vaadin.shared"
] | com.google.gwt; com.vaadin.shared; | 2,033,090 |
@SmallTest
@Feature({"ContextualSearch"})
@Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
public void testHttpsAfterAcceptForOptOut() throws InterruptedException, TimeoutException {
mPolicy.overrideDecidedStateForTesting(true);
mFakeServer.setShouldUseHttps(true);
clickToResolveAndAssertPrefetch();
} | @Feature({STR}) @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) void function() throws InterruptedException, TimeoutException { mPolicy.overrideDecidedStateForTesting(true); mFakeServer.setShouldUseHttps(true); clickToResolveAndAssertPrefetch(); } | /**
* Tests that HTTPS does resolve in the opt-out model after the user accepts.
*/ | Tests that HTTPS does resolve in the opt-out model after the user accepts | testHttpsAfterAcceptForOptOut | {
"repo_name": "was4444/chromium.src",
"path": "chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java",
"license": "bsd-3-clause",
"size": 103579
} | [
"java.util.concurrent.TimeoutException",
"org.chromium.base.test.util.Feature",
"org.chromium.base.test.util.Restriction"
] | import java.util.concurrent.TimeoutException; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; | import java.util.concurrent.*; import org.chromium.base.test.util.*; | [
"java.util",
"org.chromium.base"
] | java.util; org.chromium.base; | 1,448,209 |
private void onTerminalChanged() {
View terminalNameOverlay = findCurrentView(R.id.terminal_name_overlay);
if (terminalNameOverlay != null)
terminalNameOverlay.startAnimation(fade_out_delayed);
updateDefault();
updatePromptVisible();
ActivityCompat.invalidateOptionsMenu(ConsoleActivity.this);
} | void function() { View terminalNameOverlay = findCurrentView(R.id.terminal_name_overlay); if (terminalNameOverlay != null) terminalNameOverlay.startAnimation(fade_out_delayed); updateDefault(); updatePromptVisible(); ActivityCompat.invalidateOptionsMenu(ConsoleActivity.this); } | /**
* Called whenever the displayed terminal is changed.
*/ | Called whenever the displayed terminal is changed | onTerminalChanged | {
"repo_name": "lotan/connectbot",
"path": "app/src/main/java/org/connectbot/ConsoleActivity.java",
"license": "apache-2.0",
"size": 42823
} | [
"android.view.View",
"androidx.core.app.ActivityCompat"
] | import android.view.View; import androidx.core.app.ActivityCompat; | import android.view.*; import androidx.core.app.*; | [
"android.view",
"androidx.core"
] | android.view; androidx.core; | 1,425,344 |
@Test
public void testGPIOAnalogPortAllMax() {
String message = " PKT:SID=11;PC=2238;MT=8;MGID=1;MID=10;MD=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;bceeea75";
SHCMessage shcMessage = new SHCMessage(message, packet);
List<Type> values = shcMessage.getData().getOpenHABTypes();
assertEquals(16, values.size());
for (int i = 0; i < values.size(); i += 2) {
assertEquals(OnOffType.ON, values.get(i));
assertEquals(2047, ((DecimalType) values.get(i + 1)).intValue());
}
}
| void function() { String message = STR; SHCMessage shcMessage = new SHCMessage(message, packet); List<Type> values = shcMessage.getData().getOpenHABTypes(); assertEquals(16, values.size()); for (int i = 0; i < values.size(); i += 2) { assertEquals(OnOffType.ON, values.get(i)); assertEquals(2047, ((DecimalType) values.get(i + 1)).intValue()); } } | /**
* test data is: GPIO AnalogPort:
* FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
*/ | test data is: GPIO AnalogPort: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | testGPIOAnalogPortAllMax | {
"repo_name": "watou/openhab",
"path": "bundles/binding/org.openhab.binding.smarthomatic/src/test/java/org/openhab/binding/smarthomatic/TestSHCMessage.java",
"license": "epl-1.0",
"size": 24841
} | [
"java.util.List",
"org.junit.Assert",
"org.openhab.binding.smarthomatic.internal.SHCMessage",
"org.openhab.core.library.types.DecimalType",
"org.openhab.core.library.types.OnOffType",
"org.openhab.core.types.Type"
] | import java.util.List; import org.junit.Assert; import org.openhab.binding.smarthomatic.internal.SHCMessage; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.OnOffType; import org.openhab.core.types.Type; | import java.util.*; import org.junit.*; import org.openhab.binding.smarthomatic.internal.*; import org.openhab.core.library.types.*; import org.openhab.core.types.*; | [
"java.util",
"org.junit",
"org.openhab.binding",
"org.openhab.core"
] | java.util; org.junit; org.openhab.binding; org.openhab.core; | 450,905 |
public void start() throws BundleException {
logger.info("Loading the OSGi Framework Factory");
FrameworkFactory frameworkFactory = ServiceLoader.load(FrameworkFactory.class).iterator()
.next();
logger.info("Creating the OSGi Framework");
framework = frameworkFactory.newFramework(frameworkConfiguration);
logger.info("Starting the OSGi Framework");
framework.start(); | void function() throws BundleException { logger.info(STR); FrameworkFactory frameworkFactory = ServiceLoader.load(FrameworkFactory.class).iterator() .next(); logger.info(STR); framework = frameworkFactory.newFramework(frameworkConfiguration); logger.info(STR); framework.start(); | /**
* Starts the OSGi framework, installs and starts the bundles.
*
* @throws BundleException
* if the framework could not be started
*/ | Starts the OSGi framework, installs and starts the bundles | start | {
"repo_name": "taverna-incubator/incubator-taverna-osgi",
"path": "osgi-launcher/src/main/java/uk/org/taverna/osgi/OsgiLauncher.java",
"license": "apache-2.0",
"size": 13958
} | [
"java.util.ServiceLoader",
"org.osgi.framework.BundleException",
"org.osgi.framework.launch.FrameworkFactory"
] | import java.util.ServiceLoader; import org.osgi.framework.BundleException; import org.osgi.framework.launch.FrameworkFactory; | import java.util.*; import org.osgi.framework.*; import org.osgi.framework.launch.*; | [
"java.util",
"org.osgi.framework"
] | java.util; org.osgi.framework; | 1,109,002 |
@Override
public String getBestProvider(Criteria criteria, boolean enabledOnly) {
String result = null;
List<String> providers = getProviders(criteria, enabledOnly);
if (!providers.isEmpty()) {
result = pickBest(providers);
if (D) Log.d(TAG, "getBestProvider(" + criteria + ", " + enabledOnly + ")=" + result);
return result;
}
providers = getProviders(null, enabledOnly);
if (!providers.isEmpty()) {
result = pickBest(providers);
if (D) Log.d(TAG, "getBestProvider(" + criteria + ", " + enabledOnly + ")=" + result);
return result;
}
if (D) Log.d(TAG, "getBestProvider(" + criteria + ", " + enabledOnly + ")=" + result);
return null;
} | String function(Criteria criteria, boolean enabledOnly) { String result = null; List<String> providers = getProviders(criteria, enabledOnly); if (!providers.isEmpty()) { result = pickBest(providers); if (D) Log.d(TAG, STR + criteria + STR + enabledOnly + ")=" + result); return result; } providers = getProviders(null, enabledOnly); if (!providers.isEmpty()) { result = pickBest(providers); if (D) Log.d(TAG, STR + criteria + STR + enabledOnly + ")=" + result); return result; } if (D) Log.d(TAG, STR + criteria + STR + enabledOnly + ")=" + result); return null; } | /**
* Return the name of the best provider given a Criteria object.
* This method has been deprecated from the public API,
* and the whole LocationProvider (including #meetsCriteria)
* has been deprecated as well. So this method now uses
* some simplified logic.
*/ | Return the name of the best provider given a Criteria object. This method has been deprecated from the public API, and the whole LocationProvider (including #meetsCriteria) has been deprecated as well. So this method now uses some simplified logic | getBestProvider | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/server/LocationManagerService.java",
"license": "apache-2.0",
"size": 99961
} | [
"android.location.Criteria",
"android.util.Log",
"java.util.List"
] | import android.location.Criteria; import android.util.Log; import java.util.List; | import android.location.*; import android.util.*; import java.util.*; | [
"android.location",
"android.util",
"java.util"
] | android.location; android.util; java.util; | 2,528,751 |
public void setParameterService(ParameterService parameterService) {
this.parameterService = parameterService;
} | void function(ParameterService parameterService) { this.parameterService = parameterService; } | /**
* Sets the parameterService attribute value.
* @param parameterService The parameterService to set.
*/ | Sets the parameterService attribute value | setParameterService | {
"repo_name": "blackcathacker/kc.preclean",
"path": "coeus-code/src/main/java/org/kuali/coeus/propdev/impl/budget/ProposalBudgetServiceImpl.java",
"license": "apache-2.0",
"size": 9405
} | [
"org.kuali.rice.coreservice.framework.parameter.ParameterService"
] | import org.kuali.rice.coreservice.framework.parameter.ParameterService; | import org.kuali.rice.coreservice.framework.parameter.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 2,610,730 |
private static float calcWeightedHashValue(final int hashIndex, final float w)
throws HiveException {
if(w < 0.f) {
throw new HiveException("Non-negative value is not accepted for a feature weight");
}
if(w == 0.f) {
return Float.MAX_VALUE;
} else {
return hashIndex / w;
}
} | static float function(final int hashIndex, final float w) throws HiveException { if(w < 0.f) { throw new HiveException(STR); } if(w == 0.f) { return Float.MAX_VALUE; } else { return hashIndex / w; } } | /**
* For a larger w, hash value tends to be smaller and tends to be selected as minhash.
*/ | For a larger w, hash value tends to be smaller and tends to be selected as minhash | calcWeightedHashValue | {
"repo_name": "NaokiStones/hivemall",
"path": "src/main/java/hivemall/knn/lsh/bBitMinHashUDF.java",
"license": "apache-2.0",
"size": 5356
} | [
"org.apache.hadoop.hive.ql.metadata.HiveException"
] | import org.apache.hadoop.hive.ql.metadata.HiveException; | import org.apache.hadoop.hive.ql.metadata.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,466,815 |
public Map<String, NailStats> getNailStats() {
Map<String, NailStats> result = new TreeMap();
synchronized (allNailStats) {
for (Map.Entry<String, NailStats> entry : allNailStats.entrySet()) {
result.put(entry.getKey(), (NailStats) entry.getValue().clone());
}
}
return result;
} | Map<String, NailStats> function() { Map<String, NailStats> result = new TreeMap(); synchronized (allNailStats) { for (Map.Entry<String, NailStats> entry : allNailStats.entrySet()) { result.put(entry.getKey(), (NailStats) entry.getValue().clone()); } } return result; } | /**
* Returns a snapshot of this NGServer's nail statistics. The result is a <code>java.util.Map
* </code>, keyed by class name, with <a href="NailStats.html">NailStats</a> objects as values.
*
* @return a snapshot of this NGServer's nail statistics.
*/ | Returns a snapshot of this NGServer's nail statistics. The result is a <code>java.util.Map </code>, keyed by class name, with NailStats objects as values | getNailStats | {
"repo_name": "martylamb/nailgun",
"path": "nailgun-server/src/main/java/com/facebook/nailgun/NGServer.java",
"license": "apache-2.0",
"size": 19107
} | [
"java.util.Map",
"java.util.TreeMap"
] | import java.util.Map; import java.util.TreeMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,640,911 |
public InputStream getInputStream(int index) {
return ins[index];
} | InputStream function(int index) { return ins[index]; } | /**
* Returns the unbuffered stream with the value for {@code index}.
*/ | Returns the unbuffered stream with the value for index | getInputStream | {
"repo_name": "Proplex/Leaf",
"path": "mainActivity/src/main/java/co/wakarimasen/ceredux/DiskLruCache.java",
"license": "mit",
"size": 33096
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 819,301 |
public HTMLWriter ew(final String tagAndAttrs, String content) {
List<String> p = NWUtils.split(tagAndAttrs, ' ');
String tag = p.get(0);
b.append('<').append(tag);
for (int i = 1; i < p.size(); i++) {
String nameAndValue = p.get(i);
int pos = nameAndValue.indexOf('=');
b.append(' ');
b.append(nameAndValue, 0, pos);
b.append("=\"");
encodeHTML(b, nameAndValue.substring(pos + 1));
b.append('"');
}
b.append('>');
if (content != null) {
encodeHTML(b, content);
}
b.append("</");
b.append(tag);
b.append('>');
return this;
}
| HTMLWriter function(final String tagAndAttrs, String content) { List<String> p = NWUtils.split(tagAndAttrs, ' '); String tag = p.get(0); b.append('<').append(tag); for (int i = 1; i < p.size(); i++) { String nameAndValue = p.get(i); int pos = nameAndValue.indexOf('='); b.append(' '); b.append(nameAndValue, 0, pos); b.append("=\"STR'); } b.append('>'); if (content != null) { encodeHTML(b, content); } b.append("</"); b.append(tag); b.append('>'); return this; } | /**
* Creates a tag.
*
* @param tagAndAttrs name of the tag and attributes separated by spaces.
* Example: "textarea wrap=off"
* @param content text content for the tag. null is treated as an empty
* string
* @return this
*/ | Creates a tag | ew | {
"repo_name": "tim-lebedkov/npackd-gae-web",
"path": "src/main/java/com/googlecode/npackdweb/wlib/HTMLWriter.java",
"license": "gpl-3.0",
"size": 5624
} | [
"com.googlecode.npackdweb.NWUtils",
"java.util.List"
] | import com.googlecode.npackdweb.NWUtils; import java.util.List; | import com.googlecode.npackdweb.*; import java.util.*; | [
"com.googlecode.npackdweb",
"java.util"
] | com.googlecode.npackdweb; java.util; | 731,234 |
private void startBackgroundThread() {
backgroundThread = new HandlerThread("CameraBackground");
backgroundThread.start();
backgroundHandler = new Handler(backgroundThread.getLooper());
} | void function() { backgroundThread = new HandlerThread(STR); backgroundThread.start(); backgroundHandler = new Handler(backgroundThread.getLooper()); } | /**
* Starts a background thread and its Handler.
*/ | Starts a background thread and its Handler | startBackgroundThread | {
"repo_name": "lackary/CameraSample",
"path": "camera2tool/src/main/java/com/lackary/camera2tool/Control/Camera2Instant.java",
"license": "gpl-3.0",
"size": 42877
} | [
"android.os.Handler",
"android.os.HandlerThread"
] | import android.os.Handler; import android.os.HandlerThread; | import android.os.*; | [
"android.os"
] | android.os; | 2,559,462 |
public void writeSyncValue(String storeName, Scope scope,
boolean persist,
byte[] key, Iterable<Versioned<byte[]>> values)
throws PersistException {
SynchronizingStorageEngine store = storeRegistry.get(storeName);
if (store == null) {
store = storeRegistry.register(storeName, scope, persist);
}
store.writeSyncValue(new ByteArray(key), values);
} | void function(String storeName, Scope scope, boolean persist, byte[] key, Iterable<Versioned<byte[]>> values) throws PersistException { SynchronizingStorageEngine store = storeRegistry.get(storeName); if (store == null) { store = storeRegistry.register(storeName, scope, persist); } store.writeSyncValue(new ByteArray(key), values); } | /**
* Write a value synchronized from another node, bypassing some of the
* usual logic when a client writes data. If the store is not known,
* this will automatically register it
* @param storeName the store name
* @param scope the scope for the store
* @param persist TODO
* @param key the key to write
* @param values a list of versions for the key to write
* @throws PersistException
*/ | Write a value synchronized from another node, bypassing some of the usual logic when a client writes data. If the store is not known, this will automatically register it | writeSyncValue | {
"repo_name": "dothub/floodlight",
"path": "src/main/java/org/sdnplatform/sync/internal/SyncManager.java",
"license": "apache-2.0",
"size": 33105
} | [
"org.sdnplatform.sync.Versioned",
"org.sdnplatform.sync.error.PersistException",
"org.sdnplatform.sync.internal.store.SynchronizingStorageEngine",
"org.sdnplatform.sync.internal.util.ByteArray"
] | import org.sdnplatform.sync.Versioned; import org.sdnplatform.sync.error.PersistException; import org.sdnplatform.sync.internal.store.SynchronizingStorageEngine; import org.sdnplatform.sync.internal.util.ByteArray; | import org.sdnplatform.sync.*; import org.sdnplatform.sync.error.*; import org.sdnplatform.sync.internal.store.*; import org.sdnplatform.sync.internal.util.*; | [
"org.sdnplatform.sync"
] | org.sdnplatform.sync; | 325,228 |
@Override
public Shape createTransformedShape(final Shape shape) throws TransformException {
return isIdentity() ? shape : AbstractMathTransform2D.createTransformedShape(this, shape, null, null, false);
} | Shape function(final Shape shape) throws TransformException { return isIdentity() ? shape : AbstractMathTransform2D.createTransformedShape(this, shape, null, null, false); } | /**
* Transforms the specified shape. The default implementation computes quadratic curves
* using three points for each line segment in the shape. The returned object is often
* a {@link Path2D}, but may also be a {@link Line2D} or a {@link QuadCurve2D} if such
* simplification is possible.
*
* @param shape shape to transform.
* @return transformed shape, or {@code shape} if this transform is the identity transform.
* @throws TransformException if a transform failed.
*/ | Transforms the specified shape. The default implementation computes quadratic curves using three points for each line segment in the shape. The returned object is often a <code>Path2D</code>, but may also be a <code>Line2D</code> or a <code>QuadCurve2D</code> if such simplification is possible | createTransformedShape | {
"repo_name": "Geomatys/sis",
"path": "core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform2D.java",
"license": "apache-2.0",
"size": 19208
} | [
"java.awt.Shape",
"org.opengis.referencing.operation.TransformException"
] | import java.awt.Shape; import org.opengis.referencing.operation.TransformException; | import java.awt.*; import org.opengis.referencing.operation.*; | [
"java.awt",
"org.opengis.referencing"
] | java.awt; org.opengis.referencing; | 243,580 |
protected void addWidgetToList(Widget listItem) {
m_scrollList.add(listItem);
onContentChange();
} | void function(Widget listItem) { m_scrollList.add(listItem); onContentChange(); } | /**
* Add a list item widget to the list panel.<p>
*
* @param listItem the list item to add
*/ | Add a list item widget to the list panel | addWidgetToList | {
"repo_name": "it-tavis/opencms-core",
"path": "src-gwt/org/opencms/ade/galleries/client/ui/A_CmsListTab.java",
"license": "lgpl-2.1",
"size": 22797
} | [
"com.google.gwt.user.client.ui.Widget"
] | import com.google.gwt.user.client.ui.Widget; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,410,414 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.