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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public Builder progressNumberFormat(@NonNull String format) {
this.progressNumberFormat = format;
return this;
} | Builder function(@NonNull String format) { this.progressNumberFormat = format; return this; } | /**
* hange the format of the small text showing current and maximum units of progress. The default
* is "%1d/%2d".
*/ | hange the format of the small text showing current and maximum units of progress. The default is "%1d/%2d" | progressNumberFormat | {
"repo_name": "A-Miracle/QiangHongBao",
"path": "core/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java",
"license": "apache-2.0",
"size": 76301
} | [
"androidx.annotation.NonNull"
] | import androidx.annotation.NonNull; | import androidx.annotation.*; | [
"androidx.annotation"
] | androidx.annotation; | 327,142 |
private void patternFilter( PatternDescrBuilder< ? > pattern ) throws RecognitionException {
// if ( input.LA( 1 ) == DRL5Lexer.PIPE ) {
// while ( input.LA( 1 ) == DRL5Lexer.PIPE ) {
// match( input,
// DRL5Lexer.PIPE,
// null,
// null,
// DroolsEditorType.SYMBOL );
// if ( state.failed ) return;
//
// filterDef( pattern );
// if ( state.failed ) return;
// }
// } else {
match( input,
DRL5Lexer.ID,
DroolsSoftKeywords.OVER,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return;
filterDef( pattern );
if ( state.failed ) return;
// }
} | void function( PatternDescrBuilder< ? > pattern ) throws RecognitionException { match( input, DRL5Lexer.ID, DroolsSoftKeywords.OVER, null, DroolsEditorType.KEYWORD ); if ( state.failed ) return; filterDef( pattern ); if ( state.failed ) return; } | /**
* patternFilter := OVER filterDef
* DISALLOWED: | ( PIPE filterDef )+
*
* @param pattern
* @throws RecognitionException
*/ | patternFilter := OVER filterDef | patternFilter | {
"repo_name": "yurloc/drools",
"path": "drools-compiler/src/main/java/org/drools/lang/DRL5Parser.java",
"license": "apache-2.0",
"size": 169427
} | [
"org.antlr.runtime.RecognitionException",
"org.drools.lang.api.PatternDescrBuilder"
] | import org.antlr.runtime.RecognitionException; import org.drools.lang.api.PatternDescrBuilder; | import org.antlr.runtime.*; import org.drools.lang.api.*; | [
"org.antlr.runtime",
"org.drools.lang"
] | org.antlr.runtime; org.drools.lang; | 1,133,111 |
@ApiModelProperty(
required = true,
value =
"The ACME challenge token for this challenge. This is the raw value returned from the ACME server.")
public String getToken() {
return token;
} | @ApiModelProperty( required = true, value = STR) String function() { return token; } | /**
* The ACME challenge token for this challenge. This is the raw value returned from the ACME
* server.
*
* @return token
*/ | The ACME challenge token for this challenge. This is the raw value returned from the ACME server | getToken | {
"repo_name": "kubernetes-client/java",
"path": "client-java-contrib/cert-manager/src/main/java/io/cert/manager/models/V1beta1ChallengeSpec.java",
"license": "apache-2.0",
"size": 11462
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 2,596,501 |
public String getMountedObbPath(String filename) throws RemoteException; | String function(String filename) throws RemoteException; | /**
* Gets the path to the mounted Opaque Binary Blob (OBB).
*/ | Gets the path to the mounted Opaque Binary Blob (OBB) | getMountedObbPath | {
"repo_name": "doctang/TestPlatform",
"path": "AutoTest/src/android/os/storage/IMountService.java",
"license": "apache-2.0",
"size": 54707
} | [
"android.os.RemoteException"
] | import android.os.RemoteException; | import android.os.*; | [
"android.os"
] | android.os; | 898,684 |
void merge(String uri, TriplesWriteHandle handle, GraphPermissions permissions, Transaction transaction)
throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException;
/** <p>Add triples from the graphData object to the specified graph. The
* server can receive the triples as any of the {@link RDFMimeTypes}.
* Specify the mimetype appropriate for your content by calling {@link
* #setDefaultMimetype setDefaultMimetype}.</p>
*
* @param uri the graph uri or {@link #DEFAULT_GRAPH} constant
* @param graphData the object containing triples of appropriate RDFMimeTypesMimetype} | void merge(String uri, TriplesWriteHandle handle, GraphPermissions permissions, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; /** <p>Add triples from the graphData object to the specified graph. The * server can receive the triples as any of the {@link RDFMimeTypes}. * Specify the mimetype appropriate for your content by calling { * #setDefaultMimetype setDefaultMimetype}.</p> * * @param uri the graph uri or {@link #DEFAULT_GRAPH} constant * @param graphData the object containing triples of appropriate RDFMimeTypesMimetype} | /** <p>Add triples from the handle and add specified permissions to the
* specified graph. The server can receive the triples as any of the
* {@link RDFMimeTypes}. Specify the mimetype appropriate for your content
* by calling {@link #setDefaultMimetype setDefaultMimetype} or {@link
* BaseHandle#setMimetype handle.setMimetype} or withMimetype (if
* available) on your handle.</p>
*
* @param uri the graph uri or {@link #DEFAULT_GRAPH} constant
* @param handle the handle containing triples of appropriate RDFMimeTypes
* @param permissions the permissions to add to this graph
* @param transaction the open transaction to write in
*/ | Add triples from the handle and add specified permissions to the specified graph. The server can receive the triples as any of the <code>RDFMimeTypes</code>. Specify the mimetype appropriate for your content by calling <code>#setDefaultMimetype setDefaultMimetype</code> or <code>BaseHandle#setMimetype handle.setMimetype</code> or withMimetype (if available) on your handle | merge | {
"repo_name": "marklogic/java-client-api",
"path": "marklogic-client-api/src/main/java/com/marklogic/client/semantics/GraphManager.java",
"license": "apache-2.0",
"size": 32807
} | [
"com.marklogic.client.FailedRequestException",
"com.marklogic.client.ForbiddenUserException",
"com.marklogic.client.ResourceNotFoundException",
"com.marklogic.client.Transaction",
"com.marklogic.client.io.marker.TriplesWriteHandle"
] | import com.marklogic.client.FailedRequestException; import com.marklogic.client.ForbiddenUserException; import com.marklogic.client.ResourceNotFoundException; import com.marklogic.client.Transaction; import com.marklogic.client.io.marker.TriplesWriteHandle; | import com.marklogic.client.*; import com.marklogic.client.io.marker.*; | [
"com.marklogic.client"
] | com.marklogic.client; | 1,682,924 |
public static List<Person> getPersonRepeated(int copies){
ArrayList<Person> list = new ArrayList<Person>();
for(int i = 0; i < copies; i++){
List<Person> singleList =
JsonUtils.convertToList(
"eu/dnetlib/iis/core/examples/data/person.json",
Person.SCHEMA$, Person.class);
list.addAll(singleList);
}
return list;
}
| static List<Person> function(int copies){ ArrayList<Person> list = new ArrayList<Person>(); for(int i = 0; i < copies; i++){ List<Person> singleList = JsonUtils.convertToList( STR, Person.SCHEMA$, Person.class); list.addAll(singleList); } return list; } | /**
* Similar to {@link getPerson()}, but the records are repeated a
* couple of times.
* @param copies number of times the records are repeated
* @throws IOException
*/ | Similar to <code>getPerson()</code>, but the records are repeated a couple of times | getPersonRepeated | {
"repo_name": "openaire/iis-examples",
"path": "src/main/java/eu/dnetlib/iis/core/examples/StandardDataStoreExamples.java",
"license": "apache-2.0",
"size": 8923
} | [
"eu.dnetlib.iis.common.java.io.JsonUtils",
"eu.dnetlib.iis.core.examples.schemas.documentandauthor.Person",
"java.util.ArrayList",
"java.util.List"
] | import eu.dnetlib.iis.common.java.io.JsonUtils; import eu.dnetlib.iis.core.examples.schemas.documentandauthor.Person; import java.util.ArrayList; import java.util.List; | import eu.dnetlib.iis.common.java.io.*; import eu.dnetlib.iis.core.examples.schemas.documentandauthor.*; import java.util.*; | [
"eu.dnetlib.iis",
"java.util"
] | eu.dnetlib.iis; java.util; | 1,011,785 |
public void setLocale(Locale locale) {
lock();
try {
native_setLocale(locale.toString(), mFlags);
} finally {
unlock();
}
} | void function(Locale locale) { lock(); try { native_setLocale(locale.toString(), mFlags); } finally { unlock(); } } | /**
* Sets the locale for this database. Does nothing if this database has
* the NO_LOCALIZED_COLLATORS flag set or was opened read only.
* @throws SQLException if the locale could not be set. The most common reason
* for this is that there is no collator available for the locale you requested.
* In this case the database remains unchanged.
*/ | Sets the locale for this database. Does nothing if this database has the NO_LOCALIZED_COLLATORS flag set or was opened read only | setLocale | {
"repo_name": "mateor/pdroid",
"path": "android-4.0.3_r1/trunk/frameworks/base/core/java/android/database/sqlite/SQLiteDatabase.java",
"license": "gpl-3.0",
"size": 113971
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,722,253 |
@SuppressWarnings("unchecked")
private DynamoDBMapping readMapping() throws IOException {
DynamoDBMappingBuilder mappingBuilder = new DynamoDBMappingBuilder();
try {
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(getClass().getClassLoader().getResourceAsStream(MAPPING_FILE));
Element root = doc.getRootElement();
List<Element> tableElements = root.getChildren("table");
for(Element tableElement : tableElements) {
String tableName = tableElement.getAttributeValue("name");
long readCapacUnits = Long.parseLong(tableElement.getAttributeValue("readcunit"));
long writeCapacUnits = Long.parseLong(tableElement.getAttributeValue("writecunit"));
mappingBuilder.setTableName(tableName);
mappingBuilder.setProvisionedThroughput(tableName, readCapacUnits, writeCapacUnits);
LOG.debug("Basic table properties have been set: Name, and Provisioned throughput.");
// Retrieving key's features
List<Element> fieldElements = tableElement.getChildren("key");
for(Element fieldElement : fieldElements) {
String keyName = fieldElement.getAttributeValue("name");
String keyType = fieldElement.getAttributeValue("type");
String keyAttrType = fieldElement.getAttributeValue("att-type");
if(keyType.equals("hash"))
mappingBuilder.setHashKeySchema(tableName, keyName, keyAttrType);
else if(keyType.equals("hashrange"))
mappingBuilder.setHashRangeKeySchema(tableName, keyName, keyAttrType);
}
LOG.debug("Table key schemas have been set.");
// Retrieving attributes
fieldElements = tableElement.getChildren("attribute");
for(Element fieldElement : fieldElements) {
String attributeName = fieldElement.getAttributeValue("name");
String attributeType = fieldElement.getAttributeValue("type");
mappingBuilder.addAttribute(tableName, attributeName, attributeType, 0);
}
LOG.debug("Table attributes have been read.");
}
} catch(IOException ex) {
LOG.error("Error while performing xml mapping.");
ex.printStackTrace();
throw ex;
} catch(Exception ex) {
LOG.error("Error while performing xml mapping.");
ex.printStackTrace();
throw new IOException(ex);
}
return mappingBuilder.build();
} | @SuppressWarnings(STR) DynamoDBMapping function() throws IOException { DynamoDBMappingBuilder mappingBuilder = new DynamoDBMappingBuilder(); try { SAXBuilder builder = new SAXBuilder(); Document doc = builder.build(getClass().getClassLoader().getResourceAsStream(MAPPING_FILE)); Element root = doc.getRootElement(); List<Element> tableElements = root.getChildren("table"); for(Element tableElement : tableElements) { String tableName = tableElement.getAttributeValue("name"); long readCapacUnits = Long.parseLong(tableElement.getAttributeValue(STR)); long writeCapacUnits = Long.parseLong(tableElement.getAttributeValue(STR)); mappingBuilder.setTableName(tableName); mappingBuilder.setProvisionedThroughput(tableName, readCapacUnits, writeCapacUnits); LOG.debug(STR); List<Element> fieldElements = tableElement.getChildren("key"); for(Element fieldElement : fieldElements) { String keyName = fieldElement.getAttributeValue("name"); String keyType = fieldElement.getAttributeValue("type"); String keyAttrType = fieldElement.getAttributeValue(STR); if(keyType.equals("hash")) mappingBuilder.setHashKeySchema(tableName, keyName, keyAttrType); else if(keyType.equals(STR)) mappingBuilder.setHashRangeKeySchema(tableName, keyName, keyAttrType); } LOG.debug(STR); fieldElements = tableElement.getChildren(STR); for(Element fieldElement : fieldElements) { String attributeName = fieldElement.getAttributeValue("name"); String attributeType = fieldElement.getAttributeValue("type"); mappingBuilder.addAttribute(tableName, attributeName, attributeType, 0); } LOG.debug(STR); } } catch(IOException ex) { LOG.error(STR); ex.printStackTrace(); throw ex; } catch(Exception ex) { LOG.error(STR); ex.printStackTrace(); throw new IOException(ex); } return mappingBuilder.build(); } | /**
* Reads the schema file and converts it into a data structure to be used
* @param pMapFile The schema file to be mapped into a table
* @return DynamoDBMapping Object containing all necessary information to create tables
* @throws IOException
*/ | Reads the schema file and converts it into a data structure to be used | readMapping | {
"repo_name": "infospace/gora",
"path": "gora-dynamodb/src/main/java/org/apache/gora/dynamodb/store/DynamoDBStore.java",
"license": "apache-2.0",
"size": 28006
} | [
"java.io.IOException",
"java.util.List",
"org.apache.gora.dynamodb.store.DynamoDBMapping",
"org.jdom.Document",
"org.jdom.Element",
"org.jdom.input.SAXBuilder"
] | import java.io.IOException; import java.util.List; import org.apache.gora.dynamodb.store.DynamoDBMapping; import org.jdom.Document; import org.jdom.Element; import org.jdom.input.SAXBuilder; | import java.io.*; import java.util.*; import org.apache.gora.dynamodb.store.*; import org.jdom.*; import org.jdom.input.*; | [
"java.io",
"java.util",
"org.apache.gora",
"org.jdom",
"org.jdom.input"
] | java.io; java.util; org.apache.gora; org.jdom; org.jdom.input; | 2,853,421 |
private static Exception errorDecoder(final String methodKey, final Response response) {
final String firstLine = String.format("Status %s reading %s", response.status(), methodKey);
throw Optional.ofNullable(response.body())
.map(
body -> {
try (BufferedReader reader = new BufferedReader(body.asReader())) {
final String errorMessageBody = reader.lines().collect(Collectors.joining("\n"));
return new HttpInteractionException(
response.status(), firstLine + "\n" + errorMessageBody);
} catch (final IOException e) {
log.log(Level.INFO, "An additional error occurred when decoding response", e);
return new HttpInteractionException(response.status(), firstLine);
}
})
.orElseGet(() -> new HttpInteractionException(response.status(), firstLine));
} | static Exception function(final String methodKey, final Response response) { final String firstLine = String.format(STR, response.status(), methodKey); throw Optional.ofNullable(response.body()) .map( body -> { try (BufferedReader reader = new BufferedReader(body.asReader())) { final String errorMessageBody = reader.lines().collect(Collectors.joining("\n")); return new HttpInteractionException( response.status(), firstLine + "\n" + errorMessageBody); } catch (final IOException e) { log.log(Level.INFO, STR, e); return new HttpInteractionException(response.status(), firstLine); } }) .orElseGet(() -> new HttpInteractionException(response.status(), firstLine)); } | /**
* This decoder acts similar to the default decoder where the method key and response status codes
* are printed, but in addition, if present, any server response body message is also printed.
*/ | This decoder acts similar to the default decoder where the method key and response status codes are printed, but in addition, if present, any server response body message is also printed | errorDecoder | {
"repo_name": "ssoloff/triplea-game-triplea",
"path": "http-clients/src/main/java/org/triplea/http/client/HttpClient.java",
"license": "gpl-3.0",
"size": 3503
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.util.Optional",
"java.util.logging.Level",
"java.util.stream.Collectors"
] | import java.io.BufferedReader; import java.io.IOException; import java.util.Optional; import java.util.logging.Level; import java.util.stream.Collectors; | import java.io.*; import java.util.*; import java.util.logging.*; import java.util.stream.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,582,988 |
public void addSubClassOf() {
Base.removeAll(this.model, this.getResource(), SUBCLASSOF);
}
| void function() { Base.removeAll(this.model, this.getResource(), SUBCLASSOF); } | /**
* Removes all values of property SubClassOf *
* [Generated from RDFReactor template rule #removeall1dynamic]
*/ | Removes all values of property SubClassOf [Generated from RDFReactor template rule #removeall1dynamic] | addSubClassOf | {
"repo_name": "semweb4j/semweb4j",
"path": "org.semweb4j.rdfreactor.generator/src/main/java/org/ontoware/rdfreactor/schema/bootstrap/Class.java",
"license": "bsd-2-clause",
"size": 18262
} | [
"org.ontoware.rdfreactor.runtime.Base"
] | import org.ontoware.rdfreactor.runtime.Base; | import org.ontoware.rdfreactor.runtime.*; | [
"org.ontoware.rdfreactor"
] | org.ontoware.rdfreactor; | 611,972 |
@Test
public void testGzipSupport() throws Exception {
final String entityText = "Hello, this is some plain text coming back.";
this.serverBootstrap.registerHandler("*", createGzipEncodingRequestHandler(entityText));
final HttpHost target = start();
final HttpGet request = new HttpGet("/some-resource");
final HttpResponse response = this.httpclient.execute(target, request);
Assert.assertEquals("The entity text is correctly transported", entityText,
EntityUtils.toString(response.getEntity()));
} | void function() throws Exception { final String entityText = STR; this.serverBootstrap.registerHandler("*", createGzipEncodingRequestHandler(entityText)); final HttpHost target = start(); final HttpGet request = new HttpGet(STR); final HttpResponse response = this.httpclient.execute(target, request); Assert.assertEquals(STR, entityText, EntityUtils.toString(response.getEntity())); } | /**
* Test for a server returning gzipped content.
*
* @throws Exception
*/ | Test for a server returning gzipped content | testGzipSupport | {
"repo_name": "byronka/xenos",
"path": "lib/lib_src/httpcomponents_source/httpcomponents-client-4.4/httpclient/src/test/java/org/apache/http/impl/client/integration/TestContentCodings.java",
"license": "mit",
"size": 17714
} | [
"org.apache.http.HttpHost",
"org.apache.http.HttpResponse",
"org.apache.http.client.methods.HttpGet",
"org.apache.http.util.EntityUtils",
"org.junit.Assert"
] | import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.util.EntityUtils; import org.junit.Assert; | import org.apache.http.*; import org.apache.http.client.methods.*; import org.apache.http.util.*; import org.junit.*; | [
"org.apache.http",
"org.junit"
] | org.apache.http; org.junit; | 2,110,007 |
@Override
public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) {
Object childFeature = feature;
Object childObject = child;
boolean qualify =
childFeature == EcorePackage.Literals.EPACKAGE__ECLASSIFIERS ||
childFeature == DictionaryPackage.Literals.EACTIVITY_DICTIONARY__EXTENDED_DEFINITIONS;
if (qualify) {
return getString
("_UI_CreateChild_text2",
new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
}
return super.getCreateChildText(owner, feature, child, selection);
} | String function(Object owner, Object feature, Object child, Collection<?> selection) { Object childFeature = feature; Object childObject = child; boolean qualify = childFeature == EcorePackage.Literals.EPACKAGE__ECLASSIFIERS childFeature == DictionaryPackage.Literals.EACTIVITY_DICTIONARY__EXTENDED_DEFINITIONS; if (qualify) { return getString (STR, new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); } return super.getCreateChildText(owner, feature, child, selection); } | /**
* This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for <code>org.eclipse.emf.edit.command.CreateChildCommand</code>. | getCreateChildText | {
"repo_name": "nasa/OpenSPIFe",
"path": "gov.nasa.ensemble.dictionary/src/gov/nasa/ensemble/dictionary/provider/EActivityDictionaryItemProvider.java",
"license": "apache-2.0",
"size": 14115
} | [
"gov.nasa.ensemble.dictionary.DictionaryPackage",
"java.util.Collection",
"org.eclipse.emf.ecore.EcorePackage"
] | import gov.nasa.ensemble.dictionary.DictionaryPackage; import java.util.Collection; import org.eclipse.emf.ecore.EcorePackage; | import gov.nasa.ensemble.dictionary.*; import java.util.*; import org.eclipse.emf.ecore.*; | [
"gov.nasa.ensemble",
"java.util",
"org.eclipse.emf"
] | gov.nasa.ensemble; java.util; org.eclipse.emf; | 500,823 |
public ServiceFuture<PublicIPPrefixInner> updateTagsAsync(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags, final ServiceCallback<PublicIPPrefixInner> serviceCallback) {
return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags), serviceCallback);
} | ServiceFuture<PublicIPPrefixInner> function(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags, final ServiceCallback<PublicIPPrefixInner> serviceCallback) { return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName, tags), serviceCallback); } | /**
* Updates public IP prefix tags.
*
* @param resourceGroupName The name of the resource group.
* @param publicIpPrefixName The name of the public IP prefix.
* @param tags Resource tags.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Updates public IP prefix tags | updateTagsAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/network/v2020_06_01/implementation/PublicIPPrefixesInner.java",
"license": "mit",
"size": 69595
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture",
"java.util.Map"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.Map; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 434,427 |
public IDataset getIncident_energy(); | IDataset function(); | /**
* Energy on entering beamline component
* <p>
* <b>Type:</b> NX_FLOAT
* <b>Units:</b> NX_ENERGY
* <b>Dimensions:</b> 1: i;
* </p>
*
* @return the value.
*/ | Energy on entering beamline component Type: NX_FLOAT Units: NX_ENERGY Dimensions: 1: i; | getIncident_energy | {
"repo_name": "Anthchirp/dawnsci",
"path": "org.eclipse.dawnsci.nexus/src/org/eclipse/dawnsci/nexus/NXbeam.java",
"license": "epl-1.0",
"size": 5394
} | [
"org.eclipse.dawnsci.analysis.api.dataset.IDataset"
] | import org.eclipse.dawnsci.analysis.api.dataset.IDataset; | import org.eclipse.dawnsci.analysis.api.dataset.*; | [
"org.eclipse.dawnsci"
] | org.eclipse.dawnsci; | 578,162 |
@Generated
@CVariable()
@NInt
public static native long GCKeyCodeKeypadPlus(); | @CVariable() static native long function(); | /**
* Keypad +
*/ | Keypad + | GCKeyCodeKeypadPlus | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/gamecontroller/c/GameController.java",
"license": "apache-2.0",
"size": 61506
} | [
"org.moe.natj.c.ann.CVariable"
] | import org.moe.natj.c.ann.CVariable; | import org.moe.natj.c.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 1,250,287 |
void addChangeListener(RendererChangeListener listener); | void addChangeListener(RendererChangeListener listener); | /**
* Adds a change listener.
*
* @param listener the listener.
*/ | Adds a change listener | addChangeListener | {
"repo_name": "jfree/jfreechart",
"path": "src/main/java/org/jfree/chart/renderer/PolarItemRenderer.java",
"license": "lgpl-2.1",
"size": 6378
} | [
"org.jfree.chart.event.RendererChangeListener"
] | import org.jfree.chart.event.RendererChangeListener; | import org.jfree.chart.event.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 87,858 |
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getAD_User_ID()));
} | KeyNamePair function() { return new KeyNamePair(get_ID(), String.valueOf(getAD_User_ID())); } | /** Get Record ID/ColumnName
@return ID/ColumnName pair
*/ | Get Record ID/ColumnName | getKeyNamePair | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/X_B_BuyerFunds.java",
"license": "gpl-2.0",
"size": 6423
} | [
"org.compiere.util.KeyNamePair"
] | import org.compiere.util.KeyNamePair; | import org.compiere.util.*; | [
"org.compiere.util"
] | org.compiere.util; | 1,777,219 |
private static void initDefaultLogger() {
Properties props = new Properties();
props.setProperty("log4j.rootLogger", "INFO, A1");
props.setProperty("log4j.appender.A1", "org.apache.log4j.ConsoleAppender");
props.setProperty("log4j.appender.A1.layout", "org.apache.log4j.PatternLayout");
props.setProperty("log4j.appender.A1.layout.ConversionPattern", "%-4r [%t] %-5p %c %x - %m%n");
PropertyConfigurator.configure(props);
} | static void function() { Properties props = new Properties(); props.setProperty(STR, STR); props.setProperty(STR, STR); props.setProperty(STR, STR); props.setProperty(STR, STR); PropertyConfigurator.configure(props); } | /**
* Initialize log4j with a default logger.
* Only to be used with short CLI runs: --version or --help.
*/ | Initialize log4j with a default logger. Only to be used with short CLI runs: --version or --help | initDefaultLogger | {
"repo_name": "linqs/psl",
"path": "psl-parser/src/main/java/org/linqs/psl/parser/CommandLineLoader.java",
"license": "apache-2.0",
"size": 17402
} | [
"java.util.Properties",
"org.apache.log4j.PropertyConfigurator"
] | import java.util.Properties; import org.apache.log4j.PropertyConfigurator; | import java.util.*; import org.apache.log4j.*; | [
"java.util",
"org.apache.log4j"
] | java.util; org.apache.log4j; | 1,942,810 |
public static JSONObject tableAction(JSONObject cols, int count) {
JSONObject json = new JSONObject(true)
.put("type", RenderType.table.name())
.put("columns", cols)
.put("count", count);
return json;
} | static JSONObject function(JSONObject cols, int count) { JSONObject json = new JSONObject(true) .put("type", RenderType.table.name()) .put(STR, cols) .put("count", count); return json; } | /**
* table action: to draw a table. The columns of the table must be selected and named
* @param cols a mapping from column names in th data object to the display names for the client rendering
* @return the action
*/ | table action: to draw a table. The columns of the table must be selected and named | tableAction | {
"repo_name": "DravitLochan/susi_server",
"path": "src/ai/susi/mind/SusiAction.java",
"license": "lgpl-2.1",
"size": 17235
} | [
"org.json.JSONObject"
] | import org.json.JSONObject; | import org.json.*; | [
"org.json"
] | org.json; | 2,318,436 |
boolean removeCircleFromField(String circle, ProfileField<?> field, SPFPersona p) {
if (field.getIdentifier().equals(ProfileField.IDENTIFIER.getIdentifier()) || field.getIdentifier().equals(ProfileField.DISPLAY_NAME.getIdentifier())) {
return false;
}
SQLiteDatabase db = getWritableDatabase();
return removeCircleFromField(circle, field, p, db);
} | boolean removeCircleFromField(String circle, ProfileField<?> field, SPFPersona p) { if (field.getIdentifier().equals(ProfileField.IDENTIFIER.getIdentifier()) field.getIdentifier().equals(ProfileField.DISPLAY_NAME.getIdentifier())) { return false; } SQLiteDatabase db = getWritableDatabase(); return removeCircleFromField(circle, field, p, db); } | /**
* Remove a circle from a specified profile field.
*
* @param field
* the {@link ProfileField} to modify
* @param circle
* - the circle to add
* @param p
* - the {@link SPFPersona} to modify
* @return true if the operation was successful
*/ | Remove a circle from a specified profile field | removeCircleFromField | {
"repo_name": "deib-polimi/SPF2",
"path": "sPFFramework/src/main/java/it/polimi/spf/framework/profile/ProfileTable.java",
"license": "lgpl-3.0",
"size": 19690
} | [
"android.database.sqlite.SQLiteDatabase",
"it.polimi.spf.shared.model.ProfileField"
] | import android.database.sqlite.SQLiteDatabase; import it.polimi.spf.shared.model.ProfileField; | import android.database.sqlite.*; import it.polimi.spf.shared.model.*; | [
"android.database",
"it.polimi.spf"
] | android.database; it.polimi.spf; | 477,046 |
private static String urlEncode(final String text) throws UnsupportedEncodingException {
return URLEncoder.encode(text, "UTF-8");
}
public static class Graph {
private final String name;
private final Set<Plotter> plotters = new LinkedHashSet<Plotter>();
private Graph(final String name) {
this.name = name;
} | static String function(final String text) throws UnsupportedEncodingException { return URLEncoder.encode(text, "UTF-8"); } public static class Graph { private final String name; private final Set<Plotter> plotters = new LinkedHashSet<Plotter>(); private Graph(final String name) { this.name = name; } | /**
* Encode text as UTF-8
*
* @param text
* the text to encode
* @return the encoded text, as UTF-8
*/ | Encode text as UTF-8 | urlEncode | {
"repo_name": "Zarius/Bukkit-OtherBlocks",
"path": "src/com/gmail/zariust/otherdrops/metrics/Metrics.java",
"license": "gpl-3.0",
"size": 24855
} | [
"java.io.UnsupportedEncodingException",
"java.net.URLEncoder",
"java.util.LinkedHashSet",
"java.util.Set"
] | import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.LinkedHashSet; import java.util.Set; | import java.io.*; import java.net.*; import java.util.*; | [
"java.io",
"java.net",
"java.util"
] | java.io; java.net; java.util; | 2,869,360 |
@SuppressWarnings("unchecked") // for retrieval of session attributes
public UserEvent process(HttpServletRequest request, HttpServletResponse response,
ISession session, SAML2IDP organization,
Hashtable<String, String> attributeMapper) throws OAException
{
_logger.debug("Request recieved: " + request.getRequestURL().toString());
Boolean boolResponse = (Boolean)request.getAttribute(SAML2AuthNConstants.RESPONSE_ENDPOINT_PARAM);
if (boolResponse != null && boolResponse)
{
return handleResponse(request, session, organization, attributeMapper);
}
return createAuthNRequest(request, response, session,
organization);
}
| @SuppressWarnings(STR) UserEvent function(HttpServletRequest request, HttpServletResponse response, ISession session, SAML2IDP organization, Hashtable<String, String> attributeMapper) throws OAException { _logger.debug(STR + request.getRequestURL().toString()); Boolean boolResponse = (Boolean)request.getAttribute(SAML2AuthNConstants.RESPONSE_ENDPOINT_PARAM); if (boolResponse != null && boolResponse) { return handleResponse(request, session, organization, attributeMapper); } return createAuthNRequest(request, response, session, organization); } | /**
* Processes the event according to the implemented profile.
*
* @param request The HTTP request.
* @param response The HTTP response.
* @param session The Authentication Session.
* @param organization The SAML organization.
* @param attributeMapper The Table with attributes.
*
* @return The resulting User event.
* @throws OAException If an error occurs.
*/ | Processes the event according to the implemented profile | process | {
"repo_name": "GluuFederation/gluu-Asimba",
"path": "asimba-am-remote-saml2/src/main/java/com/alfaariss/oa/authentication/remote/saml2/profile/sso/WebBrowserSSOProfile.java",
"license": "agpl-3.0",
"size": 44248
} | [
"com.alfaariss.oa.OAException",
"com.alfaariss.oa.UserEvent",
"com.alfaariss.oa.api.session.ISession",
"com.alfaariss.oa.authentication.remote.saml2.SAML2AuthNConstants",
"java.util.Hashtable",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import com.alfaariss.oa.OAException; import com.alfaariss.oa.UserEvent; import com.alfaariss.oa.api.session.ISession; import com.alfaariss.oa.authentication.remote.saml2.SAML2AuthNConstants; import java.util.Hashtable; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import com.alfaariss.oa.*; import com.alfaariss.oa.api.session.*; import com.alfaariss.oa.authentication.remote.saml2.*; import java.util.*; import javax.servlet.http.*; | [
"com.alfaariss.oa",
"java.util",
"javax.servlet"
] | com.alfaariss.oa; java.util; javax.servlet; | 1,530,571 |
public Property<ZoneId> zoneIdProperty() {
return zoneId;
} | Property<ZoneId> function() { return zoneId; } | /**
* The zoneId property
*
* @return the zoneId property
*/ | The zoneId property | zoneIdProperty | {
"repo_name": "fthevenet/binjr",
"path": "binjr-core/src/main/java/eu/binjr/common/javafx/controls/ZonedDateTimePicker.java",
"license": "apache-2.0",
"size": 6158
} | [
"java.time.ZoneId"
] | import java.time.ZoneId; | import java.time.*; | [
"java.time"
] | java.time; | 230,750 |
protected void decryptEncryptedAssertions(final Response response, final Decrypter decrypter) {
for (EncryptedAssertion encryptedAssertion : response.getEncryptedAssertions()) {
try {
Assertion decryptedAssertion = decrypter.decrypt(encryptedAssertion);
response.getAssertions().add(decryptedAssertion);
} catch (DecryptionException e) {
logger.error("Decryption of assertion failed, continue with the next one", e);
}
}
} | void function(final Response response, final Decrypter decrypter) { for (EncryptedAssertion encryptedAssertion : response.getEncryptedAssertions()) { try { Assertion decryptedAssertion = decrypter.decrypt(encryptedAssertion); response.getAssertions().add(decryptedAssertion); } catch (DecryptionException e) { logger.error(STR, e); } } } | /**
* Decrypt encrypted assertions and add them to the assertions list of the response.
*
* @param response
* @param decrypter
*/ | Decrypt encrypted assertions and add them to the assertions list of the response | decryptEncryptedAssertions | {
"repo_name": "F0REacH/pac4j-1.5.1",
"path": "pac4j-saml/src/main/java/org/pac4j/saml/sso/Saml2ResponseValidator.java",
"license": "apache-2.0",
"size": 18103
} | [
"org.opensaml.saml2.core.Assertion",
"org.opensaml.saml2.core.EncryptedAssertion",
"org.opensaml.saml2.core.Response",
"org.opensaml.saml2.encryption.Decrypter",
"org.opensaml.xml.encryption.DecryptionException"
] | import org.opensaml.saml2.core.Assertion; import org.opensaml.saml2.core.EncryptedAssertion; import org.opensaml.saml2.core.Response; import org.opensaml.saml2.encryption.Decrypter; import org.opensaml.xml.encryption.DecryptionException; | import org.opensaml.saml2.core.*; import org.opensaml.saml2.encryption.*; import org.opensaml.xml.encryption.*; | [
"org.opensaml.saml2",
"org.opensaml.xml"
] | org.opensaml.saml2; org.opensaml.xml; | 2,603,306 |
public Iterator<String> findPropertyKeys( final String prefix ) {
if ( prefix == null ) {
throw new NullPointerException( "Prefix must not be null" );
}
final HashSet<String> keys = new HashSet<String>();
collectPropertyKeys( prefix, this, keys );
final String[] objects = keys.toArray( new String[ keys.size() ] );
Arrays.sort( objects );
return Arrays.asList( objects ).iterator();
} | Iterator<String> function( final String prefix ) { if ( prefix == null ) { throw new NullPointerException( STR ); } final HashSet<String> keys = new HashSet<String>(); collectPropertyKeys( prefix, this, keys ); final String[] objects = keys.toArray( new String[ keys.size() ] ); Arrays.sort( objects ); return Arrays.asList( objects ).iterator(); } | /**
* Searches all property keys that start with a given prefix.
*
* @param prefix the prefix that all selected property keys should share
* @return the properties as iterator.
*/ | Searches all property keys that start with a given prefix | findPropertyKeys | {
"repo_name": "mbatchelor/pentaho-reporting",
"path": "libraries/libbase/src/main/java/org/pentaho/reporting/libraries/base/config/HierarchicalConfiguration.java",
"license": "lgpl-2.1",
"size": 10934
} | [
"java.util.Arrays",
"java.util.HashSet",
"java.util.Iterator"
] | import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 942,497 |
public static void delete(String dir, String file) {
if (connection == null)
return;
try {
deleteMapStmt.setString(1, dir);
deleteMapStmt.setString(2, file);
cacheSize -= deleteMapStmt.executeUpdate();
updateCacheSize();
} catch (SQLException e) {
ErrorHandler.error("Failed to delete beatmap entry from database.", e, true);
}
} | static void function(String dir, String file) { if (connection == null) return; try { deleteMapStmt.setString(1, dir); deleteMapStmt.setString(2, file); cacheSize -= deleteMapStmt.executeUpdate(); updateCacheSize(); } catch (SQLException e) { ErrorHandler.error(STR, e, true); } } | /**
* Deletes the beatmap entry from the database.
* @param dir the directory
* @param file the file
*/ | Deletes the beatmap entry from the database | delete | {
"repo_name": "kanekikun420/opsu",
"path": "src/itdelatrisu/opsu/db/BeatmapDB.java",
"license": "gpl-3.0",
"size": 18924
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 333,387 |
public void initialize(LocalRegion subRegion,
InternalRegionArguments internalRegionArgs) throws RegionExistsException,
TimeoutException, IOException, ClassNotFoundException {
boolean success = false;
try {
try {
// releases initialization Latches
subRegion.initialize(internalRegionArgs.getSnapshotInputStream(),
internalRegionArgs.getImageTarget(), internalRegionArgs);
// register the region with resource manager to get heap events
if (!subRegion.isInternalRegion()) {
if (!subRegion.isDestroyed) {
cache.getResourceManager().addResourceListener(ResourceType.MEMORY, subRegion);
InternalDistributedSystem system = this.cache.getDistributedSystem();
system.handleResourceEvent(ResourceEvent.REGION_CREATE, subRegion);
}
}
success = true;
} catch (CancelException e) {
// don't print a call stack
throw e;
} catch (RedundancyAlreadyMetException e) {
// don't log this
throw e;
} catch (final RuntimeException validationException) {
this.cache.getLoggerI18n().warning(
LocalizedStrings.LocalRegion_INITIALIZATION_FAILED_FOR_REGION_0,
subRegion.getFullPath(), validationException);
throw validationException;
} catch (Error e) {
this.cache.getLoggerI18n().warning(
LocalizedStrings.LocalRegion_INITIALIZATION_FAILED_FOR_REGION_0,
subRegion.getFullPath(), e);
throw e;
} finally {
if (!success) {
this.cache.setRegionByPath(subRegion.getFullPath(), null);
initializationFailed(subRegion);
cache.getResourceManager(false).removeResourceListener(subRegion);
}
}
subRegion.postCreateRegion();
} finally {
// make sure region initialization latch is open regardless
// before returning;
// if the latch is not open at this point, then an exception must
// have occurred
if (subRegion != null && !subRegion.isInitialized()) {
getCache().getLoggerI18n().fine(
"Region initialize latch is closed, Error must have occurred");
}
}
} | void function(LocalRegion subRegion, InternalRegionArguments internalRegionArgs) throws RegionExistsException, TimeoutException, IOException, ClassNotFoundException { boolean success = false; try { try { subRegion.initialize(internalRegionArgs.getSnapshotInputStream(), internalRegionArgs.getImageTarget(), internalRegionArgs); if (!subRegion.isInternalRegion()) { if (!subRegion.isDestroyed) { cache.getResourceManager().addResourceListener(ResourceType.MEMORY, subRegion); InternalDistributedSystem system = this.cache.getDistributedSystem(); system.handleResourceEvent(ResourceEvent.REGION_CREATE, subRegion); } } success = true; } catch (CancelException e) { throw e; } catch (RedundancyAlreadyMetException e) { throw e; } catch (final RuntimeException validationException) { this.cache.getLoggerI18n().warning( LocalizedStrings.LocalRegion_INITIALIZATION_FAILED_FOR_REGION_0, subRegion.getFullPath(), validationException); throw validationException; } catch (Error e) { this.cache.getLoggerI18n().warning( LocalizedStrings.LocalRegion_INITIALIZATION_FAILED_FOR_REGION_0, subRegion.getFullPath(), e); throw e; } finally { if (!success) { this.cache.setRegionByPath(subRegion.getFullPath(), null); initializationFailed(subRegion); cache.getResourceManager(false).removeResourceListener(subRegion); } } subRegion.postCreateRegion(); } finally { if (subRegion != null && !subRegion.isInitialized()) { getCache().getLoggerI18n().fine( STR); } } } | /**
* Explicitly initialize a region that was skipped during
* {@link #createSubregion(String, RegionAttributes, InternalRegionArguments,
* boolean)}. Used by GemFireXD to delay initialization of a region during
* DDL replay till all ALTER TABLE have not completed execution.
*/ | Explicitly initialize a region that was skipped during <code>#createSubregion(String, RegionAttributes, InternalRegionArguments, boolean)</code>. Used by GemFireXD to delay initialization of a region during DDL replay till all ALTER TABLE have not completed execution | initialize | {
"repo_name": "papicella/snappy-store",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java",
"license": "apache-2.0",
"size": 506961
} | [
"com.gemstone.gemfire.CancelException",
"com.gemstone.gemfire.cache.RegionExistsException",
"com.gemstone.gemfire.cache.TimeoutException",
"com.gemstone.gemfire.distributed.internal.InternalDistributedSystem",
"com.gemstone.gemfire.distributed.internal.ResourceEvent",
"com.gemstone.gemfire.internal.cache.control.InternalResourceManager",
"com.gemstone.gemfire.internal.cache.partitioned.RedundancyAlreadyMetException",
"com.gemstone.gemfire.internal.i18n.LocalizedStrings",
"java.io.IOException"
] | import com.gemstone.gemfire.CancelException; import com.gemstone.gemfire.cache.RegionExistsException; import com.gemstone.gemfire.cache.TimeoutException; import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem; import com.gemstone.gemfire.distributed.internal.ResourceEvent; import com.gemstone.gemfire.internal.cache.control.InternalResourceManager; import com.gemstone.gemfire.internal.cache.partitioned.RedundancyAlreadyMetException; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import java.io.IOException; | import com.gemstone.gemfire.*; import com.gemstone.gemfire.cache.*; import com.gemstone.gemfire.distributed.internal.*; import com.gemstone.gemfire.internal.cache.control.*; import com.gemstone.gemfire.internal.cache.partitioned.*; import com.gemstone.gemfire.internal.i18n.*; import java.io.*; | [
"com.gemstone.gemfire",
"java.io"
] | com.gemstone.gemfire; java.io; | 2,825,382 |
return new Path(main + DELTA_SIDE_FILE_SUFFIX);
} | return new Path(main + DELTA_SIDE_FILE_SUFFIX); } | /**
* Get the filename of the ORC ACID side file that contains the lengths
* of the intermediate footers.
* @param main the main ORC filename
* @return the name of the side file
*/ | Get the filename of the ORC ACID side file that contains the lengths of the intermediate footers | getSideFile | {
"repo_name": "pudidic/orc",
"path": "java/core/src/java/org/apache/orc/impl/OrcAcidUtils.java",
"license": "apache-2.0",
"size": 2965
} | [
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 378,629 |
private BigInteger oddModPow(BigInteger y, BigInteger z) {
// Special case for exponent of one
if (y.equals(ONE))
return this;
// Special case for base of zero
if (signum == 0)
return ZERO;
int[] base = mag.clone();
int[] exp = y.mag;
int[] mod = z.mag;
int modLen = mod.length;
// Select an appropriate window size
int wbits = 0;
int ebits = bitLength(exp, exp.length);
// if exponent is 65537 (0x10001), use minimum window size
if ((ebits != 17) || (exp[0] != 65537)) {
while (ebits > bnExpModThreshTable[wbits]) {
wbits++;
}
}
// Calculate appropriate table size
int tblmask = 1 << wbits;
// Allocate table for precomputed odd powers of base in Montgomery form
int[][] table = new int[tblmask][];
for (int i=0; i < tblmask; i++)
table[i] = new int[modLen];
// Compute the modular inverse
int inv = -MutableBigInteger.inverseMod32(mod[modLen-1]);
// Convert base to Montgomery form
int[] a = leftShift(base, base.length, modLen << 5);
MutableBigInteger q = new MutableBigInteger(),
a2 = new MutableBigInteger(a),
b2 = new MutableBigInteger(mod);
MutableBigInteger r= a2.divide(b2, q);
table[0] = r.toIntArray();
// Pad table[0] with leading zeros so its length is at least modLen
if (table[0].length < modLen) {
int offset = modLen - table[0].length;
int[] t2 = new int[modLen];
for (int i=0; i < table[0].length; i++)
t2[i+offset] = table[0][i];
table[0] = t2;
}
// Set b to the square of the base
int[] b = squareToLen(table[0], modLen, null);
b = montReduce(b, mod, modLen, inv);
// Set t to high half of b
int[] t = Arrays.copyOf(b, modLen);
// Fill in the table with odd powers of the base
for (int i=1; i < tblmask; i++) {
int[] prod = multiplyToLen(t, modLen, table[i-1], modLen, null);
table[i] = montReduce(prod, mod, modLen, inv);
}
// Pre load the window that slides over the exponent
int bitpos = 1 << ((ebits-1) & (32-1));
int buf = 0;
int elen = exp.length;
int eIndex = 0;
for (int i = 0; i <= wbits; i++) {
buf = (buf << 1) | (((exp[eIndex] & bitpos) != 0)?1:0);
bitpos >>>= 1;
if (bitpos == 0) {
eIndex++;
bitpos = 1 << (32-1);
elen--;
}
}
int multpos = ebits;
// The first iteration, which is hoisted out of the main loop
ebits--;
boolean isone = true;
multpos = ebits - wbits;
while ((buf & 1) == 0) {
buf >>>= 1;
multpos++;
}
int[] mult = table[buf >>> 1];
buf = 0;
if (multpos == ebits)
isone = false;
// The main loop
while (true) {
ebits--;
// Advance the window
buf <<= 1;
if (elen != 0) {
buf |= ((exp[eIndex] & bitpos) != 0) ? 1 : 0;
bitpos >>>= 1;
if (bitpos == 0) {
eIndex++;
bitpos = 1 << (32-1);
elen--;
}
}
// Examine the window for pending multiplies
if ((buf & tblmask) != 0) {
multpos = ebits - wbits;
while ((buf & 1) == 0) {
buf >>>= 1;
multpos++;
}
mult = table[buf >>> 1];
buf = 0;
}
// Perform multiply
if (ebits == multpos) {
if (isone) {
b = mult.clone();
isone = false;
} else {
t = b;
a = multiplyToLen(t, modLen, mult, modLen, a);
a = montReduce(a, mod, modLen, inv);
t = a; a = b; b = t;
}
}
// Check if done
if (ebits == 0)
break;
// Square the input
if (!isone) {
t = b;
a = squareToLen(t, modLen, a);
a = montReduce(a, mod, modLen, inv);
t = a; a = b; b = t;
}
}
// Convert result out of Montgomery form and return
int[] t2 = new int[2*modLen];
System.arraycopy(b, 0, t2, modLen, modLen);
b = montReduce(t2, mod, modLen, inv);
t2 = Arrays.copyOf(b, modLen);
return new BigInteger(1, t2);
} | BigInteger function(BigInteger y, BigInteger z) { if (y.equals(ONE)) return this; if (signum == 0) return ZERO; int[] base = mag.clone(); int[] exp = y.mag; int[] mod = z.mag; int modLen = mod.length; int wbits = 0; int ebits = bitLength(exp, exp.length); if ((ebits != 17) (exp[0] != 65537)) { while (ebits > bnExpModThreshTable[wbits]) { wbits++; } } int tblmask = 1 << wbits; int[][] table = new int[tblmask][]; for (int i=0; i < tblmask; i++) table[i] = new int[modLen]; int inv = -MutableBigInteger.inverseMod32(mod[modLen-1]); int[] a = leftShift(base, base.length, modLen << 5); MutableBigInteger q = new MutableBigInteger(), a2 = new MutableBigInteger(a), b2 = new MutableBigInteger(mod); MutableBigInteger r= a2.divide(b2, q); table[0] = r.toIntArray(); if (table[0].length < modLen) { int offset = modLen - table[0].length; int[] t2 = new int[modLen]; for (int i=0; i < table[0].length; i++) t2[i+offset] = table[0][i]; table[0] = t2; } int[] b = squareToLen(table[0], modLen, null); b = montReduce(b, mod, modLen, inv); int[] t = Arrays.copyOf(b, modLen); for (int i=1; i < tblmask; i++) { int[] prod = multiplyToLen(t, modLen, table[i-1], modLen, null); table[i] = montReduce(prod, mod, modLen, inv); } int bitpos = 1 << ((ebits-1) & (32-1)); int buf = 0; int elen = exp.length; int eIndex = 0; for (int i = 0; i <= wbits; i++) { buf = (buf << 1) (((exp[eIndex] & bitpos) != 0)?1:0); bitpos >>>= 1; if (bitpos == 0) { eIndex++; bitpos = 1 << (32-1); elen--; } } int multpos = ebits; ebits--; boolean isone = true; multpos = ebits - wbits; while ((buf & 1) == 0) { buf >>>= 1; multpos++; } int[] mult = table[buf >>> 1]; buf = 0; if (multpos == ebits) isone = false; while (true) { ebits--; buf <<= 1; if (elen != 0) { buf = ((exp[eIndex] & bitpos) != 0) ? 1 : 0; bitpos >>>= 1; if (bitpos == 0) { eIndex++; bitpos = 1 << (32-1); elen--; } } if ((buf & tblmask) != 0) { multpos = ebits - wbits; while ((buf & 1) == 0) { buf >>>= 1; multpos++; } mult = table[buf >>> 1]; buf = 0; } if (ebits == multpos) { if (isone) { b = mult.clone(); isone = false; } else { t = b; a = multiplyToLen(t, modLen, mult, modLen, a); a = montReduce(a, mod, modLen, inv); t = a; a = b; b = t; } } if (ebits == 0) break; if (!isone) { t = b; a = squareToLen(t, modLen, a); a = montReduce(a, mod, modLen, inv); t = a; a = b; b = t; } } int[] t2 = new int[2*modLen]; System.arraycopy(b, 0, t2, modLen, modLen); b = montReduce(t2, mod, modLen, inv); t2 = Arrays.copyOf(b, modLen); return new BigInteger(1, t2); } | /**
* Returns a BigInteger whose value is x to the power of y mod z.
* Assumes: z is odd && x < z.
*/ | Returns a BigInteger whose value is x to the power of y mod z. Assumes: z is odd && x < z | oddModPow | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/java/math/BigInteger.java",
"license": "mit",
"size": 162457
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 41,111 |
public void setTimeUnit(TimeUnit timeUnit) {
this.timeUnit = timeUnit;
} | void function(TimeUnit timeUnit) { this.timeUnit = timeUnit; } | /**
* Time unit for initialDelay and delay options.
*/ | Time unit for initialDelay and delay options | setTimeUnit | {
"repo_name": "punkhorn/camel-upstream",
"path": "core/camel-support/src/main/java/org/apache/camel/support/ScheduledPollEndpoint.java",
"license": "apache-2.0",
"size": 20090
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,007,764 |
public Duration getTimeTaken() {
return this.timeTaken;
} | Duration function() { return this.timeTaken; } | /**
* Return the time taken for the application to be ready to service requests, or
* {@code null} if unknown.
* @return the time taken to be ready to service requests
* @since 2.6.0
*/ | Return the time taken for the application to be ready to service requests, or null if unknown | getTimeTaken | {
"repo_name": "htynkn/spring-boot",
"path": "spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/event/ApplicationReadyEvent.java",
"license": "apache-2.0",
"size": 2396
} | [
"java.time.Duration"
] | import java.time.Duration; | import java.time.*; | [
"java.time"
] | java.time; | 486,502 |
@Test
public void getAcl() throws Exception {
ClientId id = createTestClientId(client(1));
List<AccessRightType> acl = getClient(id).getAcl();
assertEquals(4, acl.size());
assertTrue(acl.get(0).getSubjectId() instanceof ClientId);
assertTrue(acl.get(1).getSubjectId() instanceof ClientId);
assertTrue(acl.get(2).getSubjectId() instanceof ServiceId);
assertTrue(acl.get(3).getSubjectId() instanceof LocalGroupId);
} | void function() throws Exception { ClientId id = createTestClientId(client(1)); List<AccessRightType> acl = getClient(id).getAcl(); assertEquals(4, acl.size()); assertTrue(acl.get(0).getSubjectId() instanceof ClientId); assertTrue(acl.get(1).getSubjectId() instanceof ClientId); assertTrue(acl.get(2).getSubjectId() instanceof ServiceId); assertTrue(acl.get(3).getSubjectId() instanceof LocalGroupId); } | /**
* Test getting ACL.
* @throws Exception if an error occurs
*/ | Test getting ACL | getAcl | {
"repo_name": "ria-ee/X-Road",
"path": "src/serverconf/src/test/java/ee/ria/xroad/proxy/conf/DAOImplTest.java",
"license": "mit",
"size": 8514
} | [
"ee.ria.xroad.common.conf.serverconf.model.AccessRightType",
"ee.ria.xroad.common.identifier.ClientId",
"ee.ria.xroad.common.identifier.LocalGroupId",
"ee.ria.xroad.common.identifier.ServiceId",
"ee.ria.xroad.proxy.conf.TestUtil",
"java.util.List",
"org.junit.Assert"
] | import ee.ria.xroad.common.conf.serverconf.model.AccessRightType; import ee.ria.xroad.common.identifier.ClientId; import ee.ria.xroad.common.identifier.LocalGroupId; import ee.ria.xroad.common.identifier.ServiceId; import ee.ria.xroad.proxy.conf.TestUtil; import java.util.List; import org.junit.Assert; | import ee.ria.xroad.common.conf.serverconf.model.*; import ee.ria.xroad.common.identifier.*; import ee.ria.xroad.proxy.conf.*; import java.util.*; import org.junit.*; | [
"ee.ria.xroad",
"java.util",
"org.junit"
] | ee.ria.xroad; java.util; org.junit; | 38,405 |
private void setKeyFullId(String keyFullId) {
if (!TextUtils.isEmpty(keyFullId)) {
try {
String[] components = keyFullId.split(":");
if (components.length == 2) {
type = components[0];
keyId = components[1];
}
} catch (Exception e) {
Log.e(LOG_TAG, "## setKeyFullId() failed : " + e.getMessage(), e);
}
}
} | void function(String keyFullId) { if (!TextUtils.isEmpty(keyFullId)) { try { String[] components = keyFullId.split(":"); if (components.length == 2) { type = components[0]; keyId = components[1]; } } catch (Exception e) { Log.e(LOG_TAG, STR + e.getMessage(), e); } } } | /**
* Update the key fields with a key full id
*
* @param keyFullId the key full id
*/ | Update the key fields with a key full id | setKeyFullId | {
"repo_name": "matrix-org/matrix-android-sdk",
"path": "matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/data/MXKey.java",
"license": "apache-2.0",
"size": 3681
} | [
"android.text.TextUtils",
"org.matrix.androidsdk.core.Log"
] | import android.text.TextUtils; import org.matrix.androidsdk.core.Log; | import android.text.*; import org.matrix.androidsdk.core.*; | [
"android.text",
"org.matrix.androidsdk"
] | android.text; org.matrix.androidsdk; | 898,778 |
private void skip(XmlPullParser parser) throws XmlPullParserException, IOException
{
if (parser.getEventType() != XmlPullParser.START_TAG)
{
throw new IllegalStateException();
}
int depth = 1;
while (depth != 0)
{
switch (parser.next())
{
case XmlPullParser.END_TAG:
depth--;
break;
case XmlPullParser.START_TAG:
depth++;
break;
}
}
} | void function(XmlPullParser parser) throws XmlPullParserException, IOException { if (parser.getEventType() != XmlPullParser.START_TAG) { throw new IllegalStateException(); } int depth = 1; while (depth != 0) { switch (parser.next()) { case XmlPullParser.END_TAG: depth--; break; case XmlPullParser.START_TAG: depth++; break; } } } | /**
* Skips a tag that does not fit
*
* @param parser
* @throws org.xmlpull.v1.XmlPullParserException
* @throws java.io.IOException
*/ | Skips a tag that does not fit | skip | {
"repo_name": "interoberlin/sugarmonkey",
"path": "lib/src/main/java/de/interoberlin/sauvignon/lib/controller/SvgParser.java",
"license": "gpl-3.0",
"size": 55508
} | [
"java.io.IOException",
"org.xmlpull.v1.XmlPullParser",
"org.xmlpull.v1.XmlPullParserException"
] | import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; | import java.io.*; import org.xmlpull.v1.*; | [
"java.io",
"org.xmlpull.v1"
] | java.io; org.xmlpull.v1; | 878,931 |
public boolean isAnswered() {
return flags.contains(Flags.Flag.ANSWERED);
}
| boolean function() { return flags.contains(Flags.Flag.ANSWERED); } | /**
* Returns <code>true</code> if message is answered.
*/ | Returns <code>true</code> if message is answered | isAnswered | {
"repo_name": "007slm/jodd",
"path": "jodd-mail/src/main/java/jodd/mail/ReceivedEmail.java",
"license": "bsd-3-clause",
"size": 7433
} | [
"javax.mail.Flags"
] | import javax.mail.Flags; | import javax.mail.*; | [
"javax.mail"
] | javax.mail; | 2,804,650 |
public static void saveImage(ImageBuffer image, Media media)
{
factoryGraphic.saveImage(image, media);
}
| static void function(ImageBuffer image, Media media) { factoryGraphic.saveImage(image, media); } | /**
* Save an image into a file.
*
* @param image The image to save (must not be <code>null</code>).
* @param media The output media (must not be <code>null</code>).
* @throws LionEngineException If an error occurred when saving the image.
*/ | Save an image into a file | saveImage | {
"repo_name": "b3dgs/lionengine",
"path": "lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/Graphics.java",
"license": "gpl-3.0",
"size": 12591
} | [
"com.b3dgs.lionengine.Media"
] | import com.b3dgs.lionengine.Media; | import com.b3dgs.lionengine.*; | [
"com.b3dgs.lionengine"
] | com.b3dgs.lionengine; | 1,922,106 |
private static List<String> getIdsFor(int year, int maxId) {
List<String> result = new ArrayList<>();
for (int i = 1; i <= maxId; i++) {
result.add(String.format("%04d/%03d", year, i));
}
return result;
} | static List<String> function(int year, int maxId) { List<String> result = new ArrayList<>(); for (int i = 1; i <= maxId; i++) { result.add(String.format(STR, year, i)); } return result; } | /**
* Helper method for allNonWithdrawnIdsWithOldHtmlFormat.
*
* @param year The year of the generated IDs (e.g. 1996)
* @param maxId The maximum ID to generate in the given year (e.g. 112)
* @return A list of IDs in the from yyyy/iii (e.g. [1996/001, 1996/002, ..., 1996/112]
*/ | Helper method for allNonWithdrawnIdsWithOldHtmlFormat | getIdsFor | {
"repo_name": "JabRef/jabref",
"path": "src/test/java/org/jabref/logic/importer/fetcher/IacrEprintFetcherTest.java",
"license": "mit",
"size": 9178
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 966,749 |
protected Set<Integer> getThreadIds() {
return threadMap.keySet();
} | Set<Integer> function() { return threadMap.keySet(); } | /**
* Returns a set of thread IDs.
*/ | Returns a set of thread IDs | getThreadIds | {
"repo_name": "xhoong/incubator-calcite",
"path": "core/src/test/java/org/apache/calcite/test/concurrent/ConcurrentTestCommandGenerator.java",
"license": "apache-2.0",
"size": 40612
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 927,033 |
@Test
public void testDfsAdminCmd() throws Exception {
cluster = new MiniDFSCluster.Builder(config).
numDataNodes(2).
manageNameDfsDirs(false).build();
cluster.waitActive();
try {
FSImage fsi = cluster.getNameNode().getFSImage();
// it is started with dfs.namenode.name.dir.restore set to true (in SetUp())
boolean restore = fsi.getStorage().getRestoreFailedStorage();
LOG.info("Restore is " + restore);
assertEquals(restore, true);
// now run DFSAdmnin command
String cmd = "-fs NAMENODE -restoreFailedStorage false";
String namenode = config.get(DFSConfigKeys.FS_DEFAULT_NAME_KEY, "file:///");
CommandExecutor executor =
new CLITestCmdDFS(cmd,
new CLICommandDFSAdmin()).getExecutor(namenode, config);
executor.executeCommand(cmd);
restore = fsi.getStorage().getRestoreFailedStorage();
assertFalse("After set true call restore is " + restore, restore);
// run one more time - to set it to true again
cmd = "-fs NAMENODE -restoreFailedStorage true";
executor.executeCommand(cmd);
restore = fsi.getStorage().getRestoreFailedStorage();
assertTrue("After set false call restore is " + restore, restore);
// run one more time - no change in value
cmd = "-fs NAMENODE -restoreFailedStorage check";
CommandExecutor.Result cmdResult = executor.executeCommand(cmd);
restore = fsi.getStorage().getRestoreFailedStorage();
assertTrue("After check call restore is " + restore, restore);
String commandOutput = cmdResult.getCommandOutput();
assertTrue(commandOutput.contains("restoreFailedStorage is set to true"));
} finally {
cluster.shutdown();
}
} | void function() throws Exception { cluster = new MiniDFSCluster.Builder(config). numDataNodes(2). manageNameDfsDirs(false).build(); cluster.waitActive(); try { FSImage fsi = cluster.getNameNode().getFSImage(); boolean restore = fsi.getStorage().getRestoreFailedStorage(); LOG.info(STR + restore); assertEquals(restore, true); String cmd = STR; String namenode = config.get(DFSConfigKeys.FS_DEFAULT_NAME_KEY, STRAfter set true call restore is STR-fs NAMENODE -restoreFailedStorage trueSTRAfter set false call restore is STR-fs NAMENODE -restoreFailedStorage checkSTRAfter check call restore is STRrestoreFailedStorage is set to true")); } finally { cluster.shutdown(); } } | /**
* Test dfsadmin -restoreFailedStorage command
* @throws Exception
*/ | Test dfsadmin -restoreFailedStorage command | testDfsAdminCmd | {
"repo_name": "JingchengDu/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestStorageRestore.java",
"license": "apache-2.0",
"size": 17551
} | [
"org.apache.hadoop.hdfs.DFSConfigKeys",
"org.apache.hadoop.hdfs.MiniDFSCluster",
"org.junit.Assert"
] | import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.junit.Assert; | import org.apache.hadoop.hdfs.*; import org.junit.*; | [
"org.apache.hadoop",
"org.junit"
] | org.apache.hadoop; org.junit; | 2,344,329 |
public static Processor iti30ResponseValidator() {
return ConformanceProfileValidators.validatingProcessor(ItiPamProfile.ITI_30_ACK);
} | static Processor function() { return ConformanceProfileValidators.validatingProcessor(ItiPamProfile.ITI_30_ACK); } | /**
* Returns a validating processor for ITI-30 response messages
* (Patient Identity Management).
*/ | Returns a validating processor for ITI-30 response messages (Patient Identity Management) | iti30ResponseValidator | {
"repo_name": "oehf/ipf",
"path": "platform-camel/ihe/mllp/src/main/java/org/openehealth/ipf/platform/camel/ihe/mllp/PamCamelValidators.java",
"license": "apache-2.0",
"size": 2700
} | [
"org.apache.camel.Processor",
"org.openehealth.ipf.gazelle.validation.profile.pam.ItiPamProfile",
"org.openehealth.ipf.platform.camel.hl7.validation.ConformanceProfileValidators"
] | import org.apache.camel.Processor; import org.openehealth.ipf.gazelle.validation.profile.pam.ItiPamProfile; import org.openehealth.ipf.platform.camel.hl7.validation.ConformanceProfileValidators; | import org.apache.camel.*; import org.openehealth.ipf.gazelle.validation.profile.pam.*; import org.openehealth.ipf.platform.camel.hl7.validation.*; | [
"org.apache.camel",
"org.openehealth.ipf"
] | org.apache.camel; org.openehealth.ipf; | 2,428,539 |
@Deprecated
public void addInternalServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
ServletHolder holder = new ServletHolder(clazz);
if (name != null) {
holder.setName(name);
}
webAppContext.addServlet(holder, pathSpec);
} | void function(String name, String pathSpec, Class<? extends HttpServlet> clazz) { ServletHolder holder = new ServletHolder(clazz); if (name != null) { holder.setName(name); } webAppContext.addServlet(holder, pathSpec); } | /**
* Add an internal servlet in the server.
* @param name The name of the servlet (can be passed as null)
* @param pathSpec The path spec for the servlet
* @param clazz The servlet class
* @deprecated this is a temporary method
*/ | Add an internal servlet in the server | addInternalServlet | {
"repo_name": "submergerock/avatar-hadoop",
"path": "build/hadoop-0.20.1-dev/src/core/org/apache/hadoop/http/HttpServer.java",
"license": "apache-2.0",
"size": 19362
} | [
"javax.servlet.http.HttpServlet",
"org.mortbay.jetty.servlet.ServletHolder"
] | import javax.servlet.http.HttpServlet; import org.mortbay.jetty.servlet.ServletHolder; | import javax.servlet.http.*; import org.mortbay.jetty.servlet.*; | [
"javax.servlet",
"org.mortbay.jetty"
] | javax.servlet; org.mortbay.jetty; | 2,808,101 |
protected int getNshServicePathId(LoadBalanceId id, int nshSpiId) {
int nshSpiNew = nshSpiId << 5;
nshSpiNew = nshSpiNew | id.loadBalanceId();
return nshSpiNew;
} | int function(LoadBalanceId id, int nshSpiId) { int nshSpiNew = nshSpiId << 5; nshSpiNew = nshSpiNew id.loadBalanceId(); return nshSpiNew; } | /**
* Encapsulate 5 bit load balance id to nsh spi.
*
* @param id load balance identifier
* @param nshSpiId nsh service path index
* @return updated service path index
*/ | Encapsulate 5 bit load balance id to nsh spi | getNshServicePathId | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "apps/vtn/sfcmgr/src/main/java/org/onosproject/sfc/manager/impl/SfcManager.java",
"license": "apache-2.0",
"size": 29059
} | [
"org.onosproject.vtnrsc.LoadBalanceId"
] | import org.onosproject.vtnrsc.LoadBalanceId; | import org.onosproject.vtnrsc.*; | [
"org.onosproject.vtnrsc"
] | org.onosproject.vtnrsc; | 124,491 |
@Test
public void TestCharacter()
{
for (int i = 0; i < CHARACTER_LOWER_.length; i ++) {
if (UCharacter.isLetter(CHARACTER_LOWER_[i]) &&
!UCharacter.isLowerCase(CHARACTER_LOWER_[i])) {
errln("FAIL isLowerCase test for \\u" +
hex(CHARACTER_LOWER_[i]));
break;
}
if (UCharacter.isLetter(CHARACTER_UPPER_[i]) &&
!(UCharacter.isUpperCase(CHARACTER_UPPER_[i]) ||
UCharacter.isTitleCase(CHARACTER_UPPER_[i]))) {
errln("FAIL isUpperCase test for \\u" +
hex(CHARACTER_UPPER_[i]));
break;
}
if (CHARACTER_LOWER_[i] !=
UCharacter.toLowerCase(CHARACTER_UPPER_[i]) ||
(CHARACTER_UPPER_[i] !=
UCharacter.toUpperCase(CHARACTER_LOWER_[i]) &&
CHARACTER_UPPER_[i] !=
UCharacter.toTitleCase(CHARACTER_LOWER_[i]))) {
errln("FAIL case conversion test for \\u" +
hex(CHARACTER_UPPER_[i]) +
" to \\u" + hex(CHARACTER_LOWER_[i]));
break;
}
if (CHARACTER_LOWER_[i] !=
UCharacter.toLowerCase(CHARACTER_LOWER_[i])) {
errln("FAIL lower case conversion test for \\u" +
hex(CHARACTER_LOWER_[i]));
break;
}
if (CHARACTER_UPPER_[i] !=
UCharacter.toUpperCase(CHARACTER_UPPER_[i]) &&
CHARACTER_UPPER_[i] !=
UCharacter.toTitleCase(CHARACTER_UPPER_[i])) {
errln("FAIL upper case conversion test for \\u" +
hex(CHARACTER_UPPER_[i]));
break;
}
logln("Ok \\u" + hex(CHARACTER_UPPER_[i]) + " and \\u" +
hex(CHARACTER_LOWER_[i]));
}
} | void function() { for (int i = 0; i < CHARACTER_LOWER_.length; i ++) { if (UCharacter.isLetter(CHARACTER_LOWER_[i]) && !UCharacter.isLowerCase(CHARACTER_LOWER_[i])) { errln(STR + hex(CHARACTER_LOWER_[i])); break; } if (UCharacter.isLetter(CHARACTER_UPPER_[i]) && !(UCharacter.isUpperCase(CHARACTER_UPPER_[i]) UCharacter.isTitleCase(CHARACTER_UPPER_[i]))) { errln(STR + hex(CHARACTER_UPPER_[i])); break; } if (CHARACTER_LOWER_[i] != UCharacter.toLowerCase(CHARACTER_UPPER_[i]) (CHARACTER_UPPER_[i] != UCharacter.toUpperCase(CHARACTER_LOWER_[i]) && CHARACTER_UPPER_[i] != UCharacter.toTitleCase(CHARACTER_LOWER_[i]))) { errln(STR + hex(CHARACTER_UPPER_[i]) + STR + hex(CHARACTER_LOWER_[i])); break; } if (CHARACTER_LOWER_[i] != UCharacter.toLowerCase(CHARACTER_LOWER_[i])) { errln(STR + hex(CHARACTER_LOWER_[i])); break; } if (CHARACTER_UPPER_[i] != UCharacter.toUpperCase(CHARACTER_UPPER_[i]) && CHARACTER_UPPER_[i] != UCharacter.toTitleCase(CHARACTER_UPPER_[i])) { errln(STR + hex(CHARACTER_UPPER_[i])); break; } logln(STR + hex(CHARACTER_UPPER_[i]) + STR + hex(CHARACTER_LOWER_[i])); } } | /**
* Testing the uppercase and lowercase function of UCharacter
*/ | Testing the uppercase and lowercase function of UCharacter | TestCharacter | {
"repo_name": "life-beam/j2objc",
"path": "jre_emul/android/platform/external/icu/android_icu4j/src/main/tests/android/icu/dev/test/lang/UCharacterCaseTest.java",
"license": "apache-2.0",
"size": 55097
} | [
"android.icu.lang.UCharacter"
] | import android.icu.lang.UCharacter; | import android.icu.lang.*; | [
"android.icu"
] | android.icu; | 2,102,629 |
public ForeignKey generateForeignKey(ForeignKeyInfo fkInfo, Database database, List<ForeignKey> fkList)
throws DatabaseException {
// Simple (non-composite) keys have KEY_SEQ=1, so create the ForeignKey.
// In case of subsequent parts of composite keys (KEY_SEQ>1) don't create new instance, just reuse the one from
// previous call.
// According to #getExportedKeys() contract, the result set rows are properly sorted, so the reuse of previous
// FK instance is safe.
ForeignKey foreignKey = null;
if (fkInfo.getKeySeq() == 1 || (fkInfo.getReferencesUniqueColumn() && fkInfo.getKeySeq() == 0)) {
foreignKey = new ForeignKey();
} else {
for (ForeignKey foundFK : fkList) {
if (foundFK.getName().equalsIgnoreCase(fkInfo.getFkName())) {
foreignKey = foundFK;
}
}
if (foreignKey == null) {
throw new DatabaseException("Database returned out of sequence foreign key column for "
+ fkInfo.getFkName());
}
}
foreignKey.setName(fkInfo.getFkName());
final Table pkTable = new Table(fkInfo.getPkTableName());
pkTable.setSchema(fkInfo.getPkTableSchema());
foreignKey.setPrimaryKeyTable(pkTable);
foreignKey.addPrimaryKeyColumn(fkInfo.getPkColumn());
final String fkTableName = fkInfo.getFkTableName();
Table fkTable = new Table(fkTableName);
fkTable.setSchema(fkInfo.getFkSchema());
foreignKey.setForeignKeyTable(fkTable);
foreignKey.addForeignKeyColumn(fkInfo.getFkColumn());
foreignKey.setUpdateRule(fkInfo.getUpdateRule());
foreignKey.setDeleteRule(fkInfo.getDeleteRule());
foreignKey.setReferencesUniqueColumn(fkInfo.getReferencesUniqueColumn());
if (database.supportsInitiallyDeferrableColumns()) {
if (fkInfo.getDeferrablility() == DatabaseMetaData.importedKeyInitiallyDeferred) {
foreignKey.setDeferrable(Boolean.TRUE);
foreignKey.setInitiallyDeferred(Boolean.TRUE);
} else if (fkInfo.getDeferrablility() == DatabaseMetaData.importedKeyInitiallyImmediate) {
foreignKey.setDeferrable(Boolean.TRUE);
foreignKey.setInitiallyDeferred(Boolean.FALSE);
} else if (fkInfo.getDeferrablility() == DatabaseMetaData.importedKeyNotDeferrable) {
foreignKey.setDeferrable(Boolean.FALSE);
foreignKey.setInitiallyDeferred(Boolean.FALSE);
}
}
return foreignKey;
} | ForeignKey function(ForeignKeyInfo fkInfo, Database database, List<ForeignKey> fkList) throws DatabaseException { ForeignKey foreignKey = null; if (fkInfo.getKeySeq() == 1 (fkInfo.getReferencesUniqueColumn() && fkInfo.getKeySeq() == 0)) { foreignKey = new ForeignKey(); } else { for (ForeignKey foundFK : fkList) { if (foundFK.getName().equalsIgnoreCase(fkInfo.getFkName())) { foreignKey = foundFK; } } if (foreignKey == null) { throw new DatabaseException(STR + fkInfo.getFkName()); } } foreignKey.setName(fkInfo.getFkName()); final Table pkTable = new Table(fkInfo.getPkTableName()); pkTable.setSchema(fkInfo.getPkTableSchema()); foreignKey.setPrimaryKeyTable(pkTable); foreignKey.addPrimaryKeyColumn(fkInfo.getPkColumn()); final String fkTableName = fkInfo.getFkTableName(); Table fkTable = new Table(fkTableName); fkTable.setSchema(fkInfo.getFkSchema()); foreignKey.setForeignKeyTable(fkTable); foreignKey.addForeignKeyColumn(fkInfo.getFkColumn()); foreignKey.setUpdateRule(fkInfo.getUpdateRule()); foreignKey.setDeleteRule(fkInfo.getDeleteRule()); foreignKey.setReferencesUniqueColumn(fkInfo.getReferencesUniqueColumn()); if (database.supportsInitiallyDeferrableColumns()) { if (fkInfo.getDeferrablility() == DatabaseMetaData.importedKeyInitiallyDeferred) { foreignKey.setDeferrable(Boolean.TRUE); foreignKey.setInitiallyDeferred(Boolean.TRUE); } else if (fkInfo.getDeferrablility() == DatabaseMetaData.importedKeyInitiallyImmediate) { foreignKey.setDeferrable(Boolean.TRUE); foreignKey.setInitiallyDeferred(Boolean.FALSE); } else if (fkInfo.getDeferrablility() == DatabaseMetaData.importedKeyNotDeferrable) { foreignKey.setDeferrable(Boolean.FALSE); foreignKey.setInitiallyDeferred(Boolean.FALSE); } } return foreignKey; } | /**
* Generation of Foreign Key based on information about it.
*
* @param fkInfo contains all needed properties of FK
* @param database current database
* @param fkList list of already generated keys
* @return generated Foreing Key
* @throws liquibase.exception.DatabaseException Database Exception
*/ | Generation of Foreign Key based on information about it | generateForeignKey | {
"repo_name": "hongliangpan/manydesigns.cn",
"path": "trunk/portofino-database/liquibase/snapshot/jvm/JdbcDatabaseSnapshotGenerator.java",
"license": "lgpl-3.0",
"size": 34510
} | [
"java.sql.DatabaseMetaData",
"java.util.List"
] | import java.sql.DatabaseMetaData; import java.util.List; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 1,613,863 |
public ServiceCall delete204SucceededAsync(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
} | ServiceCall function(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException(STR); } | /**
* Long running delete succeeds and returns right away.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link ServiceCall} object
*/ | Long running delete succeeds and returns right away | delete204SucceededAsync | {
"repo_name": "sharadagarwal/autorest",
"path": "AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROsOperationsImpl.java",
"license": "mit",
"size": 315973
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,700,829 |
Collection<QName> deploy(File deploymentUnitDirectory); | Collection<QName> deploy(File deploymentUnitDirectory); | /**
* Deploys a process from the filesystem.
* @param deploymentUnitDirectory directory containing all deployment files
* @return a collection of process ids (deployed processes)
*/ | Deploys a process from the filesystem | deploy | {
"repo_name": "firzhan/wso2-ode",
"path": "bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessStore.java",
"license": "apache-2.0",
"size": 3426
} | [
"java.io.File",
"java.util.Collection",
"javax.xml.namespace.QName"
] | import java.io.File; import java.util.Collection; import javax.xml.namespace.QName; | import java.io.*; import java.util.*; import javax.xml.namespace.*; | [
"java.io",
"java.util",
"javax.xml"
] | java.io; java.util; javax.xml; | 354,928 |
@Test
public void testAssertObject() throws Exception {
when( constraint.isAllowedCachedLeft( any( ContextEntry.class ),
any( InternalFactHandle.class ) ) ).thenReturn( true );
when( constraint.isAllowedCachedRight( any( LeftTupleImpl.class ),
any( ContextEntry.class ) ) ).thenReturn( true );
final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory
.insert( "test0" );
// assert object, should add one to right memory
this.node.assertObject( f0,
this.context,
this.workingMemory );
assertEquals( 0,
this.memory.getLeftTupleMemory().size() );
assertEquals( 1,
this.memory.getRightTupleMemory().size() );
// check new objects/handles still assert
final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.insert( "test1" );
this.node.assertObject( f1,
this.context,
this.workingMemory );
assertEquals( 2,
this.memory.getRightTupleMemory().size() );
RightTuple rightTuple = this.memory.getRightTupleMemory().getFirst( new LeftTupleImpl( f0, this.node, true ), null, null );
final InternalFactHandle rf0 = rightTuple.getFactHandle();
final InternalFactHandle rf1 = ( (RightTuple) rightTuple.getNext() )
.getFactHandle();
assertEquals( f0,
rf0 );
assertEquals( f1,
rf1 );
} | void function() throws Exception { when( constraint.isAllowedCachedLeft( any( ContextEntry.class ), any( InternalFactHandle.class ) ) ).thenReturn( true ); when( constraint.isAllowedCachedRight( any( LeftTupleImpl.class ), any( ContextEntry.class ) ) ).thenReturn( true ); final DefaultFactHandle f0 = (DefaultFactHandle) this.workingMemory .insert( "test0" ); this.node.assertObject( f0, this.context, this.workingMemory ); assertEquals( 0, this.memory.getLeftTupleMemory().size() ); assertEquals( 1, this.memory.getRightTupleMemory().size() ); final DefaultFactHandle f1 = (DefaultFactHandle) this.workingMemory.insert( "test1" ); this.node.assertObject( f1, this.context, this.workingMemory ); assertEquals( 2, this.memory.getRightTupleMemory().size() ); RightTuple rightTuple = this.memory.getRightTupleMemory().getFirst( new LeftTupleImpl( f0, this.node, true ), null, null ); final InternalFactHandle rf0 = rightTuple.getFactHandle(); final InternalFactHandle rf1 = ( (RightTuple) rightTuple.getNext() ) .getFactHandle(); assertEquals( f0, rf0 ); assertEquals( f1, rf1 ); } | /**
* Test just object assertions
*
* @throws Exception
*/ | Test just object assertions | testAssertObject | {
"repo_name": "yurloc/drools",
"path": "drools-core/src/test/java/org/drools/reteoo/JoinNodeTest.java",
"license": "apache-2.0",
"size": 27403
} | [
"org.drools.common.DefaultFactHandle",
"org.drools.common.InternalFactHandle",
"org.drools.rule.ContextEntry",
"org.junit.Assert",
"org.mockito.Matchers",
"org.mockito.Mockito"
] | import org.drools.common.DefaultFactHandle; import org.drools.common.InternalFactHandle; import org.drools.rule.ContextEntry; import org.junit.Assert; import org.mockito.Matchers; import org.mockito.Mockito; | import org.drools.common.*; import org.drools.rule.*; import org.junit.*; import org.mockito.*; | [
"org.drools.common",
"org.drools.rule",
"org.junit",
"org.mockito"
] | org.drools.common; org.drools.rule; org.junit; org.mockito; | 2,701,903 |
public static <T> int[] where(T[] t, Condition<T> c) {
TIntArrayList retVal = new TIntArrayList();
for (int i = 0; i < t.length; i++) {
if (c.eval(t[i])) {
retVal.add(i);
}
}
return retVal.toArray();
} | static <T> int[] function(T[] t, Condition<T> c) { TIntArrayList retVal = new TIntArrayList(); for (int i = 0; i < t.length; i++) { if (c.eval(t[i])) { retVal.add(i); } } return retVal.toArray(); } | /**
* Scans the specified values and applies the {@link Condition} to each
* value, returning the indexes of the values where the condition evaluates
* to true.
*
* @param values the values to test
* @param c the condition used to test each value
* @return
*/ | Scans the specified values and applies the <code>Condition</code> to each value, returning the indexes of the values where the condition evaluates to true | where | {
"repo_name": "UniKnow/htm.java",
"path": "src/main/java/org/numenta/nupic/util/ArrayUtils.java",
"license": "gpl-3.0",
"size": 52874
} | [
"gnu.trove.list.array.TIntArrayList"
] | import gnu.trove.list.array.TIntArrayList; | import gnu.trove.list.array.*; | [
"gnu.trove.list"
] | gnu.trove.list; | 1,492,881 |
public RealMatrix getR() {
if (cachedR == null) {
// R is supposed to be m x n
final int n = qrt.length;
final int m = qrt[0].length;
double[][] ra = new double[m][n];
// copy the diagonal from rDiag and the upper triangle of qr
for (int row = FastMath.min(m, n) - 1; row >= 0; row--) {
ra[row][row] = rDiag[row];
for (int col = row + 1; col < n; col++) {
ra[row][col] = qrt[col][row];
}
}
cachedR = MatrixUtils.createRealMatrix(ra);
}
// return the cached matrix
return cachedR;
} | RealMatrix function() { if (cachedR == null) { final int n = qrt.length; final int m = qrt[0].length; double[][] ra = new double[m][n]; for (int row = FastMath.min(m, n) - 1; row >= 0; row--) { ra[row][row] = rDiag[row]; for (int col = row + 1; col < n; col++) { ra[row][col] = qrt[col][row]; } } cachedR = MatrixUtils.createRealMatrix(ra); } return cachedR; } | /**
* Returns the matrix R of the decomposition.
* <p>R is an upper-triangular matrix</p>
* @return the R matrix
*/ | Returns the matrix R of the decomposition. R is an upper-triangular matrix | getR | {
"repo_name": "venkateshamurthy/java-quantiles",
"path": "src/main/java/org/apache/commons/math3/linear/QRDecomposition.java",
"license": "apache-2.0",
"size": 17906
} | [
"org.apache.commons.math3.util.FastMath"
] | import org.apache.commons.math3.util.FastMath; | import org.apache.commons.math3.util.*; | [
"org.apache.commons"
] | org.apache.commons; | 167,800 |
public void setCreateTimestamp(Date createTimestamp) {
this.createTimestamp = createTimestamp;
} | void function(Date createTimestamp) { this.createTimestamp = createTimestamp; } | /**
* <p>
* Setter for the field <code>createTimestamp</code>.
* </p>
*
* @param createTimestamp
* a {@link java.util.Date} object.
*/ | Setter for the field <code>createTimestamp</code>. | setCreateTimestamp | {
"repo_name": "joansmith/seqware",
"path": "seqware-common/src/main/java/net/sourceforge/seqware/common/model/Registration.java",
"license": "gpl-3.0",
"size": 12065
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,703,544 |
public boolean rewriteExif(String filename, Collection<ExifTag> tags)
throws FileNotFoundException, IOException {
RandomAccessFile file = null;
InputStream is = null;
boolean ret;
try {
File temp = new File(filename);
is = new BufferedInputStream(new FileInputStream(temp));
// Parse beginning of APP1 in exif to find size of exif header.
ExifParser parser = null;
try {
parser = ExifParser.parse(is, this);
} catch (ExifInvalidFormatException e) {
throw new IOException("Invalid exif format : ", e);
}
long exifSize = parser.getOffsetToExifEndFromSOF();
// Free up resources
is.close();
is = null;
// Open file for memory mapping.
file = new RandomAccessFile(temp, "rw");
long fileLength = file.length();
if (fileLength < exifSize) {
throw new IOException("Filesize changed during operation");
}
// Map only exif header into memory.
ByteBuffer buf = file.getChannel().map(MapMode.READ_WRITE, 0, exifSize);
// Attempt to overwrite tag values without changing lengths (avoids
// file copy).
ret = rewriteExif(buf, tags);
} catch (IOException e) {
closeSilently(file);
throw e;
} finally {
closeSilently(is);
}
file.close();
return ret;
} | boolean function(String filename, Collection<ExifTag> tags) throws FileNotFoundException, IOException { RandomAccessFile file = null; InputStream is = null; boolean ret; try { File temp = new File(filename); is = new BufferedInputStream(new FileInputStream(temp)); ExifParser parser = null; try { parser = ExifParser.parse(is, this); } catch (ExifInvalidFormatException e) { throw new IOException(STR, e); } long exifSize = parser.getOffsetToExifEndFromSOF(); is.close(); is = null; file = new RandomAccessFile(temp, "rw"); long fileLength = file.length(); if (fileLength < exifSize) { throw new IOException(STR); } ByteBuffer buf = file.getChannel().map(MapMode.READ_WRITE, 0, exifSize); ret = rewriteExif(buf, tags); } catch (IOException e) { closeSilently(file); throw e; } finally { closeSilently(is); } file.close(); return ret; } | /**
* Attempts to do an in-place rewrite the exif metadata in a file for the
* given tags. If tags do not exist or do not have the same size as the
* existing exif tags, this method will fail.
*
* @param filename a String containing a filepath for a jpeg file with exif
* tags to rewrite.
* @param tags tags that will be written into the jpeg file over existing
* tags if possible.
* @return true if success, false if could not overwrite. If false, no
* changes are made to the file.
* @throws FileNotFoundException
* @throws IOException
*/ | Attempts to do an in-place rewrite the exif metadata in a file for the given tags. If tags do not exist or do not have the same size as the existing exif tags, this method will fail | rewriteExif | {
"repo_name": "bmaupin/android-sms-plus",
"path": "src/com/android/mms/exif/ExifInterface.java",
"license": "apache-2.0",
"size": 92509
} | [
"java.io.BufferedInputStream",
"java.io.File",
"java.io.FileInputStream",
"java.io.FileNotFoundException",
"java.io.IOException",
"java.io.InputStream",
"java.io.RandomAccessFile",
"java.nio.ByteBuffer",
"java.nio.channels.FileChannel",
"java.util.Collection"
] | import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.util.Collection; | import java.io.*; import java.nio.*; import java.nio.channels.*; import java.util.*; | [
"java.io",
"java.nio",
"java.util"
] | java.io; java.nio; java.util; | 905,026 |
@Deprecated
public static URI getOldUploadSegmentHttpsURI(String host, int port) throws URISyntaxException {
return getURI(HTTPS, host, port, OLD_SEGMENT_PATH);
} | static URI function(String host, int port) throws URISyntaxException { return getURI(HTTPS, host, port, OLD_SEGMENT_PATH); } | /**
* This method calls the old segment upload endpoint. We will deprecate this behavior soon. Please call
* getUploadSegmentHttpsURI to construct your request.
*/ | This method calls the old segment upload endpoint. We will deprecate this behavior soon. Please call getUploadSegmentHttpsURI to construct your request | getOldUploadSegmentHttpsURI | {
"repo_name": "apucher/pinot",
"path": "pinot-common/src/main/java/com/linkedin/pinot/common/utils/FileUploadDownloadClient.java",
"license": "apache-2.0",
"size": 23721
} | [
"java.net.URISyntaxException"
] | import java.net.URISyntaxException; | import java.net.*; | [
"java.net"
] | java.net; | 2,197,343 |
@Override
public void init() throws FactoryProductionException
{
try
{
final InitialContext ic = new InitialContext();
ds = (DataSource) ic.lookup( icString );
// Test creating a connection
final Connection c = ds.getConnection();
c.close();
}
catch (final NamingException ne)
{
throw new FactoryProductionException( ne.toString() );
}
catch (final SQLException sqle)
{
throw new FactoryProductionException( sqle.toString() );
}
}
private String icString = "";
private DataSource ds = null; | void function() throws FactoryProductionException { try { final InitialContext ic = new InitialContext(); ds = (DataSource) ic.lookup( icString ); final Connection c = ds.getConnection(); c.close(); } catch (final NamingException ne) { throw new FactoryProductionException( ne.toString() ); } catch (final SQLException sqle) { throw new FactoryProductionException( sqle.toString() ); } } private String icString = ""; private DataSource ds = null; | /**
* <P>
* Initialise the factory by attempting to get the classes required for the
* driver.
* </P>
*
* @exception FactoryProductionException
*/ | Initialise the factory by attempting to get the classes required for the driver. | init | {
"repo_name": "danielhams/mad-java",
"path": "3UTIL/util/src/uk/co/modularaudio/util/pooling/sql/JNDIConnectionFactory.java",
"license": "gpl-3.0",
"size": 4843
} | [
"java.sql.Connection",
"java.sql.SQLException",
"javax.naming.InitialContext",
"javax.naming.NamingException",
"javax.sql.DataSource",
"uk.co.modularaudio.util.pooling.common.FactoryProductionException"
] | import java.sql.Connection; import java.sql.SQLException; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; import uk.co.modularaudio.util.pooling.common.FactoryProductionException; | import java.sql.*; import javax.naming.*; import javax.sql.*; import uk.co.modularaudio.util.pooling.common.*; | [
"java.sql",
"javax.naming",
"javax.sql",
"uk.co.modularaudio"
] | java.sql; javax.naming; javax.sql; uk.co.modularaudio; | 2,712,685 |
private List<ColorMarkerPoint> considerSpread() {
List<ColorMarkerPoint> finalColorMarkerPoints = new ArrayList<ColorMarkerPoint>();
for (ColorMarkerPoint point : markerPoints) {
if (point.hasLeftSpread()) {
float fLeftValue = point.getMappingValue() - point.getLeftSpread();
finalColorMarkerPoints.add(new ColorMarkerPoint(fLeftValue, point.getColor()));
}
finalColorMarkerPoints.add(point);
if (point.hasRightSpread()) {
float fRightValue = point.getMappingValue() + point.getRightSpread();
finalColorMarkerPoints.add(new ColorMarkerPoint(fRightValue, point.getColor()));
}
}
return finalColorMarkerPoints;
} | List<ColorMarkerPoint> function() { List<ColorMarkerPoint> finalColorMarkerPoints = new ArrayList<ColorMarkerPoint>(); for (ColorMarkerPoint point : markerPoints) { if (point.hasLeftSpread()) { float fLeftValue = point.getMappingValue() - point.getLeftSpread(); finalColorMarkerPoints.add(new ColorMarkerPoint(fLeftValue, point.getColor())); } finalColorMarkerPoints.add(point); if (point.hasRightSpread()) { float fRightValue = point.getMappingValue() + point.getRightSpread(); finalColorMarkerPoints.add(new ColorMarkerPoint(fRightValue, point.getColor())); } } return finalColorMarkerPoints; } | /**
* Converts the spread in color marker points to separate color points, which are easier to map later. Does some
* checking and error handling.
*
* @return the list with all the marker points instead of spreads
*/ | Converts the spread in color marker points to separate color points, which are easier to map later. Does some checking and error handling | considerSpread | {
"repo_name": "Caleydo/caleydo",
"path": "org.caleydo.core/src/org/caleydo/core/util/color/mapping/ColorMapper.java",
"license": "bsd-3-clause",
"size": 9080
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,874,692 |
@Test
public void applyQ() {
ZMatrixRMaj A = RandomMatrices_ZDRM.rectangle(5, 4, rand);
QRDecompositionHouseholderTran_ZDRM alg = new QRDecompositionHouseholderTran_ZDRM();
assertTrue(alg.decompose(A));
ZMatrixRMaj Q = alg.getQ(null,false);
ZMatrixRMaj B = RandomMatrices_ZDRM.rectangle(5,2,rand);
ZMatrixRMaj expected = new ZMatrixRMaj(B.numRows,B.numCols);
CommonOps_ZDRM.mult(Q,B,expected);
alg.applyQ(B);
assertTrue(MatrixFeatures_ZDRM.isIdentical(expected,B, UtilEjml.TEST_F64));
} | void function() { ZMatrixRMaj A = RandomMatrices_ZDRM.rectangle(5, 4, rand); QRDecompositionHouseholderTran_ZDRM alg = new QRDecompositionHouseholderTran_ZDRM(); assertTrue(alg.decompose(A)); ZMatrixRMaj Q = alg.getQ(null,false); ZMatrixRMaj B = RandomMatrices_ZDRM.rectangle(5,2,rand); ZMatrixRMaj expected = new ZMatrixRMaj(B.numRows,B.numCols); CommonOps_ZDRM.mult(Q,B,expected); alg.applyQ(B); assertTrue(MatrixFeatures_ZDRM.isIdentical(expected,B, UtilEjml.TEST_F64)); } | /**
* Sees if computing Q explicitly and applying Q produces the same results
*/ | Sees if computing Q explicitly and applying Q produces the same results | applyQ | {
"repo_name": "lessthanoptimal/ejml",
"path": "main/ejml-zdense/test/org/ejml/dense/row/decompose/qr/TestQRDecompositionHouseholderTran_ZDRM.java",
"license": "apache-2.0",
"size": 6871
} | [
"org.ejml.UtilEjml",
"org.ejml.data.ZMatrixRMaj",
"org.junit.jupiter.api.Assertions"
] | import org.ejml.UtilEjml; import org.ejml.data.ZMatrixRMaj; import org.junit.jupiter.api.Assertions; | import org.ejml.*; import org.ejml.data.*; import org.junit.jupiter.api.*; | [
"org.ejml",
"org.ejml.data",
"org.junit.jupiter"
] | org.ejml; org.ejml.data; org.junit.jupiter; | 1,704,469 |
public void setAnisotropicFilterDegree(float val) {
if ( anisotropicFilterDegree == null ) {
anisotropicFilterDegree = (SFFloat)getField( "anisotropicFilterDegree" );
}
anisotropicFilterDegree.setValue( val );
} | void function(float val) { if ( anisotropicFilterDegree == null ) { anisotropicFilterDegree = (SFFloat)getField( STR ); } anisotropicFilterDegree.setValue( val ); } | /** Set the anisotropicFilterDegree field.
* @param val The float to set. */ | Set the anisotropicFilterDegree field | setAnisotropicFilterDegree | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/xj3d/sai/external/node/texturing/SAITextureProperties.java",
"license": "gpl-2.0",
"size": 7339
} | [
"org.web3d.x3d.sai.SFFloat"
] | import org.web3d.x3d.sai.SFFloat; | import org.web3d.x3d.sai.*; | [
"org.web3d.x3d"
] | org.web3d.x3d; | 2,550,055 |
public void setInexactAlarm(int type, long triggerAtMillis, PendingIntent operation) {
alarmManager.set(type, triggerAtMillis, operation);
}
| void function(int type, long triggerAtMillis, PendingIntent operation) { alarmManager.set(type, triggerAtMillis, operation); } | /**
* Sets inexact alarm above android kitkat and exact before
*
* @param type
* @param triggerAtMillis
* @param operation
*/ | Sets inexact alarm above android kitkat and exact before | setInexactAlarm | {
"repo_name": "rzetzsche/AlarmManagerCompat",
"path": "alarmmanagercompat/src/main/java/de/plauzeware/alarmmangercompat/AlarmManagerCompat.java",
"license": "apache-2.0",
"size": 6975
} | [
"android.app.PendingIntent"
] | import android.app.PendingIntent; | import android.app.*; | [
"android.app"
] | android.app; | 1,351,893 |
public boolean canUpdate(SonarObject proxy) {
return canUpdate(proxy, edit_mode);
} | boolean function(SonarObject proxy) { return canUpdate(proxy, edit_mode); } | /** Check if the user can update a proxy attribute.
* @param proxy Proxy object to check.
* @return true if user can update the attribute */ | Check if the user can update a proxy attribute | canUpdate | {
"repo_name": "SRF-Consulting/NDOR-IRIS",
"path": "src/us/mn/state/dot/tms/client/Session.java",
"license": "gpl-2.0",
"size": 14665
} | [
"us.mn.state.dot.sonar.SonarObject"
] | import us.mn.state.dot.sonar.SonarObject; | import us.mn.state.dot.sonar.*; | [
"us.mn.state"
] | us.mn.state; | 115,495 |
public static AccessControlList getAdminAcls(Configuration conf,
String configKey) {
try {
AccessControlList adminAcl =
new AccessControlList(conf.get(configKey, " "));
adminAcl.addUser(UserGroupInformation.getCurrentUser().
getShortUserName());
return adminAcl;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
} | static AccessControlList function(Configuration conf, String configKey) { try { AccessControlList adminAcl = new AccessControlList(conf.get(configKey, " ")); adminAcl.addUser(UserGroupInformation.getCurrentUser(). getShortUserName()); return adminAcl; } catch (Exception ex) { throw new RuntimeException(ex); } } | /**
* Get the ACL object representing the cluster administrators
* The user who starts the daemon is automatically added as an admin
* @param conf
* @param configKey the key that holds the ACL string in its value
* @return AccessControlList instance
*/ | Get the ACL object representing the cluster administrators The user who starts the daemon is automatically added as an admin | getAdminAcls | {
"repo_name": "simplegeo/hadoop",
"path": "src/core/org/apache/hadoop/security/SecurityUtil.java",
"license": "apache-2.0",
"size": 9013
} | [
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.security.authorize.AccessControlList"
] | import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.authorize.AccessControlList; | import org.apache.hadoop.conf.*; import org.apache.hadoop.security.authorize.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,668,965 |
public void setAuditModelRegistry(AuditModelRegistryImpl auditModelRegistry)
{
this.auditModelRegistry = auditModelRegistry;
}
| void function(AuditModelRegistryImpl auditModelRegistry) { this.auditModelRegistry = auditModelRegistry; } | /**
* Set the registry holding the audit models
* @since 3.2
*/ | Set the registry holding the audit models | setAuditModelRegistry | {
"repo_name": "Alfresco/community-edition",
"path": "projects/repository/source/java/org/alfresco/repo/audit/AuditComponentImpl.java",
"license": "lgpl-3.0",
"size": 37937
} | [
"org.alfresco.repo.audit.model.AuditModelRegistryImpl"
] | import org.alfresco.repo.audit.model.AuditModelRegistryImpl; | import org.alfresco.repo.audit.model.*; | [
"org.alfresco.repo"
] | org.alfresco.repo; | 2,039,180 |
private static BigInteger getGenerator(ArrayList<BigInteger> factors, BigInteger prime, SecureRandom rand){
int bitLength = prime.bitLength()-1;
BigInteger pMinusOne = prime.subtract(BigInteger.ONE);
BigInteger z, lnr; //Z = (p-1)/factor(i). LNR = x.modPow(z,p)
BigInteger x = new BigInteger(bitLength,rand); //Pick a random integer x smaller than the safe prime p
int size = factors.size();
// Loop while x is not a generator
ext: while (true) {
// Test all prime factors
for (int i=0;i<size;i++) {
z = pMinusOne.divide(factors.get(i));
lnr = x.modPow(z,prime);
//If == 1, x is not a generator
if (lnr.equals(BigInteger.ONE)) {
x = new BigInteger(bitLength,rand); //Pick a random integer x smaller than the safe prime p
continue ext; }
}
//If we are here, this mean x is a generator !
return x;
}
}
| static BigInteger function(ArrayList<BigInteger> factors, BigInteger prime, SecureRandom rand){ int bitLength = prime.bitLength()-1; BigInteger pMinusOne = prime.subtract(BigInteger.ONE); BigInteger z, lnr; BigInteger x = new BigInteger(bitLength,rand); int size = factors.size(); ext: while (true) { for (int i=0;i<size;i++) { z = pMinusOne.divide(factors.get(i)); lnr = x.modPow(z,prime); if (lnr.equals(BigInteger.ONE)) { x = new BigInteger(bitLength,rand); continue ext; } } return x; } } | /**
* Return a generator
* @param factors the list of the factor of the safe prime minus one (2rt-1)
* @param prime a safe prime
* @param rand an instance of SecureRandom
* @return a generator for this safe prime
*/ | Return a generator | getGenerator | {
"repo_name": "heniancheng/FRODO",
"path": "src/frodo2/solutionSpaces/crypto/ElGamalScheme.java",
"license": "agpl-3.0",
"size": 13954
} | [
"java.math.BigInteger",
"java.security.SecureRandom",
"java.util.ArrayList"
] | import java.math.BigInteger; import java.security.SecureRandom; import java.util.ArrayList; | import java.math.*; import java.security.*; import java.util.*; | [
"java.math",
"java.security",
"java.util"
] | java.math; java.security; java.util; | 986,043 |
public String getExtendedStackTraceAsString(final String suffix) {
return this.getExtendedStackTraceAsString(null, PlainTextRenderer.getInstance(), suffix);
} | String function(final String suffix) { return this.getExtendedStackTraceAsString(null, PlainTextRenderer.getInstance(), suffix); } | /**
* Format the stack trace including packaging information.
*
* @return The formatted stack trace including packaging information.
* @param suffix
*/ | Format the stack trace including packaging information | getExtendedStackTraceAsString | {
"repo_name": "codescale/logging-log4j2",
"path": "log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java",
"license": "apache-2.0",
"size": 30759
} | [
"org.apache.logging.log4j.core.pattern.PlainTextRenderer"
] | import org.apache.logging.log4j.core.pattern.PlainTextRenderer; | import org.apache.logging.log4j.core.pattern.*; | [
"org.apache.logging"
] | org.apache.logging; | 1,610,230 |
Update withNewAppServicePlan(Creatable<AppServicePlan> appServicePlanCreatable); | Update withNewAppServicePlan(Creatable<AppServicePlan> appServicePlanCreatable); | /**
* Creates a new app service plan to use.
*
* @param appServicePlanCreatable the new app service plan creatable
* @return the next stage of the web app update
*/ | Creates a new app service plan to use | withNewAppServicePlan | {
"repo_name": "jianghaolu/azure-sdk-for-java",
"path": "azure-mgmt-appservice/src/main/java/com/microsoft/azure/management/appservice/WebApp.java",
"license": "mit",
"size": 16445
} | [
"com.microsoft.azure.management.resources.fluentcore.model.Creatable"
] | import com.microsoft.azure.management.resources.fluentcore.model.Creatable; | import com.microsoft.azure.management.resources.fluentcore.model.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 1,821,500 |
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
} | void function(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { } | /**
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
*/ | Called by ItemBlocks after a block is set in the world, to allow post-place logic | onBlockPlacedBy | {
"repo_name": "SkidJava/BaseClient",
"path": "new_1.8.8/net/minecraft/block/Block.java",
"license": "gpl-2.0",
"size": 70456
} | [
"net.minecraft.block.state.IBlockState",
"net.minecraft.entity.EntityLivingBase",
"net.minecraft.item.ItemStack",
"net.minecraft.util.BlockPos",
"net.minecraft.world.World"
] | import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; import net.minecraft.world.World; | import net.minecraft.block.state.*; import net.minecraft.entity.*; import net.minecraft.item.*; import net.minecraft.util.*; import net.minecraft.world.*; | [
"net.minecraft.block",
"net.minecraft.entity",
"net.minecraft.item",
"net.minecraft.util",
"net.minecraft.world"
] | net.minecraft.block; net.minecraft.entity; net.minecraft.item; net.minecraft.util; net.minecraft.world; | 828,946 |
public WsdlType getWsdl(Session session, ServiceId id) {
ServiceType service =
new ServiceDAOImpl().getService(session, id);
if (service != null) {
return service.getWsdl();
}
return null;
} | WsdlType function(Session session, ServiceId id) { ServiceType service = new ServiceDAOImpl().getService(session, id); if (service != null) { return service.getWsdl(); } return null; } | /**
* Returns the WSDL of the given service identifier.
* @param session the session
* @param id the service identifier
* @return the WSDL of the given service identifier
*/ | Returns the WSDL of the given service identifier | getWsdl | {
"repo_name": "ria-ee/X-Road",
"path": "src/serverconf/src/main/java/ee/ria/xroad/common/conf/serverconf/dao/WsdlDAOImpl.java",
"license": "mit",
"size": 2032
} | [
"ee.ria.xroad.common.conf.serverconf.model.ServiceType",
"ee.ria.xroad.common.conf.serverconf.model.WsdlType",
"ee.ria.xroad.common.identifier.ServiceId",
"org.hibernate.Session"
] | import ee.ria.xroad.common.conf.serverconf.model.ServiceType; import ee.ria.xroad.common.conf.serverconf.model.WsdlType; import ee.ria.xroad.common.identifier.ServiceId; import org.hibernate.Session; | import ee.ria.xroad.common.conf.serverconf.model.*; import ee.ria.xroad.common.identifier.*; import org.hibernate.*; | [
"ee.ria.xroad",
"org.hibernate"
] | ee.ria.xroad; org.hibernate; | 200,390 |
OffsetDateTime lastUpdated(); | OffsetDateTime lastUpdated(); | /**
* Gets the lastUpdated property: The last updated timestamp for the pipeline run event in ISO8601 format.
*
* @return the lastUpdated value.
*/ | Gets the lastUpdated property: The last updated timestamp for the pipeline run event in ISO8601 format | lastUpdated | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/PipelineRun.java",
"license": "mit",
"size": 3147
} | [
"java.time.OffsetDateTime"
] | import java.time.OffsetDateTime; | import java.time.*; | [
"java.time"
] | java.time; | 849,296 |
private void reindex() {
try {
// recreate the RAMDirectory
directory = new RAMDirectory();
IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(
Version.LUCENE_CURRENT, analyzer));
// iterate through all rows
for (int row=0; row < tableModel.getRowCount(); row++){
//for each row make a new document
Document document = new Document();
//add the row number of this row in the decorated table model
//this will allow us to retrieve the results later
//and map this table model's row to a row in the decorated
//table model
document.add(new Field(ROW_NUMBER, "" + row, Field.Store.YES, Field.Index.ANALYZED));
//iterate through all columns
//index the value keyed by the column name
//NOTE: there could be a problem with using column names with spaces
for (int column=0; column < tableModel.getColumnCount(); column++){
String columnName = tableModel.getColumnName(column);
String columnValue = String.valueOf(tableModel.getValueAt(row, column)).toLowerCase();
document.add(new Field(columnName, columnValue, Field.Store.YES, Field.Index.ANALYZED));
}
writer.addDocument(document);
}
writer.optimize();
writer.close();
} catch (Exception e){
e.printStackTrace();
}
} | void function() { try { directory = new RAMDirectory(); IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig( Version.LUCENE_CURRENT, analyzer)); for (int row=0; row < tableModel.getRowCount(); row++){ Document document = new Document(); document.add(new Field(ROW_NUMBER, "" + row, Field.Store.YES, Field.Index.ANALYZED)); for (int column=0; column < tableModel.getColumnCount(); column++){ String columnName = tableModel.getColumnName(column); String columnValue = String.valueOf(tableModel.getValueAt(row, column)).toLowerCase(); document.add(new Field(columnName, columnValue, Field.Store.YES, Field.Index.ANALYZED)); } writer.addDocument(document); } writer.optimize(); writer.close(); } catch (Exception e){ e.printStackTrace(); } } | /**
* Reset the search results and links to the decorated (inner) table
* model from this table model.
*/ | Reset the search results and links to the decorated (inner) table model from this table model | reindex | {
"repo_name": "tokee/lucene",
"path": "contrib/swing/src/java/org/apache/lucene/swing/models/TableSearcher.java",
"license": "apache-2.0",
"size": 12319
} | [
"org.apache.lucene.document.Document",
"org.apache.lucene.document.Field",
"org.apache.lucene.index.IndexWriter",
"org.apache.lucene.index.IndexWriterConfig",
"org.apache.lucene.store.RAMDirectory",
"org.apache.lucene.util.Version"
] | import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.util.Version; | import org.apache.lucene.document.*; import org.apache.lucene.index.*; import org.apache.lucene.store.*; import org.apache.lucene.util.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 1,288,600 |
public Update addFloat(Enum<?> field, long f) throws Exception {
if (!field.getClass().equals(clazz)) {
throw new Exception("UpdateMap.addFloat(): Class missmatch!");
}
Update u = new Update(Type.FLOAT, new Float(f));
map.put(field, u);
return u;
} | Update function(Enum<?> field, long f) throws Exception { if (!field.getClass().equals(clazz)) { throw new Exception(STR); } Update u = new Update(Type.FLOAT, new Float(f)); map.put(field, u); return u; } | /**
* Adds a {@code flat} update.
*
* @param field
* field name
* @param f
* float update value
* @return {@code Update} object
* @throws Exception
*/ | Adds a flat update | addFloat | {
"repo_name": "pezi/treedb-cmdb",
"path": "src/main/java/at/treedb/at/treedb/db/UpdateMap.java",
"license": "lgpl-2.1",
"size": 13982
} | [
"at.treedb.db.Update"
] | import at.treedb.db.Update; | import at.treedb.db.*; | [
"at.treedb.db"
] | at.treedb.db; | 1,608,954 |
@Override
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e)
throws Exception {
if (this.ctx == null) {
this.ctx = ctx;
} else {
assert this.ctx == ctx;
}
getQueue().add(e);
} | void function(ChannelHandlerContext ctx, MessageEvent e) throws Exception { if (this.ctx == null) { this.ctx = ctx; } else { assert this.ctx == ctx; } getQueue().add(e); } | /**
* Stores all write requests to the queue so that they are actually written
* on {@link #flush()}.
*/ | Stores all write requests to the queue so that they are actually written on <code>#flush()</code> | writeRequested | {
"repo_name": "codefollower/Open-Source-Research",
"path": "Douyu-0.7.1/douyu-netty/src/main/java/com/codefollower/douyu/netty/handler/queue/BufferedWriteHandler.java",
"license": "apache-2.0",
"size": 12762
} | [
"com.codefollower.douyu.netty.channel.ChannelHandlerContext",
"com.codefollower.douyu.netty.channel.MessageEvent"
] | import com.codefollower.douyu.netty.channel.ChannelHandlerContext; import com.codefollower.douyu.netty.channel.MessageEvent; | import com.codefollower.douyu.netty.channel.*; | [
"com.codefollower.douyu"
] | com.codefollower.douyu; | 507,804 |
@Named("GetQueueAttributes")
@POST
@Path("/")
@FormParams(keys = ACTION, values = "GetQueueAttributes")
@XMLResponseParser(ValueHandler.class)
String getAttribute(@EndpointParam URI queue, @FormParam("AttributeName.1") String attributeName); | @Named(STR) @Path("/") @FormParams(keys = ACTION, values = STR) @XMLResponseParser(ValueHandler.class) String getAttribute(@EndpointParam URI queue, @FormParam(STR) String attributeName); | /**
* returns an attribute of a queue.
*
* @param queue
* queue to get the attributes of
*/ | returns an attribute of a queue | getAttribute | {
"repo_name": "yanzhijun/jclouds-aliyun",
"path": "apis/sqs/src/main/java/org/jclouds/sqs/features/QueueApi.java",
"license": "apache-2.0",
"size": 11966
} | [
"javax.inject.Named",
"javax.ws.rs.FormParam",
"javax.ws.rs.Path",
"org.jclouds.rest.annotations.EndpointParam",
"org.jclouds.rest.annotations.FormParams",
"org.jclouds.rest.annotations.XMLResponseParser",
"org.jclouds.sqs.xml.ValueHandler"
] | import javax.inject.Named; import javax.ws.rs.FormParam; import javax.ws.rs.Path; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.FormParams; import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.sqs.xml.ValueHandler; | import javax.inject.*; import javax.ws.rs.*; import org.jclouds.rest.annotations.*; import org.jclouds.sqs.xml.*; | [
"javax.inject",
"javax.ws",
"org.jclouds.rest",
"org.jclouds.sqs"
] | javax.inject; javax.ws; org.jclouds.rest; org.jclouds.sqs; | 2,772,642 |
@Nonnull
public static <T> Observable<Long> countLong(
@Nonnull Observable<? extends T> source,
@Nonnull Func1<? super T, Boolean> predicate) {
return countLong(where(source, predicate));
} | @Nonnull static <T> Observable<Long> function( @Nonnull Observable<? extends T> source, @Nonnull Func1<? super T, Boolean> predicate) { return countLong(where(source, predicate)); } | /**
* Counts the number of elements where the predicate returns true as long.
* @param <T> the element type
* @param source the source sequence of Ts
* @param predicate the predicate function
* @return the observable with a single value
* @since 0.97
*/ | Counts the number of elements where the predicate returns true as long | countLong | {
"repo_name": "akarnokd/reactive4java",
"path": "src/main/java/hu/akarnokd/reactive4java/reactive/Reactive.java",
"license": "apache-2.0",
"size": 367224
} | [
"hu.akarnokd.reactive4java.base.Func1",
"hu.akarnokd.reactive4java.base.Observable",
"javax.annotation.Nonnull"
] | import hu.akarnokd.reactive4java.base.Func1; import hu.akarnokd.reactive4java.base.Observable; import javax.annotation.Nonnull; | import hu.akarnokd.reactive4java.base.*; import javax.annotation.*; | [
"hu.akarnokd.reactive4java",
"javax.annotation"
] | hu.akarnokd.reactive4java; javax.annotation; | 1,803,359 |
boolean exists(String path) throws IOException; | boolean exists(String path) throws IOException; | /**
* Checks if a file or directory exists in under file system.
*
* @param path the absolute path
* @return true if the path exists, false otherwise
*/ | Checks if a file or directory exists in under file system | exists | {
"repo_name": "apc999/alluxio",
"path": "core/common/src/main/java/alluxio/underfs/UnderFileSystem.java",
"license": "apache-2.0",
"size": 20838
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,480,920 |
public DataSource<T> getDataSource() {
return dataSource;
} | DataSource<T> function() { return dataSource; } | /**
* Gets the {@Link DataSource} for this Grid.
*
* @return the data source used by this grid
*/ | Gets the DataSource for this Grid | getDataSource | {
"repo_name": "magi42/vaadin",
"path": "client/src/com/vaadin/client/widgets/Grid.java",
"license": "apache-2.0",
"size": 300856
} | [
"com.vaadin.client.data.DataSource"
] | import com.vaadin.client.data.DataSource; | import com.vaadin.client.data.*; | [
"com.vaadin.client"
] | com.vaadin.client; | 1,377,309 |
public DataInputStream getMetaBlock(String name) throws IOException,
MetaBlockDoesNotExist {
return readerBCF.getMetaBlock(name);
} | DataInputStream function(String name) throws IOException, MetaBlockDoesNotExist { return readerBCF.getMetaBlock(name); } | /**
* Stream access to a meta block.``
*
* @param name
* The name of the meta block.
* @return The input stream.
* @throws IOException
* on I/O error.
* @throws MetaBlockDoesNotExist
* If the meta block with the name does not exist.
*/ | Stream access to a meta block.`` | getMetaBlock | {
"repo_name": "koichi626/hadoop-gpu",
"path": "hadoop-gpu-0.20.1/src/core/org/apache/hadoop/io/file/tfile/TFile.java",
"license": "apache-2.0",
"size": 74043
} | [
"java.io.DataInputStream",
"java.io.IOException"
] | import java.io.DataInputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 179,418 |
protected WebappLoader createWebappLoader()
throws IOException, MojoExecutionException
{
if ( useSeparateTomcatClassLoader )
{
return ( isContextReloadable() )
? new ExternalRepositoriesReloadableWebappLoader( getTomcatClassLoader(), getLog() )
: new WebappLoader( getTomcatClassLoader() );
}
return ( isContextReloadable() )
? new ExternalRepositoriesReloadableWebappLoader( Thread.currentThread().getContextClassLoader(), getLog() )
: new WebappLoader( Thread.currentThread().getContextClassLoader() );
} | WebappLoader function() throws IOException, MojoExecutionException { if ( useSeparateTomcatClassLoader ) { return ( isContextReloadable() ) ? new ExternalRepositoriesReloadableWebappLoader( getTomcatClassLoader(), getLog() ) : new WebappLoader( getTomcatClassLoader() ); } return ( isContextReloadable() ) ? new ExternalRepositoriesReloadableWebappLoader( Thread.currentThread().getContextClassLoader(), getLog() ) : new WebappLoader( Thread.currentThread().getContextClassLoader() ); } | /**
* Gets the webapp loader to run this web application under.
*
* @return the webapp loader to use
* @throws IOException if the webapp loader could not be created
* @throws MojoExecutionException in case of an error creating the webapp loader
*/ | Gets the webapp loader to run this web application under | createWebappLoader | {
"repo_name": "karthikjaps/Tomcat",
"path": "tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractRunMojo.java",
"license": "apache-2.0",
"size": 54598
} | [
"java.io.IOException",
"org.apache.catalina.loader.WebappLoader",
"org.apache.maven.plugin.MojoExecutionException",
"org.apache.tomcat.maven.common.run.ExternalRepositoriesReloadableWebappLoader"
] | import java.io.IOException; import org.apache.catalina.loader.WebappLoader; import org.apache.maven.plugin.MojoExecutionException; import org.apache.tomcat.maven.common.run.ExternalRepositoriesReloadableWebappLoader; | import java.io.*; import org.apache.catalina.loader.*; import org.apache.maven.plugin.*; import org.apache.tomcat.maven.common.run.*; | [
"java.io",
"org.apache.catalina",
"org.apache.maven",
"org.apache.tomcat"
] | java.io; org.apache.catalina; org.apache.maven; org.apache.tomcat; | 2,257,090 |
protected boolean matchesAnnotation(AbstractClassSensorAssignment<?> classSensorAssignment, ImmutableClassType classType) {
// only check if we have annotation set
if (StringUtils.isEmpty(classSensorAssignment.getAnnotation())) {
return true;
}
IMatchPattern pattern = PatternFactory.getPattern(classSensorAssignment.getAnnotation());
// check class and super classes first
if (checkClassAndSuperClassForAnnotation(classType, pattern)) {
return true;
}
// then all interfaces.
for (ImmutableAbstractInterfaceType interfaceType : classType.getImmutableRealizedInterfaces()) {
if (interfaceType.isInterface() && checkInterfaceAndSuperInterfaceForAnnotation(interfaceType.castToInterface(), pattern)) {
return true;
}
}
return false;
} | boolean function(AbstractClassSensorAssignment<?> classSensorAssignment, ImmutableClassType classType) { if (StringUtils.isEmpty(classSensorAssignment.getAnnotation())) { return true; } IMatchPattern pattern = PatternFactory.getPattern(classSensorAssignment.getAnnotation()); if (checkClassAndSuperClassForAnnotation(classType, pattern)) { return true; } for (ImmutableAbstractInterfaceType interfaceType : classType.getImmutableRealizedInterfaces()) { if (interfaceType.isInterface() && checkInterfaceAndSuperInterfaceForAnnotation(interfaceType.castToInterface(), pattern)) { return true; } } return false; } | /**
* Checks if the {@link AbstractClassSensorAssignment} matches the given
* {@link ImmutableClassType} in terms of annotation specified in the
* {@link AbstractClassSensorAssignment}.
*
* @param classSensorAssignment
* Assignment defining the annotations.
* @param classType
* Type to check.
* @return <code>true</code> if class or any of it super-classes or realized interfaces are
* implementing the specified annotation.
*/ | Checks if the <code>AbstractClassSensorAssignment</code> matches the given <code>ImmutableClassType</code> in terms of annotation specified in the <code>AbstractClassSensorAssignment</code> | matchesAnnotation | {
"repo_name": "inspectIT/inspectIT",
"path": "inspectit.server/src/main/java/rocks/inspectit/server/instrumentation/config/filter/ClassSensorAssignmentFilter.java",
"license": "agpl-3.0",
"size": 9850
} | [
"org.apache.commons.lang.StringUtils",
"rocks.inspectit.shared.all.instrumentation.classcache.ImmutableAbstractInterfaceType",
"rocks.inspectit.shared.all.instrumentation.classcache.ImmutableClassType",
"rocks.inspectit.shared.all.pattern.IMatchPattern",
"rocks.inspectit.shared.all.pattern.PatternFactory",
"rocks.inspectit.shared.cs.ci.assignment.AbstractClassSensorAssignment"
] | import org.apache.commons.lang.StringUtils; import rocks.inspectit.shared.all.instrumentation.classcache.ImmutableAbstractInterfaceType; import rocks.inspectit.shared.all.instrumentation.classcache.ImmutableClassType; import rocks.inspectit.shared.all.pattern.IMatchPattern; import rocks.inspectit.shared.all.pattern.PatternFactory; import rocks.inspectit.shared.cs.ci.assignment.AbstractClassSensorAssignment; | import org.apache.commons.lang.*; import rocks.inspectit.shared.all.instrumentation.classcache.*; import rocks.inspectit.shared.all.pattern.*; import rocks.inspectit.shared.cs.ci.assignment.*; | [
"org.apache.commons",
"rocks.inspectit.shared"
] | org.apache.commons; rocks.inspectit.shared; | 2,755,902 |
@Override
boolean equals(@Nullable Object obj); | boolean equals(@Nullable Object obj); | /**
* Returns {@code true} if {@code obj} is another {@code RangeSet} that contains the same ranges
* according to {@link Range#equals(Object)}.
*/ | Returns true if obj is another RangeSet that contains the same ranges according to <code>Range#equals(Object)</code> | equals | {
"repo_name": "trivium-io/trivium-core",
"path": "src/io/trivium/dep/com/google/common/collect/RangeSet.java",
"license": "apache-2.0",
"size": 8025
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,424,520 |
@Nonnull
public FileSourceBuilder charset(@Nonnull Charset charset) {
this.charset = charset;
return this;
} | FileSourceBuilder function(@Nonnull Charset charset) { this.charset = charset; return this; } | /**
* Sets the character set used to encode the files. Default value is {@link
* java.nio.charset.StandardCharsets#UTF_8}.
* <p>
* Setting this component has no effect if the user provides a custom
* {@code readFileFn} to the {@link #build(FunctionEx) build()} method.
*/ | Sets the character set used to encode the files. Default value is <code>java.nio.charset.StandardCharsets#UTF_8</code>. Setting this component has no effect if the user provides a custom readFileFn to the <code>#build(FunctionEx) build()</code> method | charset | {
"repo_name": "jerrinot/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/jet/pipeline/FileSourceBuilder.java",
"license": "apache-2.0",
"size": 10058
} | [
"java.nio.charset.Charset",
"javax.annotation.Nonnull"
] | import java.nio.charset.Charset; import javax.annotation.Nonnull; | import java.nio.charset.*; import javax.annotation.*; | [
"java.nio",
"javax.annotation"
] | java.nio; javax.annotation; | 529,299 |
@Override
protected Set getDistributionManagerIds() {
DistributionAdvisor da = UpdateAttributesProcessor.this.advisee.getDistributionAdvisor();
if (da.useAdminMembersForDefault()) {
return getDistributionManager().getDistributionManagerIdsIncludingAdmin();
} else {
return super.getDistributionManagerIds();
}
} | Set function() { DistributionAdvisor da = UpdateAttributesProcessor.this.advisee.getDistributionAdvisor(); if (da.useAdminMembersForDefault()) { return getDistributionManager().getDistributionManagerIdsIncludingAdmin(); } else { return super.getDistributionManagerIds(); } } | /**
* If this processor being used by controller then return ALL members; otherwise defer to super.
*
* @return a Set of the current members
* @since GemFire 5.7
*/ | If this processor being used by controller then return ALL members; otherwise defer to super | getDistributionManagerIds | {
"repo_name": "smanvi-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/UpdateAttributesProcessor.java",
"license": "apache-2.0",
"size": 17653
} | [
"java.util.Set",
"org.apache.geode.distributed.internal.DistributionAdvisor"
] | import java.util.Set; import org.apache.geode.distributed.internal.DistributionAdvisor; | import java.util.*; import org.apache.geode.distributed.internal.*; | [
"java.util",
"org.apache.geode"
] | java.util; org.apache.geode; | 2,090,933 |
private void assertEditObjPropStmt(String uriOfSub, String uriOfPred,
String uriOfObj, Authorization expectedAuthorization) {
EditObjectPropertyStatement whatToAuth = new EditObjectPropertyStatement(
ontModel, uriOfSub, new Property(uriOfPred), uriOfObj);
PolicyDecision dec = policy.isAuthorized(ids, whatToAuth);
log.debug(dec);
Assert.assertNotNull(dec);
Assert.assertEquals(expectedAuthorization, dec.getAuthorized());
} | void function(String uriOfSub, String uriOfPred, String uriOfObj, Authorization expectedAuthorization) { EditObjectPropertyStatement whatToAuth = new EditObjectPropertyStatement( ontModel, uriOfSub, new Property(uriOfPred), uriOfObj); PolicyDecision dec = policy.isAuthorized(ids, whatToAuth); log.debug(dec); Assert.assertNotNull(dec); Assert.assertEquals(expectedAuthorization, dec.getAuthorized()); } | /**
* Create an {@link EditObjectPropertyStatement}, test it, and compare to
* expected results.
*/ | Create an <code>EditObjectPropertyStatement</code>, test it, and compare to expected results | assertEditObjPropStmt | {
"repo_name": "vivo-project/Vitro",
"path": "api/src/test/java/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicy_2_Test.java",
"license": "bsd-3-clause",
"size": 10319
} | [
"edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization",
"edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision",
"edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.EditObjectPropertyStatement",
"edu.cornell.mannlib.vitro.webapp.beans.Property",
"org.junit.Assert"
] | import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyDecision; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.EditObjectPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.Property; import org.junit.Assert; | import edu.cornell.mannlib.vitro.webapp.auth.*; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.*; import edu.cornell.mannlib.vitro.webapp.beans.*; import org.junit.*; | [
"edu.cornell.mannlib",
"org.junit"
] | edu.cornell.mannlib; org.junit; | 634,155 |
public Intent putExtra(String name, int[] value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putIntArray(name, value);
return this;
} | Intent function(String name, int[] value) { if (mExtras == null) { mExtras = new Bundle(); } mExtras.putIntArray(name, value); return this; } | /**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The int array data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getIntArrayExtra(String)
*/ | Add extended data to the intent. The name must include a package prefix, for example the app com.android.contacts would use names like "com.android.contacts.ShowAll" | putExtra | {
"repo_name": "indashnet/InDashNet.Open.UN2000",
"path": "android/frameworks/base/core/java/android/content/Intent.java",
"license": "apache-2.0",
"size": 299722
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 981,351 |
public SimpleInterval getInterval() {
return interval;
} | SimpleInterval function() { return interval; } | /**
* Gets our query interval (the interval that all Features returned by this FeatureContext overlap).
* Null if this context has no interval.
*
* @return query interval for this FeatureContext (may be null)
*/ | Gets our query interval (the interval that all Features returned by this FeatureContext overlap). Null if this context has no interval | getInterval | {
"repo_name": "davidadamsphd/hellbender",
"path": "src/main/java/org/broadinstitute/hellbender/engine/FeatureContext.java",
"license": "bsd-3-clause",
"size": 13998
} | [
"org.broadinstitute.hellbender.utils.SimpleInterval"
] | import org.broadinstitute.hellbender.utils.SimpleInterval; | import org.broadinstitute.hellbender.utils.*; | [
"org.broadinstitute.hellbender"
] | org.broadinstitute.hellbender; | 2,530,352 |
public void writeShort(FieldName field_name, short value)
{
writer.writeFieldName(field_name);
writer.writeShort(value);
}
| void function(FieldName field_name, short value) { writer.writeFieldName(field_name); writer.writeShort(value); } | /**
* Write a short in primitive form
*
* @param field_name
* @param value
*/ | Write a short in primitive form | writeShort | {
"repo_name": "jim-kane/jimmutable",
"path": "base/src/main/java/org/jimmutable/core/serialization/writer/ObjectWriter.java",
"license": "unlicense",
"size": 9596
} | [
"org.jimmutable.core.serialization.FieldName"
] | import org.jimmutable.core.serialization.FieldName; | import org.jimmutable.core.serialization.*; | [
"org.jimmutable.core"
] | org.jimmutable.core; | 854,659 |
default Optional<CompletableFuture<User>> requestOptionUserValueByIndex(int index) {
return getOptionByIndex(index).flatMap(SlashCommandInteractionOption::requestUserValue);
} | default Optional<CompletableFuture<User>> requestOptionUserValueByIndex(int index) { return getOptionByIndex(index).flatMap(SlashCommandInteractionOption::requestUserValue); } | /**
* Gets the user value of an option at the specified index.
*
* @param index The index of the option to search for.
* @return An Optional with the user value of such an option if it exists; an empty Optional otherwise
*/ | Gets the user value of an option at the specified index | requestOptionUserValueByIndex | {
"repo_name": "BtoBastian/Javacord",
"path": "javacord-api/src/main/java/org/javacord/api/interaction/SlashCommandInteractionOptionsProvider.java",
"license": "lgpl-3.0",
"size": 22752
} | [
"java.util.Optional",
"java.util.concurrent.CompletableFuture",
"org.javacord.api.entity.user.User"
] | import java.util.Optional; import java.util.concurrent.CompletableFuture; import org.javacord.api.entity.user.User; | import java.util.*; import java.util.concurrent.*; import org.javacord.api.entity.user.*; | [
"java.util",
"org.javacord.api"
] | java.util; org.javacord.api; | 1,229,079 |
protected ModelAndView buildCallbackUrlResponseType(final AccessTokenRequestDataHolder holder,
final String redirectUri,
final OAuth20AccessToken accessToken,
final List<NameValuePair> params,
final OAuth20RefreshToken refreshToken,
final JEEContext context) throws Exception {
val attributes = holder.getAuthentication().getAttributes();
val state = attributes.get(OAuth20Constants.STATE).get(0).toString();
val nonce = attributes.get(OAuth20Constants.NONCE).get(0).toString();
val builder = new URIBuilder(redirectUri);
val stringBuilder = new StringBuilder();
val encodedAccessToken = OAuth20JwtAccessTokenEncoder.builder()
.accessToken(accessToken)
.registeredService(holder.getRegisteredService())
.service(holder.getService())
.accessTokenJwtBuilder(accessTokenJwtBuilder)
.casProperties(casProperties)
.build()
.encode();
val expiration = accessTokenExpirationPolicy.buildTicketExpirationPolicy();
val timeToLive = expiration.getTimeToLive();
stringBuilder.append(OAuth20Constants.ACCESS_TOKEN)
.append('=')
.append(encodedAccessToken)
.append('&')
.append(OAuth20Constants.TOKEN_TYPE)
.append('=')
.append(OAuth20Constants.TOKEN_TYPE_BEARER)
.append('&')
.append(OAuth20Constants.EXPIRES_IN)
.append('=')
.append(timeToLive);
if (refreshToken != null) {
stringBuilder.append('&')
.append(OAuth20Constants.REFRESH_TOKEN)
.append('=')
.append(refreshToken.getId());
}
params.forEach(p -> stringBuilder.append('&')
.append(p.getName())
.append('=')
.append(p.getValue()));
if (StringUtils.isNotBlank(state)) {
stringBuilder.append('&')
.append(OAuth20Constants.STATE)
.append('=')
.append(state);
}
if (StringUtils.isNotBlank(nonce)) {
stringBuilder.append('&')
.append(OAuth20Constants.NONCE)
.append('=')
.append(nonce);
}
builder.setFragment(stringBuilder.toString());
val url = builder.toString();
LOGGER.debug("Redirecting to URL [{}]", url);
val parameters = new LinkedHashMap<String, String>();
parameters.put(OAuth20Constants.ACCESS_TOKEN, encodedAccessToken);
if (refreshToken != null) {
parameters.put(OAuth20Constants.REFRESH_TOKEN, refreshToken.getId());
}
parameters.put(OAuth20Constants.EXPIRES_IN, timeToLive.toString());
parameters.put(OAuth20Constants.STATE, state);
parameters.put(OAuth20Constants.NONCE, nonce);
parameters.put(OAuth20Constants.CLIENT_ID, accessToken.getClientId());
return buildResponseModelAndView(context, servicesManager, accessToken.getClientId(), url, parameters);
} | ModelAndView function(final AccessTokenRequestDataHolder holder, final String redirectUri, final OAuth20AccessToken accessToken, final List<NameValuePair> params, final OAuth20RefreshToken refreshToken, final JEEContext context) throws Exception { val attributes = holder.getAuthentication().getAttributes(); val state = attributes.get(OAuth20Constants.STATE).get(0).toString(); val nonce = attributes.get(OAuth20Constants.NONCE).get(0).toString(); val builder = new URIBuilder(redirectUri); val stringBuilder = new StringBuilder(); val encodedAccessToken = OAuth20JwtAccessTokenEncoder.builder() .accessToken(accessToken) .registeredService(holder.getRegisteredService()) .service(holder.getService()) .accessTokenJwtBuilder(accessTokenJwtBuilder) .casProperties(casProperties) .build() .encode(); val expiration = accessTokenExpirationPolicy.buildTicketExpirationPolicy(); val timeToLive = expiration.getTimeToLive(); stringBuilder.append(OAuth20Constants.ACCESS_TOKEN) .append('=') .append(encodedAccessToken) .append('&') .append(OAuth20Constants.TOKEN_TYPE) .append('=') .append(OAuth20Constants.TOKEN_TYPE_BEARER) .append('&') .append(OAuth20Constants.EXPIRES_IN) .append('=') .append(timeToLive); if (refreshToken != null) { stringBuilder.append('&') .append(OAuth20Constants.REFRESH_TOKEN) .append('=') .append(refreshToken.getId()); } params.forEach(p -> stringBuilder.append('&') .append(p.getName()) .append('=') .append(p.getValue())); if (StringUtils.isNotBlank(state)) { stringBuilder.append('&') .append(OAuth20Constants.STATE) .append('=') .append(state); } if (StringUtils.isNotBlank(nonce)) { stringBuilder.append('&') .append(OAuth20Constants.NONCE) .append('=') .append(nonce); } builder.setFragment(stringBuilder.toString()); val url = builder.toString(); LOGGER.debug(STR, url); val parameters = new LinkedHashMap<String, String>(); parameters.put(OAuth20Constants.ACCESS_TOKEN, encodedAccessToken); if (refreshToken != null) { parameters.put(OAuth20Constants.REFRESH_TOKEN, refreshToken.getId()); } parameters.put(OAuth20Constants.EXPIRES_IN, timeToLive.toString()); parameters.put(OAuth20Constants.STATE, state); parameters.put(OAuth20Constants.NONCE, nonce); parameters.put(OAuth20Constants.CLIENT_ID, accessToken.getClientId()); return buildResponseModelAndView(context, servicesManager, accessToken.getClientId(), url, parameters); } | /**
* Build callback url response type string.
*
* @param holder the holder
* @param redirectUri the redirect uri
* @param accessToken the access token
* @param params the params
* @param refreshToken the refresh token
* @param context the context
* @return the string
* @throws Exception the exception
*/ | Build callback url response type string | buildCallbackUrlResponseType | {
"repo_name": "leleuj/cas",
"path": "support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/callback/OAuth20TokenAuthorizationResponseBuilder.java",
"license": "apache-2.0",
"size": 6780
} | [
"java.util.LinkedHashMap",
"java.util.List",
"org.apache.commons.lang3.StringUtils",
"org.apache.http.NameValuePair",
"org.apache.http.client.utils.URIBuilder",
"org.apereo.cas.support.oauth.OAuth20Constants",
"org.apereo.cas.support.oauth.web.response.accesstoken.ext.AccessTokenRequestDataHolder",
"org.apereo.cas.support.oauth.web.response.accesstoken.response.OAuth20JwtAccessTokenEncoder",
"org.apereo.cas.ticket.accesstoken.OAuth20AccessToken",
"org.apereo.cas.ticket.refreshtoken.OAuth20RefreshToken",
"org.pac4j.core.context.JEEContext",
"org.springframework.web.servlet.ModelAndView"
] | import java.util.LinkedHashMap; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.http.NameValuePair; import org.apache.http.client.utils.URIBuilder; import org.apereo.cas.support.oauth.OAuth20Constants; import org.apereo.cas.support.oauth.web.response.accesstoken.ext.AccessTokenRequestDataHolder; import org.apereo.cas.support.oauth.web.response.accesstoken.response.OAuth20JwtAccessTokenEncoder; import org.apereo.cas.ticket.accesstoken.OAuth20AccessToken; import org.apereo.cas.ticket.refreshtoken.OAuth20RefreshToken; import org.pac4j.core.context.JEEContext; import org.springframework.web.servlet.ModelAndView; | import java.util.*; import org.apache.commons.lang3.*; import org.apache.http.*; import org.apache.http.client.utils.*; import org.apereo.cas.support.oauth.*; import org.apereo.cas.support.oauth.web.response.accesstoken.ext.*; import org.apereo.cas.support.oauth.web.response.accesstoken.response.*; import org.apereo.cas.ticket.accesstoken.*; import org.apereo.cas.ticket.refreshtoken.*; import org.pac4j.core.context.*; import org.springframework.web.servlet.*; | [
"java.util",
"org.apache.commons",
"org.apache.http",
"org.apereo.cas",
"org.pac4j.core",
"org.springframework.web"
] | java.util; org.apache.commons; org.apache.http; org.apereo.cas; org.pac4j.core; org.springframework.web; | 2,340,420 |
public Vertex createPronoun(String text, Vertex meaning, Network network, Primitive type, Primitive type2) {
Vertex word = createWord(text, meaning, false, network, Primitive.PRONOUN, null, type, type2, null);
return word;
} | Vertex function(String text, Vertex meaning, Network network, Primitive type, Primitive type2) { Vertex word = createWord(text, meaning, false, network, Primitive.PRONOUN, null, type, type2, null); return word; } | /**
* Create the pronoun with the meaning.
*/ | Create the pronoun with the meaning | createPronoun | {
"repo_name": "BOTlibre/BOTlibre",
"path": "ai-engine/source/org/botlibre/knowledge/Bootstrap.java",
"license": "epl-1.0",
"size": 59008
} | [
"org.botlibre.api.knowledge.Network",
"org.botlibre.api.knowledge.Vertex"
] | import org.botlibre.api.knowledge.Network; import org.botlibre.api.knowledge.Vertex; | import org.botlibre.api.knowledge.*; | [
"org.botlibre.api"
] | org.botlibre.api; | 1,472,390 |
//---------------//
// getStaffAbove //
//---------------//
public Staff getStaffAbove (Point sysPt)
{
Staff best = null;
for (TreeNode node : getParts()) {
SystemPart part = (SystemPart) node;
if (!part.isDummy()) {
for (TreeNode n : part.getStaves()) {
Staff staff = (Staff) n;
if (staff.getCenter().y < sysPt.y) {
best = staff;
}
}
}
}
return best;
}
| Staff function (Point sysPt) { Staff best = null; for (TreeNode node : getParts()) { SystemPart part = (SystemPart) node; if (!part.isDummy()) { for (TreeNode n : part.getStaves()) { Staff staff = (Staff) n; if (staff.getCenter().y < sysPt.y) { best = staff; } } } } return best; } | /**
* Determine the real staff which is just above the given point.
*
* @param sysPt the given point
* @return the staff above
*/ | Determine the real staff which is just above the given point | getStaffAbove | {
"repo_name": "jlpoolen/libreveris",
"path": "src/main/omr/score/entity/ScoreSystem.java",
"license": "lgpl-3.0",
"size": 16629
} | [
"java.awt.Point"
] | import java.awt.Point; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,720,322 |
IpLink getIpLink(TerminationPoint src, TerminationPoint dst); | IpLink getIpLink(TerminationPoint src, TerminationPoint dst); | /**
* Returns the ip links between the specified source
* and destination termination points.
*
* @param src source termination point
* @param dst destination termination point
* @return ip link from source to destination; null if none found
*/ | Returns the ip links between the specified source and destination termination points | getIpLink | {
"repo_name": "kuujo/onos",
"path": "apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/link/IpLinkService.java",
"license": "apache-2.0",
"size": 3200
} | [
"org.onosproject.iptopology.api.IpLink",
"org.onosproject.iptopology.api.TerminationPoint"
] | import org.onosproject.iptopology.api.IpLink; import org.onosproject.iptopology.api.TerminationPoint; | import org.onosproject.iptopology.api.*; | [
"org.onosproject.iptopology"
] | org.onosproject.iptopology; | 2,779,773 |
public JAXBElement<OAIPMHtype> identify() throws Exception //
{
LOG.info("identify");
OAIPMHtype oaipmh = makeOaiPmhType();
RequestType request = makeRequestType();
oaipmh.setRequest(request);
request.setVerb(VerbType.IDENTIFY);
IdentifyType identify = factoryPmh.createIdentifyType();
oaipmh.setIdentify(identify);
identify.setRepositoryName(repoName);
identify.setBaseURL(oaiPmhDisplayUri);
identify.setProtocolVersion("2.0");
List<String> adminEmails = identify.getAdminEmail();
for ( String adminEmail : adminEmailsString ) {
adminEmails.add(adminEmail);
}
identify.setEarliestDatestamp(earliestTimestamp);
identify.setDeletedRecord(DeletedRecordType.NO);
identify.setGranularity(GranularityType.YYYY_MM_DD);
return factoryPmh.createOAIPMH(oaipmh);
} | JAXBElement<OAIPMHtype> function() throws Exception LOG.info(STR); OAIPMHtype oaipmh = makeOaiPmhType(); RequestType request = makeRequestType(); oaipmh.setRequest(request); request.setVerb(VerbType.IDENTIFY); IdentifyType identify = factoryPmh.createIdentifyType(); oaipmh.setIdentify(identify); identify.setRepositoryName(repoName); identify.setBaseURL(oaiPmhDisplayUri); identify.setProtocolVersion("2.0"); List<String> adminEmails = identify.getAdminEmail(); for ( String adminEmail : adminEmailsString ) { adminEmails.add(adminEmail); } identify.setEarliestDatestamp(earliestTimestamp); identify.setDeletedRecord(DeletedRecordType.NO); identify.setGranularity(GranularityType.YYYY_MM_DD); return factoryPmh.createOAIPMH(oaipmh); } | /**
* verb: Identify
*
* @return data describing this OAI PMH server
*/ | verb: Identify | identify | {
"repo_name": "Deutsche-Digitale-Bibliothek/ddb-backend",
"path": "OaiPmhServer/src/main/java/de/fhg/iais/cortex/oaipmh/service/OaiPmhService.java",
"license": "apache-2.0",
"size": 29390
} | [
"de.fhg.iais.cortex.generated.oaiPmh.DeletedRecordType",
"de.fhg.iais.cortex.generated.oaiPmh.GranularityType",
"de.fhg.iais.cortex.generated.oaiPmh.IdentifyType",
"de.fhg.iais.cortex.generated.oaiPmh.OAIPMHtype",
"de.fhg.iais.cortex.generated.oaiPmh.RequestType",
"de.fhg.iais.cortex.generated.oaiPmh.VerbType",
"java.util.List",
"javax.xml.bind.JAXBElement"
] | import de.fhg.iais.cortex.generated.oaiPmh.DeletedRecordType; import de.fhg.iais.cortex.generated.oaiPmh.GranularityType; import de.fhg.iais.cortex.generated.oaiPmh.IdentifyType; import de.fhg.iais.cortex.generated.oaiPmh.OAIPMHtype; import de.fhg.iais.cortex.generated.oaiPmh.RequestType; import de.fhg.iais.cortex.generated.oaiPmh.VerbType; import java.util.List; import javax.xml.bind.JAXBElement; | import de.fhg.iais.cortex.generated.*; import java.util.*; import javax.xml.bind.*; | [
"de.fhg.iais",
"java.util",
"javax.xml"
] | de.fhg.iais; java.util; javax.xml; | 521,346 |
public synchronized void cancelRemotePortForwarding(int bindPort) throws IOException {
if (tm == null)
throw new IllegalStateException("You need to establish a connection first.");
if (!authenticated)
throw new IllegalStateException("The connection is not authenticated.");
cm.requestCancelGlobalForward(bindPort);
}
| synchronized void function(int bindPort) throws IOException { if (tm == null) throw new IllegalStateException(STR); if (!authenticated) throw new IllegalStateException(STR); cm.requestCancelGlobalForward(bindPort); } | /**
* Cancel an earlier requested remote port forwarding.
* Currently active forwardings will not be affected (e.g., disrupted).
* Note that further connection forwarding requests may be received until
* this method has returned.
*
* @param bindPort the allocated port number on the server
* @throws IOException if the remote side refuses the cancel request or another low
* level error occurs (e.g., the underlying connection is closed)
*/ | Cancel an earlier requested remote port forwarding. Currently active forwardings will not be affected (e.g., disrupted). Note that further connection forwarding requests may be received until this method has returned | cancelRemotePortForwarding | {
"repo_name": "MonALISA-CIT/fdt",
"path": "src/ch/ethz/ssh2/Connection.java",
"license": "apache-2.0",
"size": 48622
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 112,984 |
@Test
public void testFindNoStatuses() {
final Specification<ClusterEntity> spec = JpaClusterSpecs
.find(
NAME,
null,
TAGS,
MIN_UPDATE_TIME,
MAX_UPDATE_TIME
);
spec.toPredicate(this.root, this.cq, this.cb);
Mockito.verify(this.cb, Mockito.times(1))
.equal(this.root.get(ClusterEntity_.name), NAME);
Mockito.verify(this.cb, Mockito.times(1))
.greaterThanOrEqualTo(this.root.get(ClusterEntity_.updated), MIN_UPDATE_TIME);
Mockito.verify(this.cb, Mockito.times(1)).lessThan(
this.root.get(ClusterEntity_.updated), MAX_UPDATE_TIME);
Mockito.verify(this.cb, Mockito.times(1))
.like(this.root.get(ClusterEntity_.tags), this.tagLikeStatement);
for (final ClusterStatus status : STATUSES) {
Mockito.verify(this.cb, Mockito.never())
.equal(this.root.get(ClusterEntity_.status), status);
}
} | void function() { final Specification<ClusterEntity> spec = JpaClusterSpecs .find( NAME, null, TAGS, MIN_UPDATE_TIME, MAX_UPDATE_TIME ); spec.toPredicate(this.root, this.cq, this.cb); Mockito.verify(this.cb, Mockito.times(1)) .equal(this.root.get(ClusterEntity_.name), NAME); Mockito.verify(this.cb, Mockito.times(1)) .greaterThanOrEqualTo(this.root.get(ClusterEntity_.updated), MIN_UPDATE_TIME); Mockito.verify(this.cb, Mockito.times(1)).lessThan( this.root.get(ClusterEntity_.updated), MAX_UPDATE_TIME); Mockito.verify(this.cb, Mockito.times(1)) .like(this.root.get(ClusterEntity_.tags), this.tagLikeStatement); for (final ClusterStatus status : STATUSES) { Mockito.verify(this.cb, Mockito.never()) .equal(this.root.get(ClusterEntity_.status), status); } } | /**
* Test the find specification.
*/ | Test the find specification | testFindNoStatuses | {
"repo_name": "irontable/genie",
"path": "genie-core/src/test/java/com/netflix/genie/core/jpa/specifications/JpaClusterSpecsUnitTests.java",
"license": "apache-2.0",
"size": 18690
} | [
"com.netflix.genie.common.dto.ClusterStatus",
"com.netflix.genie.core.jpa.entities.ClusterEntity",
"org.mockito.Mockito",
"org.springframework.data.jpa.domain.Specification"
] | import com.netflix.genie.common.dto.ClusterStatus; import com.netflix.genie.core.jpa.entities.ClusterEntity; import org.mockito.Mockito; import org.springframework.data.jpa.domain.Specification; | import com.netflix.genie.common.dto.*; import com.netflix.genie.core.jpa.entities.*; import org.mockito.*; import org.springframework.data.jpa.domain.*; | [
"com.netflix.genie",
"org.mockito",
"org.springframework.data"
] | com.netflix.genie; org.mockito; org.springframework.data; | 1,851,468 |
void schedule(Runnable task) throws InvalidParameterException, InvalidContextException; | void schedule(Runnable task) throws InvalidParameterException, InvalidContextException; | /**
* The method submits a runnable task into the task queue to be executed.
*
* @param task the task to be scheduled, cannot be {@code null}.
* @throws InvalidParameterException when {@code task} is {@code null}.
* @throws InvalidContextException if the task queue is not running.
*/ | The method submits a runnable task into the task queue to be executed | schedule | {
"repo_name": "raistlic/raistlic-lib-commons-core",
"path": "src/main/java/org/raistlic/common/taskqueue/TaskQueue.java",
"license": "apache-2.0",
"size": 7612
} | [
"org.raistlic.common.precondition.InvalidContextException",
"org.raistlic.common.precondition.InvalidParameterException"
] | import org.raistlic.common.precondition.InvalidContextException; import org.raistlic.common.precondition.InvalidParameterException; | import org.raistlic.common.precondition.*; | [
"org.raistlic.common"
] | org.raistlic.common; | 2,201,768 |
protected void fireTreeNodesRemoved (Object source,
Object[] path,
int[] childIndices,
Object[] children)
{
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
TreeModelEvent e = null;
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == TreeModelListener.class) {
// Lazily create the event:
if (e == null) {
e = new TreeModelEvent(source, path, childIndices, children);
}
((TreeModelListener) listeners[i + 1]).treeNodesRemoved(e);
}
}
}
| void function (Object source, Object[] path, int[] childIndices, Object[] children) { Object[] listeners = listenerList.getListenerList(); TreeModelEvent e = null; for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TreeModelListener.class) { if (e == null) { e = new TreeModelEvent(source, path, childIndices, children); } ((TreeModelListener) listeners[i + 1]).treeNodesRemoved(e); } } } | /**
* Notify all listeners that have registered interest for
* notification on this event type. The event instance
* is lazily created using the parameters passed into
* the fire method.
*
* @param source DOCUMENT ME!
* @param path DOCUMENT ME!
* @param childIndices DOCUMENT ME!
* @param children DOCUMENT ME!
* @see EventListenerList
*/ | Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method | fireTreeNodesRemoved | {
"repo_name": "Audiveris/audiveris",
"path": "src/main/org/audiveris/omr/ui/treetable/AbstractTreeTableModel.java",
"license": "agpl-3.0",
"size": 10869
} | [
"javax.swing.event.TreeModelEvent",
"javax.swing.event.TreeModelListener"
] | import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; | import javax.swing.event.*; | [
"javax.swing"
] | javax.swing; | 468,952 |
public List<Tuple3<FieldsAlignment, FieldsAligned, FieldsSource>> getRelationshipWasAlignedBy(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException {
List<Object> args = new ArrayList<Object>();
args.add(ids);
args.add(fromFields);
args.add(relFields);
args.add(toFields);
TypeReference<List<List<Tuple3<FieldsAlignment, FieldsAligned, FieldsSource>>>> retType = new TypeReference<List<List<Tuple3<FieldsAlignment, FieldsAligned, FieldsSource>>>>() {};
List<List<Tuple3<FieldsAlignment, FieldsAligned, FieldsSource>>> res = caller.jsonrpcCall("CDMI_EntityAPI.get_relationship_WasAlignedBy", args, retType, true, false);
return res.get(0);
} | List<Tuple3<FieldsAlignment, FieldsAligned, FieldsSource>> function(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(ids); args.add(fromFields); args.add(relFields); args.add(toFields); TypeReference<List<List<Tuple3<FieldsAlignment, FieldsAligned, FieldsSource>>>> retType = new TypeReference<List<List<Tuple3<FieldsAlignment, FieldsAligned, FieldsSource>>>>() {}; List<List<Tuple3<FieldsAlignment, FieldsAligned, FieldsSource>>> res = caller.jsonrpcCall(STR, args, retType, true, false); return res.get(0); } | /**
* <p>Original spec-file function name: get_relationship_WasAlignedBy</p>
* <pre>
* </pre>
* @param ids instance of list of String
* @param fromFields instance of list of String
* @param relFields instance of list of String
* @param toFields instance of list of String
* @return instance of list of tuple of size 3: type {@link us.kbase.cdmientityapi.FieldsAlignment FieldsAlignment} (original type "fields_Alignment"), type {@link us.kbase.cdmientityapi.FieldsAligned FieldsAligned} (original type "fields_Aligned"), type {@link us.kbase.cdmientityapi.FieldsSource FieldsSource} (original type "fields_Source")
* @throws IOException if an IO exception occurs
* @throws JsonClientException if a JSON RPC exception occurs
*/ | Original spec-file function name: get_relationship_WasAlignedBy <code> </code> | getRelationshipWasAlignedBy | {
"repo_name": "kbase/trees",
"path": "src/us/kbase/cdmientityapi/CDMIEntityAPIClient.java",
"license": "mit",
"size": 869221
} | [
"com.fasterxml.jackson.core.type.TypeReference",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"us.kbase.common.service.JsonClientException",
"us.kbase.common.service.Tuple3"
] | import com.fasterxml.jackson.core.type.TypeReference; import java.io.IOException; import java.util.ArrayList; import java.util.List; import us.kbase.common.service.JsonClientException; import us.kbase.common.service.Tuple3; | import com.fasterxml.jackson.core.type.*; import java.io.*; import java.util.*; import us.kbase.common.service.*; | [
"com.fasterxml.jackson",
"java.io",
"java.util",
"us.kbase.common"
] | com.fasterxml.jackson; java.io; java.util; us.kbase.common; | 1,967,532 |
public void addAttributeParser(String type, SdpParser<? extends AttributeField> parser) {
synchronized (this.attributeParsers) {
this.attributeParsers.put(type, parser);
}
}
| void function(String type, SdpParser<? extends AttributeField> parser) { synchronized (this.attributeParsers) { this.attributeParsers.put(type, parser); } } | /**
* Adds an attribute parser to the pipeline.
*
* @param parser
* The parser to be registered
*/ | Adds an attribute parser to the pipeline | addAttributeParser | {
"repo_name": "ocarriles/sbc",
"path": "sbc-media/src/main/java/org/restcomm/sbc/media/helpers/ExtendedSdpParserPipeline.java",
"license": "agpl-3.0",
"size": 9576
} | [
"org.mobicents.media.server.io.sdp.SdpParser",
"org.mobicents.media.server.io.sdp.fields.AttributeField"
] | import org.mobicents.media.server.io.sdp.SdpParser; import org.mobicents.media.server.io.sdp.fields.AttributeField; | import org.mobicents.media.server.io.sdp.*; import org.mobicents.media.server.io.sdp.fields.*; | [
"org.mobicents.media"
] | org.mobicents.media; | 2,423,501 |
public boolean supportsSchemasInTableDefinitions() throws SQLException {
return false;
} | boolean function() throws SQLException { return false; } | /**
* Can a schema name be used in a table definition statement?
*
* @return true if so
* @throws SQLException
* DOCUMENT ME!
*/ | Can a schema name be used in a table definition statement | supportsSchemasInTableDefinitions | {
"repo_name": "shubhanshu-gupta/Apache-Solr",
"path": "example/solr/collection1/lib/mysql-connector-java-5.1.32/src/com/mysql/jdbc/DatabaseMetaData.java",
"license": "apache-2.0",
"size": 287958
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 371,112 |
public Rule setParams(List<RuleParam> params) {
this.params.clear();
for (RuleParam param : params) {
param.setRule(this);
this.params.add(param);
}
return this;
} | Rule function(List<RuleParam> params) { this.params.clear(); for (RuleParam param : params) { param.setRule(this); this.params.add(param); } return this; } | /**
* Sets the rule parameters
*/ | Sets the rule parameters | setParams | {
"repo_name": "lbndev/sonarqube",
"path": "sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java",
"license": "lgpl-3.0",
"size": 13305
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,803,135 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Version.class))
{
case VersioningPackage.VERSION__PRIMARY_SPEC:
case VersioningPackage.VERSION__TAG_SPECS:
case VersioningPackage.VERSION__LOG_MESSAGE:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Version.class)) { case VersioningPackage.VERSION__PRIMARY_SPEC: case VersioningPackage.VERSION__TAG_SPECS: case VersioningPackage.VERSION__LOG_MESSAGE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "edgarmueller/emfstore-rest",
"path": "bundles/org.eclipse.emf.emfstore.server.model.edit/src/org/eclipse/emf/emfstore/internal/server/model/versioning/provider/VersionItemProvider.java",
"license": "epl-1.0",
"size": 10614
} | [
"org.eclipse.emf.common.notify.Notification",
"org.eclipse.emf.edit.provider.ViewerNotification",
"org.eclipse.emf.emfstore.internal.server.model.versioning.Version",
"org.eclipse.emf.emfstore.internal.server.model.versioning.VersioningPackage"
] | import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification; import org.eclipse.emf.emfstore.internal.server.model.versioning.Version; import org.eclipse.emf.emfstore.internal.server.model.versioning.VersioningPackage; | import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; import org.eclipse.emf.emfstore.internal.server.model.versioning.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 18,798 |
public InputStream getInputStream() {
return Channels.newInputStream(in);
} | InputStream function() { return Channels.newInputStream(in); } | /**
* Get the stream for the parent's input, which is the child's output.
*
* @return the parent's input stream for the child's output
*/ | Get the stream for the parent's input, which is the child's output | getInputStream | {
"repo_name": "jnr/jnr-process",
"path": "src/main/java/jnr/process/Process.java",
"license": "apache-2.0",
"size": 5836
} | [
"java.io.InputStream",
"java.nio.channels.Channels"
] | import java.io.InputStream; import java.nio.channels.Channels; | import java.io.*; import java.nio.channels.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,260,106 |
public static int checkAck(boolean transacted, int acknowledgeMode) {
if (!transacted && acknowledgeMode == Session.SESSION_TRANSACTED) {
return Session.AUTO_ACKNOWLEDGE;
}
return acknowledgeMode;
} | static int function(boolean transacted, int acknowledgeMode) { if (!transacted && acknowledgeMode == Session.SESSION_TRANSACTED) { return Session.AUTO_ACKNOWLEDGE; } return acknowledgeMode; } | /**
* I'm keeping this as static as the same check will be done within RA.
* This is to conform with TCK Tests where we must return ackMode exactly as they want if transacted=false
*/ | I'm keeping this as static as the same check will be done within RA. This is to conform with TCK Tests where we must return ackMode exactly as they want if transacted=false | checkAck | {
"repo_name": "gaohoward/activemq-artemis",
"path": "artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java",
"license": "apache-2.0",
"size": 29848
} | [
"javax.jms.Session"
] | import javax.jms.Session; | import javax.jms.*; | [
"javax.jms"
] | javax.jms; | 889,799 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.