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
@MediumTest @Feature({"Accessibility"}) public void testObservesTitleChanges() throws Exception { loadUrl(PAGE_1_HTML); // Bring the tab switcher forward and send it away twice. toggleTabSwitcher(true); assertEquals("Page 1", getTabTitleOfListItem(0)); toggleTabSwitcher(false); toggleTabSwitcher(true); toggleTabSwitcher(false); // Load another URL. final TabLoadObserver observer = new TabLoadObserver(getActivity().getActivityTab(), PAGE_2_HTML); assertTrue(CriteriaHelper.pollForUIThreadCriteria(observer)); // Bring the tab switcher forward and check the title. toggleTabSwitcher(true); assertEquals("Page 2", getTabTitleOfListItem(0)); }
@Feature({STR}) void function() throws Exception { loadUrl(PAGE_1_HTML); toggleTabSwitcher(true); assertEquals(STR, getTabTitleOfListItem(0)); toggleTabSwitcher(false); toggleTabSwitcher(true); toggleTabSwitcher(false); final TabLoadObserver observer = new TabLoadObserver(getActivity().getActivityTab(), PAGE_2_HTML); assertTrue(CriteriaHelper.pollForUIThreadCriteria(observer)); toggleTabSwitcher(true); assertEquals(STR, getTabTitleOfListItem(0)); }
/** * Tests that the TabObserver of the {@link AccessibilityTabModelListItem} is added back * to the Tab after the View is hidden. This requires bringing the tab switcher back twice * because the TabObserver is removed/added when the tab switcher's View is detached from/ * attached to the window. */
Tests that the TabObserver of the <code>AccessibilityTabModelListItem</code> is added back to the Tab after the View is hidden. This requires bringing the tab switcher back twice because the TabObserver is removed/added when the tab switcher's View is detached from attached to the window
testObservesTitleChanges
{ "repo_name": "Bysmyyr/chromium-crosswalk", "path": "chrome/android/javatests/src/org/chromium/chrome/browser/widget/OverviewListLayoutTest.java", "license": "bsd-3-clause", "size": 17699 }
[ "org.chromium.base.test.util.Feature", "org.chromium.chrome.test.util.browser.TabLoadObserver", "org.chromium.content.browser.test.util.CriteriaHelper" ]
import org.chromium.base.test.util.Feature; import org.chromium.chrome.test.util.browser.TabLoadObserver; import org.chromium.content.browser.test.util.CriteriaHelper;
import org.chromium.base.test.util.*; import org.chromium.chrome.test.util.browser.*; import org.chromium.content.browser.test.util.*;
[ "org.chromium.base", "org.chromium.chrome", "org.chromium.content" ]
org.chromium.base; org.chromium.chrome; org.chromium.content;
469,751
public void generateActionModelMenus(); public Document getActionModelMenu(String context);
void generateActionModelMenus(); public Document function(String context);
/** * Used to get the document object from the action model map * @param context action model name * @return document object */
Used to get the document object from the action model map
getActionModelMenu
{ "repo_name": "leocockroach/JasperServer5.6", "path": "jasperserver-api/engine/src/main/java/com/jaspersoft/jasperserver/api/engine/common/service/ActionModelService.java", "license": "gpl-2.0", "size": 1512 }
[ "org.jdom.Document" ]
import org.jdom.Document;
import org.jdom.*;
[ "org.jdom" ]
org.jdom;
1,757,223
EClass getmultExp();
EClass getmultExp();
/** * Returns the meta object for class '{@link org.xtext.example.delphi.delphi.multExp <em>mult Exp</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>mult Exp</em>'. * @see org.xtext.example.delphi.delphi.multExp * @generated */
Returns the meta object for class '<code>org.xtext.example.delphi.delphi.multExp mult Exp</code>'.
getmultExp
{ "repo_name": "adolfosbh/cs2as", "path": "org.xtext.example.delphi/src-gen/org/xtext/example/delphi/delphi/DelphiPackage.java", "license": "epl-1.0", "size": 434880 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
416,405
private UnknownFieldSetLite mergeFrom(final CodedInputStream input) throws IOException { // Ensures initialization in mergeFieldFrom. while (true) { final int tag = input.readTag(); if (tag == 0 || !mergeFieldFrom(tag, input)) { break; } } return this; }
UnknownFieldSetLite function(final CodedInputStream input) throws IOException { while (true) { final int tag = input.readTag(); if (tag == 0 !mergeFieldFrom(tag, input)) { break; } } return this; }
/** * Parse an entire message from {@code input} and merge its fields into * this set. */
Parse an entire message from input and merge its fields into this set
mergeFrom
{ "repo_name": "npuichigo/ttsflow", "path": "third_party/protobuf/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java", "license": "apache-2.0", "size": 13479 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,904,284
@Test public void testFares() throws Exception { DirectionsRoute[] routes = DirectionsApi.newRequest(context) .origin("Fisherman's Wharf, San Francisco") .destination("Union Square, San Francisco") .mode(TravelMode.TRANSIT) .departureTime(new DateTime(2015, 1, 1, 19, 0, DateTimeZone.UTC)) .await(); // Just in case we get a walking route or something silly for (DirectionsRoute route : routes) { if (route.fare.value != null && "USD".equals(route.fare.currency.getCurrencyCode())) { return; } } fail("Fare data not found in any route"); }
void function() throws Exception { DirectionsRoute[] routes = DirectionsApi.newRequest(context) .origin(STR) .destination(STR) .mode(TravelMode.TRANSIT) .departureTime(new DateTime(2015, 1, 1, 19, 0, DateTimeZone.UTC)) .await(); for (DirectionsRoute route : routes) { if (route.fare.value != null && "USD".equals(route.fare.currency.getCurrencyCode())) { return; } } fail(STR); }
/** * Test fares are returned for transit requests that support them. */
Test fares are returned for transit requests that support them
testFares
{ "repo_name": "GabrielApG/google-maps-services-java", "path": "src/test/java/com/google/maps/DirectionsApiTest.java", "license": "apache-2.0", "size": 11593 }
[ "com.google.maps.model.DirectionsRoute", "com.google.maps.model.TravelMode", "org.joda.time.DateTime", "org.joda.time.DateTimeZone", "org.junit.Assert" ]
import com.google.maps.model.DirectionsRoute; import com.google.maps.model.TravelMode; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.junit.Assert;
import com.google.maps.model.*; import org.joda.time.*; import org.junit.*;
[ "com.google.maps", "org.joda.time", "org.junit" ]
com.google.maps; org.joda.time; org.junit;
1,396,901
public void configureControlPlugin(AuthzSubject subject, AppdefEntityID id) throws PermissionException, PluginException, ConfigFetchException, AppdefEntityNotFoundException, AgentNotFoundException { // authz check checkModifyPermission(subject, id); String pluginName, pluginType; ConfigResponse mergedResponse; pluginName = id.toString(); try { pluginType = platformManager.getPlatformPluginName(id); mergedResponse = configManager.getMergedConfigResponse(subject, ProductPlugin.TYPE_CONTROL, id, true); ControlCommandsClient client = controlCommandsClientFactory.getClient(id); client.controlPluginAdd(pluginName, pluginType, mergedResponse); } catch (EncodingException e) { throw new PluginException("Unable to decode config", e); } catch (AgentConnectionException e) { throw new PluginException("Agent error: " + e.getMessage(), e); } catch (AgentRemoteException e) { throw new PluginException("Agent error: " + e.getMessage(), e); } }
void function(AuthzSubject subject, AppdefEntityID id) throws PermissionException, PluginException, ConfigFetchException, AppdefEntityNotFoundException, AgentNotFoundException { checkModifyPermission(subject, id); String pluginName, pluginType; ConfigResponse mergedResponse; pluginName = id.toString(); try { pluginType = platformManager.getPlatformPluginName(id); mergedResponse = configManager.getMergedConfigResponse(subject, ProductPlugin.TYPE_CONTROL, id, true); ControlCommandsClient client = controlCommandsClientFactory.getClient(id); client.controlPluginAdd(pluginName, pluginType, mergedResponse); } catch (EncodingException e) { throw new PluginException(STR, e); } catch (AgentConnectionException e) { throw new PluginException(STR + e.getMessage(), e); } catch (AgentRemoteException e) { throw new PluginException(STR + e.getMessage(), e); } }
/** * Enable an entity for control **/
Enable an entity for control
configureControlPlugin
{ "repo_name": "cc14514/hq6", "path": "hq-server/src/main/java/org/hyperic/hq/control/server/session/ControlManagerImpl.java", "license": "unlicense", "size": 29079 }
[ "org.hyperic.hq.agent.AgentConnectionException", "org.hyperic.hq.agent.AgentRemoteException", "org.hyperic.hq.appdef.shared.AgentNotFoundException", "org.hyperic.hq.appdef.shared.AppdefEntityID", "org.hyperic.hq.appdef.shared.AppdefEntityNotFoundException", "org.hyperic.hq.appdef.shared.ConfigFetchException", "org.hyperic.hq.authz.server.session.AuthzSubject", "org.hyperic.hq.authz.shared.PermissionException", "org.hyperic.hq.control.agent.client.ControlCommandsClient", "org.hyperic.hq.product.PluginException", "org.hyperic.hq.product.ProductPlugin", "org.hyperic.util.config.ConfigResponse", "org.hyperic.util.config.EncodingException" ]
import org.hyperic.hq.agent.AgentConnectionException; import org.hyperic.hq.agent.AgentRemoteException; import org.hyperic.hq.appdef.shared.AgentNotFoundException; import org.hyperic.hq.appdef.shared.AppdefEntityID; import org.hyperic.hq.appdef.shared.AppdefEntityNotFoundException; import org.hyperic.hq.appdef.shared.ConfigFetchException; import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.authz.shared.PermissionException; import org.hyperic.hq.control.agent.client.ControlCommandsClient; import org.hyperic.hq.product.PluginException; import org.hyperic.hq.product.ProductPlugin; import org.hyperic.util.config.ConfigResponse; import org.hyperic.util.config.EncodingException;
import org.hyperic.hq.agent.*; import org.hyperic.hq.appdef.shared.*; import org.hyperic.hq.authz.server.session.*; import org.hyperic.hq.authz.shared.*; import org.hyperic.hq.control.agent.client.*; import org.hyperic.hq.product.*; import org.hyperic.util.config.*;
[ "org.hyperic.hq", "org.hyperic.util" ]
org.hyperic.hq; org.hyperic.util;
2,701,835
public Column getCfmFlapCountColumn() { ColumnDescription columndesc = new ColumnDescription( InterfaceColumn.CFMFLAPCOUNT .columnName(), "getCfmFlapCountColumn", VersionNum.VERSION730); return (Column) super.getColumnHandler(columndesc); }
Column function() { ColumnDescription columndesc = new ColumnDescription( InterfaceColumn.CFMFLAPCOUNT .columnName(), STR, VersionNum.VERSION730); return (Column) super.getColumnHandler(columndesc); }
/** * Get the Column entity which column name is "cfm_flap_count" from the Row * entity of attributes. * @return the Column entity which column name is "cfm_flap_count" */
Get the Column entity which column name is "cfm_flap_count" from the Row entity of attributes
getCfmFlapCountColumn
{ "repo_name": "harikrushna-Huawei/hackathon", "path": "protocols/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Interface.java", "license": "apache-2.0", "size": 50192 }
[ "org.onosproject.ovsdb.rfc.notation.Column", "org.onosproject.ovsdb.rfc.tableservice.ColumnDescription" ]
import org.onosproject.ovsdb.rfc.notation.Column; import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription;
import org.onosproject.ovsdb.rfc.notation.*; import org.onosproject.ovsdb.rfc.tableservice.*;
[ "org.onosproject.ovsdb" ]
org.onosproject.ovsdb;
263,451
public static final void deleteEverything() throws TTException { closeEverything(); Storage.truncateStorage(PATHS.PATH1.config); Storage.truncateStorage(PATHS.PATH2.config); }
static final void function() throws TTException { closeEverything(); Storage.truncateStorage(PATHS.PATH1.config); Storage.truncateStorage(PATHS.PATH2.config); }
/** * Deleting all resources as defined in the enum {@link PATHS}. * * @throws TTException */
Deleting all resources as defined in the enum <code>PATHS</code>
deleteEverything
{ "repo_name": "sebastiangraf/treetank", "path": "coremodules/core/src/main/java/org/treetank/testutil/CoreTestHelper.java", "license": "bsd-3-clause", "size": 19635 }
[ "org.treetank.access.Storage", "org.treetank.exception.TTException" ]
import org.treetank.access.Storage; import org.treetank.exception.TTException;
import org.treetank.access.*; import org.treetank.exception.*;
[ "org.treetank.access", "org.treetank.exception" ]
org.treetank.access; org.treetank.exception;
1,135,552
@Test public void testStoreFileScannerThrowsErrors() throws IOException { Path hfilePath = new Path(new Path( HBaseTestingUtility.getTestDir("internalScannerExposesErrors"), "regionname"), "familyname"); FaultyFileSystem fs = new FaultyFileSystem(util.getTestFileSystem()); StoreFile.Writer writer = StoreFile.createWriter(fs, hfilePath, 2 * 1024); TestStoreFile.writeStoreFile( writer, Bytes.toBytes("cf"), Bytes.toBytes("qual")); StoreFile sf = new StoreFile(fs, writer.getPath(), false, util.getConfiguration(), BloomType.NONE, false); List<StoreFileScanner> scanners = StoreFileScanner.getScannersForStoreFiles( Collections.singletonList(sf), false, true); KeyValueScanner scanner = scanners.get(0); FaultyInputStream inStream = fs.inStreams.get(0).get(); assertNotNull(inStream); scanner.seek(KeyValue.LOWESTKEY); // Do at least one successful read assertNotNull(scanner.next()); inStream.startFaults(); try { int scanned=0; while (scanner.next() != null) { scanned++; } fail("Scanner didn't throw after faults injected"); } catch (IOException ioe) { LOG.info("Got expected exception", ioe); assertTrue(ioe.getMessage().contains("Could not iterate")); } scanner.close(); }
void function() throws IOException { Path hfilePath = new Path(new Path( HBaseTestingUtility.getTestDir(STR), STR), STR); FaultyFileSystem fs = new FaultyFileSystem(util.getTestFileSystem()); StoreFile.Writer writer = StoreFile.createWriter(fs, hfilePath, 2 * 1024); TestStoreFile.writeStoreFile( writer, Bytes.toBytes("cf"), Bytes.toBytes("qual")); StoreFile sf = new StoreFile(fs, writer.getPath(), false, util.getConfiguration(), BloomType.NONE, false); List<StoreFileScanner> scanners = StoreFileScanner.getScannersForStoreFiles( Collections.singletonList(sf), false, true); KeyValueScanner scanner = scanners.get(0); FaultyInputStream inStream = fs.inStreams.get(0).get(); assertNotNull(inStream); scanner.seek(KeyValue.LOWESTKEY); assertNotNull(scanner.next()); inStream.startFaults(); try { int scanned=0; while (scanner.next() != null) { scanned++; } fail(STR); } catch (IOException ioe) { LOG.info(STR, ioe); assertTrue(ioe.getMessage().contains(STR)); } scanner.close(); }
/** * Injects errors into the pread calls of an on-disk file, and makes * sure those bubble up to the StoreFileScanner */
Injects errors into the pread calls of an on-disk file, and makes sure those bubble up to the StoreFileScanner
testStoreFileScannerThrowsErrors
{ "repo_name": "abaranau/hbase", "path": "src/test/java/org/apache/hadoop/hbase/regionserver/TestFSErrorsExposed.java", "license": "apache-2.0", "size": 7967 }
[ "java.io.IOException", "java.util.Collections", "java.util.List", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.HBaseTestingUtility", "org.apache.hadoop.hbase.KeyValue", "org.apache.hadoop.hbase.regionserver.StoreFile", "org.apache.hadoop.hbase.util.Bytes", "org.junit.Assert" ]
import java.io.IOException; import java.util.Collections; import java.util.List; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.regionserver.StoreFile; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Assert;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.regionserver.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
[ "java.io", "java.util", "org.apache.hadoop", "org.junit" ]
java.io; java.util; org.apache.hadoop; org.junit;
432,990
byte[] bytesrc = convertHexString(message); Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); DESKeySpec desKeySpec = new DESKeySpec(key.getBytes("UTF-8")); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey secretKey = keyFactory.generateSecret(desKeySpec); IvParameterSpec iv = new IvParameterSpec(key.getBytes("UTF-8")); cipher.init(Cipher.DECRYPT_MODE, secretKey, iv); byte[] retByte = cipher.doFinal(bytesrc); return new String(retByte); }
byte[] bytesrc = convertHexString(message); Cipher cipher = Cipher.getInstance(STR); DESKeySpec desKeySpec = new DESKeySpec(key.getBytes("UTF-8")); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey secretKey = keyFactory.generateSecret(desKeySpec); IvParameterSpec iv = new IvParameterSpec(key.getBytes("UTF-8")); cipher.init(Cipher.DECRYPT_MODE, secretKey, iv); byte[] retByte = cipher.doFinal(bytesrc); return new String(retByte); }
/** * decripta il messaggio * * @param message messaggio per la decritptazione * @return stringa decriptata * @throws Exception */
decripta il messaggio
decrypt
{ "repo_name": "IngSW-unipv/Progetto-A", "path": "Sette_e_Mezzo_Server/src/net/Criptazione.java", "license": "mit", "size": 5119 }
[ "javax.crypto.Cipher", "javax.crypto.SecretKey", "javax.crypto.SecretKeyFactory", "javax.crypto.spec.DESKeySpec", "javax.crypto.spec.IvParameterSpec" ]
import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import javax.crypto.spec.IvParameterSpec;
import javax.crypto.*; import javax.crypto.spec.*;
[ "javax.crypto" ]
javax.crypto;
2,842,217
public DBColumnExpr pgAge(DBColumnExpr expr) { return new PostgresFuncExpr(expr, PostgresSqlPhrase.AGE, null, DataType.INTEGER); }
DBColumnExpr function(DBColumnExpr expr) { return new PostgresFuncExpr(expr, PostgresSqlPhrase.AGE, null, DataType.INTEGER); }
/** * See https://www.postgresql.org/docs/current/functions-datetime.html */
See HREF
pgAge
{ "repo_name": "apache/empire-db", "path": "empire-db/src/main/java/org/apache/empire/dbms/postgresql/DBCommandPostgres.java", "license": "apache-2.0", "size": 5707 }
[ "org.apache.empire.data.DataType", "org.apache.empire.db.DBColumnExpr" ]
import org.apache.empire.data.DataType; import org.apache.empire.db.DBColumnExpr;
import org.apache.empire.data.*; import org.apache.empire.db.*;
[ "org.apache.empire" ]
org.apache.empire;
749,807
public static List<String> split(String stringToSplit, String delimiter, boolean trim) { if (stringToSplit == null) { return new ArrayList<String>(); } if (delimiter == null) { throw new IllegalArgumentException(); } StringTokenizer tokenizer = new StringTokenizer(stringToSplit, delimiter, false); List<String> splitTokens = new ArrayList<String>(tokenizer.countTokens()); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (trim) { token = token.trim(); } splitTokens.add(token); } return splitTokens; }
static List<String> function(String stringToSplit, String delimiter, boolean trim) { if (stringToSplit == null) { return new ArrayList<String>(); } if (delimiter == null) { throw new IllegalArgumentException(); } StringTokenizer tokenizer = new StringTokenizer(stringToSplit, delimiter, false); List<String> splitTokens = new ArrayList<String>(tokenizer.countTokens()); while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (trim) { token = token.trim(); } splitTokens.add(token); } return splitTokens; }
/** * Splits stringToSplit into a list, using the given delimiter * * @param stringToSplit * the string to split * @param delimiter * the string to split on * @param trim * should the split strings be whitespace trimmed? * * @return the list of strings, split by delimiter * * @throws IllegalArgumentException */
Splits stringToSplit into a list, using the given delimiter
split
{ "repo_name": "1fechner/FeatureExtractor", "path": "sources/FeatureExtractor/lib/mysql-connector-java-5.1.38/src/com/mysql/jdbc/StringUtils.java", "license": "lgpl-2.1", "size": 87237 }
[ "java.util.ArrayList", "java.util.List", "java.util.StringTokenizer" ]
import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer;
import java.util.*;
[ "java.util" ]
java.util;
1,522,205
public void setRequestUrl(String urlStr) { // This looks a little confusing: We're trying to fixup an incoming // request URL that starts with: // "http(s):/www.archive.org" // so it becomes: // "http(s)://www.archive.org" // (note the missing second "/" in the first) // // if that is not the case, then see if the incoming scheme // is known, adding an implied "http://" scheme if there doesn't appear // to be a scheme.. // TODO: make the default "http://" configurable. if (!urlStr.startsWith(UrlOperations.HTTP_SCHEME) && !urlStr.startsWith(UrlOperations.HTTPS_SCHEME) && !urlStr.startsWith(UrlOperations.FTP_SCHEME) && !urlStr.startsWith(UrlOperations.FTPS_SCHEME)) { if(urlStr.startsWith("http:/")) { urlStr = UrlOperations.HTTP_SCHEME + urlStr.substring(6); } else if(urlStr.startsWith("https:/")) { urlStr = UrlOperations.HTTPS_SCHEME + urlStr.substring(7); } else if(urlStr.startsWith("ftp:/")) { urlStr = UrlOperations.FTP_SCHEME + urlStr.substring(5); } else if(urlStr.startsWith("ftps:/")) { urlStr = UrlOperations.FTPS_SCHEME + urlStr.substring(6); } else { if(UrlOperations.urlToScheme(urlStr) == null) { urlStr = UrlOperations.HTTP_SCHEME + urlStr; } } } try { String decodedUrlStr = URLDecoder.decode(urlStr, "UTF-8"); String idnEncodedHost = UsableURIFactory.getInstance(decodedUrlStr, "UTF-8").getHost(); if (idnEncodedHost != null) { // If url is absolute, replace host with IDN-encoded host. String unicodeEncodedHost = URLEncoder.encode(IDNA.toUnicode(idnEncodedHost), "UTF-8"); urlStr = urlStr.replace(unicodeEncodedHost, idnEncodedHost); } } catch (UnsupportedEncodingException ex) { // Should never happen as UTF-8 is required to be present throw new RuntimeException(ex); } catch (URIException ex) { throw new RuntimeException(ex); } put(REQUEST_URL, urlStr); }
void function(String urlStr) { if (!urlStr.startsWith(UrlOperations.HTTP_SCHEME) && !urlStr.startsWith(UrlOperations.HTTPS_SCHEME) && !urlStr.startsWith(UrlOperations.FTP_SCHEME) && !urlStr.startsWith(UrlOperations.FTPS_SCHEME)) { if(urlStr.startsWith(STR)) { urlStr = UrlOperations.HTTP_SCHEME + urlStr.substring(6); } else if(urlStr.startsWith(STR)) { urlStr = UrlOperations.HTTPS_SCHEME + urlStr.substring(7); } else if(urlStr.startsWith("ftp:/")) { urlStr = UrlOperations.FTP_SCHEME + urlStr.substring(5); } else if(urlStr.startsWith(STR)) { urlStr = UrlOperations.FTPS_SCHEME + urlStr.substring(6); } else { if(UrlOperations.urlToScheme(urlStr) == null) { urlStr = UrlOperations.HTTP_SCHEME + urlStr; } } } try { String decodedUrlStr = URLDecoder.decode(urlStr, "UTF-8"); String idnEncodedHost = UsableURIFactory.getInstance(decodedUrlStr, "UTF-8").getHost(); if (idnEncodedHost != null) { String unicodeEncodedHost = URLEncoder.encode(IDNA.toUnicode(idnEncodedHost), "UTF-8"); urlStr = urlStr.replace(unicodeEncodedHost, idnEncodedHost); } } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); } catch (URIException ex) { throw new RuntimeException(ex); } put(REQUEST_URL, urlStr); }
/** * Set the request URL. * @param urlStr Request URL. */
Set the request URL
setRequestUrl
{ "repo_name": "iipc/openwayback", "path": "wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java", "license": "apache-2.0", "size": 37532 }
[ "gnu.inet.encoding.IDNA", "java.io.UnsupportedEncodingException", "java.net.URLDecoder", "java.net.URLEncoder", "org.apache.commons.httpclient.URIException", "org.archive.url.UsableURIFactory", "org.archive.wayback.util.url.UrlOperations" ]
import gnu.inet.encoding.IDNA; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import org.apache.commons.httpclient.URIException; import org.archive.url.UsableURIFactory; import org.archive.wayback.util.url.UrlOperations;
import gnu.inet.encoding.*; import java.io.*; import java.net.*; import org.apache.commons.httpclient.*; import org.archive.url.*; import org.archive.wayback.util.url.*;
[ "gnu.inet.encoding", "java.io", "java.net", "org.apache.commons", "org.archive.url", "org.archive.wayback" ]
gnu.inet.encoding; java.io; java.net; org.apache.commons; org.archive.url; org.archive.wayback;
497,389
Transfer getTransfer( StoreKey storeKey, String path, TransferOperation op ) throws IndyWorkflowException;
Transfer getTransfer( StoreKey storeKey, String path, TransferOperation op ) throws IndyWorkflowException;
/** * Retrieve a {@link Transfer} object suitable for use in the specified operation. This method handles the selection logic in the event the store * is a {@link Group}, and doesn't fire any events (the returned {@link Transfer} object handles that in this case).<br/> * <b>No content generators are called in this method.</b> * * @param storeKey The key to the store in which the Transfer should reside * @param path The path of the Transfer inside the store * @param op The operation we want to execute on the returned Transfer * @return A suitable transfer object (not null; those cases result in an exception) NOTE: the returned transfer may not exist! * @throws IndyWorkflowException in case no suitable storage location can be found */
Retrieve a <code>Transfer</code> object suitable for use in the specified operation. This method handles the selection logic in the event the store is a <code>Group</code>, and doesn't fire any events (the returned <code>Transfer</code> object handles that in this case). No content generators are called in this method
getTransfer
{ "repo_name": "pkocandr/indy", "path": "api/src/main/java/org/commonjava/indy/content/ContentManager.java", "license": "apache-2.0", "size": 12014 }
[ "org.commonjava.indy.IndyWorkflowException", "org.commonjava.indy.model.core.StoreKey", "org.commonjava.maven.galley.model.Transfer", "org.commonjava.maven.galley.model.TransferOperation" ]
import org.commonjava.indy.IndyWorkflowException; import org.commonjava.indy.model.core.StoreKey; import org.commonjava.maven.galley.model.Transfer; import org.commonjava.maven.galley.model.TransferOperation;
import org.commonjava.indy.*; import org.commonjava.indy.model.core.*; import org.commonjava.maven.galley.model.*;
[ "org.commonjava.indy", "org.commonjava.maven" ]
org.commonjava.indy; org.commonjava.maven;
278,997
void debuggerAdded(BackEndDebuggerProvider provider, IDebugger debugger);
void debuggerAdded(BackEndDebuggerProvider provider, IDebugger debugger);
/** * Invoked after a new debugger was added to the provider. * * @param provider The provider where the debugger was added. * @param debugger The debugger added to the provider. */
Invoked after a new debugger was added to the provider
debuggerAdded
{ "repo_name": "AmesianX/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/debug/debugger/interfaces/DebuggerProviderListener.java", "license": "apache-2.0", "size": 1439 }
[ "com.google.security.zynamics.binnavi.debug.debugger.BackEndDebuggerProvider" ]
import com.google.security.zynamics.binnavi.debug.debugger.BackEndDebuggerProvider;
import com.google.security.zynamics.binnavi.debug.debugger.*;
[ "com.google.security" ]
com.google.security;
732,626
protected void setupObjectList() { objectList.add(new NumberHashMap(DataTypes.OBJ_TEXT_ENCODING, this, TextEncoding.TEXT_ENCODING_FIELD_SIZE)); objectList.add(new PairedTextEncodedStringNullTerminated(DataTypes.OBJ_TEXT, this)); }
void function() { objectList.add(new NumberHashMap(DataTypes.OBJ_TEXT_ENCODING, this, TextEncoding.TEXT_ENCODING_FIELD_SIZE)); objectList.add(new PairedTextEncodedStringNullTerminated(DataTypes.OBJ_TEXT, this)); }
/** * Consists of a text encoding , and then a series of null terminated Strings, there should be an even number * of Strings as they are paired as involvement/involvee */
Consists of a text encoding , and then a series of null terminated Strings, there should be an even number of Strings as they are paired as involvement/involvee
setupObjectList
{ "repo_name": "craigpetchell/Jaudiotagger", "path": "src/org/jaudiotagger/tag/id3/framebody/FrameBodyTIPL.java", "license": "lgpl-2.1", "size": 7805 }
[ "org.jaudiotagger.tag.datatype.DataTypes", "org.jaudiotagger.tag.datatype.NumberHashMap", "org.jaudiotagger.tag.datatype.PairedTextEncodedStringNullTerminated", "org.jaudiotagger.tag.id3.valuepair.TextEncoding" ]
import org.jaudiotagger.tag.datatype.DataTypes; import org.jaudiotagger.tag.datatype.NumberHashMap; import org.jaudiotagger.tag.datatype.PairedTextEncodedStringNullTerminated; import org.jaudiotagger.tag.id3.valuepair.TextEncoding;
import org.jaudiotagger.tag.datatype.*; import org.jaudiotagger.tag.id3.valuepair.*;
[ "org.jaudiotagger.tag" ]
org.jaudiotagger.tag;
2,666,352
private static boolean hasHardwareAcceleration(Context context) { if (context instanceof Activity) { return hasHardwareAcceleration((Activity) context); } return false; }
static boolean function(Context context) { if (context instanceof Activity) { return hasHardwareAcceleration((Activity) context); } return false; }
/** * Returns true if the given Context is a HW-accelerated Activity. * * TODO(husky): Remove when initialize() is refactored (see TODO there) */
Returns true if the given Context is a HW-accelerated Activity. TODO(husky): Remove when initialize() is refactored (see TODO there)
hasHardwareAcceleration
{ "repo_name": "mogoweb/chromium-crosswalk", "path": "content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java", "license": "bsd-3-clause", "size": 130354 }
[ "android.app.Activity", "android.content.Context" ]
import android.app.Activity; import android.content.Context;
import android.app.*; import android.content.*;
[ "android.app", "android.content" ]
android.app; android.content;
2,352,448
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { mainContain = new javax.swing.JPanel(); lblGenredOn = new javax.swing.JLabel(); txtSTotal = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); tabla = new javax.swing.JTable(); CtrlPan = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jdpDesde = new org.jdesktop.swingx.JXDatePicker(); jLabel2 = new javax.swing.JLabel(); jdpHasta = new org.jdesktop.swingx.JXDatePicker(); jLabel3 = new javax.swing.JLabel(); jcbFilter = new javax.swing.JComboBox(); lblGenredOn.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblGenredOn.setText("Generado: DIA-HORA"); txtSTotal.setEditable(false); txtSTotal.setColumns(7); txtSTotal.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N jLabel5.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N jLabel5.setText("Total de ingresos:"); tabla.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Fecha", "Operacion", "Ingreso" } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { false, false, false };
@SuppressWarnings(STR) void function() { mainContain = new javax.swing.JPanel(); lblGenredOn = new javax.swing.JLabel(); txtSTotal = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); tabla = new javax.swing.JTable(); CtrlPan = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jdpDesde = new org.jdesktop.swingx.JXDatePicker(); jLabel2 = new javax.swing.JLabel(); jdpHasta = new org.jdesktop.swingx.JXDatePicker(); jLabel3 = new javax.swing.JLabel(); jcbFilter = new javax.swing.JComboBox(); lblGenredOn.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblGenredOn.setText(STR); txtSTotal.setEditable(false); txtSTotal.setColumns(7); txtSTotal.setFont(new java.awt.Font(STR, 1, 15)); jLabel5.setFont(new java.awt.Font(STR, 1, 15)); jLabel5.setText(STR); tabla.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Fecha", STR, STR } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { false, false, false };
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */
This method is called from within the constructor to initialize the form. regenerated by the Form Editor
initComponents
{ "repo_name": "engcardso/Videoup", "path": "src/com/videoup/views/modreps/RIncomings.java", "license": "gpl-2.0", "size": 17026 }
[ "javax.swing.table.DefaultTableModel" ]
import javax.swing.table.DefaultTableModel;
import javax.swing.table.*;
[ "javax.swing" ]
javax.swing;
663,480
public static List<Image> getSmallAbilityIcons(final Set<MagicAbility> abilities) { return Stream.of(values()) .filter(obj -> abilities.contains(obj.ability)) .filter(AbilityIcon::hasSmallIcon) .map(obj -> obj.getSmallIcon().getImage()) .collect(Collectors.toList()); }
static List<Image> function(final Set<MagicAbility> abilities) { return Stream.of(values()) .filter(obj -> abilities.contains(obj.ability)) .filter(AbilityIcon::hasSmallIcon) .map(obj -> obj.getSmallIcon().getImage()) .collect(Collectors.toList()); }
/** * Returns a list of small 16x16 ability icon images that are * drawn onto a card image displayed on the battlefield. */
Returns a list of small 16x16 ability icon images that are drawn onto a card image displayed on the battlefield
getSmallAbilityIcons
{ "repo_name": "magarena/magarena", "path": "src/magic/ui/theme/AbilityIcon.java", "license": "gpl-3.0", "size": 10481 }
[ "java.awt.Image", "java.util.List", "java.util.Set", "java.util.stream.Collectors", "java.util.stream.Stream" ]
import java.awt.Image; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream;
import java.awt.*; import java.util.*; import java.util.stream.*;
[ "java.awt", "java.util" ]
java.awt; java.util;
379,584
public OneToMany getOneToMany(CPropertyInfo property);
OneToMany function(CPropertyInfo property);
/** * Returns the one-to-many customization for the given property. Must not * return null. * * @param context * processing context. * @param property * property to retrieve customization for. * @return One-to-many customization for the given property, never null. */
Returns the one-to-many customization for the given property. Must not return null
getOneToMany
{ "repo_name": "highsource/hyperjaxb3", "path": "ejb/plugin/src/main/java/org/jvnet/hyperjaxb3/ejb/strategy/customizing/Customizing.java", "license": "bsd-2-clause", "size": 4422 }
[ "com.sun.tools.xjc.model.CPropertyInfo", "org.jvnet.hyperjaxb3.ejb.schemas.customizations.OneToMany" ]
import com.sun.tools.xjc.model.CPropertyInfo; import org.jvnet.hyperjaxb3.ejb.schemas.customizations.OneToMany;
import com.sun.tools.xjc.model.*; import org.jvnet.hyperjaxb3.ejb.schemas.customizations.*;
[ "com.sun.tools", "org.jvnet.hyperjaxb3" ]
com.sun.tools; org.jvnet.hyperjaxb3;
1,139,880
public void testOrder(Pid previous, Pid next) { Assert.assertEquals(-1, previous.compareTo(next)); }
void function(Pid previous, Pid next) { Assert.assertEquals(-1, previous.compareTo(next)); }
/** * Tests the order of two names. The previous name must have a lesser value * than the next name to pass the test. * * @param previous The previous name * @param next The next name */
Tests the order of two names. The previous name must have a lesser value than the next name to pass the test
testOrder
{ "repo_name": "HawaiiStateDigitalArchives/PID-webservice", "path": "Minter/src/test/java/com/hida/model/PidTest.java", "license": "apache-2.0", "size": 5601 }
[ "junit.framework.Assert" ]
import junit.framework.Assert;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
148,397
public Point2D getAxisEnd() { return this.axisEnd; }
Point2D function() { return this.axisEnd; }
/** * Get the end of the axis */
Get the end of the axis
getAxisEnd
{ "repo_name": "oswetto/PDFrenderer", "path": "src/com/sun/pdfview/pattern/ShaderType2.java", "license": "lgpl-2.1", "size": 9885 }
[ "java.awt.geom.Point2D" ]
import java.awt.geom.Point2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
215,479
private static void outputPair(int row, int gi, Pair p) { int x = (int)p.x; int y = (int)p.y; println(row+"\t"+gi+"\t"+x+"\t"+y); } // SECOND CODE EXAMPLE
static void function(int row, int gi, Pair p) { int x = (int)p.x; int y = (int)p.y; println(row+"\t"+gi+"\t"+x+"\t"+y); }
/** * Place-holder for a plotting or other analysis function * @param row the row number (for convenience) * @param gi generating index (for convenience) * @param p the point Pair */
Place-holder for a plotting or other analysis function
outputPair
{ "repo_name": "himanshug/sketches-core", "path": "src/test/java/com/yahoo/sketches/PowerLawGeneratorTest.java", "license": "apache-2.0", "size": 5064 }
[ "com.yahoo.sketches.PowerLawGenerator" ]
import com.yahoo.sketches.PowerLawGenerator;
import com.yahoo.sketches.*;
[ "com.yahoo.sketches" ]
com.yahoo.sketches;
1,823,746
public static void parseHistoryFromFS(String path, Listener l, FileSystem fs) throws IOException { FSDataInputStream in = fs.open(new Path(path)); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); try { String line = null; StringBuffer buf = new StringBuffer(); // Read the meta-info line. Note that this might a jobinfo line for // files // written with older format line = reader.readLine(); // Check if the file is empty if (line == null) { return; } // Get the information required for further processing MetaInfoManager mgr = new MetaInfoManager(line); boolean isEscaped = mgr.isValueEscaped(); String lineDelim = String.valueOf(mgr.getLineDelim()); String escapedLineDelim = StringUtils.escapeString(lineDelim, StringUtils.ESCAPE_CHAR, mgr.getLineDelim()); do { buf.append(line); if (!line.trim().endsWith(lineDelim) || line.trim().endsWith(escapedLineDelim)) { buf.append("\n"); continue; } parseLine(buf.toString(), l, isEscaped); buf = new StringBuffer(); } while ((line = reader.readLine()) != null); } finally { try { reader.close(); } catch (IOException ex) { } } }
static void function(String path, Listener l, FileSystem fs) throws IOException { FSDataInputStream in = fs.open(new Path(path)); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); try { String line = null; StringBuffer buf = new StringBuffer(); line = reader.readLine(); if (line == null) { return; } MetaInfoManager mgr = new MetaInfoManager(line); boolean isEscaped = mgr.isValueEscaped(); String lineDelim = String.valueOf(mgr.getLineDelim()); String escapedLineDelim = StringUtils.escapeString(lineDelim, StringUtils.ESCAPE_CHAR, mgr.getLineDelim()); do { buf.append(line); if (!line.trim().endsWith(lineDelim) line.trim().endsWith(escapedLineDelim)) { buf.append("\n"); continue; } parseLine(buf.toString(), l, isEscaped); buf = new StringBuffer(); } while ((line = reader.readLine()) != null); } finally { try { reader.close(); } catch (IOException ex) { } } }
/** * Parses history file and invokes Listener.handle() for each line of * history. It can be used for looking through history files for specific * items without having to keep whole history in memory. * * @param path * path to history file * @param l * Listener for history events * @param fs * FileSystem where history file is present * @throws IOException */
Parses history file and invokes Listener.handle() for each line of history. It can be used for looking through history files for specific items without having to keep whole history in memory
parseHistoryFromFS
{ "repo_name": "dongpf/hadoop-0.19.1", "path": "src/mapred/org/apache/hadoop/mapred/JobHistory.java", "license": "apache-2.0", "size": 70364 }
[ "java.io.BufferedReader", "java.io.IOException", "java.io.InputStreamReader", "org.apache.hadoop.fs.FSDataInputStream", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.util.StringUtils" ]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.util.StringUtils;
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,384,444
private void outputTextToWriter(String text) throws IOException { if (text == null) { return; } int length = text.length(); for (int i = 0; i < length; i++) { char c = text.charAt(i); switch (c) { case '&': this._writer.write("&amp;amp;"); break; case '<': this._writer.write("&amp;lt;"); break; case '>': this._writer.write("&amp;gt;"); break; case 0xD: this._writer.write("&amp;#xD;"); break; case ' ': this._writer.write("&middot;"); break; case '\n': this._writer.write("&para;\n"); break; default: this._writer.write(c); break; } } }
void function(String text) throws IOException { if (text == null) { return; } int length = text.length(); for (int i = 0; i < length; i++) { char c = text.charAt(i); switch (c) { case '&': this._writer.write(STR); break; case '<': this._writer.write(STR); break; case '>': this._writer.write(STR); break; case 0xD: this._writer.write(STR); break; case ' ': this._writer.write(STR); break; case '\n': this._writer.write(STR); break; default: this._writer.write(c); break; } } }
/** * Method outputTextToWriter * * @param text * @throws IOException */
Method outputTextToWriter
outputTextToWriter
{ "repo_name": "test2v/DanDelXAdES", "path": "proj/xml-security-src-1_3_0/xml-security-1_3_0/src/org/apache/xml/security/signature/XMLSignatureInputDebugger.java", "license": "lgpl-3.0", "size": 17826 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,715,318
public ImageData getImageData() { if (false == isLoaded()) { return null; } if (m_fastout) { final ScratchPad temp = new ScratchPad(m_dest_wide, m_dest_high); temp.getContext().drawImage(m_jsimg, m_clip_xpos, m_clip_ypos, m_clip_wide, m_clip_high, 0, 0, m_dest_wide, m_dest_high); return temp.getContext().getImageData(0, 0, m_dest_wide, m_dest_high); } else { return m_filterImage.getContext().getImageData(0, 0, m_dest_wide, m_dest_high); } }
ImageData function() { if (false == isLoaded()) { return null; } if (m_fastout) { final ScratchPad temp = new ScratchPad(m_dest_wide, m_dest_high); temp.getContext().drawImage(m_jsimg, m_clip_xpos, m_clip_ypos, m_clip_wide, m_clip_high, 0, 0, m_dest_wide, m_dest_high); return temp.getContext().getImageData(0, 0, m_dest_wide, m_dest_high); } else { return m_filterImage.getContext().getImageData(0, 0, m_dest_wide, m_dest_high); } }
/** * Returns an ImageData object that can be used for further image processing * e.g. by image filters. * * @return ImageData */
Returns an ImageData object that can be used for further image processing e.g. by image filters
getImageData
{ "repo_name": "ahome-it/lienzo-core", "path": "src/main/java/com/ait/lienzo/client/core/image/ImageProxy.java", "license": "apache-2.0", "size": 20255 }
[ "com.ait.lienzo.client.core.types.ImageData", "com.ait.lienzo.client.core.util.ScratchPad" ]
import com.ait.lienzo.client.core.types.ImageData; import com.ait.lienzo.client.core.util.ScratchPad;
import com.ait.lienzo.client.core.types.*; import com.ait.lienzo.client.core.util.*;
[ "com.ait.lienzo" ]
com.ait.lienzo;
2,187,828
@Override public void mousePressed(MouseEvent arg0) { }
void function(MouseEvent arg0) { }
/** * Does nothing * @param arg0 */
Does nothing
mousePressed
{ "repo_name": "brandonsbarber/CS201-Course-Work", "path": "src/cs201/gui/CityPanel.java", "license": "mit", "size": 18142 }
[ "java.awt.event.MouseEvent" ]
import java.awt.event.MouseEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
2,082,157
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { text.reset(); return; }
void function(String uri, String localName, String qName, Attributes attributes) throws SAXException { text.reset(); return; }
/** * Receive notification of the start of an element. * * @param name The element type name. * @param attributes The specified or defaulted attributes. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement */
Receive notification of the start of an element
startElement
{ "repo_name": "deepstupid/phex", "path": "src/main/java/phex/xml/sax/parser/share/AlternateLocationHandler.java", "license": "agpl-3.0", "size": 3100 }
[ "org.xml.sax.Attributes", "org.xml.sax.SAXException" ]
import org.xml.sax.Attributes; import org.xml.sax.SAXException;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
1,787,817
public Element getCurrentElement() { return currentElement; }
Element function() { return currentElement; }
/** * Gets currently edited element * @return currently edited element */
Gets currently edited element
getCurrentElement
{ "repo_name": "PoprostuRonin/spritor", "path": "src/main/java/com/poprosturonin/controller/DesignController.java", "license": "mit", "size": 8105 }
[ "com.poprosturonin.model.design.Element" ]
import com.poprosturonin.model.design.Element;
import com.poprosturonin.model.design.*;
[ "com.poprosturonin.model" ]
com.poprosturonin.model;
256,538
private static boolean matchLabel(Node target, String label) { if (label == null) { return true; } while (target.isLabel()) { if (target.getFirstChild().getString().equals(label)) { return true; } target = target.getParent(); } return false; }
static boolean function(Node target, String label) { if (label == null) { return true; } while (target.isLabel()) { if (target.getFirstChild().getString().equals(label)) { return true; } target = target.getParent(); } return false; }
/** * Check if label is actually referencing the target control structure. If * label is null, it always returns true. */
Check if label is actually referencing the target control structure. If label is null, it always returns true
matchLabel
{ "repo_name": "brad4d/closure-compiler", "path": "src/com/google/javascript/jscomp/ControlFlowAnalysis.java", "license": "apache-2.0", "size": 35131 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,654,568
private void search() throws IOException, java.text.ParseException { normalSearchWithAlgorithm(); }
void function() throws IOException, java.text.ParseException { normalSearchWithAlgorithm(); }
/** * Executes the search query. * * @throws IOException */
Executes the search query
search
{ "repo_name": "nhesusrz/thesis", "path": "src/lucene/Searcher.java", "license": "lgpl-3.0", "size": 8231 }
[ "java.io.IOException", "org.apache.lucene.queryParser.ParseException" ]
import java.io.IOException; import org.apache.lucene.queryParser.ParseException;
import java.io.*; import org.apache.lucene.*;
[ "java.io", "org.apache.lucene" ]
java.io; org.apache.lucene;
549,618
public void writeModel(String outFile) throws IOException { if (outFile == null || outFile.isEmpty()) { throw new IllegalArgumentException("outFile can not be null or empty."); } final File outF = new File(outFile); // Try to create out file. if (!outF.exists()) { outF.createNewFile(); } RuntimeModel generator = this.trainableModel.build(); ObjectMapper objectMapper = new ObjectMapper() .registerModule(new ParameterNamesModule()) .registerModule(new Jdk8Module()); objectMapper.enable(SerializationFeature.INDENT_OUTPUT); objectMapper.writeValue(outF, generator); }
void function(String outFile) throws IOException { if (outFile == null outFile.isEmpty()) { throw new IllegalArgumentException(STR); } final File outF = new File(outFile); if (!outF.exists()) { outF.createNewFile(); } RuntimeModel generator = this.trainableModel.build(); ObjectMapper objectMapper = new ObjectMapper() .registerModule(new ParameterNamesModule()) .registerModule(new Jdk8Module()); objectMapper.enable(SerializationFeature.INDENT_OUTPUT); objectMapper.writeValue(outF, generator); }
/** * Writes the trainableModel serialized to a file to load it later. * * @param outFile The file to write. */
Writes the trainableModel serialized to a file to load it later
writeModel
{ "repo_name": "tfelix/namegen", "path": "src/main/java/de/tfelix/namegen/NameGenGenerator.java", "license": "mit", "size": 4962 }
[ "com.fasterxml.jackson.databind.ObjectMapper", "com.fasterxml.jackson.databind.SerializationFeature", "com.fasterxml.jackson.datatype.jdk8.Jdk8Module", "com.fasterxml.jackson.module.paramnames.ParameterNamesModule", "de.tfelix.namegen.model.RuntimeModel", "java.io.File", "java.io.IOException" ]
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.module.paramnames.ParameterNamesModule; import de.tfelix.namegen.model.RuntimeModel; import java.io.File; import java.io.IOException;
import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.datatype.jdk8.*; import com.fasterxml.jackson.module.paramnames.*; import de.tfelix.namegen.model.*; import java.io.*;
[ "com.fasterxml.jackson", "de.tfelix.namegen", "java.io" ]
com.fasterxml.jackson; de.tfelix.namegen; java.io;
2,147,331
@BeforeClass public static void beforeTests() { // Local Declarations IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IProject project = null; String separator = System.getProperty("file.separator"); String userDir = System.getProperty("user.home") + separator + "ICETests" + separator + "caebatTesterWorkspace"; // Enable Debugging System.setProperty("DebugICE", ""); // Setup the project try { // Get the project handle IPath projectPath = new Path(userDir + separator + ".project"); // Create the project description IProjectDescription desc = ResourcesPlugin.getWorkspace() .loadProjectDescription(projectPath); // Get the project handle and create it project = workspaceRoot.getProject(desc.getName()); // Create the project if it doesn't exist if (!project.exists()) { project.create(desc, new NullProgressMonitor()); } // Open the project if it is not already open if (project.exists() && !project.isOpen()) { project.open(new NullProgressMonitor()); } // Refresh the workspace project.refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { // Catch exception for creating the project e.printStackTrace(); fail(); } // Set the global project reference. projectSpace = project; return; }
static void function() { IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IProject project = null; String separator = System.getProperty(STR); String userDir = System.getProperty(STR) + separator + STR + separator + STR; System.setProperty(STR, STR.project"); IProjectDescription desc = ResourcesPlugin.getWorkspace() .loadProjectDescription(projectPath); project = workspaceRoot.getProject(desc.getName()); if (!project.exists()) { project.create(desc, new NullProgressMonitor()); } if (project.exists() && !project.isOpen()) { project.open(new NullProgressMonitor()); } project.refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { e.printStackTrace(); fail(); } projectSpace = project; return; }
/** * <p> * This operation sets up the workspace. * </p> */
This operation sets up the workspace.
beforeTests
{ "repo_name": "SmithRWORNL/ice", "path": "tests/org.eclipse.ice.vibe.test/src/org/eclipse/ice/vibe/kvPair/test/VibeKVPairBuilderTester.java", "license": "epl-1.0", "size": 4601 }
[ "org.eclipse.core.resources.IProject", "org.eclipse.core.resources.IProjectDescription", "org.eclipse.core.resources.IResource", "org.eclipse.core.resources.IWorkspaceRoot", "org.eclipse.core.resources.ResourcesPlugin", "org.eclipse.core.runtime.CoreException", "org.eclipse.core.runtime.NullProgressMonitor", "org.junit.Assert" ]
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.NullProgressMonitor; import org.junit.Assert;
import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.junit.*;
[ "org.eclipse.core", "org.junit" ]
org.eclipse.core; org.junit;
399,928
public void setQuality(Text qual) { if (qual == null) throw new IllegalArgumentException("can't have a null quality"); quality = qual; } public String getInstrument() { return instrument; }
void function(Text qual) { if (qual == null) throw new IllegalArgumentException(STR); quality = qual; } public String getInstrument() { return instrument; }
/** * Set quality. Quality should be encoded in Sanger Phred+33 format. */
Set quality. Quality should be encoded in Sanger Phred+33 format
setQuality
{ "repo_name": "tkrishp/Hadoop-BAM", "path": "src/main/java/org/seqdoop/hadoop_bam/SequencedFragment.java", "license": "mit", "size": 13978 }
[ "org.apache.hadoop.io.Text" ]
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,092,478
public static boolean isNone(Try<?> t) { return t.isFailure() && t.failed().get() instanceof NoSuchElementException; }
static boolean function(Try<?> t) { return t.isFailure() && t.failed().get() instanceof NoSuchElementException; }
/** * Checks whether the given Try indicates that no value was found (by being a failure of NoSuchElementException). */
Checks whether the given Try indicates that no value was found (by being a failure of NoSuchElementException)
isNone
{ "repo_name": "Tradeshift/ts-reaktive", "path": "ts-reaktive-marshal/src/main/java/com/tradeshift/reaktive/marshal/ReadProtocol.java", "license": "mit", "size": 2036 }
[ "io.vavr.control.Try", "java.util.NoSuchElementException" ]
import io.vavr.control.Try; import java.util.NoSuchElementException;
import io.vavr.control.*; import java.util.*;
[ "io.vavr.control", "java.util" ]
io.vavr.control; java.util;
2,151,403
public IBlockState withRotation(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING))); }
IBlockState function(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING))); }
/** * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed * blockstate. */
Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed blockstate
withRotation
{ "repo_name": "InverMN/MinecraftForgeReference", "path": "MinecraftBlocks2/BlockPistonBase.java", "license": "unlicense", "size": 20102 }
[ "net.minecraft.block.state.IBlockState", "net.minecraft.util.EnumFacing", "net.minecraft.util.Rotation" ]
import net.minecraft.block.state.IBlockState; import net.minecraft.util.EnumFacing; import net.minecraft.util.Rotation;
import net.minecraft.block.state.*; import net.minecraft.util.*;
[ "net.minecraft.block", "net.minecraft.util" ]
net.minecraft.block; net.minecraft.util;
1,249,931
@ApiModelProperty(value = "Count of personal projects of contributor.") @JsonProperty("personalProjectsCount") public Integer getPersonalProjectsCount() { return personalProjectsCount; }
@ApiModelProperty(value = STR) @JsonProperty(STR) Integer function() { return personalProjectsCount; }
/** * Count of personal projects of contributor. **/
Count of personal projects of contributor
getPersonalProjectsCount
{ "repo_name": "EMResearch/EMB", "path": "jdk_8_maven/cs/rest/original/catwatch/catwatch-backend/src/main/java/org/zalando/catwatch/backend/model/Contributor.java", "license": "apache-2.0", "size": 5225 }
[ "com.fasterxml.jackson.annotation.JsonProperty", "io.swagger.annotations.ApiModelProperty" ]
import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.*; import io.swagger.annotations.*;
[ "com.fasterxml.jackson", "io.swagger.annotations" ]
com.fasterxml.jackson; io.swagger.annotations;
771,774
protected void scanStartElementName () throws IOException, XNIException { // name if (fNamespaces) { fEntityScanner.scanQName(fElementQName); } else { String name = fEntityScanner.scanName(); fElementQName.setValues(null, name, name, null); } // Must skip spaces here because the DTD scanner // would consume them at the end of the external subset. fSawSpace = fEntityScanner.skipSpaces(); } // scanStartElementName()
void function () throws IOException, XNIException { if (fNamespaces) { fEntityScanner.scanQName(fElementQName); } else { String name = fEntityScanner.scanName(); fElementQName.setValues(null, name, name, null); } fSawSpace = fEntityScanner.skipSpaces(); }
/** * Scans the name of an element in a start or empty tag. * * @see #scanStartElement() */
Scans the name of an element in a start or empty tag
scanStartElementName
{ "repo_name": "BartoszJarocki/boilerpipe-android", "path": "src/main/java/mf/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java", "license": "apache-2.0", "size": 68031 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,042,935
protected final void FPR2GPR_32(Instruction s) { int offset = burs.ir.stackManager.allocateSpaceForConversion(); Register FP = regpool.getPhysicalRegisterSet().getFP(); RegisterOperand val = (RegisterOperand) Unary.getClearVal(s); EMIT(MIR_Store.create(PPC_STFS, val, A(FP), IC(offset), null, TG())); EMIT(MIR_Load.mutate(s, PPC_LWZ, Unary.getClearResult(s), A(FP), IC(offset), null, TG())); }
final void function(Instruction s) { int offset = burs.ir.stackManager.allocateSpaceForConversion(); Register FP = regpool.getPhysicalRegisterSet().getFP(); RegisterOperand val = (RegisterOperand) Unary.getClearVal(s); EMIT(MIR_Store.create(PPC_STFS, val, A(FP), IC(offset), null, TG())); EMIT(MIR_Load.mutate(s, PPC_LWZ, Unary.getClearResult(s), A(FP), IC(offset), null, TG())); }
/** * Emit code to move 32 bits from FPRs to GPRs * Note: intentionally use 'null' location to prevent DepGraph * from assuming that load/store not aliased. We're stepping outside * the Java type system here! */
Emit code to move 32 bits from FPRs to GPRs Note: intentionally use 'null' location to prevent DepGraph from assuming that load/store not aliased. We're stepping outside the Java type system here
FPR2GPR_32
{ "repo_name": "ut-osa/laminar", "path": "jikesrvm-3.0.0/rvm/src/org/jikesrvm/compilers/opt/lir2mir/ppc/BURS_Helpers.java", "license": "bsd-3-clause", "size": 86889 }
[ "org.jikesrvm.compilers.opt.ir.Instruction", "org.jikesrvm.compilers.opt.ir.Register", "org.jikesrvm.compilers.opt.ir.Unary", "org.jikesrvm.compilers.opt.ir.operand.RegisterOperand" ]
import org.jikesrvm.compilers.opt.ir.Instruction; import org.jikesrvm.compilers.opt.ir.Register; import org.jikesrvm.compilers.opt.ir.Unary; import org.jikesrvm.compilers.opt.ir.operand.RegisterOperand;
import org.jikesrvm.compilers.opt.ir.*; import org.jikesrvm.compilers.opt.ir.operand.*;
[ "org.jikesrvm.compilers" ]
org.jikesrvm.compilers;
550,328
void greenFloatValueChanged(short unit, float value) throws DOMException;
void greenFloatValueChanged(short unit, float value) throws DOMException;
/** * Called when the green float value has changed. */
Called when the green float value has changed
greenFloatValueChanged
{ "repo_name": "apache/batik", "path": "batik-css/src/main/java/org/apache/batik/css/dom/CSSOMValue.java", "license": "apache-2.0", "size": 46315 }
[ "org.w3c.dom.DOMException" ]
import org.w3c.dom.DOMException;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,823,870
private void grade_submission_option(RunData data, String gradeOption) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); boolean withGrade = state.getAttribute(WITH_GRADES) != null ? ((Boolean) state.getAttribute(WITH_GRADES)).booleanValue(): false; String sId = (String) state.getAttribute(GRADE_SUBMISSION_SUBMISSION_ID); String assignmentId = (String) state.getAttribute(GRADE_SUBMISSION_ASSIGNMENT_ID); // for points grading, one have to enter number as the points String grade = (String) state.getAttribute(GRADE_SUBMISSION_GRADE); AssignmentSubmissionEdit sEdit = editSubmission(sId, "grade_submission_option", state); if (sEdit != null) { //This logic could be done in one line, but would be harder to read, so break it out to make it easier to follow boolean gradeChanged = false; if((sEdit.getGrade() == null || "".equals(sEdit.getGrade().trim())) && (grade == null || "".equals(grade.trim()))){ //both are null, keep grade changed = false }else if((sEdit.getGrade() == null || "".equals(sEdit.getGrade().trim()) || (grade == null || "".equals(grade.trim())))){ //one is null the other isn't gradeChanged = true; }else if(!grade.trim().equals(sEdit.getGrade().trim())){ gradeChanged = true; } Assignment a = sEdit.getAssignment(); int typeOfGrade = a.getContent().getTypeOfGrade(); if (!withGrade) { // no grade input needed for the without-grade version of assignment tool sEdit.setGraded(true); if(gradeChanged){ sEdit.setGradedBy(UserDirectoryService.getCurrentUser() == null ? null : UserDirectoryService.getCurrentUser().getId()); } if ("return".equals(gradeOption) || "release".equals(gradeOption)) { sEdit.setGradeReleased(true); } } else if (grade == null) { sEdit.setGrade(""); sEdit.setGraded(false); if(gradeChanged){ sEdit.setGradedBy(null); } sEdit.setGradeReleased(false); } else { sEdit.setGrade(grade); if (grade.length() != 0) { sEdit.setGraded(true); if(gradeChanged){ sEdit.setGradedBy(UserDirectoryService.getCurrentUser() == null ? null : UserDirectoryService.getCurrentUser().getId()); } } else { sEdit.setGraded(false); if(gradeChanged){ sEdit.setGradedBy(null); } } } // iterate through submitters and look for grade overrides... if (withGrade && a.isGroup()) { User[] _users = sEdit.getSubmitters(); for (int i=0; _users != null && i < _users.length; i++) { String _gr = (String)state.getAttribute(GRADE_SUBMISSION_GRADE + "_" + _users[i].getId()); sEdit.addGradeForUser(_users[i].getId(), _gr); } } if ("release".equals(gradeOption)) { sEdit.setGradeReleased(true); sEdit.setGraded(true); if(gradeChanged){ sEdit.setGradedBy(UserDirectoryService.getCurrentUser() == null ? null : UserDirectoryService.getCurrentUser().getId()); } // clear the returned flag sEdit.setReturned(false); sEdit.setTimeReturned(null); } else if ("return".equals(gradeOption)) { sEdit.setGradeReleased(true); sEdit.setGraded(true); if(gradeChanged){ sEdit.setGradedBy(UserDirectoryService.getCurrentUser() == null ? null : UserDirectoryService.getCurrentUser().getId()); } sEdit.setReturned(true); sEdit.setTimeReturned(TimeService.newTime()); sEdit.setHonorPledgeFlag(Boolean.FALSE.booleanValue()); } else if ("save".equals(gradeOption)) { sEdit.setGradeReleased(false); sEdit.setReturned(false); sEdit.setTimeReturned(null); } ResourcePropertiesEdit pEdit = sEdit.getPropertiesEdit(); if (state.getAttribute(AssignmentSubmission.ALLOW_RESUBMIT_NUMBER) != null) { // get resubmit number pEdit.addProperty(AssignmentSubmission.ALLOW_RESUBMIT_NUMBER, (String) state.getAttribute(AssignmentSubmission.ALLOW_RESUBMIT_NUMBER)); if (state.getAttribute(ALLOW_RESUBMIT_CLOSEYEAR) != null) { // get resubmit time Time closeTime = getTimeFromState(state, ALLOW_RESUBMIT_CLOSEMONTH, ALLOW_RESUBMIT_CLOSEDAY, ALLOW_RESUBMIT_CLOSEYEAR, ALLOW_RESUBMIT_CLOSEHOUR, ALLOW_RESUBMIT_CLOSEMIN); pEdit.addProperty(AssignmentSubmission.ALLOW_RESUBMIT_CLOSETIME, String.valueOf(closeTime.getTime())); } else { pEdit.removeProperty(AssignmentSubmission.ALLOW_RESUBMIT_CLOSETIME); } } else { // clean resubmission property pEdit.removeProperty(AssignmentSubmission.ALLOW_RESUBMIT_CLOSETIME); pEdit.removeProperty(AssignmentSubmission.ALLOW_RESUBMIT_NUMBER); } // the instructor comment String feedbackCommentString = StringUtils .trimToNull((String) state.getAttribute(GRADE_SUBMISSION_FEEDBACK_COMMENT)); if (feedbackCommentString != null) { sEdit.setFeedbackComment(feedbackCommentString); } else { sEdit.setFeedbackComment(""); } // the instructor inline feedback String feedbackTextString = (String) state.getAttribute(GRADE_SUBMISSION_FEEDBACK_TEXT); if (feedbackTextString != null) { sEdit.setFeedbackText(feedbackTextString); } List v = (List) state.getAttribute(GRADE_SUBMISSION_FEEDBACK_ATTACHMENT); if (v != null) { // clear the old attachments first sEdit.clearFeedbackAttachments(); for (int i = 0; i < v.size(); i++) { sEdit.addFeedbackAttachment((Reference) v.get(i)); } } String sReference = sEdit.getReference(); // save a timestamp for this grading process sEdit.getPropertiesEdit().addProperty(AssignmentConstants.PROP_LAST_GRADED_DATE, TimeService.newTime().toStringLocalFull()); AssignmentService.commitEdit(sEdit); // update grades in gradebook String aReference = a.getReference(); String associateGradebookAssignment = StringUtils.trimToNull(a.getProperties().getProperty(AssignmentService.PROP_ASSIGNMENT_ASSOCIATE_GRADEBOOK_ASSIGNMENT)); if (!"remove".equals(gradeOption)) { // update grade in gradebook integrateGradebook(state, aReference, associateGradebookAssignment, null, null, null, -1, null, sReference, "update", -1); } else { //remove grade from gradebook integrateGradebook(state, aReference, associateGradebookAssignment, null, null, null, -1, null, sReference, "remove", -1); } } if (state.getAttribute(STATE_MESSAGE) == null) { // SAK-29314 - put submission information into state boolean viewSubsOnlySelected = stringToBool((String)data.getParameters().getString(PARAMS_VIEW_SUBS_ONLY_CHECKBOX)); putSubmissionInfoIntoState(state, assignmentId, sId, viewSubsOnlySelected); state.setAttribute(STATE_MODE, MODE_INSTRUCTOR_GRADE_SUBMISSION); state.setAttribute(GRADE_SUBMISSION_DONE, Boolean.TRUE); } else { state.removeAttribute(GRADE_SUBMISSION_DONE); } // SAK-29314 - update the list being iterated over sizeResources(state); } // grade_submission_option
void function(RunData data, String gradeOption) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); boolean withGrade = state.getAttribute(WITH_GRADES) != null ? ((Boolean) state.getAttribute(WITH_GRADES)).booleanValue(): false; String sId = (String) state.getAttribute(GRADE_SUBMISSION_SUBMISSION_ID); String assignmentId = (String) state.getAttribute(GRADE_SUBMISSION_ASSIGNMENT_ID); String grade = (String) state.getAttribute(GRADE_SUBMISSION_GRADE); AssignmentSubmissionEdit sEdit = editSubmission(sId, STR, state); if (sEdit != null) { boolean gradeChanged = false; if((sEdit.getGrade() == null STRSTRSTRSTRreturnSTRreleaseSTRSTR_STRreleaseSTRreturnSTRsaveSTRSTRremoveSTRupdateSTRremove", -1); } } if (state.getAttribute(STATE_MESSAGE) == null) { boolean viewSubsOnlySelected = stringToBool((String)data.getParameters().getString(PARAMS_VIEW_SUBS_ONLY_CHECKBOX)); putSubmissionInfoIntoState(state, assignmentId, sId, viewSubsOnlySelected); state.setAttribute(STATE_MODE, MODE_INSTRUCTOR_GRADE_SUBMISSION); state.setAttribute(GRADE_SUBMISSION_DONE, Boolean.TRUE); } else { state.removeAttribute(GRADE_SUBMISSION_DONE); } sizeResources(state); }
/** * Common grading routine plus specific operation to differenciate cases when saving, releasing or returning grade. */
Common grading routine plus specific operation to differenciate cases when saving, releasing or returning grade
grade_submission_option
{ "repo_name": "lorenamgUMU/sakai", "path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java", "license": "apache-2.0", "size": 677150 }
[ "org.sakaiproject.assignment.api.AssignmentSubmissionEdit", "org.sakaiproject.cheftool.JetspeedRunData", "org.sakaiproject.cheftool.RunData", "org.sakaiproject.event.api.SessionState" ]
import org.sakaiproject.assignment.api.AssignmentSubmissionEdit; import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.event.api.SessionState;
import org.sakaiproject.assignment.api.*; import org.sakaiproject.cheftool.*; import org.sakaiproject.event.api.*;
[ "org.sakaiproject.assignment", "org.sakaiproject.cheftool", "org.sakaiproject.event" ]
org.sakaiproject.assignment; org.sakaiproject.cheftool; org.sakaiproject.event;
868,575
public synchronized void setChildren( int tag, ReadableArray childrenTags) { UiThreadUtil.assertOnUiThread(); ViewGroup viewToManage = (ViewGroup) mTagsToViews.get(tag); ViewGroupManager viewManager = (ViewGroupManager) resolveViewManager(tag); for (int i = 0; i < childrenTags.size(); i++) { View viewToAdd = mTagsToViews.get(childrenTags.getInt(i)); if (viewToAdd == null) { throw new IllegalViewOperationException( "Trying to add unknown view tag: " + childrenTags.getInt(i) + "\n detail: " + constructSetChildrenErrorMessage( viewToManage, viewManager, childrenTags)); } viewManager.addView(viewToManage, viewToAdd, i); } }
synchronized void function( int tag, ReadableArray childrenTags) { UiThreadUtil.assertOnUiThread(); ViewGroup viewToManage = (ViewGroup) mTagsToViews.get(tag); ViewGroupManager viewManager = (ViewGroupManager) resolveViewManager(tag); for (int i = 0; i < childrenTags.size(); i++) { View viewToAdd = mTagsToViews.get(childrenTags.getInt(i)); if (viewToAdd == null) { throw new IllegalViewOperationException( STR + childrenTags.getInt(i) + STR + constructSetChildrenErrorMessage( viewToManage, viewManager, childrenTags)); } viewManager.addView(viewToManage, viewToAdd, i); } }
/** * Simplified version of manageChildren that only deals with adding children views */
Simplified version of manageChildren that only deals with adding children views
setChildren
{ "repo_name": "TrungSpy/React-Native-SampleProject", "path": "node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java", "license": "mit", "size": 29605 }
[ "android.view.View", "android.view.ViewGroup", "com.facebook.react.bridge.ReadableArray", "com.facebook.react.bridge.UiThreadUtil" ]
import android.view.View; import android.view.ViewGroup; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.UiThreadUtil;
import android.view.*; import com.facebook.react.bridge.*;
[ "android.view", "com.facebook.react" ]
android.view; com.facebook.react;
1,795,990
protected void sendBroadcast (String message, ClanRank minRank) { MessageEventContext affinedMessage = new MessageEventContext(ChannelType.CLANCHANNEL_SYSTEM, message); for (ClanChannelUser user : users) { if (user == null) { continue; } if (user.isAffined && user.rank >= minRank.getID()) { user.player.sendMessage(affinedMessage); } } }
void function (String message, ClanRank minRank) { MessageEventContext affinedMessage = new MessageEventContext(ChannelType.CLANCHANNEL_SYSTEM, message); for (ClanChannelUser user : users) { if (user == null) { continue; } if (user.isAffined && user.rank >= minRank.getID()) { user.player.sendMessage(affinedMessage); } } }
/** * Sends a broadcast system message to clan members * @param message The message to send * @param minRank The minimum rank that must be held in order to receive the message */
Sends a broadcast system message to clan members
sendBroadcast
{ "repo_name": "itsgreco/VirtueRS3", "path": "src/org/virtue/game/content/clans/ClanChannel.java", "license": "mit", "size": 10715 }
[ "org.virtue.game.content.chat.ChannelType", "org.virtue.network.event.context.impl.out.MessageEventContext" ]
import org.virtue.game.content.chat.ChannelType; import org.virtue.network.event.context.impl.out.MessageEventContext;
import org.virtue.game.content.chat.*; import org.virtue.network.event.context.impl.out.*;
[ "org.virtue.game", "org.virtue.network" ]
org.virtue.game; org.virtue.network;
1,020,311
String build(final Path directory, final String name, final BuildParam... params) throws DockerException, InterruptedException, IOException;
String build(final Path directory, final String name, final BuildParam... params) throws DockerException, InterruptedException, IOException;
/** * Build a docker image. * * @param directory The directory containing the dockerfile. * @param name The repository name and optional tag to apply to the built image. * @param params Additional flags to use during build. * @return The id of the built image if successful, otherwise null. * @throws DockerException if a server error occurred (500) * @throws InterruptedException If the thread is interrupted * @throws IOException If some IO shit happened. */
Build a docker image
build
{ "repo_name": "bgokden/docker-client", "path": "src/main/java/com/spotify/docker/client/DockerClient.java", "license": "apache-2.0", "size": 42469 }
[ "java.io.IOException", "java.nio.file.Path" ]
import java.io.IOException; import java.nio.file.Path;
import java.io.*; import java.nio.file.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
200,216
public static LinkerInput fakeLinkerInput(Artifact artifact) { return new FakeLinkerInput(artifact); }
static LinkerInput function(Artifact artifact) { return new FakeLinkerInput(artifact); }
/** * Creates a fake linker input. The artifact must be an object file. */
Creates a fake linker input. The artifact must be an object file
fakeLinkerInput
{ "repo_name": "aehlig/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java", "license": "apache-2.0", "size": 19067 }
[ "com.google.devtools.build.lib.actions.Artifact" ]
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.*;
[ "com.google.devtools" ]
com.google.devtools;
186,771
if (rubricDescriptions.size() != rubricSubQuestions.size()) { return false; } for (List<String> rubricDescription : rubricDescriptions) { if (rubricDescription.size() != rubricChoices.size()) { return false; } } return true; }
if (rubricDescriptions.size() != rubricSubQuestions.size()) { return false; } for (List<String> rubricDescription : rubricDescriptions) { if (rubricDescription.size() != rubricChoices.size()) { return false; } } return true; }
/** * Checks if the dimensions of rubricDescription is valid according * to size of rubricSubQuestions and size of rubricChoices. */
Checks if the dimensions of rubricDescription is valid according to size of rubricSubQuestions and size of rubricChoices
isValidDescriptionSize
{ "repo_name": "TEAMMATES/teammates", "path": "src/main/java/teammates/common/datatransfer/questions/FeedbackRubricQuestionDetails.java", "license": "gpl-2.0", "size": 8746 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
394,475
public static Map<String, Object> handleCmdNopPower(byte[] payload) { // Create our response map Map<String, Object> response = new HashMap<String, Object>(); // Return the map of processed response data; return response; }
static Map<String, Object> function(byte[] payload) { Map<String, Object> response = new HashMap<String, Object>(); return response; }
/** * Processes a received frame with the CMD_NOP_POWER command. * <p> * NOP Power * * @param payload the {@link byte[]} payload data to process * @return a {@link Map} of processed response data */
Processes a received frame with the CMD_NOP_POWER command. NOP Power
handleCmdNopPower
{ "repo_name": "zsmartsystems/com.zsmartsystems.zwave", "path": "com.zsmartsystems.zwave/src/main/java/com/zsmartsystems/zwave/commandclass/impl/ZwaveCmdClassV1.java", "license": "epl-1.0", "size": 64368 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
561,370
public static Element getLastVisibleChildElement(Node parent, Hashtable hiddenNodes) { // search for node Node child = parent.getLastChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE && !isHidden(child, hiddenNodes)) { return (Element)child; } child = child.getPreviousSibling(); } // not found return null;
static Element function(Node parent, Hashtable hiddenNodes) { Node child = parent.getLastChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE && !isHidden(child, hiddenNodes)) { return (Element)child; } child = child.getPreviousSibling(); } return null;
/** Finds and returns the last visible child element node. * Overload previous method for non-Xerces node impl */
Finds and returns the last visible child element node. Overload previous method for non-Xerces node impl
getLastVisibleChildElement
{ "repo_name": "haikuowuya/android_system_code", "path": "src/com/sun/org/apache/xerces/internal/util/DOMUtil.java", "license": "apache-2.0", "size": 31302 }
[ "java.util.Hashtable", "org.w3c.dom.Element", "org.w3c.dom.Node" ]
import java.util.Hashtable; import org.w3c.dom.Element; import org.w3c.dom.Node;
import java.util.*; import org.w3c.dom.*;
[ "java.util", "org.w3c.dom" ]
java.util; org.w3c.dom;
190,671
@Test public void no_values_are_forced() { assertTrue(FeatureFlags.FORCED_VALUES.isEmpty()); }
void function() { assertTrue(FeatureFlags.FORCED_VALUES.isEmpty()); }
/** * Ensures we don't release with forced values which is intended for local development only. */
Ensures we don't release with forced values which is intended for local development only
no_values_are_forced
{ "repo_name": "cascheberg/Signal-Android", "path": "app/src/test/java/org/thoughtcrime/securesms/util/FeatureFlags_ConsistencyTest.java", "license": "gpl-3.0", "size": 2884 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
436,145
// prefix must be at least 3 characters long String tmpFilePrefix = Strings.padStart(context.getTaskId().value(), 3, '0'); File file = File.createTempFile(tmpFilePrefix, null, directory); try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(file))) { objectOutputStream.writeObject(context); } if (context.isRunAsUser()) { ForkerUtils.setSharedPermissions(file); } return file; }
String tmpFilePrefix = Strings.padStart(context.getTaskId().value(), 3, '0'); File file = File.createTempFile(tmpFilePrefix, null, directory); try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(file))) { objectOutputStream.writeObject(context); } if (context.isRunAsUser()) { ForkerUtils.setSharedPermissions(file); } return file; }
/** * Serializes a task context to disk. * @param context The context object to serialize. * @param directory The directory where to save the context object. * @return A file pointing/holding the serialized context object. * @throws IOException */
Serializes a task context to disk
serializeContext
{ "repo_name": "laurianed/scheduling", "path": "scheduler/scheduler-node/src/main/java/org/ow2/proactive/scheduler/task/context/TaskContextSerializer.java", "license": "agpl-3.0", "size": 2268 }
[ "com.google.common.base.Strings", "java.io.File", "java.io.FileOutputStream", "java.io.ObjectOutputStream", "org.ow2.proactive.scheduler.task.utils.ForkerUtils" ]
import com.google.common.base.Strings; import java.io.File; import java.io.FileOutputStream; import java.io.ObjectOutputStream; import org.ow2.proactive.scheduler.task.utils.ForkerUtils;
import com.google.common.base.*; import java.io.*; import org.ow2.proactive.scheduler.task.utils.*;
[ "com.google.common", "java.io", "org.ow2.proactive" ]
com.google.common; java.io; org.ow2.proactive;
1,426,757
protected void nextTxn(boolean rollToNext) throws StreamingException, InterruptedException, TxnBatchFailure { if (txnBatch.remainingTransactions() == 0) { closeTxnBatch(); txnBatch = null; if (rollToNext) { txnBatch = nextTxnBatch(recordWriter); } } else if (rollToNext) { LOG.debug("Switching to next Txn for {}", endPoint); txnBatch.beginNextTransaction(); // does not block } }
void function(boolean rollToNext) throws StreamingException, InterruptedException, TxnBatchFailure { if (txnBatch.remainingTransactions() == 0) { closeTxnBatch(); txnBatch = null; if (rollToNext) { txnBatch = nextTxnBatch(recordWriter); } } else if (rollToNext) { LOG.debug(STR, endPoint); txnBatch.beginNextTransaction(); } }
/** * if there are remainingTransactions in current txnBatch, begins nextTransactions * otherwise creates new txnBatch. * @param rollToNext Whether to roll to the next transaction batch */
if there are remainingTransactions in current txnBatch, begins nextTransactions otherwise creates new txnBatch
nextTxn
{ "repo_name": "ShellyLC/nifi", "path": "nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/util/hive/HiveWriter.java", "license": "apache-2.0", "size": 16976 }
[ "org.apache.hive.hcatalog.streaming.StreamingException" ]
import org.apache.hive.hcatalog.streaming.StreamingException;
import org.apache.hive.hcatalog.streaming.*;
[ "org.apache.hive" ]
org.apache.hive;
1,452,080
public Set entrySet() { return Collections.unmodifiableSet(_backingMap.entrySet()); }
Set function() { return Collections.unmodifiableSet(_backingMap.entrySet()); }
/** * Returns an <b>unmodifiable</b> view of the mappings contained in this * map. Each element in the returned set is a <code>Map.Entry</code>. * * @return an unmodifiable view of the mappings contained in this map. */
Returns an unmodifiable view of the mappings contained in this map. Each element in the returned set is a <code>Map.Entry</code>
entrySet
{ "repo_name": "CCM-Modding/Nucleum-Omnium", "path": "src/main/java/ccm/libs/org/codehaus/plexus/util/CachedMap.java", "license": "mit", "size": 14384 }
[ "java.util.Collections", "java.util.Set" ]
import java.util.Collections; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,674,632
private IAdaptable findAdapter(CompositeCommand cc, Element source, Point dropLocation, String edgeType) { GraphicalEditPart editPart = (GraphicalEditPart) lookForEditPart(source); if (editPart != null) { return new SemanticAdapter(null, editPart.getModel()); } ICommand createCommand = getDefaultDropNodeCommand(edgeType, dropLocation, source); cc.add(createCommand); return (IAdaptable) createCommand.getCommandResult().getReturnValue(); } /** * {@inheritDoc}
IAdaptable function(CompositeCommand cc, Element source, Point dropLocation, String edgeType) { GraphicalEditPart editPart = (GraphicalEditPart) lookForEditPart(source); if (editPart != null) { return new SemanticAdapter(null, editPart.getModel()); } ICommand createCommand = getDefaultDropNodeCommand(edgeType, dropLocation, source); cc.add(createCommand); return (IAdaptable) createCommand.getCommandResult().getReturnValue(); } /** * {@inheritDoc}
/** * the method provides command to create the binary link into the diagram. * Find source/target adapter * If the source and the target views do not exist, these views will be * created. * * @see dropBinaryLink(CompositeCommand cc, Element source, Element target, int linkVISUALID * , Point absoluteLocation, Element semanticLink) * * @param cc * the composite command that will contain the set of command to * create the binary link * @param source * source/target link node * @param point * source/target node location */
the method provides command to create the binary link into the diagram. Find source/target adapter If the source and the target views do not exist, these views will be created
findAdapter
{ "repo_name": "bmaggi/Papyrus-SysML11", "path": "plugins/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/edit/policy/CustomDiagramDragDropEditPolicy.java", "license": "epl-1.0", "size": 13542 }
[ "org.eclipse.core.runtime.IAdaptable", "org.eclipse.draw2d.geometry.Point", "org.eclipse.gmf.runtime.common.core.command.CompositeCommand", "org.eclipse.gmf.runtime.common.core.command.ICommand", "org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart", "org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter", "org.eclipse.uml2.uml.Element" ]
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.draw2d.geometry.Point; import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter; import org.eclipse.uml2.uml.Element;
import org.eclipse.core.runtime.*; import org.eclipse.draw2d.geometry.*; import org.eclipse.gmf.runtime.common.core.command.*; import org.eclipse.gmf.runtime.diagram.ui.editparts.*; import org.eclipse.papyrus.uml.diagram.common.commands.*; import org.eclipse.uml2.uml.*;
[ "org.eclipse.core", "org.eclipse.draw2d", "org.eclipse.gmf", "org.eclipse.papyrus", "org.eclipse.uml2" ]
org.eclipse.core; org.eclipse.draw2d; org.eclipse.gmf; org.eclipse.papyrus; org.eclipse.uml2;
287,319
public void onPeerConnectionError(final String description); } private PeerConnectionClient() { executor = new LooperExecutor(); // Looper thread is started once in private ctor and is used for all // peer connection API calls to ensure new peer connection factory is // created on the same thread as previously destroyed factory. executor.requestStart(); }
void function(final String description); } private PeerConnectionClient() { executor = new LooperExecutor(); executor.requestStart(); }
/** * Callback fired once peer connection error happened. */
Callback fired once peer connection error happened
onPeerConnectionError
{ "repo_name": "JiYou/webrtctalk", "path": "examples/android/src/org/appspot/apprtc/PeerConnectionClient.java", "license": "bsd-3-clause", "size": 35637 }
[ "org.appspot.apprtc.util.LooperExecutor" ]
import org.appspot.apprtc.util.LooperExecutor;
import org.appspot.apprtc.util.*;
[ "org.appspot.apprtc" ]
org.appspot.apprtc;
1,131,075
protected String getOriginatorEventId(IDeviceEventOriginator originator) { if (originator == null) { return null; } return originator.getEventId(); }
String function(IDeviceEventOriginator originator) { if (originator == null) { return null; } return originator.getEventId(); }
/** * Gets event id of the originating command if available. * * @param originator * @return */
Gets event id of the originating command if available
getOriginatorEventId
{ "repo_name": "sitewhere/sitewhere-tools", "path": "sitewhere-java-agent/src/main/java/com/sitewhere/agent/BaseCommandProcessor.java", "license": "mit", "size": 9977 }
[ "com.sitewhere.spi.device.event.IDeviceEventOriginator" ]
import com.sitewhere.spi.device.event.IDeviceEventOriginator;
import com.sitewhere.spi.device.event.*;
[ "com.sitewhere.spi" ]
com.sitewhere.spi;
623,433
private StockPartCollection queryQueue(TSQ tsq) { // Result to return StockPartCollection coll = new StockPartCollection(); // Configure the result object coll.setResourceName(tsq.getName()); // Holder object to receive the data ItemHolder holder = new ItemHolder(); try { // Loop until we break out - elements in a queue are 1-based for ( int i = 1; true; i++ ) { // Read item from the queue tsq.readItem(i, holder); // Get the record as a sequence of bytes byte[] record = holder.getValue(); // Convert this byte array to a new object and add to the result coll.add( new StockPart(record) ); } } catch (ItemErrorException iee) { // Equivalent to a CICS ITEMERROR // Normal termination of loop - no further elements } catch (InvalidQueueIdException iqe) { // Equivalent to a CICSQIDERR // No such queue - return an empty object } catch (CicsConditionException cce) { // A CICS failure - build an error message String err = String.format("Error querying queue : %s", cce.getMessage()); // Create a response Response r = Response.serverError().entity(err).build(); // Pass the error back up the handler chain (JAX-RS 1.0) throw new WebApplicationException(cce, r); } // Return the constructed object return coll; }
StockPartCollection function(TSQ tsq) { StockPartCollection coll = new StockPartCollection(); coll.setResourceName(tsq.getName()); ItemHolder holder = new ItemHolder(); try { for ( int i = 1; true; i++ ) { tsq.readItem(i, holder); byte[] record = holder.getValue(); coll.add( new StockPart(record) ); } } catch (ItemErrorException iee) { } catch (InvalidQueueIdException iqe) { } catch (CicsConditionException cce) { String err = String.format(STR, cce.getMessage()); Response r = Response.serverError().entity(err).build(); throw new WebApplicationException(cce, r); } return coll; }
/** * Takes the supplied TSQ and returns all of the items in the queue as * StockPart instances within a StockPartCollection. * * @param tsq The queue to query. * * @return A StockPartCollection instance representing the contents of the * supplied TSQ. */
Takes the supplied TSQ and returns all of the items in the queue as StockPart instances within a StockPartCollection
queryQueue
{ "repo_name": "cicsdev/cics-java-liberty-restapp-ext", "path": "src/Java/com/ibm/cicsdev/restappext/TemporaryStorageResource.java", "license": "apache-2.0", "size": 10088 }
[ "com.ibm.cics.server.CicsConditionException", "com.ibm.cics.server.InvalidQueueIdException", "com.ibm.cics.server.ItemErrorException", "com.ibm.cics.server.ItemHolder", "com.ibm.cicsdev.restappext.bean.StockPartCollection", "com.ibm.cicsdev.restappext.generated.StockPart", "javax.ws.rs.WebApplicationException", "javax.ws.rs.core.Response" ]
import com.ibm.cics.server.CicsConditionException; import com.ibm.cics.server.InvalidQueueIdException; import com.ibm.cics.server.ItemErrorException; import com.ibm.cics.server.ItemHolder; import com.ibm.cicsdev.restappext.bean.StockPartCollection; import com.ibm.cicsdev.restappext.generated.StockPart; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response;
import com.ibm.cics.server.*; import com.ibm.cicsdev.restappext.bean.*; import com.ibm.cicsdev.restappext.generated.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "com.ibm.cics", "com.ibm.cicsdev", "javax.ws" ]
com.ibm.cics; com.ibm.cicsdev; javax.ws;
1,042,996
ImageIcon getInsidePicture(final IAudioObject audioObject, final int width, final int height);
ImageIcon getInsidePicture(final IAudioObject audioObject, final int width, final int height);
/** * Returns image stored into audio file, if exists. * * @param audioObject * the audioObject * @param width * Width in pixels or -1 to keep original width * @param height * Height in pixels or -1 to keep original height * * @return the inside picture */
Returns image stored into audio file, if exists
getInsidePicture
{ "repo_name": "PDavid/aTunes", "path": "aTunes/src/main/java/net/sourceforge/atunes/model/ILocalAudioObjectImageHandler.java", "license": "gpl-2.0", "size": 2931 }
[ "javax.swing.ImageIcon" ]
import javax.swing.ImageIcon;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
165,741
//----------------------------------------------------------------------- public static final Chronology getIntervalChronology(ReadableInstant start, ReadableInstant end) { Chronology chrono = null; if (start != null) { chrono = start.getChronology(); } else if (end != null) { chrono = end.getChronology(); } if (chrono == null) { chrono = ISOChronology.getInstance(); } return chrono; }
static final Chronology function(ReadableInstant start, ReadableInstant end) { Chronology chrono = null; if (start != null) { chrono = start.getChronology(); } else if (end != null) { chrono = end.getChronology(); } if (chrono == null) { chrono = ISOChronology.getInstance(); } return chrono; }
/** * Gets the chronology from the specified instant based interval handling null. * <p> * The chronology is obtained from the start if that is not null, or from the * end if the start is null. The result is additionally checked, and if still * null then {@link ISOChronology#getInstance()} will be returned. * * @param start the instant to examine and use as the primary source of the chronology * @param end the instant to examine and use as the secondary source of the chronology * @return the chronology, never null */
Gets the chronology from the specified instant based interval handling null. The chronology is obtained from the start if that is not null, or from the end if the start is null. The result is additionally checked, and if still null then <code>ISOChronology#getInstance()</code> will be returned
getIntervalChronology
{ "repo_name": "PavelSozonov/JodaTimeTesting", "path": "src/main/java/org/joda/time/DateTimeUtils.java", "license": "apache-2.0", "size": 22422 }
[ "org.joda.time.chrono.ISOChronology" ]
import org.joda.time.chrono.ISOChronology;
import org.joda.time.chrono.*;
[ "org.joda.time" ]
org.joda.time;
488,002
private static int blendColors(int color1, int color2, float ratio) { final float inverseRation = 1f - ratio; float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); return Color.rgb((int) r, (int) g, (int) b); } private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer { private int[] mIndicatorColors; private int[] mDividerColors;
static int function(int color1, int color2, float ratio) { final float inverseRation = 1f - ratio; float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); return Color.rgb((int) r, (int) g, (int) b); } private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer { private int[] mIndicatorColors; private int[] mDividerColors;
/** * Blend {@code color1} and {@code color2} using the given ratio. * * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend, * 0.0 will return {@code color2}. */
Blend color1 and color2 using the given ratio
blendColors
{ "repo_name": "t28hub/SectionAdapter", "path": "sample/src/main/java/com/example/android/common/view/SlidingTabStrip.java", "license": "mit", "size": 8027 }
[ "android.graphics.Color" ]
import android.graphics.Color;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
2,038,688
public void setEndpointAttachRequests(List<EndpointAttachRequest> value) { this.endpointAttachRequests = value; }
void function(List<EndpointAttachRequest> value) { this.endpointAttachRequests = value; }
/** * Sets the value of the 'endpointAttachRequests' field. * * @param value the value to set. */
Sets the value of the 'endpointAttachRequests' field
setEndpointAttachRequests
{ "repo_name": "sashadidukh/kaa", "path": "server/common/server-shared/src/main/java/org/kaaproject/kaa/server/sync/UserClientSync.java", "license": "apache-2.0", "size": 4346 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,116,690
@WebMethod @WebResult(name = "rval", targetNamespace = "https://www.google.com/apis/ads/publisher/v201502") @RequestWrapper(localName = "performPackageAction", targetNamespace = "https://www.google.com/apis/ads/publisher/v201502", className = "com.google.api.ads.dfp.jaxws.v201502.PackageServiceInterfaceperformPackageAction") @ResponseWrapper(localName = "performPackageActionResponse", targetNamespace = "https://www.google.com/apis/ads/publisher/v201502", className = "com.google.api.ads.dfp.jaxws.v201502.PackageServiceInterfaceperformPackageActionResponse") public UpdateResult performPackageAction( @WebParam(name = "packageAction", targetNamespace = "https://www.google.com/apis/ads/publisher/v201502") PackageAction packageAction, @WebParam(name = "filterStatement", targetNamespace = "https://www.google.com/apis/ads/publisher/v201502") Statement filterStatement) throws ApiException_Exception ;
@WebResult(name = "rval", targetNamespace = STRperformPackageActionSTRhttps: @ResponseWrapper(localName = "performPackageActionResponseSTRhttps: UpdateResult function( @WebParam(name = "packageActionSTRhttps: PackageAction packageAction, @WebParam(name = "filterStatementSTRhttps: Statement filterStatement) throws ApiException_Exception ;
/** * * Performs actions on {@link Package} objects that match the given {@link Statement}. * * @param packageAction the action to perform * @param filterStatement a Publisher Query Language statement used to filter a set of packages * @return the result of the action performed * * * @param filterStatement * @param packageAction * @return * returns com.google.api.ads.dfp.jaxws.v201502.UpdateResult * @throws ApiException_Exception */
Performs actions on <code>Package</code> objects that match the given <code>Statement</code>
performPackageAction
{ "repo_name": "shyTNT/googleads-java-lib", "path": "modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201502/PackageServiceInterface.java", "license": "apache-2.0", "size": 7625 }
[ "javax.jws.WebParam", "javax.jws.WebResult", "javax.xml.ws.ResponseWrapper" ]
import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.ResponseWrapper;
import javax.jws.*; import javax.xml.ws.*;
[ "javax.jws", "javax.xml" ]
javax.jws; javax.xml;
352,520
public ExpressRoutePortInner withLinks(List<ExpressRouteLinkInner> links) { this.links = links; return this; }
ExpressRoutePortInner function(List<ExpressRouteLinkInner> links) { this.links = links; return this; }
/** * Set the set of physical links of the ExpressRoutePort resource. * * @param links the links value to set * @return the ExpressRoutePortInner object itself. */
Set the set of physical links of the ExpressRoutePort resource
withLinks
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_02_01/src/main/java/com/microsoft/azure/management/network/v2019_02_01/implementation/ExpressRoutePortInner.java", "license": "mit", "size": 8312 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,623,529
public Serializable toSerializable(Object object, Serializable defaultValue);
Serializable function(Object object, Serializable defaultValue);
/** * cast Object to a Serializable Object * @param object * @param defaultValue * @return */
cast Object to a Serializable Object
toSerializable
{ "repo_name": "gpickin/Lucee4", "path": "lucee-java/lucee-loader/src/lucee/runtime/util/Cast.java", "license": "lgpl-2.1", "size": 39496 }
[ "java.io.Serializable" ]
import java.io.Serializable;
import java.io.*;
[ "java.io" ]
java.io;
2,604,089
private void addIncomeByInvoiceByCategorySubReport(Map mainReportParams) { log.debug("Generating addIncomeByInvoiceByCategorySubReport............................."); String subReportKey = "INCOMEBYCATEGORYSUBREPORT"; Map<String, Object> params = new HashMap<String, Object>(); String nativeSql = incomeByInvoiceExtendedAction.getIncomeByInvoiceByCategoryAction().getSql(); TypedReportData subReportData = super.generateSqlSubReport( subReportKey, "/cashbox/reports/incomeByInvoiceByCategorySubReport.jrxml", PageFormat.CUSTOM, PageOrientation.PORTRAIT, nativeSql, params); //add in main report params mainReportParams.putAll(subReportData.getReportParams()); mainReportParams.put(subReportKey, subReportData.getJasperReport()); }
void function(Map mainReportParams) { log.debug(STR); String subReportKey = STR; Map<String, Object> params = new HashMap<String, Object>(); String nativeSql = incomeByInvoiceExtendedAction.getIncomeByInvoiceByCategoryAction().getSql(); TypedReportData subReportData = super.generateSqlSubReport( subReportKey, STR, PageFormat.CUSTOM, PageOrientation.PORTRAIT, nativeSql, params); mainReportParams.putAll(subReportData.getReportParams()); mainReportParams.put(subReportKey, subReportData.getJasperReport()); }
/** * income invoice by category sub report * * @param mainReportParams */
income invoice by category sub report
addIncomeByInvoiceByCategorySubReport
{ "repo_name": "arielsiles/sisk1", "path": "src/main/com/encens/khipus/action/cashbox/reports/IncomeByInvoiceReportAction.java", "license": "gpl-3.0", "size": 4596 }
[ "com.encens.khipus.action.reports.PageFormat", "com.encens.khipus.action.reports.PageOrientation", "com.jatun.titus.reportgenerator.util.TypedReportData", "java.util.HashMap", "java.util.Map" ]
import com.encens.khipus.action.reports.PageFormat; import com.encens.khipus.action.reports.PageOrientation; import com.jatun.titus.reportgenerator.util.TypedReportData; import java.util.HashMap; import java.util.Map;
import com.encens.khipus.action.reports.*; import com.jatun.titus.reportgenerator.util.*; import java.util.*;
[ "com.encens.khipus", "com.jatun.titus", "java.util" ]
com.encens.khipus; com.jatun.titus; java.util;
1,707,270
@Override public boolean itemExists(final String name) throws JMSException { if (ActiveMQRAMapMessage.trace) { ActiveMQRALogger.LOGGER.trace("itemExists(" + name + ")"); } return ((MapMessage) message).itemExists(name); }
boolean function(final String name) throws JMSException { if (ActiveMQRAMapMessage.trace) { ActiveMQRALogger.LOGGER.trace(STR + name + ")"); } return ((MapMessage) message).itemExists(name); }
/** * Does the item exist * * @param name The name * @return True / false * @throws JMSException Thrown if an error occurs */
Does the item exist
itemExists
{ "repo_name": "cshannon/activemq-artemis", "path": "artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMapMessage.java", "license": "apache-2.0", "size": 11922 }
[ "javax.jms.JMSException", "javax.jms.MapMessage" ]
import javax.jms.JMSException; import javax.jms.MapMessage;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
497,765
protected static boolean shouldDisplay(IStatus status, int mask) { IStatus[] children = status.getChildren(); if (children == null || children.length == 0) { return status.matches(mask); } for (int i = 0; i < children.length; i++) { if (children[i].matches(mask)) { return true; } } return false; }
static boolean function(IStatus status, int mask) { IStatus[] children = status.getChildren(); if (children == null children.length == 0) { return status.matches(mask); } for (int i = 0; i < children.length; i++) { if (children[i].matches(mask)) { return true; } } return false; }
/** * Returns whether the given status object should be displayed. * * @param status a status object * @param mask a mask as per <code>IStatus.matches</code> * @return <code>true</code> if the given status should be displayed, and <code>false</code> * otherwise * @see org.eclipse.core.runtime.IStatus#matches(int) */
Returns whether the given status object should be displayed
shouldDisplay
{ "repo_name": "jcryptool/core", "path": "org.jcryptool.core.logging/src/org/jcryptool/core/logging/dialogs/ExceptionDetailsErrorDialog.java", "license": "epl-1.0", "size": 22694 }
[ "org.eclipse.core.runtime.IStatus" ]
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.*;
[ "org.eclipse.core" ]
org.eclipse.core;
675,283
public void lock(boolean shouldLock) { String lastAlias = getLastAlias(); if (shouldLock) { if (lastAlias != null) { criteria.setLockMode(lastAlias, LockMode.PESSIMISTIC_WRITE); } else { criteria.setLockMode(LockMode.PESSIMISTIC_WRITE); } } else { if (lastAlias != null) { criteria.setLockMode(lastAlias, LockMode.NONE); } else { criteria.setLockMode(LockMode.NONE); } } }
void function(boolean shouldLock) { String lastAlias = getLastAlias(); if (shouldLock) { if (lastAlias != null) { criteria.setLockMode(lastAlias, LockMode.PESSIMISTIC_WRITE); } else { criteria.setLockMode(LockMode.PESSIMISTIC_WRITE); } } else { if (lastAlias != null) { criteria.setLockMode(lastAlias, LockMode.NONE); } else { criteria.setLockMode(LockMode.NONE); } } }
/** * Whether a pessimistic lock should be obtained. * * @param shouldLock True if it should */
Whether a pessimistic lock should be obtained
lock
{ "repo_name": "erdi/grails-core", "path": "grails-hibernate/src/main/groovy/grails/orm/HibernateCriteriaBuilder.java", "license": "apache-2.0", "size": 75516 }
[ "org.hibernate.LockMode" ]
import org.hibernate.LockMode;
import org.hibernate.*;
[ "org.hibernate" ]
org.hibernate;
734,152
public void raiseException(Throwable exception, String message, boolean stopGame) { FMLLog.log(Level.ERROR, exception, "Something raised an exception. The message was '%s'. 'stopGame' is %b", message, stopGame); if (stopGame) { getSidedDelegate().haltGame(message,exception); } }
void function(Throwable exception, String message, boolean stopGame) { FMLLog.log(Level.ERROR, exception, STR, message, stopGame); if (stopGame) { getSidedDelegate().haltGame(message,exception); } }
/** * Raise an exception */
Raise an exception
raiseException
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraftforge/fml/common/FMLCommonHandler.java", "license": "lgpl-2.1", "size": 24542 }
[ "org.apache.logging.log4j.Level" ]
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.*;
[ "org.apache.logging" ]
org.apache.logging;
1,367,869
Token t; StringBuilder buffer; String name; char c = nextNonWSChar(); // first - the built in value extraction switch (c) { case '\"': // string literal follows buffer = new StringBuilder(); while (true) { c = nextChar(); if (c == EOSToken.getChar()) { throwParseException("bad literal string - not terminated by \""); } if (c == '"') { break; } if (c == '\\') { // we only support passthrough at present c = nextChar(); } buffer.append(c); } t = new StringToken(buffer.toString()); return t; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': // first digit of integer literal buffer = new StringBuilder(); buffer.append(c); while (isIntegerChar(c = nextChar())) { buffer.append(c); } ptr--; int ival = 0; try { ival = Integer.parseInt(buffer.toString()); } catch (NumberFormatException ex) { throwParseException("bad literal integer - illegal character - should never happen!"); } t = new IntegerToken(ival); return t; case '[': buffer = new StringBuilder(); while (true) { c = nextChar(); if (c == EOSToken.getChar()) { throwParseException("bad special literal - not terminated by ]"); } if (c == ']') { break; } buffer.append(c); } String special = buffer.toString(); if ("true".equalsIgnoreCase(special) || "yes".equalsIgnoreCase(special) || "y".equalsIgnoreCase(special) || "set".equalsIgnoreCase(special) || "on".equalsIgnoreCase(special) || "OK".equalsIgnoreCase(special)) { t = new BooleanToken(Boolean.TRUE); return t; } if ("false".equalsIgnoreCase(special) || "no".equalsIgnoreCase(special) || "n".equalsIgnoreCase(special) || "unset".equalsIgnoreCase(special) || "off".equalsIgnoreCase(special)) { t = new BooleanToken(Boolean.FALSE); return t; } throwParseException("unknown special literal - " + special); case '`': buffer = new StringBuilder(); while (true) { c = nextChar(); if (c == EOSToken.getChar()) { throwParseException("bad parameter - not terminated by `"); } if (c == '`') { break; } buffer.append(c); } name = buffer.toString(); if (!exactMatch) { name = ParseAndEvaluate.nonExactName(name); } t = new ParameterToken(name); return t; } ptr--; for (OperatorToken ot : languagedefinition.getTokens()) { if (tokenMatcher(ot)) { ptr += ot.getTokenString().length(); return ot; } } ptr++; // and now attempt to process text for simple parameternames or functionnames buffer = new StringBuilder(); if (!isNameChar(c)) { throwParseException("illegal name character - found " + c); } buffer.append(c); while (isNameChar(c = nextChar())) { buffer.append(c); } ptr--; name = buffer.toString(); FunctionToken function = functionMatch(name); if (function != null) { c = nextNonWSChar(); if (c == languagedefinition.getFunctionBra()) { return function; } else { throwParseException("illegal function construct - expected " + languagedefinition.getFunctionBra() + " - found " + c); return null; } } else { if (!exactMatch) { name = ParseAndEvaluate.nonExactName(name); } t = new ParameterToken(name); return t; } }
Token t; StringBuilder buffer; String name; char c = nextNonWSChar(); switch (c) { case '\STRbad literal string - not terminated by \STR') { break; } if (c == '\\') { c = nextChar(); } buffer.append(c); } t = new StringToken(buffer.toString()); return t; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': buffer = new StringBuilder(); buffer.append(c); while (isIntegerChar(c = nextChar())) { buffer.append(c); } ptr--; int ival = 0; try { ival = Integer.parseInt(buffer.toString()); } catch (NumberFormatException ex) { throwParseException(STR); } t = new IntegerToken(ival); return t; case '[': buffer = new StringBuilder(); while (true) { c = nextChar(); if (c == EOSToken.getChar()) { throwParseException(STR); } if (c == ']') { break; } buffer.append(c); } String special = buffer.toString(); if ("true".equalsIgnoreCase(special) "yes".equalsIgnoreCase(special) "y".equalsIgnoreCase(special) "set".equalsIgnoreCase(special) "on".equalsIgnoreCase(special) "OK".equalsIgnoreCase(special)) { t = new BooleanToken(Boolean.TRUE); return t; } if ("false".equalsIgnoreCase(special) "no".equalsIgnoreCase(special) "n".equalsIgnoreCase(special) "unset".equalsIgnoreCase(special) "off".equalsIgnoreCase(special)) { t = new BooleanToken(Boolean.FALSE); return t; } throwParseException(STR + special); case '`': buffer = new StringBuilder(); while (true) { c = nextChar(); if (c == EOSToken.getChar()) { throwParseException(STR); } if (c == '`') { break; } buffer.append(c); } name = buffer.toString(); if (!exactMatch) { name = ParseAndEvaluate.nonExactName(name); } t = new ParameterToken(name); return t; } ptr--; for (OperatorToken ot : languagedefinition.getTokens()) { if (tokenMatcher(ot)) { ptr += ot.getTokenString().length(); return ot; } } ptr++; buffer = new StringBuilder(); if (!isNameChar(c)) { throwParseException(STR + c); } buffer.append(c); while (isNameChar(c = nextChar())) { buffer.append(c); } ptr--; name = buffer.toString(); FunctionToken function = functionMatch(name); if (function != null) { c = nextNonWSChar(); if (c == languagedefinition.getFunctionBra()) { return function; } else { throwParseException(STR + languagedefinition.getFunctionBra() + STR + c); return null; } } else { if (!exactMatch) { name = ParseAndEvaluate.nonExactName(name); } t = new ParameterToken(name); return t; } }
/** * Get the next token from the expression. * * @return the next token */
Get the next token from the expression
nextToken
{ "repo_name": "Richard-Linsdale/mailer", "path": "expressionparserandevaluate/src/main/java/uk/theretiredprogrammer/mailer/expressionparserandevaluate/parse/LexicalAnalyser.java", "license": "apache-2.0", "size": 8827 }
[ "uk.theretiredprogrammer.mailer.expressionparserandevaluate.ParseAndEvaluate", "uk.theretiredprogrammer.mailer.expressionparserandevaluate.tokens.EOSToken", "uk.theretiredprogrammer.mailer.expressionparserandevaluate.tokens.FunctionToken", "uk.theretiredprogrammer.mailer.expressionparserandevaluate.tokens.OperatorToken", "uk.theretiredprogrammer.mailer.expressionparserandevaluate.tokens.Token" ]
import uk.theretiredprogrammer.mailer.expressionparserandevaluate.ParseAndEvaluate; import uk.theretiredprogrammer.mailer.expressionparserandevaluate.tokens.EOSToken; import uk.theretiredprogrammer.mailer.expressionparserandevaluate.tokens.FunctionToken; import uk.theretiredprogrammer.mailer.expressionparserandevaluate.tokens.OperatorToken; import uk.theretiredprogrammer.mailer.expressionparserandevaluate.tokens.Token;
import uk.theretiredprogrammer.mailer.expressionparserandevaluate.*; import uk.theretiredprogrammer.mailer.expressionparserandevaluate.tokens.*;
[ "uk.theretiredprogrammer.mailer" ]
uk.theretiredprogrammer.mailer;
2,271,321
@Override public synchronized void registerSynchronizationCallback(SynchronizationCallback sync) throws NotSupportedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "registerSynchronizationCallback", sync); // Disallow registration of null syncs if (sync == null) { final NullPointerException npe = new NullPointerException(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "registerSynchronizationCallback", npe); throw npe; } // If this is the first registration we just add it on a new level and we're done if (_syncLevel < 0) { final ArrayList<SynchronizationCallback> newSyncList = new ArrayList<SynchronizationCallback>(); newSyncList.add(sync); setLevel(newSyncList); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "registerSynchronizationCallback", _syncLevel); return; } // We clone a new sync level from the last one and add this one to it // Get the current list final ArrayList currentSyncList = _syncLevels.get(_syncLevel); // Current list should not be null (unless we have a logic error) if (currentSyncList == null) { // We can recover though final ArrayList<SynchronizationCallback> newSyncList = new ArrayList<SynchronizationCallback>(); newSyncList.add(sync); setLevel(newSyncList); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "registerSynchronizationCallback", _syncLevel); return; } // Clone it with space for the new sync final ArrayList<SynchronizationCallback> newSyncList = new ArrayList<SynchronizationCallback>(currentSyncList); // Add the new sync on the end of the new list newSyncList.add(sync); // Make the new list current setLevel(newSyncList); // Garbage collect old levels which are no longer referenced garbageCollectUnusedLevels(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "registerSynchronizationCallback", _syncLevel); }
synchronized void function(SynchronizationCallback sync) throws NotSupportedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, STR, sync); if (sync == null) { final NullPointerException npe = new NullPointerException(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, STR, npe); throw npe; } if (_syncLevel < 0) { final ArrayList<SynchronizationCallback> newSyncList = new ArrayList<SynchronizationCallback>(); newSyncList.add(sync); setLevel(newSyncList); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, STR, _syncLevel); return; } final ArrayList currentSyncList = _syncLevels.get(_syncLevel); if (currentSyncList == null) { final ArrayList<SynchronizationCallback> newSyncList = new ArrayList<SynchronizationCallback>(); newSyncList.add(sync); setLevel(newSyncList); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, STR, _syncLevel); return; } final ArrayList<SynchronizationCallback> newSyncList = new ArrayList<SynchronizationCallback>(currentSyncList); newSyncList.add(sync); setLevel(newSyncList); garbageCollectUnusedLevels(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, STR, _syncLevel); }
/** * Register a {@link com.ibm.websphere.jtaextensions.SynchronizationCallback SynchronizationCallback} object with the transaction manager. * The registered <code>sync</code> receives notification of the completion * of each transaction mediated by the transaction manager in the local JVM. * * @param sync An object implementing the {@link com.ibm.websphere.jtaextensions.SynchronizationCallback SynchronizationCallback} interface. * the calling process. If there is no active transaction currently associated with the thread, returns 0; * * @exception NotSupportedException Thrown if this method is called from an environment * or at a time when the function is not available. * */
Register a <code>com.ibm.websphere.jtaextensions.SynchronizationCallback SynchronizationCallback</code> object with the transaction manager. The registered <code>sync</code> receives notification of the completion of each transaction mediated by the transaction manager in the local JVM
registerSynchronizationCallback
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.tx.jta.extensions/src/com/ibm/ws/jtaextensions/ExtendedJTATransactionImpl.java", "license": "epl-1.0", "size": 20056 }
[ "com.ibm.ejs.ras.Tr", "com.ibm.ejs.ras.TraceComponent", "com.ibm.websphere.jtaextensions.NotSupportedException", "com.ibm.websphere.jtaextensions.SynchronizationCallback", "java.util.ArrayList" ]
import com.ibm.ejs.ras.Tr; import com.ibm.ejs.ras.TraceComponent; import com.ibm.websphere.jtaextensions.NotSupportedException; import com.ibm.websphere.jtaextensions.SynchronizationCallback; import java.util.ArrayList;
import com.ibm.ejs.ras.*; import com.ibm.websphere.jtaextensions.*; import java.util.*;
[ "com.ibm.ejs", "com.ibm.websphere", "java.util" ]
com.ibm.ejs; com.ibm.websphere; java.util;
1,749,591
Object handle(String serviceFilter, Method method, Object[] args, long timeout);
Object handle(String serviceFilter, Method method, Object[] args, long timeout);
/** * Handling when a method is not available. * * @param serviceFilter * The filter of the service that is tracked and not available. * @param method * The method that was invoked. * @param args * The arguments that were used during the original method call. * @param timeout * The time until the Reference waited for the service to be available. * @return In case this function returns an object that will be returned as the result of the original method call. */
Handling when a method is not available
handle
{ "repo_name": "everit-org-archive/osgi-servicereference", "path": "core/src/main/java/org/everit/osgi/servicereference/core/ServiceUnavailableHandler.java", "license": "lgpl-3.0", "size": 1806 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,557,375
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<AvailableServiceAliasInner>> listSinglePageAsync(String location) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (location == null) { return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String apiVersion = "2020-05-01"; return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), location, this.client.getSubscriptionId(), apiVersion, context)) .<PagedResponse<AvailableServiceAliasInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<AvailableServiceAliasInner>> function(String location) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (location == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String apiVersion = STR; return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), location, this.client.getSubscriptionId(), apiVersion, context)) .<PagedResponse<AvailableServiceAliasInner>>map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }
/** * Gets all available service aliases for this subscription in this region. * * @param location The location. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all available service aliases for this subscription in this region. */
Gets all available service aliases for this subscription in this region
listSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/AvailableServiceAliasesClientImpl.java", "license": "mit", "size": 26127 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.FluxUtil", "com.azure.resourcemanager.network.fluent.models.AvailableServiceAliasInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.network.fluent.models.AvailableServiceAliasInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,850,793
public String upload_file1(String group_name, byte[] file_buff, String file_ext_name, NameValuePair[] meta_list) throws IOException, MyException { String parts[] = this.upload_file(group_name, file_buff, file_ext_name, meta_list); if (parts != null) { return parts[0] + SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR + parts[1]; } else { return null; } }
String function(String group_name, byte[] file_buff, String file_ext_name, NameValuePair[] meta_list) throws IOException, MyException { String parts[] = this.upload_file(group_name, file_buff, file_ext_name, meta_list); if (parts != null) { return parts[0] + SPLIT_GROUP_NAME_AND_FILENAME_SEPERATOR + parts[1]; } else { return null; } }
/** * upload file to storage server (by file buff) * * @param group_name the group name to upload file to, can be empty * @param file_buff file content/buff * @param file_ext_name file ext name, do not include dot(.) * @param meta_list meta info array * @return file id(including group name and filename) if success, <br> * return null if fail */
upload file to storage server (by file buff)
upload_file1
{ "repo_name": "brucevsked/vskeddemolist", "path": "vskeddemos/mavenproject/fastdfsclientdemo/src/main/java/org/csource/fastdfs/StorageClient1.java", "license": "mit", "size": 27070 }
[ "java.io.IOException", "org.csource.common.MyException", "org.csource.common.NameValuePair" ]
import java.io.IOException; import org.csource.common.MyException; import org.csource.common.NameValuePair;
import java.io.*; import org.csource.common.*;
[ "java.io", "org.csource.common" ]
java.io; org.csource.common;
2,904,393
private static String getJsonString(String folderPath, ReportGenerator generator) { String path = null; // First get the JSON file path File folder = new File(folderPath); if (folder.isDirectory()) { File[] files = folder.listFiles(); int index = 0; boolean found = false; while (index < files.length && !found) { File file = files[index]; if (file.isFile()) { path = file.getPath(); found = true; } index++; } } // Get the file content if (path != null) { return generator.readFile(path); } return ""; }
static String function(String folderPath, ReportGenerator generator) { String path = null; File folder = new File(folderPath); if (folder.isDirectory()) { File[] files = folder.listFiles(); int index = 0; boolean found = false; while (index < files.length && !found) { File file = files[index]; if (file.isFile()) { path = file.getPath(); found = true; } index++; } } if (path != null) { return generator.readFile(path); } return ""; }
/** * Get the JSON string into the file inside the folderPath. * * @param folderPath the folder path * @return the JSON string */
Get the JSON string into the file inside the folderPath
getJsonString
{ "repo_name": "EasyinnovaSL/DPFManager", "path": "src/main/java/dpfmanager/shell/modules/report/util/ReportJson.java", "license": "gpl-3.0", "size": 4474 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,218,751
@SmallTest @Feature({"Cronet"}) public void testRedirectAsync() throws Exception { // Start the request and wait to see the redirect. TestUrlRequestCallback callback = new TestUrlRequestCallback(); callback.setAutoAdvance(false); UrlRequest.Builder builder = new UrlRequest.Builder(NativeTestServer.getRedirectURL(), callback, callback.getExecutor(), mTestFramework.mCronetEngine); UrlRequest urlRequest = builder.build(); urlRequest.start(); callback.waitForNextStep(); // Check the redirect. assertEquals(ResponseStep.ON_RECEIVED_REDIRECT, callback.mResponseStep); assertEquals(1, callback.mRedirectResponseInfoList.size()); checkResponseInfo(callback.mRedirectResponseInfoList.get(0), NativeTestServer.getRedirectURL(), 302, "Found"); assertEquals(1, callback.mRedirectResponseInfoList.get(0).getUrlChain().size()); assertEquals(NativeTestServer.getSuccessURL(), callback.mRedirectUrlList.get(0)); checkResponseInfoHeader( callback.mRedirectResponseInfoList.get(0), "redirect-header", "header-value"); UrlResponseInfo expected = createUrlResponseInfo(new String[] {NativeTestServer.getRedirectURL()}, "Found", 302, 74, "Location", "/success.txt", "redirect-header", "header-value"); assertResponseEquals(expected, callback.mRedirectResponseInfoList.get(0)); // Wait for an unrelated request to finish. The request should not // advance until followRedirect is invoked. testSimpleGet(); assertEquals(ResponseStep.ON_RECEIVED_REDIRECT, callback.mResponseStep); assertEquals(1, callback.mRedirectResponseInfoList.size()); // Follow the redirect and wait for the next set of headers. urlRequest.followRedirect(); callback.waitForNextStep(); assertEquals(ResponseStep.ON_RESPONSE_STARTED, callback.mResponseStep); assertEquals(1, callback.mRedirectResponseInfoList.size()); assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); checkResponseInfo(callback.mResponseInfo, NativeTestServer.getSuccessURL(), 200, "OK"); assertEquals(2, callback.mResponseInfo.getUrlChain().size()); assertEquals( NativeTestServer.getRedirectURL(), callback.mResponseInfo.getUrlChain().get(0)); assertEquals(NativeTestServer.getSuccessURL(), callback.mResponseInfo.getUrlChain().get(1)); // Wait for an unrelated request to finish. The request should not // advance until read is invoked. testSimpleGet(); assertEquals(ResponseStep.ON_RESPONSE_STARTED, callback.mResponseStep); // One read should get all the characters, but best not to depend on // how much is actually read from the socket at once. while (!callback.isDone()) { callback.startNextRead(urlRequest); callback.waitForNextStep(); String response = callback.mResponseAsString; ResponseStep step = callback.mResponseStep; if (!callback.isDone()) { assertEquals(ResponseStep.ON_READ_COMPLETED, step); } // Should not receive any messages while waiting for another get, // as the next read has not been started. testSimpleGet(); assertEquals(response, callback.mResponseAsString); assertEquals(step, callback.mResponseStep); } assertEquals(ResponseStep.ON_SUCCEEDED, callback.mResponseStep); assertEquals(NativeTestServer.SUCCESS_BODY, callback.mResponseAsString); UrlResponseInfo urlResponseInfo = createUrlResponseInfo( new String[] {NativeTestServer.getRedirectURL(), NativeTestServer.getSuccessURL()}, "OK", 200, 260, "Content-Type", "text/plain", "Access-Control-Allow-Origin", "*", "header-name", "header-value", "multi-header-name", "header-value1", "multi-header-name", "header-value2"); assertResponseEquals(urlResponseInfo, callback.mResponseInfo); // Make sure there are no other pending messages, which would trigger // asserts in TestUrlRequestCallback. testSimpleGet(); }
@Feature({STR}) void function() throws Exception { TestUrlRequestCallback callback = new TestUrlRequestCallback(); callback.setAutoAdvance(false); UrlRequest.Builder builder = new UrlRequest.Builder(NativeTestServer.getRedirectURL(), callback, callback.getExecutor(), mTestFramework.mCronetEngine); UrlRequest urlRequest = builder.build(); urlRequest.start(); callback.waitForNextStep(); assertEquals(ResponseStep.ON_RECEIVED_REDIRECT, callback.mResponseStep); assertEquals(1, callback.mRedirectResponseInfoList.size()); checkResponseInfo(callback.mRedirectResponseInfoList.get(0), NativeTestServer.getRedirectURL(), 302, "Found"); assertEquals(1, callback.mRedirectResponseInfoList.get(0).getUrlChain().size()); assertEquals(NativeTestServer.getSuccessURL(), callback.mRedirectUrlList.get(0)); checkResponseInfoHeader( callback.mRedirectResponseInfoList.get(0), STR, STR); UrlResponseInfo expected = createUrlResponseInfo(new String[] {NativeTestServer.getRedirectURL()}, "Found", 302, 74, STR, STR, STR, STR); assertResponseEquals(expected, callback.mRedirectResponseInfoList.get(0)); testSimpleGet(); assertEquals(ResponseStep.ON_RECEIVED_REDIRECT, callback.mResponseStep); assertEquals(1, callback.mRedirectResponseInfoList.size()); urlRequest.followRedirect(); callback.waitForNextStep(); assertEquals(ResponseStep.ON_RESPONSE_STARTED, callback.mResponseStep); assertEquals(1, callback.mRedirectResponseInfoList.size()); assertEquals(200, callback.mResponseInfo.getHttpStatusCode()); checkResponseInfo(callback.mResponseInfo, NativeTestServer.getSuccessURL(), 200, "OK"); assertEquals(2, callback.mResponseInfo.getUrlChain().size()); assertEquals( NativeTestServer.getRedirectURL(), callback.mResponseInfo.getUrlChain().get(0)); assertEquals(NativeTestServer.getSuccessURL(), callback.mResponseInfo.getUrlChain().get(1)); testSimpleGet(); assertEquals(ResponseStep.ON_RESPONSE_STARTED, callback.mResponseStep); while (!callback.isDone()) { callback.startNextRead(urlRequest); callback.waitForNextStep(); String response = callback.mResponseAsString; ResponseStep step = callback.mResponseStep; if (!callback.isDone()) { assertEquals(ResponseStep.ON_READ_COMPLETED, step); } testSimpleGet(); assertEquals(response, callback.mResponseAsString); assertEquals(step, callback.mResponseStep); } assertEquals(ResponseStep.ON_SUCCEEDED, callback.mResponseStep); assertEquals(NativeTestServer.SUCCESS_BODY, callback.mResponseAsString); UrlResponseInfo urlResponseInfo = createUrlResponseInfo( new String[] {NativeTestServer.getRedirectURL(), NativeTestServer.getSuccessURL()}, "OK", 200, 260, STR, STR, STR, "*", STR, STR, STR, STR, STR, STR); assertResponseEquals(urlResponseInfo, callback.mResponseInfo); testSimpleGet(); }
/** * Tests a redirect by running it step-by-step. Also tests that delaying a * request works as expected. To make sure there are no unexpected pending * messages, does a GET between UrlRequest.Callback callbacks. */
Tests a redirect by running it step-by-step. Also tests that delaying a request works as expected. To make sure there are no unexpected pending messages, does a GET between UrlRequest.Callback callbacks
testRedirectAsync
{ "repo_name": "ds-hwang/chromium-crosswalk", "path": "components/cronet/android/test/javatests/src/org/chromium/net/CronetUrlRequestTest.java", "license": "bsd-3-clause", "size": 79493 }
[ "org.chromium.base.test.util.Feature", "org.chromium.net.TestUrlRequestCallback" ]
import org.chromium.base.test.util.Feature; import org.chromium.net.TestUrlRequestCallback;
import org.chromium.base.test.util.*; import org.chromium.net.*;
[ "org.chromium.base", "org.chromium.net" ]
org.chromium.base; org.chromium.net;
1,646,666
public OffsetDateTime startedAt() { return this.startedAt; }
OffsetDateTime function() { return this.startedAt; }
/** * Get the startedAt property: The time when the command started. * * @return the startedAt value. */
Get the startedAt property: The time when the command started
startedAt
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/fluent/models/CommandResultProperties.java", "license": "mit", "size": 2845 }
[ "java.time.OffsetDateTime" ]
import java.time.OffsetDateTime;
import java.time.*;
[ "java.time" ]
java.time;
2,085,711
CompletableFuture<OperatorBackPressureStatsResponse> requestOperatorBackPressureStats( JobVertexID jobVertexId);
CompletableFuture<OperatorBackPressureStatsResponse> requestOperatorBackPressureStats( JobVertexID jobVertexId);
/** * Requests the statistics on operator back pressure. * * @param jobVertexId JobVertex for which the stats are requested. * @return A Future to the {@link OperatorBackPressureStatsResponse}. */
Requests the statistics on operator back pressure
requestOperatorBackPressureStats
{ "repo_name": "aljoscha/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMasterGateway.java", "license": "apache-2.0", "size": 12902 }
[ "java.util.concurrent.CompletableFuture", "org.apache.flink.runtime.jobgraph.JobVertexID", "org.apache.flink.runtime.rest.handler.legacy.backpressure.OperatorBackPressureStatsResponse" ]
import java.util.concurrent.CompletableFuture; import org.apache.flink.runtime.jobgraph.JobVertexID; import org.apache.flink.runtime.rest.handler.legacy.backpressure.OperatorBackPressureStatsResponse;
import java.util.concurrent.*; import org.apache.flink.runtime.jobgraph.*; import org.apache.flink.runtime.rest.handler.legacy.backpressure.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
564,877
private void removePendingAcks(PositionImpl position) { Consumer ackOwnedConsumer = null; if (pendingAcks.get(position.getLedgerId(), position.getEntryId()) == null) { for (Consumer consumer : subscription.getConsumers()) { if (!consumer.equals(this) && consumer.getPendingAcks().containsKey(position.getLedgerId(), position.getEntryId())) { ackOwnedConsumer = consumer; break; } } } else { ackOwnedConsumer = this; } // remove pending message from appropriate consumer and unblock unAckMsg-flow if requires LongPair ackedPosition = ackOwnedConsumer != null ? ackOwnedConsumer.getPendingAcks().get(position.getLedgerId(), position.getEntryId()) : null; if (ackedPosition != null) { if (!ackOwnedConsumer.getPendingAcks().remove(position.getLedgerId(), position.getEntryId())) { // Message was already removed by the other consumer return; } if (log.isDebugEnabled()) { log.debug("[{}-{}] consumer {} received ack {}", topicName, subscription, consumerId, position); } // unblock consumer-throttling when limit check is disabled or receives half of maxUnackedMessages => // consumer can start again consuming messages int unAckedMsgs = UNACKED_MESSAGES_UPDATER.get(ackOwnedConsumer); if ((((unAckedMsgs <= getMaxUnackedMessages() / 2) && ackOwnedConsumer.blockedConsumerOnUnackedMsgs) && ackOwnedConsumer.shouldBlockConsumerOnUnackMsgs()) || !shouldBlockConsumerOnUnackMsgs()) { ackOwnedConsumer.blockedConsumerOnUnackedMsgs = false; flowConsumerBlockedPermits(ackOwnedConsumer); } } }
void function(PositionImpl position) { Consumer ackOwnedConsumer = null; if (pendingAcks.get(position.getLedgerId(), position.getEntryId()) == null) { for (Consumer consumer : subscription.getConsumers()) { if (!consumer.equals(this) && consumer.getPendingAcks().containsKey(position.getLedgerId(), position.getEntryId())) { ackOwnedConsumer = consumer; break; } } } else { ackOwnedConsumer = this; } LongPair ackedPosition = ackOwnedConsumer != null ? ackOwnedConsumer.getPendingAcks().get(position.getLedgerId(), position.getEntryId()) : null; if (ackedPosition != null) { if (!ackOwnedConsumer.getPendingAcks().remove(position.getLedgerId(), position.getEntryId())) { return; } if (log.isDebugEnabled()) { log.debug(STR, topicName, subscription, consumerId, position); } int unAckedMsgs = UNACKED_MESSAGES_UPDATER.get(ackOwnedConsumer); if ((((unAckedMsgs <= getMaxUnackedMessages() / 2) && ackOwnedConsumer.blockedConsumerOnUnackedMsgs) && ackOwnedConsumer.shouldBlockConsumerOnUnackMsgs()) !shouldBlockConsumerOnUnackMsgs()) { ackOwnedConsumer.blockedConsumerOnUnackedMsgs = false; flowConsumerBlockedPermits(ackOwnedConsumer); } } }
/** * first try to remove ack-position from the current_consumer's pendingAcks. * if ack-message doesn't present into current_consumer's pendingAcks * a. try to remove from other connected subscribed consumers (It happens when client * tries to acknowledge message through different consumer under the same subscription) * * * @param position */
first try to remove ack-position from the current_consumer's pendingAcks. if ack-message doesn't present into current_consumer's pendingAcks a. try to remove from other connected subscribed consumers (It happens when client tries to acknowledge message through different consumer under the same subscription)
removePendingAcks
{ "repo_name": "massakam/pulsar", "path": "pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java", "license": "apache-2.0", "size": 45451 }
[ "org.apache.bookkeeper.mledger.impl.PositionImpl", "org.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap" ]
import org.apache.bookkeeper.mledger.impl.PositionImpl; import org.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap;
import org.apache.bookkeeper.mledger.impl.*; import org.apache.pulsar.common.util.collections.*;
[ "org.apache.bookkeeper", "org.apache.pulsar" ]
org.apache.bookkeeper; org.apache.pulsar;
73,289
@Test(expected=IOException.class) public void testParseQueue() throws IOException { CapacityScheduler cs = new CapacityScheduler(); cs.setConf(new YarnConfiguration()); CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration(); setupQueueConfiguration(conf); conf.setQueues(CapacitySchedulerConfiguration.ROOT + ".a.a1", new String[] {"b1"} ); conf.setCapacity(CapacitySchedulerConfiguration.ROOT + ".a.a1.b1", 100.0f); conf.setUserLimitFactor(CapacitySchedulerConfiguration.ROOT + ".a.a1.b1", 100.0f); cs.reinitialize(conf, new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(conf), new NMTokenSecretManagerInRM(conf), new ClientToAMTokenSecretManagerInRM(), null)); }
@Test(expected=IOException.class) void function() throws IOException { CapacityScheduler cs = new CapacityScheduler(); cs.setConf(new YarnConfiguration()); CapacitySchedulerConfiguration conf = new CapacitySchedulerConfiguration(); setupQueueConfiguration(conf); conf.setQueues(CapacitySchedulerConfiguration.ROOT + ".a.a1", new String[] {"b1"} ); conf.setCapacity(CapacitySchedulerConfiguration.ROOT + STR, 100.0f); conf.setUserLimitFactor(CapacitySchedulerConfiguration.ROOT + STR, 100.0f); cs.reinitialize(conf, new RMContextImpl(null, null, null, null, null, null, new RMContainerTokenSecretManager(conf), new NMTokenSecretManagerInRM(conf), new ClientToAMTokenSecretManagerInRM(), null)); }
/** Test that parseQueue throws an exception when two leaf queues have the * same name * @throws IOException */
Test that parseQueue throws an exception when two leaf queues have the same name
testParseQueue
{ "repo_name": "jonathangizmo/HadoopDistJ", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestCapacityScheduler.java", "license": "mit", "size": 71534 }
[ "java.io.IOException", "org.apache.hadoop.yarn.conf.YarnConfiguration", "org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl", "org.apache.hadoop.yarn.server.resourcemanager.security.ClientToAMTokenSecretManagerInRM", "org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM", "org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager", "org.junit.Test" ]
import java.io.IOException; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl; import org.apache.hadoop.yarn.server.resourcemanager.security.ClientToAMTokenSecretManagerInRM; import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM; import org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager; import org.junit.Test;
import java.io.*; import org.apache.hadoop.yarn.conf.*; import org.apache.hadoop.yarn.server.resourcemanager.*; import org.apache.hadoop.yarn.server.resourcemanager.security.*; import org.junit.*;
[ "java.io", "org.apache.hadoop", "org.junit" ]
java.io; org.apache.hadoop; org.junit;
2,107,087
public static java.util.Set extractManchesterTriageProtocolConfigurationSet(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.ManchesterTriageProtocolConfigVoCollection voCollection) { return extractManchesterTriageProtocolConfigurationSet(domainFactory, voCollection, null, new HashMap()); }
static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.ManchesterTriageProtocolConfigVoCollection voCollection) { return extractManchesterTriageProtocolConfigurationSet(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.emergency.configuration.domain.objects.ManchesterTriageProtocolConfiguration set from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.emergency.configuration.domain.objects.ManchesterTriageProtocolConfiguration set from the value object collection
extractManchesterTriageProtocolConfigurationSet
{ "repo_name": "FreudianNM/openMAXIMS", "path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/emergency/vo/domain/ManchesterTriageProtocolConfigVoAssembler.java", "license": "agpl-3.0", "size": 25144 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,744,907
public static int createPreSplitLoadTestTable(Configuration conf, TableDescriptor desc, ColumnFamilyDescriptor hcd) throws IOException { return createPreSplitLoadTestTable(conf, desc, hcd, DEFAULT_REGIONS_PER_SERVER); }
static int function(Configuration conf, TableDescriptor desc, ColumnFamilyDescriptor hcd) throws IOException { return createPreSplitLoadTestTable(conf, desc, hcd, DEFAULT_REGIONS_PER_SERVER); }
/** * Creates a pre-split table for load testing. If the table already exists, * logs a warning and continues. * @return the number of regions the table was split into */
Creates a pre-split table for load testing. If the table already exists, logs a warning and continues
createPreSplitLoadTestTable
{ "repo_name": "francisliu/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java", "license": "apache-2.0", "size": 169730 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hbase.client.ColumnFamilyDescriptor", "org.apache.hadoop.hbase.client.TableDescriptor" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.TableDescriptor;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.client.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,283,477
protected String getWebappDeploymentFile(String fileName, String hostName, String webappType) { String webappDeploymentDir; String webappFilepath = null; Map<String, WebApplicationsHolder> webApplicationsHolderMap = WebAppUtils.getAllWebappHolders(getConfigContext()); for (WebApplicationsHolder webApplicationsHolder : webApplicationsHolderMap.values()) { WebApplication webApplication = webApplicationsHolder.getAllWebapps().get(fileName); if (webApplication != null && webApplication.getHostName().equals(hostName)) { File webappFile = webApplicationsHolder.getAllWebapps().get(fileName).getWebappFile(); // if webapp deployed using CApp this give the actual webapp file // since its not inside repository/deployment/webapps directory if (webappFile.getAbsolutePath().contains("carbonapps")) { webappFilepath = webappFile.getAbsolutePath(); } else { if (WebappsConstants.JAGGERY_WEBAPP_FILTER_PROP.equalsIgnoreCase(webappType)) { webappDeploymentDir = WebappsConstants.JAGGERY_WEBAPP_REPO; webappFilepath = getAxisConfig().getRepository().getPath() + webappDeploymentDir + File.separator + fileName; } else { webappFilepath = getAxisConfig().getRepository().getPath() + WebAppUtils.getWebappDir(webappFile.getAbsolutePath()) + File.separator + fileName; } } break; } } return webappFilepath; }
String function(String fileName, String hostName, String webappType) { String webappDeploymentDir; String webappFilepath = null; Map<String, WebApplicationsHolder> webApplicationsHolderMap = WebAppUtils.getAllWebappHolders(getConfigContext()); for (WebApplicationsHolder webApplicationsHolder : webApplicationsHolderMap.values()) { WebApplication webApplication = webApplicationsHolder.getAllWebapps().get(fileName); if (webApplication != null && webApplication.getHostName().equals(hostName)) { File webappFile = webApplicationsHolder.getAllWebapps().get(fileName).getWebappFile(); if (webappFile.getAbsolutePath().contains(STR)) { webappFilepath = webappFile.getAbsolutePath(); } else { if (WebappsConstants.JAGGERY_WEBAPP_FILTER_PROP.equalsIgnoreCase(webappType)) { webappDeploymentDir = WebappsConstants.JAGGERY_WEBAPP_REPO; webappFilepath = getAxisConfig().getRepository().getPath() + webappDeploymentDir + File.separator + fileName; } else { webappFilepath = getAxisConfig().getRepository().getPath() + WebAppUtils.getWebappDir(webappFile.getAbsolutePath()) + File.separator + fileName; } } break; } } return webappFilepath; }
/** * Return the location of the actual webapp file * * @param fileName name of the webapp file * @param webappType type of the webapp * @return */
Return the location of the actual webapp file
getWebappDeploymentFile
{ "repo_name": "renweibo/carbon-deployment", "path": "components/webapp-mgt/org.wso2.carbon.webapp.mgt/src/main/java/org/wso2/carbon/webapp/mgt/WebappAdmin.java", "license": "apache-2.0", "size": 64586 }
[ "java.io.File", "java.util.Map", "org.wso2.carbon.webapp.mgt.utils.WebAppUtils" ]
import java.io.File; import java.util.Map; import org.wso2.carbon.webapp.mgt.utils.WebAppUtils;
import java.io.*; import java.util.*; import org.wso2.carbon.webapp.mgt.utils.*;
[ "java.io", "java.util", "org.wso2.carbon" ]
java.io; java.util; org.wso2.carbon;
2,331,385
@SuppressWarnings("unchecked") public J op() { final Condition condition = new Condition(null, " ( ", null, Op.RP); _conditions.add(condition); return (J)this; }
@SuppressWarnings(STR) J function() { final Condition condition = new Condition(null, STR, null, Op.RP); _conditions.add(condition); return (J)this; }
/** * Writes an open parenthesis into the search * @return this */
Writes an open parenthesis into the search
op
{ "repo_name": "wido/cloudstack", "path": "framework/db/src/main/java/com/cloud/utils/db/SearchBase.java", "license": "apache-2.0", "size": 18325 }
[ "com.cloud.utils.db.SearchCriteria" ]
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.*;
[ "com.cloud.utils" ]
com.cloud.utils;
2,618,916
public void setEnabled(int[] enabled) { this.level = PmiConstants.LEVEL_FINEGRAIN; this.enable = enabled; } /* * public void setEnabledSync (int[] enabledSync) * { * this.enableSync = enabledSync; * }
void function(int[] enabled) { this.level = PmiConstants.LEVEL_FINEGRAIN; this.enable = enabled; } /* * void functionSync (int[] enabledSync) * { * this.enableSync = enabledSync; * }
/** * Set statistics that needs to be enabled. * * @param enabled List of statistic ID that needs be enabled. * Only the statistics specified in this list will be enabled * and the statistics that are not specified in this list will be disabled.<br> * Use new int[MBeanLevelSpec.ALL_STATISTICS] to enable all the statistics and * new int[0] to disable all statistics. */
Set statistics that needs to be enabled
setEnabled
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.monitor/src/com/ibm/websphere/pmi/stat/MBeanLevelSpec.java", "license": "epl-1.0", "size": 5813 }
[ "com.ibm.websphere.pmi.PmiConstants" ]
import com.ibm.websphere.pmi.PmiConstants;
import com.ibm.websphere.pmi.*;
[ "com.ibm.websphere" ]
com.ibm.websphere;
998,961
@Nonnull public TermCollectionRequest top(final int value) { addTopOption(value); return this; }
TermCollectionRequest function(final int value) { addTopOption(value); return this; }
/** * Sets the top value for the request * * @param value the max number of items to return * @return the updated request */
Sets the top value for the request
top
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/termstore/requests/TermCollectionRequest.java", "license": "mit", "size": 5444 }
[ "com.microsoft.graph.termstore.requests.TermCollectionRequest" ]
import com.microsoft.graph.termstore.requests.TermCollectionRequest;
import com.microsoft.graph.termstore.requests.*;
[ "com.microsoft.graph" ]
com.microsoft.graph;
923,414
public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone, final Locale locale) { return cache.getDateInstance(style, timeZone, locale); } //-----------------------------------------------------------------------
static FastDateFormat function(final int style, final TimeZone timeZone, final Locale locale) { return cache.getDateInstance(style, timeZone, locale); }
/** * <p>Gets a date formatter instance using the specified style, time * zone and locale.</p> * * @param style date style: FULL, LONG, MEDIUM, or SHORT * @param timeZone optional time zone, overrides time zone of * formatted date * @param locale optional locale, overrides system locale * @return a localized standard date formatter * @throws IllegalArgumentException if the Locale has no date * pattern defined */
Gets a date formatter instance using the specified style, time zone and locale
getDateInstance
{ "repo_name": "ur0/hermes", "path": "TMessagesProj/src/main/java/org/hermes/android/time/FastDateFormat.java", "license": "gpl-2.0", "size": 22294 }
[ "java.util.Locale", "java.util.TimeZone" ]
import java.util.Locale; import java.util.TimeZone;
import java.util.*;
[ "java.util" ]
java.util;
496,008
private synchronized FSDataOutputStream createFile(String filename) throws IOException { return getFS().create(new Path(PathUtils.join(root, filename)), false); }
synchronized FSDataOutputStream function(String filename) throws IOException { return getFS().create(new Path(PathUtils.join(root, filename)), false); }
/** * Create a new file on HDFS * @param filename the file name * @return an output stream that you can use to write the new file * @throws IOException if the file cannot be created */
Create a new file on HDFS
createFile
{ "repo_name": "andrej-sajenko/georocket", "path": "georocket-server/src/main/java/io/georocket/storage/hdfs/HDFSStore.java", "license": "apache-2.0", "size": 4816 }
[ "io.georocket.util.PathUtils", "java.io.IOException", "org.apache.hadoop.fs.FSDataOutputStream", "org.apache.hadoop.fs.Path" ]
import io.georocket.util.PathUtils; import java.io.IOException; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.Path;
import io.georocket.util.*; import java.io.*; import org.apache.hadoop.fs.*;
[ "io.georocket.util", "java.io", "org.apache.hadoop" ]
io.georocket.util; java.io; org.apache.hadoop;
2,580,773
void writeDistributed( String path, DataSet<Tuple3<String, String, String>> metaDataTuples, FileSystem.WriteMode writeMode);
void writeDistributed( String path, DataSet<Tuple3<String, String, String>> metaDataTuples, FileSystem.WriteMode writeMode);
/** * Write the meta data tuples to the specified file. The tuples have the form * (element prefix, label, metadata). * * @param path path to the meta data file * @param metaDataTuples (element prefix (g,v,e), label, meta data) tuples * @param writeMode write mode, overwrite or not */
Write the meta data tuples to the specified file. The tuples have the form (element prefix, label, metadata)
writeDistributed
{ "repo_name": "galpha/gradoop", "path": "gradoop-flink/src/main/java/org/gradoop/flink/io/api/metadata/MetaDataSink.java", "license": "apache-2.0", "size": 2107 }
[ "org.apache.flink.api.java.DataSet", "org.apache.flink.api.java.tuple.Tuple3", "org.apache.flink.core.fs.FileSystem" ]
import org.apache.flink.api.java.DataSet; import org.apache.flink.api.java.tuple.Tuple3; import org.apache.flink.core.fs.FileSystem;
import org.apache.flink.api.java.*; import org.apache.flink.api.java.tuple.*; import org.apache.flink.core.fs.*;
[ "org.apache.flink" ]
org.apache.flink;
586,726
public void loadArgs(final int arg, final int count) { int index = getArgIndex(arg); for (int i = 0; i < count; ++i) { Type t = argumentTypes[arg + i]; loadInsn(t, index); index += t.getSize(); } }
void function(final int arg, final int count) { int index = getArgIndex(arg); for (int i = 0; i < count; ++i) { Type t = argumentTypes[arg + i]; loadInsn(t, index); index += t.getSize(); } }
/** * Generates the instructions to load the given method arguments on the * stack. * * @param arg * the index of the first method argument to be loaded. * @param count * the number of method arguments to be loaded. */
Generates the instructions to load the given method arguments on the stack
loadArgs
{ "repo_name": "llbit/ow2-asm", "path": "src/org/objectweb/asm/commons/GeneratorAdapter.java", "license": "bsd-3-clause", "size": 50594 }
[ "org.objectweb.asm.Type" ]
import org.objectweb.asm.Type;
import org.objectweb.asm.*;
[ "org.objectweb.asm" ]
org.objectweb.asm;
929,262
public Map<String, String> getDescriptionFields() { return descriptionFields; }
Map<String, String> function() { return descriptionFields; }
/** * Gets the description fields. * * @return the description fields */
Gets the description fields
getDescriptionFields
{ "repo_name": "Hack23/cia", "path": "service.external.esv/src/main/java/com/hack23/cia/service/external/esv/api/GovernmentBodyAnnualOutcomeSummary.java", "license": "apache-2.0", "size": 4100 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,748,682
@Test public void testPureA01_Employee_MethodOverrideClassRolesAllowed_DenyAccessClassRole() throws Exception { Log.info(logClass, getName().getMethodName(), "**Entering " + getName().getMethodName()); String queryString = "/SimpleServlet?testInstance=ejb01&testMethod=employee"; String response = generateResponseFromServlet(queryString, Constants.MANAGER_USER, Constants.MANAGER_PWD); verifyExceptionWithUserAndRole(response, MessageConstants.EJB_ACCESS_EXCEPTION, MessageConstants.JACC_AUTH_DENIED_USER_NOT_GRANTED_REQUIRED_ROLE, Constants.MANAGER_USER, Constants.EMPLOYEE_METHOD); Log.info(logClass, getName().getMethodName(), "**Exiting " + getName().getMethodName()); }
void function() throws Exception { Log.info(logClass, getName().getMethodName(), STR + getName().getMethodName()); String queryString = STR; String response = generateResponseFromServlet(queryString, Constants.MANAGER_USER, Constants.MANAGER_PWD); verifyExceptionWithUserAndRole(response, MessageConstants.EJB_ACCESS_EXCEPTION, MessageConstants.JACC_AUTH_DENIED_USER_NOT_GRANTED_REQUIRED_ROLE, Constants.MANAGER_USER, Constants.EMPLOYEE_METHOD); Log.info(logClass, getName().getMethodName(), STR + getName().getMethodName()); }
/** * Verify the following: * <OL> * <LI> Attempt to access an EJB method injected into a servlet. The RolesAllowed * <LI> annotation at method level (Employee) overrides class level (Manager) * <LI> This test covers invoking the EJB method employee() with no parameters. * </OL> * <P> Expected Results: * <OL> * <LI> Authorization failed for Manager role. * <LI> * </OL> */
Verify the following: Attempt to access an EJB method injected into a servlet. The RolesAllowed annotation at method level (Employee) overrides class level (Manager) This test covers invoking the EJB method employee() with no parameters. Expected Results: Authorization failed for Manager role.
testPureA01_Employee_MethodOverrideClassRolesAllowed_DenyAccessClassRole
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.ejbcontainer.security.jacc_fat.2/fat/src/com/ibm/ws/ejbcontainer/security/jacc_fat/PureAnnAppBndXMLBindingsTest.java", "license": "epl-1.0", "size": 22994 }
[ "com.ibm.websphere.simplicity.log.Log" ]
import com.ibm.websphere.simplicity.log.Log;
import com.ibm.websphere.simplicity.log.*;
[ "com.ibm.websphere" ]
com.ibm.websphere;
2,194,887
public void encode(Handle[] v, int offset, int arrayNullability, int expectedLength) { if (v == null) { encodeNullPointer(offset, BindingsHelper.isArrayNullable(arrayNullability)); return; } Encoder e = encoderForArray( BindingsHelper.SERIALIZED_HANDLE_SIZE, v.length, offset, expectedLength); for (int i = 0; i < v.length; ++i) { e.encode(v[i], DataHeader.HEADER_SIZE + BindingsHelper.SERIALIZED_HANDLE_SIZE * i, BindingsHelper.isElementNullable(arrayNullability)); } }
void function(Handle[] v, int offset, int arrayNullability, int expectedLength) { if (v == null) { encodeNullPointer(offset, BindingsHelper.isArrayNullable(arrayNullability)); return; } Encoder e = encoderForArray( BindingsHelper.SERIALIZED_HANDLE_SIZE, v.length, offset, expectedLength); for (int i = 0; i < v.length; ++i) { e.encode(v[i], DataHeader.HEADER_SIZE + BindingsHelper.SERIALIZED_HANDLE_SIZE * i, BindingsHelper.isElementNullable(arrayNullability)); } }
/** * Encodes an array of {@link Handle}. */
Encodes an array of <code>Handle</code>
encode
{ "repo_name": "junhuac/MQUIC", "path": "src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java", "license": "mit", "size": 19957 }
[ "org.chromium.mojo.system.Handle" ]
import org.chromium.mojo.system.Handle;
import org.chromium.mojo.system.*;
[ "org.chromium.mojo" ]
org.chromium.mojo;
27,757
protected static Ptg calcImSub( Ptg[] operands ) { if( operands.length < 2 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "IMSUB" ); String complexString1 = StringTool.allTrim( operands[0].getString() ); String complexString2 = StringTool.allTrim( operands[1].getString() ); Complex c1; Complex c2; try { c1 = imParseComplexNumber( complexString1 ); c2 = imParseComplexNumber( complexString2 ); } catch( Exception e ) { return new PtgErr( PtgErr.ERROR_NUM ); } // basically, linear binomial subtraction: // (a + bi) - (c + di)= (a-c) + (b-d)i double a = c1.real - c2.real; double b = c1.imaginary - c2.imaginary; String imSub; if( b > 0 ) { imSub = imGetExcelStr( a ) + "+" + imGetExcelStr( b ) + c1.suffix; // should have the same suffix } else { imSub = imGetExcelStr( a ) + imGetExcelStr( b ) + c1.suffix; } PtgStr pstr = new PtgStr( imSub ); log.debug( "Result from IMSUB= " + pstr.getString() ); return pstr; }
static Ptg function( Ptg[] operands ) { if( operands.length < 2 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "IMSUB" ); String complexString1 = StringTool.allTrim( operands[0].getString() ); String complexString2 = StringTool.allTrim( operands[1].getString() ); Complex c1; Complex c2; try { c1 = imParseComplexNumber( complexString1 ); c2 = imParseComplexNumber( complexString2 ); } catch( Exception e ) { return new PtgErr( PtgErr.ERROR_NUM ); } double a = c1.real - c2.real; double b = c1.imaginary - c2.imaginary; String imSub; if( b > 0 ) { imSub = imGetExcelStr( a ) + "+" + imGetExcelStr( b ) + c1.suffix; } else { imSub = imGetExcelStr( a ) + imGetExcelStr( b ) + c1.suffix; } PtgStr pstr = new PtgStr( imSub ); log.debug( STR + pstr.getString() ); return pstr; }
/** * IMSUB * Returns the difference of two complex numbers */
IMSUB Returns the difference of two complex numbers
calcImSub
{ "repo_name": "Maxels88/openxls", "path": "src/main/java/org/openxls/formats/XLS/formulas/EngineeringCalculator.java", "license": "gpl-3.0", "size": 74340 }
[ "org.openxls.toolkit.StringTool" ]
import org.openxls.toolkit.StringTool;
import org.openxls.toolkit.*;
[ "org.openxls.toolkit" ]
org.openxls.toolkit;
1,573,839
public List<String> getCategory() { return category; }
List<String> function() { return category; }
/** * A hierarchical array of the categories to which this transaction belongs. See [Categories](https://plaid.com/docs/#category-overview). * @return category **/
A hierarchical array of the categories to which this transaction belongs. See [Categories](HREF)
getCategory
{ "repo_name": "plaid/plaid-java", "path": "src/main/java/com/plaid/client/model/TransactionStream.java", "license": "mit", "size": 11276 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,839,320
public void advanceWatermark(Instant time) { if (time.isAfter(latestTimestamp)) { latestTimestamp = time; } }
void function(Instant time) { if (time.isAfter(latestTimestamp)) { latestTimestamp = time; } }
/** * Advances the watermark to the provided time, provided said time is after the current * watermark. If the provided time is before the latest, this function no-ops. * * @param time The time to advance the watermark to */
Advances the watermark to the provided time, provided said time is after the current watermark. If the provided time is before the latest, this function no-ops
advanceWatermark
{ "repo_name": "lukecwik/incubator-beam", "path": "sdks/java/io/rabbitmq/src/main/java/org/apache/beam/sdk/io/rabbitmq/RabbitMqIO.java", "license": "apache-2.0", "size": 27073 }
[ "org.joda.time.Instant" ]
import org.joda.time.Instant;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
1,028,871
public void testTimedInvokeAll2() throws InterruptedException { final ExecutorService e = new DirectExecutorService(); try (PoolCleaner cleaner = cleaner(e)) { List<Future<String>> r = e.invokeAll(new ArrayList<Callable<String>>(), MEDIUM_DELAY_MS, MILLISECONDS); assertTrue(r.isEmpty()); } }
void function() throws InterruptedException { final ExecutorService e = new DirectExecutorService(); try (PoolCleaner cleaner = cleaner(e)) { List<Future<String>> r = e.invokeAll(new ArrayList<Callable<String>>(), MEDIUM_DELAY_MS, MILLISECONDS); assertTrue(r.isEmpty()); } }
/** * timed invokeAll(empty collection) returns empty collection */
timed invokeAll(empty collection) returns empty collection
testTimedInvokeAll2
{ "repo_name": "YouDiSN/OpenJDK-Research", "path": "jdk9/jdk/test/java/util/concurrent/tck/AbstractExecutorServiceTest.java", "license": "gpl-2.0", "size": 23173 }
[ "java.util.ArrayList", "java.util.List", "java.util.concurrent.Callable", "java.util.concurrent.ExecutorService", "java.util.concurrent.Future" ]
import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
806,434
public void read(DataInputStream in) throws IOException { if (in.readInt() != FILE_VERSION) { } // // Read the list of names // String[] names = new String[in.readShort()]; for (int i = 0; i < names.length; i++) { names[i] = in.readUTF(); } // // Read the entities // int num = in.readShort(); for (int i = 0; i < num; i++) { short nameId = in.readShort(); int type = in.readByte(); String name = in.readUTF(); defEntity(names[nameId], type | GENERAL, name); } // Read the elements // num = in.readShort(); for (int i = 0; i < num; i++) { short nameId = in.readShort(); int type = in.readByte(); byte flags = in.readByte(); ContentModel m = readContentModel(in, names); String[] exclusions = readNameArray(in, names); String[] inclusions = readNameArray(in, names); AttributeList atts = readAttributeList(in, names); defElement(names[nameId], type, ((flags & 0x01) != 0), ((flags & 0x02) != 0), m, exclusions, inclusions, atts); } }
void function(DataInputStream in) throws IOException { if (in.readInt() != FILE_VERSION) { } for (int i = 0; i < names.length; i++) { names[i] = in.readUTF(); } for (int i = 0; i < num; i++) { short nameId = in.readShort(); int type = in.readByte(); String name = in.readUTF(); defEntity(names[nameId], type GENERAL, name); } for (int i = 0; i < num; i++) { short nameId = in.readShort(); int type = in.readByte(); byte flags = in.readByte(); ContentModel m = readContentModel(in, names); String[] exclusions = readNameArray(in, names); String[] inclusions = readNameArray(in, names); AttributeList atts = readAttributeList(in, names); defElement(names[nameId], type, ((flags & 0x01) != 0), ((flags & 0x02) != 0), m, exclusions, inclusions, atts); } }
/** * Recreates a DTD from an archived format. * @param in the <code>DataInputStream</code> to read from */
Recreates a DTD from an archived format
read
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java", "license": "mit", "size": 15941 }
[ "java.io.DataInputStream", "java.io.IOException" ]
import java.io.DataInputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,581,929
@Action public void quickNewEntry() { // get the clipbaord Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); try { // retrieve clipboard content Transferable content = clipboard.getContents(null); // if we have any content, create new entry... if (content != null) { // first, copy clipboard to string String text = content.getTransferData(DataFlavor.stringFlavor).toString().trim(); // identify new-line/line-separator-char String sepval = (text.contains("\r\n")) ? "\r\n" : "\n"; // if we have any leading new lines, remove these // while (text.startsWith(System.lineSeparator())) { // text = text.substring(System.lineSeparator().length()); // } while (text.startsWith(sepval)) { text = text.substring(sepval.length()); } // add text as new entry data.addEntry("", text, null, null, "", null, Tools.getTimeStamp(), -1); // and titles might be out of date now as well... data.setTitlelistUpToDate(false); // tell about success Constants.zknlogger.log(Level.INFO, "Entry save finished."); // update the dislay... updateDisplay(); // tell about success Constants.zknlogger.log(Level.INFO, "Display updated."); // and create a backup... makeAutoBackup(); // tell about success Constants.zknlogger.log(Level.INFO, "Autobackup finished (if necessary)."); } } catch (IllegalStateException | IOException | UnsupportedFlavorException e) { Constants.zknlogger.log(Level.WARNING, e.getLocalizedMessage()); } }
void function() { Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); try { Transferable content = clipboard.getContents(null); if (content != null) { String text = content.getTransferData(DataFlavor.stringFlavor).toString().trim(); String sepval = (text.contains("\r\n")) ? "\r\n" : "\n"; while (text.startsWith(sepval)) { text = text.substring(sepval.length()); } data.addEntry(STRSTREntry save finished.STRDisplay updated.STRAutobackup finished (if necessary)."); } } catch (IllegalStateException IOException UnsupportedFlavorException e) { Constants.zknlogger.log(Level.WARNING, e.getLocalizedMessage()); } }
/** * This method adds the content of the clipboard as new entry. The new entry * is created automatically, where the clipboard content is used as entry * content. No edit-window will be opened. */
This method adds the content of the clipboard as new entry. The new entry is created automatically, where the clipboard content is used as entry content. No edit-window will be opened
quickNewEntry
{ "repo_name": "RalfBarkow/Zettelkasten", "path": "src/main/java/de/danielluedecke/zettelkasten/ZettelkastenView.java", "license": "gpl-3.0", "size": 749454 }
[ "de.danielluedecke.zettelkasten.util.Constants", "java.awt.Toolkit", "java.awt.datatransfer.Clipboard", "java.awt.datatransfer.DataFlavor", "java.awt.datatransfer.Transferable", "java.awt.datatransfer.UnsupportedFlavorException", "java.io.IOException", "java.util.logging.Level" ]
import de.danielluedecke.zettelkasten.util.Constants; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; import java.util.logging.Level;
import de.danielluedecke.zettelkasten.util.*; import java.awt.*; import java.awt.datatransfer.*; import java.io.*; import java.util.logging.*;
[ "de.danielluedecke.zettelkasten", "java.awt", "java.io", "java.util" ]
de.danielluedecke.zettelkasten; java.awt; java.io; java.util;
2,572,707
Todo findTodo(Long userId, Long CareerLevelId, String todoId);
Todo findTodo(Long userId, Long CareerLevelId, String todoId);
/** * Returns instance of Todo entity. * @param userId User id. * @param CareerLevelId Career level id. * @param todoId Title of finished todo. * @return Finished todo. */
Returns instance of Todo entity
findTodo
{ "repo_name": "Vodorohelios/career-levels", "path": "src/main/java/com/inthergroup/internship/services/TodoService.java", "license": "mit", "size": 3843 }
[ "com.inthergroup.internship.models.Todo" ]
import com.inthergroup.internship.models.Todo;
import com.inthergroup.internship.models.*;
[ "com.inthergroup.internship" ]
com.inthergroup.internship;
69,146
public static void validateAlphanumeric(String s, String name) throws ClientException { if (!ALPHANUMERIC_PATTERN.matcher(s).matches()) { throw new ClientException("ValidationError", MessageFormat.format("{0} must have only alphanumeric or underscore characters", name)); } }
static void function(String s, String name) throws ClientException { if (!ALPHANUMERIC_PATTERN.matcher(s).matches()) { throw new ClientException(STR, MessageFormat.format(STR, name)); } }
/** * Checks if the string uses only alphanumerical or underscore characters. * * @param s String to validate * @param name Name of the parameter * @throws ClientException */
Checks if the string uses only alphanumerical or underscore characters
validateAlphanumeric
{ "repo_name": "sismics/docs", "path": "docs-web-common/src/main/java/com/sismics/rest/util/ValidationUtil.java", "license": "gpl-2.0", "size": 7658 }
[ "com.sismics.rest.exception.ClientException", "java.text.MessageFormat" ]
import com.sismics.rest.exception.ClientException; import java.text.MessageFormat;
import com.sismics.rest.exception.*; import java.text.*;
[ "com.sismics.rest", "java.text" ]
com.sismics.rest; java.text;
2,805,371