method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public void setCategory(Category category) { this.category = category; }
void function(Category category) { this.category = category; }
/** * Sets the category. * @param category the category to set. */
Sets the category
setCategory
{ "repo_name": "OpenWIS/openwis", "path": "openwis-metadataportal/openwis-portal/src/main/java/org/openwis/metadataportal/model/metadata/Metadata.java", "license": "gpl-3.0", "size": 9234 }
[ "org.openwis.metadataportal.model.category.Category" ]
import org.openwis.metadataportal.model.category.Category;
import org.openwis.metadataportal.model.category.*;
[ "org.openwis.metadataportal" ]
org.openwis.metadataportal;
1,335,699
@Test public void testResolveRequestType() { final Map<String, String> expected = new HashMap<String, String>() {{ put("/economy/inflationandpriceindices/data", "data"); }}; for (String uri : expected.keySet()) { String requestType = URIUtil.resolveRequestType(uri); assertEquals(requestType, expected.get(uri)); } }
void function() { final Map<String, String> expected = new HashMap<String, String>() {{ put(STR, "data"); }}; for (String uri : expected.keySet()) { String requestType = URIUtil.resolveRequestType(uri); assertEquals(requestType, expected.get(uri)); } }
/** * Tests that the equest type is properly extracted form URLs, i.e * for uri "/economy/inflationandpriceindices/data" request type is "data" */
Tests that the equest type is properly extracted form URLs, i.e for uri "/economy/inflationandpriceindices/data" request type is "data"
testResolveRequestType
{ "repo_name": "ONSdigital/babbage", "path": "src/test/java/com/github/onsdigital/babbage/util/TestURIUtil.java", "license": "mit", "size": 3218 }
[ "java.util.HashMap", "java.util.Map", "org.junit.Assert" ]
import java.util.HashMap; import java.util.Map; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
2,080,450
@VisibleForTesting static void configureDataBlockEncoding(HTable table, Configuration conf) throws IOException { HTableDescriptor tableDescriptor = table.getTableDescriptor(); if (tableDescriptor == null) { // could happen with mock table instance return; } StringBuilder dataBlockEncodingConfigValue = new StringBuilder(); Collection<HColumnDescriptor> families = tableDescriptor.getFamilies(); int i = 0; for (HColumnDescriptor familyDescriptor : families) { if (i++ > 0) { dataBlockEncodingConfigValue.append('&'); } dataBlockEncodingConfigValue.append( URLEncoder.encode(familyDescriptor.getNameAsString(), "UTF-8")); dataBlockEncodingConfigValue.append('='); DataBlockEncoding encoding = familyDescriptor.getDataBlockEncoding(); if (encoding == null) { encoding = DataBlockEncoding.NONE; } dataBlockEncodingConfigValue.append(URLEncoder.encode(encoding.toString(), "UTF-8")); } conf.set(DATABLOCK_ENCODING_FAMILIES_CONF_KEY, dataBlockEncodingConfigValue.toString()); }
static void configureDataBlockEncoding(HTable table, Configuration conf) throws IOException { HTableDescriptor tableDescriptor = table.getTableDescriptor(); if (tableDescriptor == null) { return; } StringBuilder dataBlockEncodingConfigValue = new StringBuilder(); Collection<HColumnDescriptor> families = tableDescriptor.getFamilies(); int i = 0; for (HColumnDescriptor familyDescriptor : families) { if (i++ > 0) { dataBlockEncodingConfigValue.append('&'); } dataBlockEncodingConfigValue.append( URLEncoder.encode(familyDescriptor.getNameAsString(), "UTF-8")); dataBlockEncodingConfigValue.append('='); DataBlockEncoding encoding = familyDescriptor.getDataBlockEncoding(); if (encoding == null) { encoding = DataBlockEncoding.NONE; } dataBlockEncodingConfigValue.append(URLEncoder.encode(encoding.toString(), "UTF-8")); } conf.set(DATABLOCK_ENCODING_FAMILIES_CONF_KEY, dataBlockEncodingConfigValue.toString()); }
/** * Serialize column family to data block encoding map to configuration. * Invoked while configuring the MR job for incremental load. * * @param table to read the properties from * @param conf to persist serialized values into * @throws IOException * on failure to read column family descriptors */
Serialize column family to data block encoding map to configuration. Invoked while configuring the MR job for incremental load
configureDataBlockEncoding
{ "repo_name": "Jackygq1982/hbase_src", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java", "license": "apache-2.0", "size": 28411 }
[ "java.io.IOException", "java.net.URLEncoder", "java.util.Collection", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hbase.HColumnDescriptor", "org.apache.hadoop.hbase.HTableDescriptor", "org.apache.hadoop.hbase.client.HTable", "org.apache.hadoop.hbase.io.encoding.DataBlockEncoding" ]
import java.io.IOException; import java.net.URLEncoder; import java.util.Collection; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
import java.io.*; import java.net.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.io.encoding.*;
[ "java.io", "java.net", "java.util", "org.apache.hadoop" ]
java.io; java.net; java.util; org.apache.hadoop;
1,278,405
public BitSet getDoms() { return doms; }
BitSet function() { return doms; }
/** * Dominators of this node (exclude itself) */
Dominators of this node (exclude itself)
getDoms
{ "repo_name": "sigma-random/jadx", "path": "jadx-core/src/main/java/jadx/core/dex/nodes/BlockNode.java", "license": "apache-2.0", "size": 4463 }
[ "java.util.BitSet" ]
import java.util.BitSet;
import java.util.*;
[ "java.util" ]
java.util;
1,095,378
public void submit(View view) { String title = titleBox.getText().toString(); String body = bodyBox.getText().toString(); if (title.isEmpty() || body.isEmpty()) { Toast.makeText(this, R.string.missing_argument, Toast.LENGTH_SHORT).show(); } else { Intent returnIntent = new Intent(); returnIntent.putExtra("title", title); returnIntent.putExtra("body", body); // Check if the attachment was successfully created if (attachmentType != -1) { returnIntent.putExtra("attachment", attachmentSource.getAbsolutePath()); returnIntent.putExtra("attachmentType", attachmentType); } setResult(RESULT_OK, returnIntent); finish(); } }
void function(View view) { String title = titleBox.getText().toString(); String body = bodyBox.getText().toString(); if (title.isEmpty() body.isEmpty()) { Toast.makeText(this, R.string.missing_argument, Toast.LENGTH_SHORT).show(); } else { Intent returnIntent = new Intent(); returnIntent.putExtra("title", title); returnIntent.putExtra("body", body); if (attachmentType != -1) { returnIntent.putExtra(STR, attachmentSource.getAbsolutePath()); returnIntent.putExtra(STR, attachmentType); } setResult(RESULT_OK, returnIntent); finish(); } }
/** * Called once the submit button is pressed. * @param view the caller */
Called once the submit button is pressed
submit
{ "repo_name": "pj2/trail-app", "path": "src/main/uk/co/prenderj/trail/activity/AddCommentActivity.java", "license": "mit", "size": 5618 }
[ "android.content.Intent", "android.view.View", "android.widget.Toast" ]
import android.content.Intent; import android.view.View; import android.widget.Toast;
import android.content.*; import android.view.*; import android.widget.*;
[ "android.content", "android.view", "android.widget" ]
android.content; android.view; android.widget;
1,159,454
private String getScopedEntityReferenceName(final ScopedEntityReference reference) { final String moduleNameInSource = reference.getModuleNameInSource(); final String unqualifiedName = reference.getName().getUnqualifiedName(); if (moduleNameInSource.length() == 0) { return unqualifiedName; } else { return moduleNameInSource + '.' + unqualifiedName; } }
String function(final ScopedEntityReference reference) { final String moduleNameInSource = reference.getModuleNameInSource(); final String unqualifiedName = reference.getName().getUnqualifiedName(); if (moduleNameInSource.length() == 0) { return unqualifiedName; } else { return moduleNameInSource + '.' + unqualifiedName; } }
/** * Returns the appropriately qualified name for a scoped entity reference. * @param reference the reference whose name is to be obtained. * @return the appropriately qualified name for a scoped entity reference. */
Returns the appropriately qualified name for a scoped entity reference
getScopedEntityReferenceName
{ "repo_name": "levans/Open-Quark", "path": "src/CAL_Platform/src/org/openquark/cal/caldoc/CALDocToTextUtilities.java", "license": "bsd-3-clause", "size": 40030 }
[ "org.openquark.cal.compiler.CALDocComment" ]
import org.openquark.cal.compiler.CALDocComment;
import org.openquark.cal.compiler.*;
[ "org.openquark.cal" ]
org.openquark.cal;
1,187,772
private MainWindow createMainWindow(Stage stage, Stoppable mainApp) throws IOException{ // Sets stage FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("ui" + File.separator + "mainwindow.fxml")); stage.setTitle(version); stage.setScene(new Scene(loader.load(), INITIAL_WINDOW_WIDTH, INITIAL_WINDOW_HEIGHT)); stage.show(); // Create mainWindow MainWindow mainWindow = loader.getController(); mainWindow.setLogic(logic); mainWindow.setMainApp(mainApp); return mainWindow; }
MainWindow function(Stage stage, Stoppable mainApp) throws IOException{ FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("ui" + File.separator + STR)); stage.setTitle(version); stage.setScene(new Scene(loader.load(), INITIAL_WINDOW_WIDTH, INITIAL_WINDOW_HEIGHT)); stage.show(); MainWindow mainWindow = loader.getController(); mainWindow.setLogic(logic); mainWindow.setMainApp(mainApp); return mainWindow; }
/** * Creates a main window and initializing its logic and titles. */
Creates a main window and initializing its logic and titles
createMainWindow
{ "repo_name": "CS2103AUG2016-T10-C4/Main", "path": "src/ruby/keyboardwarrior/ui/Gui.java", "license": "mit", "size": 2063 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,491,364
protected Rectangle restoreInformationControlBounds() { if (fDialogSettings == null || !(fIsRestoringLocation || fIsRestoringSize)) return null; if (!(fInformationControl instanceof IInformationControlExtension3)) throw new UnsupportedOperationException(); boolean controlRestoresSize= ((IInformationControlExtension3)fInformationControl).restoresSize(); boolean controlRestoresLocation= ((IInformationControlExtension3)fInformationControl).restoresLocation(); Rectangle bounds= new Rectangle(-1, -1, -1, -1); if (fIsRestoringSize && controlRestoresSize) { try { bounds.width= fDialogSettings.getInt(STORE_SIZE_WIDTH); bounds.height= fDialogSettings.getInt(STORE_SIZE_HEIGHT); } catch (NumberFormatException ex) { bounds.width= -1; bounds.height= -1; } } if (fIsRestoringLocation && controlRestoresLocation) { try { bounds.x= fDialogSettings.getInt(STORE_LOCATION_X); bounds.y= fDialogSettings.getInt(STORE_LOCATION_Y); } catch (NumberFormatException ex) { bounds.x= -1; bounds.y= -1; } } // sanity check if (bounds.x == -1 && bounds.y == -1 && bounds.width == -1 && bounds.height == -1) return null; Rectangle maxBounds= null; if (fSubjectControl != null && !fSubjectControl.isDisposed()) maxBounds= fSubjectControl.getDisplay().getBounds(); else { // fallback Display display= Display.getCurrent(); if (display == null) display= Display.getDefault(); if (display != null && !display.isDisposed()) maxBounds= display.getBounds(); } if (bounds.width > -1 && bounds.height > -1) { if (maxBounds != null) { bounds.width= Math.min(bounds.width, maxBounds.width); bounds.height= Math.min(bounds.height, maxBounds.height); } // Enforce an absolute minimal size bounds.width= Math.max(bounds.width, 30); bounds.height= Math.max(bounds.height, 30); } if (bounds.x > -1 && bounds.y > -1 && maxBounds != null) { bounds.x= Math.max(bounds.x, maxBounds.x); bounds.y= Math.max(bounds.y, maxBounds.y); if (bounds .width > -1 && bounds.height > -1) { bounds.x= Math.min(bounds.x, maxBounds.width - bounds.width); bounds.y= Math.min(bounds.y, maxBounds.height - bounds.height); } } return bounds; }
Rectangle function() { if (fDialogSettings == null !(fIsRestoringLocation fIsRestoringSize)) return null; if (!(fInformationControl instanceof IInformationControlExtension3)) throw new UnsupportedOperationException(); boolean controlRestoresSize= ((IInformationControlExtension3)fInformationControl).restoresSize(); boolean controlRestoresLocation= ((IInformationControlExtension3)fInformationControl).restoresLocation(); Rectangle bounds= new Rectangle(-1, -1, -1, -1); if (fIsRestoringSize && controlRestoresSize) { try { bounds.width= fDialogSettings.getInt(STORE_SIZE_WIDTH); bounds.height= fDialogSettings.getInt(STORE_SIZE_HEIGHT); } catch (NumberFormatException ex) { bounds.width= -1; bounds.height= -1; } } if (fIsRestoringLocation && controlRestoresLocation) { try { bounds.x= fDialogSettings.getInt(STORE_LOCATION_X); bounds.y= fDialogSettings.getInt(STORE_LOCATION_Y); } catch (NumberFormatException ex) { bounds.x= -1; bounds.y= -1; } } if (bounds.x == -1 && bounds.y == -1 && bounds.width == -1 && bounds.height == -1) return null; Rectangle maxBounds= null; if (fSubjectControl != null && !fSubjectControl.isDisposed()) maxBounds= fSubjectControl.getDisplay().getBounds(); else { Display display= Display.getCurrent(); if (display == null) display= Display.getDefault(); if (display != null && !display.isDisposed()) maxBounds= display.getBounds(); } if (bounds.width > -1 && bounds.height > -1) { if (maxBounds != null) { bounds.width= Math.min(bounds.width, maxBounds.width); bounds.height= Math.min(bounds.height, maxBounds.height); } bounds.width= Math.max(bounds.width, 30); bounds.height= Math.max(bounds.height, 30); } if (bounds.x > -1 && bounds.y > -1 && maxBounds != null) { bounds.x= Math.max(bounds.x, maxBounds.x); bounds.y= Math.max(bounds.y, maxBounds.y); if (bounds .width > -1 && bounds.height > -1) { bounds.x= Math.min(bounds.x, maxBounds.width - bounds.width); bounds.y= Math.min(bounds.y, maxBounds.height - bounds.height); } } return bounds; }
/** * Restores the information control's bounds. * * @return the stored bounds * @since 3.0 */
Restores the information control's bounds
restoreInformationControlBounds
{ "repo_name": "brunyuriy/quick-fix-scout", "path": "org.eclipse.jface.text_3.8.1.v20120828-155502/src/org/eclipse/jface/text/AbstractInformationControlManager.java", "license": "mit", "size": 49927 }
[ "org.eclipse.swt.graphics.Rectangle", "org.eclipse.swt.widgets.Display" ]
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
453,177
final ArrayList<String> retval = new ArrayList<String>(); final String classPath = System.getProperty("java.class.path", "."); final String[] classPathElements = classPath.split(File.pathSeparator); for (final String element : classPathElements) { retval.addAll(getResources(element, pattern)); } return retval; }
final ArrayList<String> retval = new ArrayList<String>(); final String classPath = System.getProperty(STR, "."); final String[] classPathElements = classPath.split(File.pathSeparator); for (final String element : classPathElements) { retval.addAll(getResources(element, pattern)); } return retval; }
/** * for all elements of java.class.path get a Collection of resources Pattern * pattern = Pattern.compile(".*"); gets all resources * * @param pattern * the pattern to match * @return the resources in the order they are found */
for all elements of java.class.path get a Collection of resources Pattern pattern = Pattern.compile(".*"); gets all resources
getResources
{ "repo_name": "jalian-systems/marathonv5", "path": "marathon-java/marathon-java-driver/src/main/java/net/sourceforge/marathon/javadriver/FindResources.java", "license": "apache-2.0", "size": 5312 }
[ "java.io.File", "java.util.ArrayList" ]
import java.io.File; import java.util.ArrayList;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,879,079
@Test public void ttlDirectoryFreeReplay() throws Exception { CreateDirectoryContext directoryContext = CreateDirectoryContext .mergeFrom(CreateDirectoryPOptions.newBuilder().setRecursive(true)); mFileSystemMaster.createDirectory(NESTED_URI, directoryContext); long blockId = createFileWithSingleBlock(NESTED_FILE_URI); assertEquals(1, mBlockMaster.getBlockInfo(blockId).getLocations().size()); // Set ttl & operation. mFileSystemMaster.setAttribute(NESTED_URI, SetAttributeContext.mergeFrom( SetAttributePOptions.newBuilder().setCommonOptions(FileSystemOptions .commonDefaults(ServerConfiguration.global()).toBuilder().setTtl(0) .setTtlAction(alluxio.grpc.TtlAction.FREE)))); // Simulate restart. stopServices(); startServices(); Command heartbeat = mBlockMaster.workerHeartbeat(mWorkerId1, null, ImmutableMap.of("MEM", (long) Constants.KB), ImmutableList.of(blockId), ImmutableMap.of(), ImmutableMap.of(), mMetrics); // Verify the muted Free command on worker1. assertEquals(Command.newBuilder().setCommandType(CommandType.Nothing).build(), heartbeat); assertEquals(0, mBlockMaster.getBlockInfo(blockId).getLocations().size()); }
void function() throws Exception { CreateDirectoryContext directoryContext = CreateDirectoryContext .mergeFrom(CreateDirectoryPOptions.newBuilder().setRecursive(true)); mFileSystemMaster.createDirectory(NESTED_URI, directoryContext); long blockId = createFileWithSingleBlock(NESTED_FILE_URI); assertEquals(1, mBlockMaster.getBlockInfo(blockId).getLocations().size()); mFileSystemMaster.setAttribute(NESTED_URI, SetAttributeContext.mergeFrom( SetAttributePOptions.newBuilder().setCommonOptions(FileSystemOptions .commonDefaults(ServerConfiguration.global()).toBuilder().setTtl(0) .setTtlAction(alluxio.grpc.TtlAction.FREE)))); stopServices(); startServices(); Command heartbeat = mBlockMaster.workerHeartbeat(mWorkerId1, null, ImmutableMap.of("MEM", (long) Constants.KB), ImmutableList.of(blockId), ImmutableMap.of(), ImmutableMap.of(), mMetrics); assertEquals(Command.newBuilder().setCommandType(CommandType.Nothing).build(), heartbeat); assertEquals(0, mBlockMaster.getBlockInfo(blockId).getLocations().size()); }
/** * Tests that TTL free of a directory is not forgotten across restarts. */
Tests that TTL free of a directory is not forgotten across restarts
ttlDirectoryFreeReplay
{ "repo_name": "EvilMcJerkface/alluxio", "path": "core/server/master/src/test/java/alluxio/master/file/FileSystemMasterTest.java", "license": "apache-2.0", "size": 118855 }
[ "com.google.common.collect.ImmutableList", "com.google.common.collect.ImmutableMap", "org.junit.Assert" ]
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import org.junit.Assert;
import com.google.common.collect.*; import org.junit.*;
[ "com.google.common", "org.junit" ]
com.google.common; org.junit;
2,571,092
public void addHashed(@Nonnull K hashed) { int bucket = getBucket(hashed); xorIthBit(bucket); elementsAdded++; }
void function(@Nonnull K hashed) { int bucket = getBucket(hashed); xorIthBit(bucket); elementsAdded++; }
/** * Adds a hashed element to the sketch */
Adds a hashed element to the sketch
addHashed
{ "repo_name": "inigoillan/libanalytics", "path": "src/main/java/com/inigoillan/libanalytics/algorithms/oddsketch/OddSketch.java", "license": "apache-2.0", "size": 13184 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,792,714
// If this is the second row and is not showing, do not do anything. if (!isFirstExchange && !Boolean.TRUE.toString().equals( controller.getModel().getUserPreference(ExchangeModel.TICKER_SHOW_SECOND_ROW))) { return; } try { // Create exchange. synchronized (this) { if (exchange == null) { log.debug("exchange is null ... creating exchange ... (isFirstExchange = " + isFirstExchange + ")"); if (shortExchangeName == null) { log.debug("shortExchangeName is null, defaulting to " + ExchangeData.DEFAULT_EXCHANGE); shortExchangeName = ExchangeData.DEFAULT_EXCHANGE; } createExchangeObjects(shortExchangeName); if (exchange == null) { log.debug("Cannot create exchange (isFirstExchange = " + isFirstExchange + ")"); } } } if (marketDataService != null) { if (exchangeSymbols != null) { // Only get data from server if ticker is being shown if // currency conversion is switched on. // (This is to minimise the load on the remote servers). if (!Boolean.FALSE.toString().equals(controller.getModel().getUserPreference(ExchangeModel.TICKER_SHOW)) || !Boolean.FALSE.toString().equals( controller.getModel().getUserPreference(ExchangeModel.SHOW_BITCOIN_CONVERTED_TO_FIAT))) { // Get symbol ticker if it is one of the // currencies we are interested in. // (This is to save hitting the server for every // currency). boolean getItFromTheServer = false; // Is the amount quoted the reciprocal of number // of currency units per BTC boolean invertedRates = false; // Is the currency pair the other way round ie // base currency = other, counter currency = BTC boolean reverseRates = ExchangeData.doesExchangeUseReverseRates(shortExchangeName); CurrencyPair currencyPairToUse = null; for (CurrencyPair loopSymbolPair : exchangeSymbols) { if (ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equals(shortExchangeName)) { if (loopSymbolPair.baseCurrency.equals(currency)) { getItFromTheServer = true; invertedRates = true; currencyPairToUse = loopSymbolPair; break; } } else { if ("BTC".equals(loopSymbolPair.baseCurrency) && loopSymbolPair.counterCurrency.equals(currency)) { getItFromTheServer = true; currencyPairToUse = loopSymbolPair; break; } if ("BTC".equals(loopSymbolPair.counterCurrency) && loopSymbolPair.baseCurrency.equals(currency)) { getItFromTheServer = true; invertedRates = true; currencyPairToUse = loopSymbolPair; break; } } } if (getItFromTheServer) { BigMoney last = null; BigMoney bid = null; BigMoney ask = null; Ticker loopTicker; if (ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equals(shortExchangeName)) { log.debug("Getting loopTicker for " + currency + " USD"); loopTicker = marketDataService.getTicker(currency, "USD"); System.out.println("loopTicker = " + loopTicker); Ticker btcUsdTicker = null; log.debug("Getting btcUsdTicker for BTC/USD"); btcUsdTicker = marketDataService.getTicker(Currencies.BTC, Currencies.USD); System.out.println("btcUsdTicker = " + btcUsdTicker); BigMoney usdBtcRateMoney = btcUsdTicker.getLast(); BigDecimal usdBtcRate = null; if (usdBtcRateMoney != null) { usdBtcRate = usdBtcRateMoney.getAmount(); if (loopTicker.getLast() != null) { last = loopTicker.getLast().dividedBy(usdBtcRate, RoundingMode.HALF_EVEN); } if (loopTicker.getBid() != null) { bid = loopTicker.getBid().dividedBy(usdBtcRate, RoundingMode.HALF_EVEN); } if (loopTicker.getAsk() != null) { ask = loopTicker.getAsk().dividedBy(usdBtcRate, RoundingMode.HALF_EVEN); } } } else { log.debug("Getting ticker for " + currencyPairToUse.baseCurrency + " " + currencyPairToUse.counterCurrency); loopTicker = marketDataService.getTicker(currencyPairToUse.baseCurrency, currencyPairToUse.counterCurrency); log.debug("Got ticker for " + currencyPairToUse.baseCurrency + " " + currencyPairToUse.counterCurrency); last = loopTicker.getLast(); bid = loopTicker.getBid(); ask = loopTicker.getAsk(); if (invertedRates && !reverseRates) { if (last != null && last.getAmount() != BigDecimal.ZERO) { last = BigMoney.of(last.getCurrencyUnit(), BigDecimal.ONE.divide(last.getAmount(), NUMBER_OF_SIGNIFICANT_DIGITS, BigDecimal.ROUND_HALF_EVEN)); } else { last = null; } if (bid != null && bid.getAmount() != BigDecimal.ZERO) { bid = BigMoney.of(last.getCurrencyUnit(), BigDecimal.ONE.divide(bid.getAmount(), NUMBER_OF_SIGNIFICANT_DIGITS, BigDecimal.ROUND_HALF_EVEN)); } else { bid = null; } if (ask != null && ask.getAmount() != BigDecimal.ZERO) { ask = BigMoney.of(last.getCurrencyUnit(), BigDecimal.ONE.divide(ask.getAmount(), NUMBER_OF_SIGNIFICANT_DIGITS, BigDecimal.ROUND_HALF_EVEN)); } else { ask = null; } } if (invertedRates) { if (reverseRates) { // USD/ BTC, reciprocal rate currency = currencyPairToUse.baseCurrency; } else { // BTC/ USD, reciprocal rate currency = currencyPairToUse.counterCurrency; } } else { if (reverseRates) { // USD/ BTC, normal rate currency = currencyPairToUse.baseCurrency; } else { // BTC/ USD, normal rate currency = currencyPairToUse.counterCurrency; } } } this.exchangeController.getModel().getExchangeData(shortExchangeName).setLastPrice(currency, last); this.exchangeController.getModel().getExchangeData(shortExchangeName).setLastBid(currency, bid); this.exchangeController.getModel().getExchangeData(shortExchangeName).setLastAsk(currency, ask); log.debug("Exchange = " + shortExchangeName); // Put the exchange rate into the currency converter. if (isFirstExchange) { String newCurrencyCode = currency; if (ExchangeData.BITCOIN_CHARTS_EXCHANGE_NAME.equals(shortExchangeName)) { // Use only the last three characters - the // currency code. if (currency.length() >= 3) { newCurrencyCode = currency.substring(currency.length() - 3); } } CurrencyConverter.INSTANCE.setCurrencyUnit(CurrencyUnit.of(newCurrencyCode)); CurrencyConverter.INSTANCE.setRate(last.getAmount()); } } } } // Fire exchange rate data changed - used by rest of MultiBit. mainFrame.fireExchangeDataChanged(); } } catch (Exception e) { // Stop any xchange errors percolating out. log.error(e.getClass().getName() + " " + e.getMessage()); if (e.getCause() != null) { log.error(e.getCause().getClass().getName() + " " + e.getCause().getMessage()); } } }
if (!isFirstExchange && !Boolean.TRUE.toString().equals( controller.getModel().getUserPreference(ExchangeModel.TICKER_SHOW_SECOND_ROW))) { return; } try { synchronized (this) { if (exchange == null) { log.debug(STR + isFirstExchange + ")"); if (shortExchangeName == null) { log.debug(STR + ExchangeData.DEFAULT_EXCHANGE); shortExchangeName = ExchangeData.DEFAULT_EXCHANGE; } createExchangeObjects(shortExchangeName); if (exchange == null) { log.debug(STR + isFirstExchange + ")"); } } } if (marketDataService != null) { if (exchangeSymbols != null) { if (!Boolean.FALSE.toString().equals(controller.getModel().getUserPreference(ExchangeModel.TICKER_SHOW)) !Boolean.FALSE.toString().equals( controller.getModel().getUserPreference(ExchangeModel.SHOW_BITCOIN_CONVERTED_TO_FIAT))) { boolean getItFromTheServer = false; boolean invertedRates = false; boolean reverseRates = ExchangeData.doesExchangeUseReverseRates(shortExchangeName); CurrencyPair currencyPairToUse = null; for (CurrencyPair loopSymbolPair : exchangeSymbols) { if (ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equals(shortExchangeName)) { if (loopSymbolPair.baseCurrency.equals(currency)) { getItFromTheServer = true; invertedRates = true; currencyPairToUse = loopSymbolPair; break; } } else { if ("BTC".equals(loopSymbolPair.baseCurrency) && loopSymbolPair.counterCurrency.equals(currency)) { getItFromTheServer = true; currencyPairToUse = loopSymbolPair; break; } if ("BTC".equals(loopSymbolPair.counterCurrency) && loopSymbolPair.baseCurrency.equals(currency)) { getItFromTheServer = true; invertedRates = true; currencyPairToUse = loopSymbolPair; break; } } } if (getItFromTheServer) { BigMoney last = null; BigMoney bid = null; BigMoney ask = null; Ticker loopTicker; if (ExchangeData.OPEN_EXCHANGE_RATES_EXCHANGE_NAME.equals(shortExchangeName)) { log.debug(STR + currency + STR); loopTicker = marketDataService.getTicker(currency, "USD"); System.out.println(STR + loopTicker); Ticker btcUsdTicker = null; log.debug(STR); btcUsdTicker = marketDataService.getTicker(Currencies.BTC, Currencies.USD); System.out.println(STR + btcUsdTicker); BigMoney usdBtcRateMoney = btcUsdTicker.getLast(); BigDecimal usdBtcRate = null; if (usdBtcRateMoney != null) { usdBtcRate = usdBtcRateMoney.getAmount(); if (loopTicker.getLast() != null) { last = loopTicker.getLast().dividedBy(usdBtcRate, RoundingMode.HALF_EVEN); } if (loopTicker.getBid() != null) { bid = loopTicker.getBid().dividedBy(usdBtcRate, RoundingMode.HALF_EVEN); } if (loopTicker.getAsk() != null) { ask = loopTicker.getAsk().dividedBy(usdBtcRate, RoundingMode.HALF_EVEN); } } } else { log.debug(STR + currencyPairToUse.baseCurrency + " " + currencyPairToUse.counterCurrency); loopTicker = marketDataService.getTicker(currencyPairToUse.baseCurrency, currencyPairToUse.counterCurrency); log.debug(STR + currencyPairToUse.baseCurrency + " " + currencyPairToUse.counterCurrency); last = loopTicker.getLast(); bid = loopTicker.getBid(); ask = loopTicker.getAsk(); if (invertedRates && !reverseRates) { if (last != null && last.getAmount() != BigDecimal.ZERO) { last = BigMoney.of(last.getCurrencyUnit(), BigDecimal.ONE.divide(last.getAmount(), NUMBER_OF_SIGNIFICANT_DIGITS, BigDecimal.ROUND_HALF_EVEN)); } else { last = null; } if (bid != null && bid.getAmount() != BigDecimal.ZERO) { bid = BigMoney.of(last.getCurrencyUnit(), BigDecimal.ONE.divide(bid.getAmount(), NUMBER_OF_SIGNIFICANT_DIGITS, BigDecimal.ROUND_HALF_EVEN)); } else { bid = null; } if (ask != null && ask.getAmount() != BigDecimal.ZERO) { ask = BigMoney.of(last.getCurrencyUnit(), BigDecimal.ONE.divide(ask.getAmount(), NUMBER_OF_SIGNIFICANT_DIGITS, BigDecimal.ROUND_HALF_EVEN)); } else { ask = null; } } if (invertedRates) { if (reverseRates) { currency = currencyPairToUse.baseCurrency; } else { currency = currencyPairToUse.counterCurrency; } } else { if (reverseRates) { currency = currencyPairToUse.baseCurrency; } else { currency = currencyPairToUse.counterCurrency; } } } this.exchangeController.getModel().getExchangeData(shortExchangeName).setLastPrice(currency, last); this.exchangeController.getModel().getExchangeData(shortExchangeName).setLastBid(currency, bid); this.exchangeController.getModel().getExchangeData(shortExchangeName).setLastAsk(currency, ask); log.debug(STR + shortExchangeName); if (isFirstExchange) { String newCurrencyCode = currency; if (ExchangeData.BITCOIN_CHARTS_EXCHANGE_NAME.equals(shortExchangeName)) { if (currency.length() >= 3) { newCurrencyCode = currency.substring(currency.length() - 3); } } CurrencyConverter.INSTANCE.setCurrencyUnit(CurrencyUnit.of(newCurrencyCode)); CurrencyConverter.INSTANCE.setRate(last.getAmount()); } } } } mainFrame.fireExchangeDataChanged(); } } catch (Exception e) { log.error(e.getClass().getName() + " " + e.getMessage()); if (e.getCause() != null) { log.error(e.getCause().getClass().getName() + " " + e.getCause().getMessage()); } } }
/** * When the timer executes, get the exchange data and pass to the * CurrencyConverter, which notifies parties of interest. */
When the timer executes, get the exchange data and pass to the CurrencyConverter, which notifies parties of interest
run
{ "repo_name": "u20024804/multibit", "path": "src/main/java/org/multibit/exchange/TickerTimerTask.java", "license": "mit", "size": 19966 }
[ "com.xeiam.xchange.currency.Currencies", "com.xeiam.xchange.currency.CurrencyPair", "com.xeiam.xchange.dto.marketdata.Ticker", "java.math.BigDecimal", "java.math.RoundingMode", "org.joda.money.BigMoney", "org.joda.money.CurrencyUnit", "org.multibit.model.exchange.ExchangeData", "org.multibit.model.e...
import com.xeiam.xchange.currency.Currencies; import com.xeiam.xchange.currency.CurrencyPair; import com.xeiam.xchange.dto.marketdata.Ticker; import java.math.BigDecimal; import java.math.RoundingMode; import org.joda.money.BigMoney; import org.joda.money.CurrencyUnit; import org.multibit.model.exchange.ExchangeData; import org.multibit.model.exchange.ExchangeModel;
import com.xeiam.xchange.currency.*; import com.xeiam.xchange.dto.marketdata.*; import java.math.*; import org.joda.money.*; import org.multibit.model.exchange.*;
[ "com.xeiam.xchange", "java.math", "org.joda.money", "org.multibit.model" ]
com.xeiam.xchange; java.math; org.joda.money; org.multibit.model;
846,819
public Collection<ClusterNode> serverTopologyNodes(long topVer) { return F.view(topology(topVer), F.not(FILTER_CLI), FILTER_NOT_DAEMON); }
Collection<ClusterNode> function(long topVer) { return F.view(topology(topVer), F.not(FILTER_CLI), FILTER_NOT_DAEMON); }
/** * Gets server nodes topology by specified version from snapshots history storage. * * @param topVer Topology version. * @return Server topology nodes. */
Gets server nodes topology by specified version from snapshots history storage
serverTopologyNodes
{ "repo_name": "ptupitsyn/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java", "license": "apache-2.0", "size": 126804 }
[ "java.util.Collection", "org.apache.ignite.cluster.ClusterNode", "org.apache.ignite.internal.util.typedef.F" ]
import java.util.Collection; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.util.typedef.F;
import java.util.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.util.typedef.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
164,772
void enterInnerClassName(@NotNull CQLParser.InnerClassNameContext ctx); void exitInnerClassName(@NotNull CQLParser.InnerClassNameContext ctx);
void enterInnerClassName(@NotNull CQLParser.InnerClassNameContext ctx); void exitInnerClassName(@NotNull CQLParser.InnerClassNameContext ctx);
/** * Exit a parse tree produced by {@link CQLParser#innerClassName}. */
Exit a parse tree produced by <code>CQLParser#innerClassName</code>
exitInnerClassName
{ "repo_name": "HuaweiBigData/StreamCQL", "path": "cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/CQLParserListener.java", "license": "apache-2.0", "size": 58667 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
2,798,683
public void broadcastPackets(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket... packets) { double dx, dy; final Collection<L2PcInstance> players = L2World.getInstance().getAllPlayers().values(); for (L2PcInstance player : players) { if (player == null) continue; dx = (double) player.getX() - point1.x; dy = (double) player.getY() - point1.y; if (Math.sqrt(dx * dx + dy * dy) < BOAT_BROADCAST_RADIUS) { for (L2GameServerPacket p : packets) player.sendPacket(p); } else { dx = (double) player.getX() - point2.x; dy = (double) player.getY() - point2.y; if (Math.sqrt(dx * dx + dy * dy) < BOAT_BROADCAST_RADIUS) for (L2GameServerPacket p : packets) player.sendPacket(p); } } } private static class SingletonHolder { protected static final BoatManager _instance = new BoatManager(); }
void function(VehiclePathPoint point1, VehiclePathPoint point2, L2GameServerPacket... packets) { double dx, dy; final Collection<L2PcInstance> players = L2World.getInstance().getAllPlayers().values(); for (L2PcInstance player : players) { if (player == null) continue; dx = (double) player.getX() - point1.x; dy = (double) player.getY() - point1.y; if (Math.sqrt(dx * dx + dy * dy) < BOAT_BROADCAST_RADIUS) { for (L2GameServerPacket p : packets) player.sendPacket(p); } else { dx = (double) player.getX() - point2.x; dy = (double) player.getY() - point2.y; if (Math.sqrt(dx * dx + dy * dy) < BOAT_BROADCAST_RADIUS) for (L2GameServerPacket p : packets) player.sendPacket(p); } } } private static class SingletonHolder { protected static final BoatManager _instance = new BoatManager(); }
/** * Broadcast several packets in both path points * @param point1 * @param point2 * @param packets The packets to broadcast. */
Broadcast several packets in both path points
broadcastPackets
{ "repo_name": "VytautasBoznis/l2.skilas.lt", "path": "aCis_gameserver/java/net/sf/l2j/gameserver/instancemanager/BoatManager.java", "license": "gpl-2.0", "size": 5436 }
[ "java.util.Collection", "net.sf.l2j.gameserver.model.L2World", "net.sf.l2j.gameserver.model.VehiclePathPoint", "net.sf.l2j.gameserver.model.actor.instance.L2PcInstance", "net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket" ]
import java.util.Collection; import net.sf.l2j.gameserver.model.L2World; import net.sf.l2j.gameserver.model.VehiclePathPoint; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket;
import java.util.*; import net.sf.l2j.gameserver.model.*; import net.sf.l2j.gameserver.model.actor.instance.*; import net.sf.l2j.gameserver.network.serverpackets.*;
[ "java.util", "net.sf.l2j" ]
java.util; net.sf.l2j;
58,499
protected String driveBrowser(final WebDriver driver) { // long timeout: something we're doing is leading to huge unpredictable // slowdowns in random test startup; perhaps we're holding onto a lot of ram // and we're losing on swapping/gc time. unclear. countdown(10000, 200, new Countdown() { @Override public String toString() { return "startup"; }
String function(final WebDriver driver) { countdown(10000, 200, new Countdown() { @Override public String toString() { return STR; }
/** * Do what should be done with the browser. */
Do what should be done with the browser
driveBrowser
{ "repo_name": "googlearchive/caja", "path": "tests/com/google/caja/plugin/BrowserTestCase.java", "license": "apache-2.0", "size": 9746 }
[ "org.openqa.selenium.WebDriver" ]
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.*;
[ "org.openqa.selenium" ]
org.openqa.selenium;
1,022,330
HTMLElement resolvePosition(NamedPosition p );
HTMLElement resolvePosition(NamedPosition p );
/** * Returns the HTMLElement that contains the child WorkbenchPanelView at the given position. * * @return the HTMLElement that contains the child at the given position, or null if the given position does not exist * within this activity's view. */
Returns the HTMLElement that contains the child WorkbenchPanelView at the given position
resolvePosition
{ "repo_name": "kiereleaseuser/uberfire", "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/TemplatedActivity.java", "license": "apache-2.0", "size": 1425 }
[ "org.jboss.errai.common.client.dom.HTMLElement", "org.uberfire.workbench.model.NamedPosition" ]
import org.jboss.errai.common.client.dom.HTMLElement; import org.uberfire.workbench.model.NamedPosition;
import org.jboss.errai.common.client.dom.*; import org.uberfire.workbench.model.*;
[ "org.jboss.errai", "org.uberfire.workbench" ]
org.jboss.errai; org.uberfire.workbench;
2,402,746
public Iterator sortedKeys() { return new TreeSet(this.map.keySet()).iterator(); }
Iterator function() { return new TreeSet(this.map.keySet()).iterator(); }
/** * Get an enumeration of the keys of the JSONObject. The keys will be sorted alphabetically. * * @return An iterator of the keys. */
Get an enumeration of the keys of the JSONObject. The keys will be sorted alphabetically
sortedKeys
{ "repo_name": "shaolinwu/uimaster", "path": "modules/runtime/src/main/java/org/shaolin/bmdp/json/JSONObject.java", "license": "apache-2.0", "size": 57347 }
[ "java.util.Iterator", "java.util.TreeSet" ]
import java.util.Iterator; import java.util.TreeSet;
import java.util.*;
[ "java.util" ]
java.util;
501,100
@Nullable IColony getColony(final int id);
IColony getColony(final int id);
/** * Get a colony with a certain id. * * @param id the id of the colony. * @return the colony or null. */
Get a colony with a certain id
getColony
{ "repo_name": "Minecolonies/minecolonies", "path": "src/main/java/com/minecolonies/coremod/colony/IColonyManagerCapability.java", "license": "gpl-3.0", "size": 7231 }
[ "com.minecolonies.api.colony.IColony" ]
import com.minecolonies.api.colony.IColony;
import com.minecolonies.api.colony.*;
[ "com.minecolonies.api" ]
com.minecolonies.api;
268,304
static StructType createStructTypeForRuntimeIterators(List runTimeIterators) { int len = runTimeIterators.size(); String[] fieldNames = new String[len]; String[] indexAlternativeFieldNames = new String[len]; ObjectType[] fieldTypes = new ObjectType[len]; // use an Iterator as the chances are that we will be sending // LinkedList rather than ArrayList Iterator itr = runTimeIterators.iterator(); int i = 0; while (itr.hasNext()) { RuntimeIterator iter = (RuntimeIterator) itr.next(); fieldNames[i] = iter.getInternalId(); indexAlternativeFieldNames[i] = iter.getIndexInternalID(); fieldTypes[i++] = iter.getElementType(); } return new StructTypeImpl(fieldNames, indexAlternativeFieldNames, fieldTypes); }
static StructType createStructTypeForRuntimeIterators(List runTimeIterators) { int len = runTimeIterators.size(); String[] fieldNames = new String[len]; String[] indexAlternativeFieldNames = new String[len]; ObjectType[] fieldTypes = new ObjectType[len]; Iterator itr = runTimeIterators.iterator(); int i = 0; while (itr.hasNext()) { RuntimeIterator iter = (RuntimeIterator) itr.next(); fieldNames[i] = iter.getInternalId(); indexAlternativeFieldNames[i] = iter.getIndexInternalID(); fieldTypes[i++] = iter.getElementType(); } return new StructTypeImpl(fieldNames, indexAlternativeFieldNames, fieldTypes); }
/** * This function creates a StructType using Internal IDs of the iterators as the field names for * the StructType. It should be invoked iff the iterators size is greater than 1 * * @param runTimeIterators List of RuntimeIterator objects * @return StructType object * */
This function creates a StructType using Internal IDs of the iterators as the field names for the StructType. It should be invoked iff the iterators size is greater than 1
createStructTypeForRuntimeIterators
{ "repo_name": "PurelyApplied/geode", "path": "geode-core/src/main/java/org/apache/geode/cache/query/internal/QueryUtils.java", "license": "apache-2.0", "size": 73823 }
[ "java.util.Iterator", "java.util.List", "org.apache.geode.cache.query.internal.types.StructTypeImpl", "org.apache.geode.cache.query.types.ObjectType", "org.apache.geode.cache.query.types.StructType" ]
import java.util.Iterator; import java.util.List; import org.apache.geode.cache.query.internal.types.StructTypeImpl; import org.apache.geode.cache.query.types.ObjectType; import org.apache.geode.cache.query.types.StructType;
import java.util.*; import org.apache.geode.cache.query.internal.types.*; import org.apache.geode.cache.query.types.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
1,205,420
@Override public DOCUMENT_STATUS mapSCorpus() { List<SNode> roots = getCorpus().getGraph().getRoots(); if ((roots != null) && (!roots.isEmpty())) { if (getCorpus().equals(roots.get(0))) { SaltUtil.save_DOT(getCorpus().getGraph(), getResourceURI()); } } return (DOCUMENT_STATUS.COMPLETED); } }
DOCUMENT_STATUS function() { List<SNode> roots = getCorpus().getGraph().getRoots(); if ((roots != null) && (!roots.isEmpty())) { if (getCorpus().equals(roots.get(0))) { SaltUtil.save_DOT(getCorpus().getGraph(), getResourceURI()); } } return (DOCUMENT_STATUS.COMPLETED); } }
/** * Storing the corpus-structure once */
Storing the corpus-structure once
mapSCorpus
{ "repo_name": "infraling/pepperModules-GraphAnnoModules", "path": "src/main/java/org/corpus_tools/peppermodules/graphanno/GraphAnnoExporter.java", "license": "apache-2.0", "size": 6499 }
[ "java.util.List", "org.corpus_tools.salt.core.SNode", "org.corpus_tools.salt.util.SaltUtil" ]
import java.util.List; import org.corpus_tools.salt.core.SNode; import org.corpus_tools.salt.util.SaltUtil;
import java.util.*; import org.corpus_tools.salt.core.*; import org.corpus_tools.salt.util.*;
[ "java.util", "org.corpus_tools.salt" ]
java.util; org.corpus_tools.salt;
1,113,460
protected void ensureClusterStateConsistency() throws IOException { if (cluster() != null) { ClusterState masterClusterState = client().admin().cluster().prepareState().all().get().getState(); byte[] masterClusterStateBytes = ClusterState.Builder.toBytes(masterClusterState); // remove local node reference masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null); Map<String, Object> masterStateMap = convertToMap(masterClusterState); int masterClusterStateSize = masterClusterState.toString().length(); String masterId = masterClusterState.nodes().masterNodeId(); for (Client client : cluster().getClients()) { ClusterState localClusterState = client.admin().cluster().prepareState().all().setLocal(true).get().getState(); byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterState); // remove local node reference localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null); final Map<String, Object> localStateMap = convertToMap(localClusterState); final int localClusterStateSize = localClusterState.toString().length(); // Check that the non-master node has the same version of the cluster state as the master and // that the master node matches the master (otherwise there is no requirement for the cluster state to match) if (masterClusterState.version() == localClusterState.version() && masterId.equals(localClusterState.nodes().masterNodeId())) { try { assertEquals("clusterstate UUID does not match", masterClusterState.stateUUID(), localClusterState.stateUUID()); // We cannot compare serialization bytes since serialization order of maps is not guaranteed // but we can compare serialization sizes - they should be the same assertEquals("clusterstate size does not match", masterClusterStateSize, localClusterStateSize); // Compare JSON serialization assertNull("clusterstate JSON serialization does not match", differenceBetweenMapsIgnoringArrayOrder(masterStateMap, localStateMap)); } catch (AssertionError error) { logger.error("Cluster state from master:\n{}\nLocal cluster state:\n{}", masterClusterState.toString(), localClusterState.toString()); throw error; } } } } }
void function() throws IOException { if (cluster() != null) { ClusterState masterClusterState = client().admin().cluster().prepareState().all().get().getState(); byte[] masterClusterStateBytes = ClusterState.Builder.toBytes(masterClusterState); masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null); Map<String, Object> masterStateMap = convertToMap(masterClusterState); int masterClusterStateSize = masterClusterState.toString().length(); String masterId = masterClusterState.nodes().masterNodeId(); for (Client client : cluster().getClients()) { ClusterState localClusterState = client.admin().cluster().prepareState().all().setLocal(true).get().getState(); byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterState); localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null); final Map<String, Object> localStateMap = convertToMap(localClusterState); final int localClusterStateSize = localClusterState.toString().length(); if (masterClusterState.version() == localClusterState.version() && masterId.equals(localClusterState.nodes().masterNodeId())) { try { assertEquals(STR, masterClusterState.stateUUID(), localClusterState.stateUUID()); assertEquals(STR, masterClusterStateSize, localClusterStateSize); assertNull(STR, differenceBetweenMapsIgnoringArrayOrder(masterStateMap, localStateMap)); } catch (AssertionError error) { logger.error(STR, masterClusterState.toString(), localClusterState.toString()); throw error; } } } } }
/** * Verifies that all nodes that have the same version of the cluster state as master have same cluster state */
Verifies that all nodes that have the same version of the cluster state as master have same cluster state
ensureClusterStateConsistency
{ "repo_name": "markharwood/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java", "license": "apache-2.0", "size": 98901 }
[ "java.io.IOException", "java.util.Map", "org.elasticsearch.client.Client", "org.elasticsearch.cluster.ClusterState", "org.elasticsearch.test.XContentTestUtils" ]
import java.io.IOException; import java.util.Map; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.test.XContentTestUtils;
import java.io.*; import java.util.*; import org.elasticsearch.client.*; import org.elasticsearch.cluster.*; import org.elasticsearch.test.*;
[ "java.io", "java.util", "org.elasticsearch.client", "org.elasticsearch.cluster", "org.elasticsearch.test" ]
java.io; java.util; org.elasticsearch.client; org.elasticsearch.cluster; org.elasticsearch.test;
2,283,088
public void addField(String fieldNameIn, String fieldValueIn) { Map fieldAndValue = new HashMap(); fieldAndValue.put(fieldNameIn, fieldValueIn); fieldValueList.add(fieldAndValue); }
void function(String fieldNameIn, String fieldValueIn) { Map fieldAndValue = new HashMap(); fieldAndValue.put(fieldNameIn, fieldValueIn); fieldValueList.add(fieldAndValue); }
/** * Set the name of the field to check against to see if *this* field * is required. So if the constraint is a "requiredIf field FOO == 'BAR'" then we * want to call addField("FOO", "BAR"); * * @param fieldNameIn the name of the field * @param fieldValueIn the value of the field */
Set the name of the field to check against to see if *this* field is required. So if the constraint is a "requiredIf field FOO == 'BAR'" then we want to call addField("FOO", "BAR")
addField
{ "repo_name": "colloquium/spacewalk", "path": "java/code/src/com/redhat/rhn/common/validator/RequiredIfConstraint.java", "license": "gpl-2.0", "size": 5230 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,528,979
public void setOnTrackChangedListener(@Nullable OnTrackChangedListener listener) { m_onTrackChanged = listener; }
void function(@Nullable OnTrackChangedListener listener) { m_onTrackChanged = listener; }
/** * Attaches a listener to listen for track changed events. * * @param listener the listener to attach */
Attaches a listener to listen for track changed events
setOnTrackChangedListener
{ "repo_name": "StevenFrost/AMP", "path": "app/src/main/java/com/frost/steven/amp/service/MediaService.java", "license": "mit", "size": 16602 }
[ "android.support.annotation.Nullable" ]
import android.support.annotation.Nullable;
import android.support.annotation.*;
[ "android.support" ]
android.support;
1,672,264
public static Element createFieldSet() { return Document.get().createFieldSetElement().cast(); }
static Element function() { return Document.get().createFieldSetElement().cast(); }
/** * Creates an HTML FIELDSET element. * * @return the newly-created element */
Creates an HTML FIELDSET element
createFieldSet
{ "repo_name": "syntelos/gwtcc", "path": "src/com/google/gwt/user/client/DOM.java", "license": "apache-2.0", "size": 41015 }
[ "com.google.gwt.dom.client.Document" ]
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.*;
[ "com.google.gwt" ]
com.google.gwt;
2,048,395
private RemoteOperationResult grantFolderExistence(String pathToGrant) { RemoteOperation operation = new ExistenceCheckRemoteOperation(pathToGrant, this, false); RemoteOperationResult result = operation.execute(mUploadClient); if (!result.isSuccess() && result.getCode() == ResultCode.FILE_NOT_FOUND && mCurrentUpload.isRemoteFolderToBeCreated()) { SyncOperation syncOp = new CreateFolderOperation( pathToGrant, true); result = syncOp.execute(mUploadClient, mStorageManager); } if (result.isSuccess()) { OCFile parentDir = mStorageManager.getFileByPath(pathToGrant); if (parentDir == null) { parentDir = createLocalFolder(pathToGrant); } if (parentDir != null) { result = new RemoteOperationResult(ResultCode.OK); } else { result = new RemoteOperationResult(ResultCode.UNKNOWN_ERROR); } } return result; }
RemoteOperationResult function(String pathToGrant) { RemoteOperation operation = new ExistenceCheckRemoteOperation(pathToGrant, this, false); RemoteOperationResult result = operation.execute(mUploadClient); if (!result.isSuccess() && result.getCode() == ResultCode.FILE_NOT_FOUND && mCurrentUpload.isRemoteFolderToBeCreated()) { SyncOperation syncOp = new CreateFolderOperation( pathToGrant, true); result = syncOp.execute(mUploadClient, mStorageManager); } if (result.isSuccess()) { OCFile parentDir = mStorageManager.getFileByPath(pathToGrant); if (parentDir == null) { parentDir = createLocalFolder(pathToGrant); } if (parentDir != null) { result = new RemoteOperationResult(ResultCode.OK); } else { result = new RemoteOperationResult(ResultCode.UNKNOWN_ERROR); } } return result; }
/** * Checks the existence of the folder where the current file will be uploaded both * in the remote server and in the local database. * * If the upload is set to enforce the creation of the folder, the method tries to * create it both remote and locally. * * @param pathToGrant Full remote path whose existence will be granted. * @return An {@link OCFile} instance corresponding to the folder where the file * will be uploaded. */
Checks the existence of the folder where the current file will be uploaded both in the remote server and in the local database. If the upload is set to enforce the creation of the folder, the method tries to create it both remote and locally
grantFolderExistence
{ "repo_name": "Godine/android", "path": "src/com/owncloud/android/files/services/FileUploader.java", "license": "gpl-2.0", "size": 42226 }
[ "com.owncloud.android.datamodel.OCFile", "com.owncloud.android.lib.common.operations.RemoteOperation", "com.owncloud.android.lib.common.operations.RemoteOperationResult", "com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation", "com.owncloud.android.operations.CreateFolderOperation", "com...
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation; import com.owncloud.android.operations.CreateFolderOperation; import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.datamodel.*; import com.owncloud.android.lib.common.operations.*; import com.owncloud.android.lib.resources.files.*; import com.owncloud.android.operations.*; import com.owncloud.android.operations.common.*;
[ "com.owncloud.android" ]
com.owncloud.android;
2,096,159
public void setTextViewString(Integer textViewId, Integer stringId) { TextView tv = (TextView) findViewById(textViewId); tv.setText(stringId); }
void function(Integer textViewId, Integer stringId) { TextView tv = (TextView) findViewById(textViewId); tv.setText(stringId); }
/** * Set text title. * * @param textViewId * The textView id. * @param stringId * The string resource id. */
Set text title
setTextViewString
{ "repo_name": "yanniboi/drupalcon", "path": "DrupalConPrague/DrupalCon/src/main/java/com/drupalcon/prague/BaseActivity.java", "license": "mit", "size": 7209 }
[ "android.widget.TextView" ]
import android.widget.TextView;
import android.widget.*;
[ "android.widget" ]
android.widget;
2,761,505
Component getInput(String key);
Component getInput(String key);
/** * retorna el input asociado a la clave <code>key</code> * @param key * @return */
retorna el input asociado a la clave <code>key</code>
getInput
{ "repo_name": "iriber/miGestionSwing", "path": "src/main/java/com/migestion/swing/view/dialogs/IDialogWithInput.java", "license": "gpl-2.0", "size": 938 }
[ "java.awt.Component" ]
import java.awt.Component;
import java.awt.*;
[ "java.awt" ]
java.awt;
135,427
public static int toIntValue(Object decoded) { return new BigInteger((byte[]) decoded).intValue(); }
static int function(Object decoded) { return new BigInteger((byte[]) decoded).intValue(); }
/** * Converts decoded ASN.1 Integer to int value. * If the object represents an integer value * larger than 32 bits, the high bits will be lost. * * @param decoded a decoded object corresponding to this type * @return decoded int value. */
Converts decoded ASN.1 Integer to int value. If the object represents an integer value larger than 32 bits, the high bits will be lost
toIntValue
{ "repo_name": "MindMac/android-vts", "path": "app/src/main/java/android/framework/org/apache/harmony/security_custom/asn1/ASN1Integer.java", "license": "mit", "size": 3773 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
2,230,076
public void displayCardTable(CardTable table);
void function(CardTable table);
/** * Display card table. * * @param table * the card table */
Display card table
displayCardTable
{ "repo_name": "savinov/cardpairs", "path": "src/main/java/com/github/savinov/cardpairs/ui/UserInterface.java", "license": "gpl-3.0", "size": 2271 }
[ "com.github.savinov.cardpairs.model.CardTable" ]
import com.github.savinov.cardpairs.model.CardTable;
import com.github.savinov.cardpairs.model.*;
[ "com.github.savinov" ]
com.github.savinov;
2,054,721
public org.opencps.accountmgt.service.BusinessAccountService getBusinessAccountService() { return businessAccountService; }
org.opencps.accountmgt.service.BusinessAccountService function() { return businessAccountService; }
/** * Returns the business account remote service. * * @return the business account remote service */
Returns the business account remote service
getBusinessAccountService
{ "repo_name": "hltn/opencps", "path": "portlets/opencps-portlet/docroot/WEB-INF/src/org/opencps/accountmgt/service/base/BusinessAccountServiceBaseImpl.java", "license": "agpl-3.0", "size": 15777 }
[ "org.opencps.accountmgt.service.BusinessAccountService" ]
import org.opencps.accountmgt.service.BusinessAccountService;
import org.opencps.accountmgt.service.*;
[ "org.opencps.accountmgt" ]
org.opencps.accountmgt;
1,701,348
protected IFigure setupContentPane(IFigure nodeShape) { return nodeShape; // use nodeShape itself as contentPane }
IFigure function(IFigure nodeShape) { return nodeShape; }
/** * Default implementation treats passed figure as content pane. * Respects layout one may have set for generated figure. * @param nodeShape instance of generated figure class * @generated */
Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure
setupContentPane
{ "repo_name": "nwnpallewela/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.diagram/src/org/wso2/developerstudio/eclipse/gmf/esb/diagram/edit/parts/ForEachMediatorTargetOutputConnectorEditPart.java", "license": "apache-2.0", "size": 14780 }
[ "org.eclipse.draw2d.IFigure" ]
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.*;
[ "org.eclipse.draw2d" ]
org.eclipse.draw2d;
371,653
public static AudioFileFormat getAudioFileFormat(File f) throws UnsupportedAudioFileException, IOException { Iterator i = lookupAudioFileReaderProviders(); while (i.hasNext()) { AudioFileReader reader = (AudioFileReader) i.next(); try { return reader.getAudioFileFormat(f); } catch (UnsupportedAudioFileException _) { // Try the next provider. } } throw new UnsupportedAudioFileException("file type not recognized"); }
static AudioFileFormat function(File f) throws UnsupportedAudioFileException, IOException { Iterator i = lookupAudioFileReaderProviders(); while (i.hasNext()) { AudioFileReader reader = (AudioFileReader) i.next(); try { return reader.getAudioFileFormat(f); } catch (UnsupportedAudioFileException _) { } } throw new UnsupportedAudioFileException(STR); }
/** * Return the file format of a given File. * @param f the file to check * @return the format of the file * @throws UnsupportedAudioFileException if the file's format is not * recognized * @throws IOException if there is an I/O error reading the file */
Return the file format of a given File
getAudioFileFormat
{ "repo_name": "ivmai/JCGO", "path": "goclsp/clsp_fix/javax/sound/sampled/AudioSystem.java", "license": "gpl-2.0", "size": 26363 }
[ "java.io.File", "java.io.IOException", "java.util.Iterator", "javax.sound.sampled.spi.AudioFileReader" ]
import java.io.File; import java.io.IOException; import java.util.Iterator; import javax.sound.sampled.spi.AudioFileReader;
import java.io.*; import java.util.*; import javax.sound.sampled.spi.*;
[ "java.io", "java.util", "javax.sound" ]
java.io; java.util; javax.sound;
301,776
public void testServerStarting() throws IOException { Settings.set(HarvesterSettings.HARVEST_CONTROLLER_SERVERDIR, TestInfo.SERVER_DIR .getAbsolutePath()); hcs = HarvestControllerServer.getInstance(); LogUtils.flushLogs(HarvestControllerServer.class.getName()); FileAsserts.assertFileContains("Log should contain start message.", START_MESSAGE, TestInfo.LOG_FILE); }
void function() throws IOException { Settings.set(HarvesterSettings.HARVEST_CONTROLLER_SERVERDIR, TestInfo.SERVER_DIR .getAbsolutePath()); hcs = HarvestControllerServer.getInstance(); LogUtils.flushLogs(HarvestControllerServer.class.getName()); FileAsserts.assertFileContains(STR, START_MESSAGE, TestInfo.LOG_FILE); }
/** * Testing that server starts and log-file logs this ! * @throws IOException */
Testing that server starts and log-file logs this
testServerStarting
{ "repo_name": "netarchivesuite/netarchivesuite-svngit-migration", "path": "tests/dk/netarkivet/harvester/harvesting/distribute/HarvestControllerServerTester.java", "license": "lgpl-2.1", "size": 25759 }
[ "dk.netarkivet.common.utils.Settings", "dk.netarkivet.harvester.HarvesterSettings", "dk.netarkivet.testutils.FileAsserts", "dk.netarkivet.testutils.LogUtils", "java.io.IOException" ]
import dk.netarkivet.common.utils.Settings; import dk.netarkivet.harvester.HarvesterSettings; import dk.netarkivet.testutils.FileAsserts; import dk.netarkivet.testutils.LogUtils; import java.io.IOException;
import dk.netarkivet.common.utils.*; import dk.netarkivet.harvester.*; import dk.netarkivet.testutils.*; import java.io.*;
[ "dk.netarkivet.common", "dk.netarkivet.harvester", "dk.netarkivet.testutils", "java.io" ]
dk.netarkivet.common; dk.netarkivet.harvester; dk.netarkivet.testutils; java.io;
1,035,088
public FileObject getAssetFileObject(AssetKey<?> assetKey) { String name = assetKey.getName(); return getAssetFileObject(name); }
FileObject function(AssetKey<?> assetKey) { String name = assetKey.getName(); return getAssetFileObject(name); }
/** * Returns the * <code>FileObject</code> for a given asset path, or null if no such asset * exists. First looks in the asset folder(s) for the file, then proceeds to * scan the classpath folders and jar files for it.The returned FileObject * might be inside a jar file and not writeable! * * @param assetKey The asset key to get the file object for * @return Either a FileObject for the asset or null if not found. */
Returns the <code>FileObject</code> for a given asset path, or null if no such asset exists. First looks in the asset folder(s) for the file, then proceeds to scan the classpath folders and jar files for it.The returned FileObject might be inside a jar file and not writeable
getAssetFileObject
{ "repo_name": "yetanotherindie/jMonkey-Engine", "path": "sdk/jme3-core/src/com/jme3/gde/core/assets/ProjectAssetManager.java", "license": "bsd-3-clause", "size": 25193 }
[ "com.jme3.asset.AssetKey", "org.openide.filesystems.FileObject" ]
import com.jme3.asset.AssetKey; import org.openide.filesystems.FileObject;
import com.jme3.asset.*; import org.openide.filesystems.*;
[ "com.jme3.asset", "org.openide.filesystems" ]
com.jme3.asset; org.openide.filesystems;
1,693,256
protected Method getMethod(Object obj, String methodname, Class[] params) { Class<?> type = obj.getClass(); while (type != null) { try { Method method = type.getDeclaredMethod(methodname, params); if (method != null) { return method; } } catch (Exception e) { // ignore } type = type.getSuperclass(); } return null; }
Method function(Object obj, String methodname, Class[] params) { Class<?> type = obj.getClass(); while (type != null) { try { Method method = type.getDeclaredMethod(methodname, params); if (method != null) { return method; } } catch (Exception e) { } type = type.getSuperclass(); } return null; }
/** * Returns the method with the specified signature. */
Returns the method with the specified signature
getMethod
{ "repo_name": "dpisarewski/gka_wise12", "path": "src/com/mxgraph/io/mxObjectCodec.java", "license": "lgpl-2.1", "size": 32262 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,080,680
private BlockReader getRemoteBlockReaderFromDomain() throws IOException { if (pathInfo == null) { pathInfo = clientContext.getDomainSocketFactory(). getPathInfo(inetSocketAddress, conf); } if (!pathInfo.getPathState().getUsableForDataTransfer()) { PerformanceAdvisory.LOG.debug(this + ": not trying to create a " + "remote block reader because the UNIX domain socket at " + pathInfo + " is not usable."); return null; } if (LOG.isTraceEnabled()) { LOG.trace(this + ": trying to create a remote block reader from the " + "UNIX domain socket at " + pathInfo.getPath()); } while (true) { BlockReaderPeer curPeer = nextDomainPeer(); if (curPeer == null) break; if (curPeer.fromCache) remainingCacheTries--; DomainPeer peer = (DomainPeer)curPeer.peer; BlockReader blockReader = null; try { blockReader = getRemoteBlockReader(peer); return blockReader; } catch (IOException ioe) { IOUtils.cleanup(LOG, peer); if (isSecurityException(ioe)) { if (LOG.isTraceEnabled()) { LOG.trace(this + ": got security exception while constructing " + "a remote block reader from the unix domain socket at " + pathInfo.getPath(), ioe); } throw ioe; } if (curPeer.fromCache) { // Handle an I/O error we got when using a cached peer. These are // considered less serious, because the underlying socket may be stale. if (LOG.isDebugEnabled()) { LOG.debug("Closed potentially stale domain peer " + peer, ioe); } } else { // Handle an I/O error we got when using a newly created domain peer. // We temporarily disable the domain socket path for a few minutes in // this case, to prevent wasting more time on it. LOG.warn("I/O error constructing remote block reader. Disabling " + "domain socket " + peer.getDomainSocket(), ioe); clientContext.getDomainSocketFactory() .disableDomainSocketPath(pathInfo.getPath()); return null; } } finally { if (blockReader == null) { IOUtils.cleanup(LOG, peer); } } } return null; }
BlockReader function() throws IOException { if (pathInfo == null) { pathInfo = clientContext.getDomainSocketFactory(). getPathInfo(inetSocketAddress, conf); } if (!pathInfo.getPathState().getUsableForDataTransfer()) { PerformanceAdvisory.LOG.debug(this + STR + STR + pathInfo + STR); return null; } if (LOG.isTraceEnabled()) { LOG.trace(this + STR + STR + pathInfo.getPath()); } while (true) { BlockReaderPeer curPeer = nextDomainPeer(); if (curPeer == null) break; if (curPeer.fromCache) remainingCacheTries--; DomainPeer peer = (DomainPeer)curPeer.peer; BlockReader blockReader = null; try { blockReader = getRemoteBlockReader(peer); return blockReader; } catch (IOException ioe) { IOUtils.cleanup(LOG, peer); if (isSecurityException(ioe)) { if (LOG.isTraceEnabled()) { LOG.trace(this + STR + STR + pathInfo.getPath(), ioe); } throw ioe; } if (curPeer.fromCache) { if (LOG.isDebugEnabled()) { LOG.debug(STR + peer, ioe); } } else { LOG.warn(STR + STR + peer.getDomainSocket(), ioe); clientContext.getDomainSocketFactory() .disableDomainSocketPath(pathInfo.getPath()); return null; } } finally { if (blockReader == null) { IOUtils.cleanup(LOG, peer); } } } return null; }
/** * Get a RemoteBlockReader that communicates over a UNIX domain socket. * * @return The new BlockReader, or null if we failed to create the block * reader. * * @throws InvalidToken If the block token was invalid. * Potentially other security-related execptions. */
Get a RemoteBlockReader that communicates over a UNIX domain socket
getRemoteBlockReaderFromDomain
{ "repo_name": "Bizyroth/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderFactory.java", "license": "apache-2.0", "size": 30376 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.net.DomainPeer", "org.apache.hadoop.io.IOUtils", "org.apache.hadoop.util.PerformanceAdvisory" ]
import java.io.IOException; import org.apache.hadoop.hdfs.net.DomainPeer; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.util.PerformanceAdvisory;
import java.io.*; import org.apache.hadoop.hdfs.net.*; import org.apache.hadoop.io.*; import org.apache.hadoop.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,970,288
public void validateSSLProperties(Properties props) throws SSLException { SSLConfig testConfig = new SSLConfig(props); try { testConfig.validateSSLConfig(); } catch (Exception e) { FFDCFilter.processException(e, getClass().getName(), "validateSSLProperties", this); throw asSSLException(e); } }
void function(Properties props) throws SSLException { SSLConfig testConfig = new SSLConfig(props); try { testConfig.validateSSLConfig(); } catch (Exception e) { FFDCFilter.processException(e, getClass().getName(), STR, this); throw asSSLException(e); } }
/** * <p> * This method attempts to create an SSLContext using the properties provided. * It is assumed the API is called on the node where the KeyStore information * specified in the properties resides. * </p> * * @param props The SSL properties to validate. * @throws com.ibm.websphere.ssl.SSLException * * @ibm-api **/
This method attempts to create an SSLContext using the properties provided. It is assumed the API is called on the node where the KeyStore information specified in the properties resides.
validateSSLProperties
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.ssl/src/com/ibm/websphere/ssl/JSSEHelper.java", "license": "epl-1.0", "size": 62569 }
[ "com.ibm.ws.ffdc.FFDCFilter", "java.util.Properties" ]
import com.ibm.ws.ffdc.FFDCFilter; import java.util.Properties;
import com.ibm.ws.ffdc.*; import java.util.*;
[ "com.ibm.ws", "java.util" ]
com.ibm.ws; java.util;
137,921
public void processingInstruction(String name, String value) { // We only handle the <?xml-stylesheet ...?> PI if ((_target == null) && (name.equals("xml-stylesheet"))) { String href = null; // URI of stylesheet found String media = null; // Media of stylesheet found String title = null; // Title of stylesheet found String charset = null; // Charset of stylesheet found // Get the attributes from the processing instruction StringTokenizer tokens = new StringTokenizer(value); while (tokens.hasMoreElements()) { String token = (String)tokens.nextElement(); if (token.startsWith("href")) href = getTokenValue(token); else if (token.startsWith("media")) media = getTokenValue(token); else if (token.startsWith("title")) title = getTokenValue(token); else if (token.startsWith("charset")) charset = getTokenValue(token); } // Set the target to this PI's href if the parameters are // null or match the corresponding attributes of this PI. if ( ((_PImedia == null) || (_PImedia.equals(media))) && ((_PItitle == null) || (_PImedia.equals(title))) && ((_PIcharset == null) || (_PImedia.equals(charset))) ) { _target = href; } } } public void ignorableWhitespace(char[] ch, int start, int length) { }
void function(String name, String value) { if ((_target == null) && (name.equals(STR))) { String href = null; String media = null; String title = null; String charset = null; StringTokenizer tokens = new StringTokenizer(value); while (tokens.hasMoreElements()) { String token = (String)tokens.nextElement(); if (token.startsWith("href")) href = getTokenValue(token); else if (token.startsWith("media")) media = getTokenValue(token); else if (token.startsWith("title")) title = getTokenValue(token); else if (token.startsWith(STR)) charset = getTokenValue(token); } if ( ((_PImedia == null) (_PImedia.equals(media))) && ((_PItitle == null) (_PImedia.equals(title))) && ((_PIcharset == null) (_PImedia.equals(charset))) ) { _target = href; } } } public void ignorableWhitespace(char[] ch, int start, int length) { }
/** * SAX2: Receive notification of a processing instruction. * These require special handling for stylesheet PIs. */
SAX2: Receive notification of a processing instruction. These require special handling for stylesheet PIs
processingInstruction
{ "repo_name": "MeFisto94/openjdk", "path": "jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java", "license": "gpl-2.0", "size": 56863 }
[ "java.util.StringTokenizer" ]
import java.util.StringTokenizer;
import java.util.*;
[ "java.util" ]
java.util;
2,846,297
void close() throws IOException { stream.close(); }
void close() throws IOException { stream.close(); }
/** * Closes the file item. * @throws IOException An I/O error occurred. */
Closes the file item
close
{ "repo_name": "plumer/codana", "path": "tomcat_files/7.0.0/FileUploadBase.java", "license": "mit", "size": 39657 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
526,093
@Generated @CVariable() @MappedReturn(ObjCStringMapper.class) public static native String GCKeyKeypadHyphen();
@CVariable() @MappedReturn(ObjCStringMapper.class) static native String function();
/** * Keypad - */
Keypad -
GCKeyKeypadHyphen
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/gamecontroller/c/GameController.java", "license": "apache-2.0", "size": 61506 }
[ "org.moe.natj.c.ann.CVariable", "org.moe.natj.general.ann.MappedReturn", "org.moe.natj.objc.map.ObjCStringMapper" ]
import org.moe.natj.c.ann.CVariable; import org.moe.natj.general.ann.MappedReturn; import org.moe.natj.objc.map.ObjCStringMapper;
import org.moe.natj.c.ann.*; import org.moe.natj.general.ann.*; import org.moe.natj.objc.map.*;
[ "org.moe.natj" ]
org.moe.natj;
1,250,369
public Reference<?, String> resolveBinding(String name, boolean strict) { return LexicalEnvironment.getIdentifierReference(lexEnv, name, strict); }
Reference<?, String> function(String name, boolean strict) { return LexicalEnvironment.getIdentifierReference(lexEnv, name, strict); }
/** * 8.3.2 ResolveBinding(name) * * @param name * the binding name * @param strict * the strict mode flag * @return the resolved reference */
8.3.2 ResolveBinding(name)
resolveBinding
{ "repo_name": "anba/es6draft", "path": "src/main/java/com/github/anba/es6draft/runtime/ExecutionContext.java", "license": "mit", "size": 17730 }
[ "com.github.anba.es6draft.runtime.types.Reference" ]
import com.github.anba.es6draft.runtime.types.Reference;
import com.github.anba.es6draft.runtime.types.*;
[ "com.github.anba" ]
com.github.anba;
366,548
private void _renderCommandChildId( FacesContext context, UIXCommand component ) throws IOException { String clientId = getClientId(context, component); // For links, these are actually URI attributes context.getResponseWriter().writeURIAttribute("id", clientId, "id"); context.getResponseWriter().writeURIAttribute("name", clientId, "id"); }
void function( FacesContext context, UIXCommand component ) throws IOException { String clientId = getClientId(context, component); context.getResponseWriter().writeURIAttribute("id", clientId, "id"); context.getResponseWriter().writeURIAttribute("name", clientId, "id"); }
/** * Renders the client ID as both "id" and "name" */
Renders the client ID as both "id" and "name"
_renderCommandChildId
{ "repo_name": "adamrduffy/trinidad-1.0.x", "path": "trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/NavigationPaneRenderer.java", "license": "apache-2.0", "size": 51302 }
[ "java.io.IOException", "javax.faces.context.FacesContext", "org.apache.myfaces.trinidad.component.UIXCommand" ]
import java.io.IOException; import javax.faces.context.FacesContext; import org.apache.myfaces.trinidad.component.UIXCommand;
import java.io.*; import javax.faces.context.*; import org.apache.myfaces.trinidad.component.*;
[ "java.io", "javax.faces", "org.apache.myfaces" ]
java.io; javax.faces; org.apache.myfaces;
75,123
private static List<ItemStack> getOres(int id) { return idToStackUn.size() > id ? idToStackUn.get(id) : EMPTY_LIST; }
static List<ItemStack> function(int id) { return idToStackUn.size() > id ? idToStackUn.get(id) : EMPTY_LIST; }
/** * Retrieves the List of items that are registered to this ore type. * Creates the list as empty if it did not exist. * * @param id The ore ID, see getOreID * @return An List containing ItemStacks registered for this ore */
Retrieves the List of items that are registered to this ore type. Creates the list as empty if it did not exist
getOres
{ "repo_name": "ThiagoGarciaAlves/MinecraftForge", "path": "src/main/java/net/minecraftforge/oredict/OreDictionary.java", "license": "lgpl-2.1", "size": 20376 }
[ "java.util.List", "net.minecraft.item.ItemStack" ]
import java.util.List; import net.minecraft.item.ItemStack;
import java.util.*; import net.minecraft.item.*;
[ "java.util", "net.minecraft.item" ]
java.util; net.minecraft.item;
2,200,184
public Set<Map.Entry<E, Double>> entrySet();
Set<Map.Entry<E, Double>> function();
/** * Returns a view of the entries in this counter. The values * can be safely modified with setValue(). * * @return A view of the entries in this counter */
Returns a view of the entries in this counter. The values can be safely modified with setValue()
entrySet
{ "repo_name": "automenta/corenlp", "path": "src/edu/stanford/nlp/stats/Counter.java", "license": "gpl-2.0", "size": 10485 }
[ "java.util.Map", "java.util.Set" ]
import java.util.Map; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,317,764
private interface UnclaimedPropertyHandler { void unclaimed(PropertyMetadata property); } private static class DslMixInPropertyType extends ClassGenerationHandler { private final AbstractClassGenerator.ExtensibleTypePropertyHandler extensibleTypeHandler; private boolean providesOwnDynamicObject; private boolean needDynamicAware; private boolean needGroovyObject; private boolean providesOwnToString; private final List<PropertyMetadata> mutableProperties = new ArrayList<>(); private final MethodSet actionMethods = new MethodSet(); private final SetMultimap<String, Method> closureMethods = LinkedHashMultimap.create(); public DslMixInPropertyType(ExtensibleTypePropertyHandler extensibleTypeHandler) { this.extensibleTypeHandler = extensibleTypeHandler; }
interface UnclaimedPropertyHandler { void function(PropertyMetadata property); } private static class DslMixInPropertyType extends ClassGenerationHandler { private final AbstractClassGenerator.ExtensibleTypePropertyHandler extensibleTypeHandler; private boolean providesOwnDynamicObject; private boolean needDynamicAware; private boolean needGroovyObject; private boolean providesOwnToString; private final List<PropertyMetadata> mutableProperties = new ArrayList<>(); private final MethodSet actionMethods = new MethodSet(); private final SetMultimap<String, Method> closureMethods = LinkedHashMultimap.create(); public DslMixInPropertyType(ExtensibleTypePropertyHandler extensibleTypeHandler) { this.extensibleTypeHandler = extensibleTypeHandler; }
/** * Called when no handler has claimed the property. */
Called when no handler has claimed the property
unclaimed
{ "repo_name": "gradle/gradle", "path": "subprojects/model-core/src/main/java/org/gradle/internal/instantiation/generator/AbstractClassGenerator.java", "license": "apache-2.0", "size": 60598 }
[ "com.google.common.collect.LinkedHashMultimap", "com.google.common.collect.SetMultimap", "java.lang.reflect.Method", "java.util.ArrayList", "java.util.List", "org.gradle.internal.reflect.MethodSet" ]
import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.SetMultimap; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import org.gradle.internal.reflect.MethodSet;
import com.google.common.collect.*; import java.lang.reflect.*; import java.util.*; import org.gradle.internal.reflect.*;
[ "com.google.common", "java.lang", "java.util", "org.gradle.internal" ]
com.google.common; java.lang; java.util; org.gradle.internal;
993,064
List<Resource> getRootResources() { List<Resource> rootResources = new ArrayList<Resource>(); for (Resource resource : models) { if (resource.getPath() != null) { rootResources.add(resource); } } return rootResources; }
List<Resource> getRootResources() { List<Resource> rootResources = new ArrayList<Resource>(); for (Resource resource : models) { if (resource.getPath() != null) { rootResources.add(resource); } } return rootResources; }
/** * Returns list of root resources. * * @return list of root resources. */
Returns list of root resources
getRootResources
{ "repo_name": "agentlab/org.glassfish.jersey", "path": "plugins/org.glassfish.jersey.server/src/main/java/org/glassfish/jersey/server/ResourceBag.java", "license": "epl-1.0", "size": 6331 }
[ "java.util.ArrayList", "java.util.List", "org.glassfish.jersey.server.model.Resource" ]
import java.util.ArrayList; import java.util.List; import org.glassfish.jersey.server.model.Resource;
import java.util.*; import org.glassfish.jersey.server.model.*;
[ "java.util", "org.glassfish.jersey" ]
java.util; org.glassfish.jersey;
1,081,775
@RequestMapping("/admin/hl7/hl7InQueuePending.htm") public String listPendingHL7s(ModelMap modelMap) { modelMap.addAttribute("messageState", HL7Constants.HL7_STATUS_PENDING); return "/admin/hl7/hl7InQueueList"; }
@RequestMapping(STR) String function(ModelMap modelMap) { modelMap.addAttribute(STR, HL7Constants.HL7_STATUS_PENDING); return STR; }
/** * Render the pending HL7 queue messages page * * @param modelMap * @return */
Render the pending HL7 queue messages page
listPendingHL7s
{ "repo_name": "Winbobob/openmrs-core", "path": "web/src/main/java/org/openmrs/hl7/web/controller/Hl7InQueueListController.java", "license": "mpl-2.0", "size": 5956 }
[ "org.openmrs.hl7.HL7Constants", "org.springframework.ui.ModelMap", "org.springframework.web.bind.annotation.RequestMapping" ]
import org.openmrs.hl7.HL7Constants; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping;
import org.openmrs.hl7.*; import org.springframework.ui.*; import org.springframework.web.bind.annotation.*;
[ "org.openmrs.hl7", "org.springframework.ui", "org.springframework.web" ]
org.openmrs.hl7; org.springframework.ui; org.springframework.web;
561,694
private DLNAResource createComboResource(DLNAResource original, DLNAMediaAudio audio, DLNAMediaSubtitle subtitle, Player player) { // FIXME: Use new DLNAResource() instead of clone(). Clone is bad, mmmkay? DLNAResource copy = original.clone(); copy.setMedia(original.getMedia()); copy.setNoName(true); copy.setMediaAudio(audio); copy.setMediaSubtitle(subtitle); copy.setPlayer(player); return copy; }
DLNAResource function(DLNAResource original, DLNAMediaAudio audio, DLNAMediaSubtitle subtitle, Player player) { DLNAResource copy = original.clone(); copy.setMedia(original.getMedia()); copy.setNoName(true); copy.setMediaAudio(audio); copy.setMediaSubtitle(subtitle); copy.setPlayer(player); return copy; }
/** * Create a copy of the provided original resource with the given audio * track, subtitles and player. * * @param original The original {@link DLNAResource} to create a copy of. * @param audio The audio track to use. * @param subtitle The subtitle track to use. * @param player The player to use. * @return The copy. */
Create a copy of the provided original resource with the given audio track, subtitles and player
createComboResource
{ "repo_name": "TheLQ/ps3mediaserver", "path": "src/main/java/net/pms/dlna/FileTranscodeVirtualFolder.java", "license": "gpl-2.0", "size": 7764 }
[ "net.pms.encoders.Player" ]
import net.pms.encoders.Player;
import net.pms.encoders.*;
[ "net.pms.encoders" ]
net.pms.encoders;
53,162
public static String getProperty(IBXMLAble xml, String instanceId, String propertyName) { XMLElement module = findModule(xml, instanceId); XMLElement property = findProperty(module, propertyName); if (property != null) { XMLElement value = property.getChild(XMLConstants.VALUE_STRING); return value.getText(); } return null; }
static String function(IBXMLAble xml, String instanceId, String propertyName) { XMLElement module = findModule(xml, instanceId); XMLElement property = findProperty(module, propertyName); if (property != null) { XMLElement value = property.getChild(XMLConstants.VALUE_STRING); return value.getText(); } return null; }
/** * Returns the first property if there is an array of properties set */
Returns the first property if there is an array of properties set
getProperty
{ "repo_name": "idega/platform2", "path": "src/com/idega/builder/business/XMLWriter.java", "license": "gpl-3.0", "size": 34844 }
[ "com.idega.xml.XMLElement" ]
import com.idega.xml.XMLElement;
import com.idega.xml.*;
[ "com.idega.xml" ]
com.idega.xml;
1,557,030
public void appendData(String value) throws DOMException { textNode.appendData(value); }
void function(String value) throws DOMException { textNode.appendData(value); }
/** * Append the string to the end of the character data of the node. Upon success, * <code>data</code> provides access to the concatenation of <code>data</code> and the * <code>DOMString</code> specified. * * @param value The <code>DOMString</code> to append. * @throws DOMException NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. */
Append the string to the end of the character data of the node. Upon success, <code>data</code> provides access to the concatenation of <code>data</code> and the <code>DOMString</code> specified
appendData
{ "repo_name": "arunasujith/wso2-axis2", "path": "modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java", "license": "apache-2.0", "size": 12850 }
[ "org.w3c.dom.DOMException" ]
import org.w3c.dom.DOMException;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,613,050
protected final boolean verify(Write write) { return verify(write, true); }
final boolean function(Write write) { return verify(write, true); }
/** * Shortcut method to verify {@code write}. This method is called from * {@link #add(String, TObject, long)} and * {@link #remove(String, TObject, long)} so that we can avoid creating a * duplicate Write. * * @param write * @return {@code true} if {@code write} currently exists */
Shortcut method to verify write. This method is called from <code>#add(String, TObject, long)</code> and <code>#remove(String, TObject, long)</code> so that we can avoid creating a duplicate Write
verify
{ "repo_name": "kylycht/concourse", "path": "concourse-server/src/main/java/com/cinchapi/concourse/server/storage/BufferedStore.java", "license": "apache-2.0", "size": 23966 }
[ "com.cinchapi.concourse.server.storage.temp.Write" ]
import com.cinchapi.concourse.server.storage.temp.Write;
import com.cinchapi.concourse.server.storage.temp.*;
[ "com.cinchapi.concourse" ]
com.cinchapi.concourse;
403,592
void unlink() throws PlatformException { if (this.algorithmLink) unlinkAlgorithms(); getFrom().removeNextElementLink(this); getTo().removePreviousElementLink(this); }
void unlink() throws PlatformException { if (this.algorithmLink) unlinkAlgorithms(); getFrom().removeNextElementLink(this); getTo().removePreviousElementLink(this); }
/** * Unlink the elements. * @throws PlatformException if an error occurs while linking the * elements */
Unlink the elements
unlink
{ "repo_name": "GenomicParisCentre/doelan", "path": "src/main/java/fr/ens/transcriptome/nividic/platform/workflow/WorkflowLink.java", "license": "gpl-2.0", "size": 7214 }
[ "fr.ens.transcriptome.nividic.platform.PlatformException" ]
import fr.ens.transcriptome.nividic.platform.PlatformException;
import fr.ens.transcriptome.nividic.platform.*;
[ "fr.ens.transcriptome" ]
fr.ens.transcriptome;
2,900,106
@Override public void enterImport_stmt(@NotNull Python3Parser.Import_stmtContext ctx) { }
@Override public void enterImport_stmt(@NotNull Python3Parser.Import_stmtContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitYield_expr
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/Python3BaseListener.java", "license": "gpl-3.0", "size": 30027 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
985,855
public InstructionHandle findHandle(final int pos) { final int[] positions = bytePositions; InstructionHandle ih = start; for (int i = 0; i < length; i++) { if (positions[i] == pos) { return ih; } ih = ih.getNext(); } return null; } public InstructionList(final byte[] code) { int count = 0; // Contains actual length int[] pos; InstructionHandle[] ihs; try (ByteSequence bytes = new ByteSequence(code)) { ihs = new InstructionHandle[code.length]; pos = new int[code.length]; // Can't be more than that while (bytes.available() > 0) { // Remember byte offset and associate it with the instruction final int off = bytes.getIndex(); pos[count] = off; final Instruction i = Instruction.readInstruction(bytes); InstructionHandle ih; if (i instanceof BranchInstruction) { ih = append((BranchInstruction) i); } else { ih = append(i); } ih.setPosition(off); ihs[count] = ih; count++; } } catch (final IOException e) { throw new ClassGenException(e.toString(), e); } bytePositions = new int[count]; // Trim to proper size System.arraycopy(pos, 0, bytePositions, 0, count); for (int i = 0; i < count; i++) { if (ihs[i] instanceof BranchHandle) { final BranchInstruction bi = (BranchInstruction) ihs[i].getInstruction(); int target = bi.getPosition() + bi.getIndex(); // Search for target position InstructionHandle ih = findHandle(ihs, pos, count, target); if (ih == null) { throw new ClassGenException("Couldn't find target for branch: " + bi); } bi.setTarget(ih); // Update target // If it is a Select instruction, update all branch targets if (bi instanceof Select) { // Either LOOKUPSWITCH or TABLESWITCH final Select s = (Select) bi; final int[] indices = s.getIndices(); for (int j = 0; j < indices.length; j++) { target = bi.getPosition() + indices[j]; ih = findHandle(ihs, pos, count, target); if (ih == null) { throw new ClassGenException("Couldn't find target for switch: " + bi); } s.setTarget(j, ih); // Update target } } } } }
InstructionHandle function(final int pos) { final int[] positions = bytePositions; InstructionHandle ih = start; for (int i = 0; i < length; i++) { if (positions[i] == pos) { return ih; } ih = ih.getNext(); } return null; } InstructionList(final byte[] code) { int count = 0; int[] pos; InstructionHandle[] ihs; try (ByteSequence bytes = new ByteSequence(code)) { ihs = new InstructionHandle[code.length]; pos = new int[code.length]; while (bytes.available() > 0) { final int off = bytes.getIndex(); pos[count] = off; final Instruction i = Instruction.readInstruction(bytes); InstructionHandle ih; if (i instanceof BranchInstruction) { ih = append((BranchInstruction) i); } else { ih = append(i); } ih.setPosition(off); ihs[count] = ih; count++; } } catch (final IOException e) { throw new ClassGenException(e.toString(), e); } bytePositions = new int[count]; System.arraycopy(pos, 0, bytePositions, 0, count); for (int i = 0; i < count; i++) { if (ihs[i] instanceof BranchHandle) { final BranchInstruction bi = (BranchInstruction) ihs[i].getInstruction(); int target = bi.getPosition() + bi.getIndex(); InstructionHandle ih = function(ihs, pos, count, target); if (ih == null) { throw new ClassGenException(STR + bi); } bi.setTarget(ih); if (bi instanceof Select) { final Select s = (Select) bi; final int[] indices = s.getIndices(); for (int j = 0; j < indices.length; j++) { target = bi.getPosition() + indices[j]; ih = findHandle(ihs, pos, count, target); if (ih == null) { throw new ClassGenException(STR + bi); } s.setTarget(j, ih); } } } } }
/** * Get instruction handle for instruction at byte code position pos. This only works properly, if the list is freshly initialized from a byte array or * setPositions() has been called before this method. * * @param pos * byte code position to search for * @return target position's instruction handle if available */
Get instruction handle for instruction at byte code position pos. This only works properly, if the list is freshly initialized from a byte array or setPositions() has been called before this method
findHandle
{ "repo_name": "apache/commons-bcel", "path": "src/main/java/org/apache/bcel/generic/InstructionList.java", "license": "apache-2.0", "size": 44901 }
[ "java.io.IOException", "org.apache.bcel.util.ByteSequence" ]
import java.io.IOException; import org.apache.bcel.util.ByteSequence;
import java.io.*; import org.apache.bcel.util.*;
[ "java.io", "org.apache.bcel" ]
java.io; org.apache.bcel;
2,886,179
private void loadTextures() { skin = new Skin(Gdx.files.internal(UI_FILE)); }
void function() { skin = new Skin(Gdx.files.internal(UI_FILE)); }
/** * Load view textures. * */
Load view textures
loadTextures
{ "repo_name": "alistairrutherford/noiz2-gdx", "path": "core/src/main/java/com/netthreads/gdx/app/layer/SettingsLayer.java", "license": "apache-2.0", "size": 5981 }
[ "com.badlogic.gdx.Gdx", "com.badlogic.gdx.scenes.scene2d.ui.Skin" ]
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.*; import com.badlogic.gdx.scenes.scene2d.ui.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
450,049
// [TARGET getAcl(BlobId, Entity)] // [VARIABLE "my_unique_bucket"] // [VARIABLE "my_blob_name"] // [VARIABLE 42] public Acl getBlobAcl(String bucketName, String blobName, long blobGeneration) { // [START getBlobAcl] BlobId blobId = BlobId.of(bucketName, blobName, blobGeneration); Acl acl = storage.getAcl(blobId, User.ofAllAuthenticatedUsers()); // [END getBlobAcl] return acl; }
Acl function(String bucketName, String blobName, long blobGeneration) { BlobId blobId = BlobId.of(bucketName, blobName, blobGeneration); Acl acl = storage.getAcl(blobId, User.ofAllAuthenticatedUsers()); return acl; }
/** * Example of getting the ACL entry for an entity on a blob. */
Example of getting the ACL entry for an entity on a blob
getBlobAcl
{ "repo_name": "shinfan/gcloud-java", "path": "google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/StorageSnippets.java", "license": "apache-2.0", "size": 35762 }
[ "com.google.cloud.storage.Acl", "com.google.cloud.storage.BlobId" ]
import com.google.cloud.storage.Acl; import com.google.cloud.storage.BlobId;
import com.google.cloud.storage.*;
[ "com.google.cloud" ]
com.google.cloud;
184,745
public void createConfigPanel() { if ( configPanel == null ) { Item[] items = new Item[3]; String ipAddress = "127.0.0.1"; String portNum = "1883"; String clientId = "MQTT_MIDLET"; // Query the record store (if we have opened it) for any previously set // IP address, port number or client identifier if ( config != null ) { byte[] ip = null; byte[] port = null; byte[] cid = null; try { ip = config.getRecord(1); if ( ip != null ) { ipAddress = new String(ip); } port = config.getRecord(2); if ( port != null ) { portNum = new String(port); } cid = config.getRecord(3); if ( cid != null ) { clientId = new String(cid); } } catch ( RecordStoreException rse ) { // Don't worry if something fails. The user can enter the information again } } // Build up the GUI objects TextField t1 = new TextField( "Client Id", clientId, 100, TextField.ANY ); TextField t2 = new TextField( "IP address", ipAddress, 100, TextField.ANY ); TextField t3 = new TextField( "IP port", portNum, 4, TextField.NUMERIC ); items[IDX_CLIENT_ID] = (Item)t1; items[IDX_IP_ADDR] = (Item)t2; items[IDX_PORT_NUM] = (Item)t3; Form f = new Form( "Connection", items ); f.addCommand( connect ); f.addCommand( cancel ); f.setCommandListener( this ); configPanel = f; Display.getDisplay(this).setCurrent( configPanel ); } }
void function() { if ( configPanel == null ) { Item[] items = new Item[3]; String ipAddress = STR; String portNum = "1883"; String clientId = STR; if ( config != null ) { byte[] ip = null; byte[] port = null; byte[] cid = null; try { ip = config.getRecord(1); if ( ip != null ) { ipAddress = new String(ip); } port = config.getRecord(2); if ( port != null ) { portNum = new String(port); } cid = config.getRecord(3); if ( cid != null ) { clientId = new String(cid); } } catch ( RecordStoreException rse ) { } } TextField t1 = new TextField( STR, clientId, 100, TextField.ANY ); TextField t2 = new TextField( STR, ipAddress, 100, TextField.ANY ); TextField t3 = new TextField( STR, portNum, 4, TextField.NUMERIC ); items[IDX_CLIENT_ID] = (Item)t1; items[IDX_IP_ADDR] = (Item)t2; items[IDX_PORT_NUM] = (Item)t3; Form f = new Form( STR, items ); f.addCommand( connect ); f.addCommand( cancel ); f.setCommandListener( this ); configPanel = f; Display.getDisplay(this).setCurrent( configPanel ); } }
/** * createConfigPanel * Build the lcdui display. Add the necessary fields to * a form and return the completed Displayable object. */
createConfigPanel Build the lcdui display. Add the necessary fields to a form and return the completed Displayable object
createConfigPanel
{ "repo_name": "gulliverrr/hestia-engine-dev", "path": "src/opt/boilercontrol/libs/org.eclipse.paho.jmeclient/org.eclipse.paho.jmeclient.mqttv3.MIDPSample/src/org/eclipse/paho/jmeclient/mqttv3/sampleMIDP/IA92.java", "license": "gpl-3.0", "size": 12572 }
[ "javax.microedition.lcdui.Display", "javax.microedition.lcdui.Form", "javax.microedition.lcdui.Item", "javax.microedition.lcdui.TextField", "javax.microedition.rms.RecordStoreException" ]
import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Item; import javax.microedition.lcdui.TextField; import javax.microedition.rms.RecordStoreException;
import javax.microedition.lcdui.*; import javax.microedition.rms.*;
[ "javax.microedition" ]
javax.microedition;
1,085,504
private void renderRaster(Graphic g) { if (rasterableWater.getRasterIndex(0) > 0) { rasterableWater.render(g); } }
void function(Graphic g) { if (rasterableWater.getRasterIndex(0) > 0) { rasterableWater.render(g); } }
/** * Render raster. * * @param g The graphic output. */
Render raster
renderRaster
{ "repo_name": "b3dgs/lionheart-remake", "path": "lionheart-game/src/main/java/com/b3dgs/lionheart/object/feature/Underwater.java", "license": "gpl-3.0", "size": 6465 }
[ "com.b3dgs.lionengine.graphic.Graphic" ]
import com.b3dgs.lionengine.graphic.Graphic;
import com.b3dgs.lionengine.graphic.*;
[ "com.b3dgs.lionengine" ]
com.b3dgs.lionengine;
2,149,632
private static Map<String, Object> sanitiseProperties(Map<?, ?> data) { Map<String, Object> cleaned = Maps.newHashMap(); for (Entry<?, ?> entry : data.entrySet()) { Object value = entry.getValue(); // Allow any null value, as long as it's not an empty array if (value != null && !isEmptySequence(value)) { cleaned.put((String) entry.getKey(), entry.getValue()); } } return cleaned; }
static Map<String, Object> function(Map<?, ?> data) { Map<String, Object> cleaned = Maps.newHashMap(); for (Entry<?, ?> entry : data.entrySet()) { Object value = entry.getValue(); if (value != null && !isEmptySequence(value)) { cleaned.put((String) entry.getKey(), entry.getValue()); } } return cleaned; }
/** * Filter null values out of a map. * * @param data * @return */
Filter null values out of a map
sanitiseProperties
{ "repo_name": "lindareijnhoudt/neo4j-ehri-plugin", "path": "ehri-frames/src/main/java/eu/ehri/project/persistance/DataConverter.java", "license": "gpl-3.0", "size": 13027 }
[ "com.google.common.collect.Maps", "java.util.Map" ]
import com.google.common.collect.Maps; import java.util.Map;
import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,677,452
public void onAddedTo(@Nonnull Run build) { if (build instanceof AbstractBuild) { onAddedTo((AbstractBuild) build); } }
void function(@Nonnull Run build) { if (build instanceof AbstractBuild) { onAddedTo((AbstractBuild) build); } }
/** * Called when the cause is registered. * @since 1.568 */
Called when the cause is registered
onAddedTo
{ "repo_name": "gusreiber/jenkins", "path": "core/src/main/java/hudson/model/Cause.java", "license": "mit", "size": 15691 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,375,611
ICreateTyped createTyped = client.create().resource(resource); processOptionalParams(url, preferReturn, createTyped); ExtraParameters.process(extraParameters, createTyped); return createTyped.execute(); } /** * Creates a {@link IBaseResource} on the server * * @param resourceAsString The resource to create * @param url The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>, * for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code>, may be null * @param preferReturn Add a <code>Prefer</code> header to the request, which requests that the server include * or suppress the resource body as a part of the result. If a resource is returned by the server * it will be parsed an accessible to the client via {@link MethodOutcome#getResource()}, may be null * @param extraParameters see {@link ExtraParameters} for a full list of parameters that can be passed, may be NULL * @return The {@link MethodOutcome}
ICreateTyped createTyped = client.create().resource(resource); processOptionalParams(url, preferReturn, createTyped); ExtraParameters.process(extraParameters, createTyped); return createTyped.execute(); } /** * Creates a {@link IBaseResource} on the server * * @param resourceAsString The resource to create * @param url The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>, * for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code>, may be null * @param preferReturn Add a <code>Prefer</code> header to the request, which requests that the server include * or suppress the resource body as a part of the result. If a resource is returned by the server * it will be parsed an accessible to the client via {@link MethodOutcome#getResource()}, may be null * @param extraParameters see {@link ExtraParameters} for a full list of parameters that can be passed, may be NULL * @return The {@link MethodOutcome}
/** * Creates a {@link IBaseResource} on the server * * @param resource The resource to create * @param url The search URL to use. The format of this URL should be of the form <code>[ResourceType]?[Parameters]</code>, * for example: <code>Patient?name=Smith&amp;identifier=13.2.4.11.4%7C847366</code>, may be null * @param preferReturn Add a <code>Prefer</code> header to the request, which requests that the server include * or suppress the resource body as a part of the result. If a resource is returned by the server * it will be parsed an accessible to the client via {@link MethodOutcome#getResource()}, may be null * @param extraParameters see {@link ExtraParameters} for a full list of parameters that can be passed, may be NULL * @return The {@link MethodOutcome} */
Creates a <code>IBaseResource</code> on the server
resource
{ "repo_name": "Fabryprog/camel", "path": "components/camel-fhir/camel-fhir-api/src/main/java/org/apache/camel/component/fhir/api/FhirCreate.java", "license": "apache-2.0", "size": 4249 }
[ "ca.uhn.fhir.rest.api.MethodOutcome", "ca.uhn.fhir.rest.gclient.ICreateTyped", "org.hl7.fhir.instance.model.api.IBaseResource" ]
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.gclient.ICreateTyped; import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.rest.api.*; import ca.uhn.fhir.rest.gclient.*; import org.hl7.fhir.instance.model.api.*;
[ "ca.uhn.fhir", "org.hl7.fhir" ]
ca.uhn.fhir; org.hl7.fhir;
2,089,306
DependencyDescriptor getDescriptor();
DependencyDescriptor getDescriptor();
/** * Returns this dependency as an Ivy DependencyDescriptor. This method is here to allow us to migrate away from the Ivy types * and will be removed. * * <p>You should avoid using this method. */
Returns this dependency as an Ivy DependencyDescriptor. This method is here to allow us to migrate away from the Ivy types and will be removed. You should avoid using this method
getDescriptor
{ "repo_name": "cams7/gradle-samples", "path": "plugin/dependency-management/src/main/java/org/gradle/internal/component/model/DependencyMetaData.java", "license": "gpl-2.0", "size": 2631 }
[ "org.apache.ivy.core.module.descriptor.DependencyDescriptor" ]
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.*;
[ "org.apache.ivy" ]
org.apache.ivy;
1,147,805
@Deprecated public Charset getCharSet() { return getCharset(); }
Charset function() { return getCharset(); }
/** * Return the character set, as indicated by a {@code charset} parameter, if any. * @return the character set, or {@code null} if not available * @deprecated as of Spring 4.3, in favor of {@link #getCharset()} with its name * aligned with the Java return type name */
Return the character set, as indicated by a charset parameter, if any
getCharSet
{ "repo_name": "lamsfoundation/lams", "path": "3rdParty_sources/spring/org/springframework/util/MimeType.java", "license": "gpl-2.0", "size": 17979 }
[ "java.nio.charset.Charset" ]
import java.nio.charset.Charset;
import java.nio.charset.*;
[ "java.nio" ]
java.nio;
2,337,958
@Test public void testStableName() { DoFnInvoker<Void, Void> invoker = DoFnInvokers.invokerFor(new StableNameTestDoFn()); assertThat( invoker.getClass().getName(), equalTo( String.format( "%s$%s", StableNameTestDoFn.class.getName(), DoFnInvoker.class.getSimpleName()))); }
void function() { DoFnInvoker<Void, Void> invoker = DoFnInvokers.invokerFor(new StableNameTestDoFn()); assertThat( invoker.getClass().getName(), equalTo( String.format( "%s$%s", StableNameTestDoFn.class.getName(), DoFnInvoker.class.getSimpleName()))); }
/** * This is a change-detector test that the generated name is stable across runs. */
This is a change-detector test that the generated name is stable across runs
testStableName
{ "repo_name": "shakamunyi/beam", "path": "sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/reflect/DoFnInvokersTest.java", "license": "apache-2.0", "size": 28031 }
[ "org.hamcrest.Matchers", "org.junit.Assert" ]
import org.hamcrest.Matchers; import org.junit.Assert;
import org.hamcrest.*; import org.junit.*;
[ "org.hamcrest", "org.junit" ]
org.hamcrest; org.junit;
2,237,228
//@ImageOptions(flipRtl = true) @Source("/images/simplePagerFastForward.png") ImageResource simplePagerFastForward();
@Source(STR) ImageResource simplePagerFastForward();
/** * The image used to skip ahead multiple pages. * * @return the image resource */
The image used to skip ahead multiple pages
simplePagerFastForward
{ "repo_name": "JaLandry/MeasureAuthoringTool_LatestSprint", "path": "mat/src/mat/client/CustomPager.java", "license": "apache-2.0", "size": 22118 }
[ "com.google.gwt.resources.client.ImageResource" ]
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.*;
[ "com.google.gwt" ]
com.google.gwt;
412,437
protected List<String> reconcileColumnsToUse(List<String> declaredColumns, String[] generatedKeyNames) { if (generatedKeyNames.length > 0) { this.generatedKeyColumnsUsed = true; } if (declaredColumns.size() > 0) { return new ArrayList<String>(declaredColumns); } Set<String> keys = new HashSet<String>(generatedKeyNames.length); for (String key : generatedKeyNames) { keys.add(key.toUpperCase()); } List<String> columns = new ArrayList<String>(); for (TableParameterMetaData meta : metaDataProvider.getTableParameterMetaData()) { if (!keys.contains(meta.getParameterName().toUpperCase())) { columns.add(meta.getParameterName()); } } return columns; }
List<String> function(List<String> declaredColumns, String[] generatedKeyNames) { if (generatedKeyNames.length > 0) { this.generatedKeyColumnsUsed = true; } if (declaredColumns.size() > 0) { return new ArrayList<String>(declaredColumns); } Set<String> keys = new HashSet<String>(generatedKeyNames.length); for (String key : generatedKeyNames) { keys.add(key.toUpperCase()); } List<String> columns = new ArrayList<String>(); for (TableParameterMetaData meta : metaDataProvider.getTableParameterMetaData()) { if (!keys.contains(meta.getParameterName().toUpperCase())) { columns.add(meta.getParameterName()); } } return columns; }
/** * Compare columns created from metadata with declared columns and return a reconciled list. * @param declaredColumns declared column names * @param generatedKeyNames names of generated key columns */
Compare columns created from metadata with declared columns and return a reconciled list
reconcileColumnsToUse
{ "repo_name": "leogoing/spring_jeesite", "path": "spring-jdbc-4.0/org/springframework/jdbc/core/metadata/TableMetaDataContext.java", "license": "apache-2.0", "size": 11726 }
[ "java.util.ArrayList", "java.util.HashSet", "java.util.List", "java.util.Set" ]
import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
384,609
public LinkedList<Operation> getNext() { LinkedList<Operation> ops = null; synchronized (this) { // turn in our previous assignment completeAssignment(); String newAssignment; // wait until there is work to do while ((newAssignment = selectNewAssignment()) == null) { try { wait(); } catch (InterruptedException e) { } } // initialize start time for stats if (getStartTime() == 0) setStartTime(System.currentTimeMillis()); // reserve the assignment and take work items ops = takeAssignment(newAssignment); // keep stats if (ops != null) { for(Operation op : ops) { setTotalOperationsPending(getTotalOperationsPending()-op.getCount()); setDequeuedOperations(getDequeuedOperations() + op.getCount()); if (op.isSignificant()) { setSignificantOpsDequeued(getSignificantOpsDequeued() + op.getCount()); } } setDequeuedItems(getDequeuedItems() + 1); } } return ops; }
LinkedList<Operation> function() { LinkedList<Operation> ops = null; synchronized (this) { completeAssignment(); String newAssignment; while ((newAssignment = selectNewAssignment()) == null) { try { wait(); } catch (InterruptedException e) { } } if (getStartTime() == 0) setStartTime(System.currentTimeMillis()); ops = takeAssignment(newAssignment); if (ops != null) { for(Operation op : ops) { setTotalOperationsPending(getTotalOperationsPending()-op.getCount()); setDequeuedOperations(getDequeuedOperations() + op.getCount()); if (op.isSignificant()) { setSignificantOpsDequeued(getSignificantOpsDequeued() + op.getCount()); } } setDequeuedItems(getDequeuedItems() + 1); } } return ops; }
/** * Get the operations for the next file that should be worked on. * * @return a linkedList of operations to be processed all for the same file. */
Get the operations for the next file that should be worked on
getNext
{ "repo_name": "RangerRick/opennms", "path": "opennms-rrd/opennms-rrd-api/src/main/java/org/opennms/netmgt/rrd/QueuingRrdStrategy.java", "license": "gpl-2.0", "size": 46497 }
[ "java.util.LinkedList" ]
import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
2,870,642
@Override public double[] getMembershipValues(Instance instance) throws Exception { if (m_zeroR != null) { double[] m = new double[1]; m[0] = instance.weight(); return m; } else { // Set up array for membership values double[] a = new double[numElements()]; // Initialize queues Queue<Double> queueOfWeights = new LinkedList<Double>(); Queue<Tree> queueOfNodes = new LinkedList<Tree>(); queueOfWeights.add(instance.weight()); queueOfNodes.add(m_Tree); int index = 0; // While the queue is not empty while (!queueOfNodes.isEmpty()) { a[index++] = queueOfWeights.poll(); Tree node = queueOfNodes.poll(); // Is node a leaf? if (node.m_Attribute <= -1) { continue; } // Compute weight distribution double[] weights = new double[node.m_Successors.length]; if (instance.isMissing(node.m_Attribute)) { System.arraycopy(node.m_Prop, 0, weights, 0, node.m_Prop.length); } else if (m_Info.attribute(node.m_Attribute).isNominal()) { weights[(int) instance.value(node.m_Attribute)] = 1.0; } else { if (instance.value(node.m_Attribute) < node.m_SplitPoint) { weights[0] = 1.0; } else { weights[1] = 1.0; } } for (int i = 0; i < node.m_Successors.length; i++) { queueOfNodes.add(node.m_Successors[i]); queueOfWeights.add(a[index - 1] * weights[i]); } } return a; } }
double[] function(Instance instance) throws Exception { if (m_zeroR != null) { double[] m = new double[1]; m[0] = instance.weight(); return m; } else { double[] a = new double[numElements()]; Queue<Double> queueOfWeights = new LinkedList<Double>(); Queue<Tree> queueOfNodes = new LinkedList<Tree>(); queueOfWeights.add(instance.weight()); queueOfNodes.add(m_Tree); int index = 0; while (!queueOfNodes.isEmpty()) { a[index++] = queueOfWeights.poll(); Tree node = queueOfNodes.poll(); if (node.m_Attribute <= -1) { continue; } double[] weights = new double[node.m_Successors.length]; if (instance.isMissing(node.m_Attribute)) { System.arraycopy(node.m_Prop, 0, weights, 0, node.m_Prop.length); } else if (m_Info.attribute(node.m_Attribute).isNominal()) { weights[(int) instance.value(node.m_Attribute)] = 1.0; } else { if (instance.value(node.m_Attribute) < node.m_SplitPoint) { weights[0] = 1.0; } else { weights[1] = 1.0; } } for (int i = 0; i < node.m_Successors.length; i++) { queueOfNodes.add(node.m_Successors[i]); queueOfWeights.add(a[index - 1] * weights[i]); } } return a; } }
/** * Computes array that indicates node membership. Array locations are * allocated based on breadth-first exploration of the tree. */
Computes array that indicates node membership. Array locations are allocated based on breadth-first exploration of the tree
getMembershipValues
{ "repo_name": "daniyar-artykov/j2ee", "path": "Weka_Parallel_Test/weka/weka/classifiers/trees/RandomTree.java", "license": "apache-2.0", "size": 57257 }
[ "java.util.LinkedList", "java.util.Queue" ]
import java.util.LinkedList; import java.util.Queue;
import java.util.*;
[ "java.util" ]
java.util;
1,444,427
EAttribute getFill_Gradientcolor();
EAttribute getFill_Gradientcolor();
/** * Returns the meta object for the attribute '{@link fr.lip6.move.pnml.ptnet.Fill#getGradientcolor <em>Gradientcolor</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Gradientcolor</em>'. * @see fr.lip6.move.pnml.ptnet.Fill#getGradientcolor() * @see #getFill() * @generated */
Returns the meta object for the attribute '<code>fr.lip6.move.pnml.ptnet.Fill#getGradientcolor Gradientcolor</code>'.
getFill_Gradientcolor
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-PTNet/src/fr/lip6/move/pnml/ptnet/PtnetPackage.java", "license": "epl-1.0", "size": 146931 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,556,517
public void testWriteEnd() throws IOException { }
void function() throws IOException { }
/** * Test writeEnd() - test that the contract is maintained with {@link AbstractStructuredObject}. * * @throws IOException */
Test writeEnd() - test that the contract is maintained with <code>AbstractStructuredObject</code>
testWriteEnd
{ "repo_name": "pellcorp/fop", "path": "test/java/org/apache/fop/afp/modca/AbstractStructuredObjectTest.java", "license": "apache-2.0", "size": 1966 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,499,395
private static CFG buildScriptCFG(ScriptNode scriptNode) { String name = "FUNCTION"; if(scriptNode instanceof AstRoot) name = "SCRIPT"; CFGNode scriptEntry = new CFGNode(scriptNode, name + "_ENTRY"); CFGNode scriptExit = new CFGNode(new EmptyStatement(), name + "_EXIT"); CFG cfg = new CFG(scriptEntry); cfg.addExitNode(scriptExit); CFG subGraph = JavaScriptCFGFactory.build(scriptNode); if(subGraph == null) { CFGNode empty = new CFGNode(new EmptyStatement()); subGraph = new CFG(empty); subGraph.addExitNode(empty); } scriptEntry.addEdge(null, subGraph.getEntryNode()); for(CFGNode exitNode : subGraph.getExitNodes()) { exitNode.addEdge(null, scriptExit); } for(CFGNode returnNode : subGraph.getReturnNodes()) { returnNode.addEdge(null, scriptExit); } return cfg; }
static CFG function(ScriptNode scriptNode) { String name = STR; if(scriptNode instanceof AstRoot) name = STR; CFGNode scriptEntry = new CFGNode(scriptNode, name + STR); CFGNode scriptExit = new CFGNode(new EmptyStatement(), name + "_EXIT"); CFG cfg = new CFG(scriptEntry); cfg.addExitNode(scriptExit); CFG subGraph = JavaScriptCFGFactory.build(scriptNode); if(subGraph == null) { CFGNode empty = new CFGNode(new EmptyStatement()); subGraph = new CFG(empty); subGraph.addExitNode(empty); } scriptEntry.addEdge(null, subGraph.getEntryNode()); for(CFGNode exitNode : subGraph.getExitNodes()) { exitNode.addEdge(null, scriptExit); } for(CFGNode returnNode : subGraph.getReturnNodes()) { returnNode.addEdge(null, scriptExit); } return cfg; }
/** * Builds a CFG for a function or script. * @param scriptNode An ASTRoot node or FunctionNode. * @return The complete CFG. */
Builds a CFG for a function or script
buildScriptCFG
{ "repo_name": "saltlab/Pangor", "path": "js/src/ca/ubc/ece/salt/pangor/js/cfg/JavaScriptCFGFactory.java", "license": "apache-2.0", "size": 36689 }
[ "ca.ubc.ece.salt.pangor.cfg.CFGNode", "org.mozilla.javascript.ast.AstRoot", "org.mozilla.javascript.ast.EmptyStatement", "org.mozilla.javascript.ast.ScriptNode" ]
import ca.ubc.ece.salt.pangor.cfg.CFGNode; import org.mozilla.javascript.ast.AstRoot; import org.mozilla.javascript.ast.EmptyStatement; import org.mozilla.javascript.ast.ScriptNode;
import ca.ubc.ece.salt.pangor.cfg.*; import org.mozilla.javascript.ast.*;
[ "ca.ubc.ece", "org.mozilla.javascript" ]
ca.ubc.ece; org.mozilla.javascript;
743,732
public List getConnectorTypeVals() { return this.connectorTypeVals; }
List function() { return this.connectorTypeVals; }
/** * Return the connectorTypeVals. */
Return the connectorTypeVals
getConnectorTypeVals
{ "repo_name": "devjin24/howtomcatworks", "path": "bookrefer/jakarta-tomcat-5.0.18-src/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/connector/ConnectorForm.java", "license": "apache-2.0", "size": 26566 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,420,906
public String generateSectionLabel(PieDataset dataset, Comparable key) { int index = getIndex(key); builder.delete(0, builder.length()); builder.append(key.toString()); builder.append(" = "); if(index > -1){ double per = percents[index]; Util.convertBytes(builder, counts[index], true); //get a trunkated percentage. double percent = per/totalPercent; percent *= 10000.0; percent = (int)percent; percent /= 100.0; builder.append(" ("); builder.append(Double.toString(percent)); builder.append("%)"); return builder.toString(); } return ""; }
String function(PieDataset dataset, Comparable key) { int index = getIndex(key); builder.delete(0, builder.length()); builder.append(key.toString()); builder.append(STR); if(index > -1){ double per = percents[index]; Util.convertBytes(builder, counts[index], true); double percent = per/totalPercent; percent *= 10000.0; percent = (int)percent; percent /= 100.0; builder.append(STR); builder.append(Double.toString(percent)); builder.append("%)"); return builder.toString(); } return ""; }
/** * Generate the label */
Generate the label
generateSectionLabel
{ "repo_name": "nologic/nabs", "path": "client/trunk/modules/pieChart/src/eunomia/plugin/gui/pieChart/Main.java", "license": "gpl-2.0", "size": 13101 }
[ "com.vivic.eunomia.sys.util.Util", "org.jfree.data.general.PieDataset" ]
import com.vivic.eunomia.sys.util.Util; import org.jfree.data.general.PieDataset;
import com.vivic.eunomia.sys.util.*; import org.jfree.data.general.*;
[ "com.vivic.eunomia", "org.jfree.data" ]
com.vivic.eunomia; org.jfree.data;
585,151
Collection<PropAwardPersonRole> getRolesByHierarchy(String sponsorCode);
Collection<PropAwardPersonRole> getRolesByHierarchy(String sponsorCode);
/** * Gets the set of PropAwardPersonRole entries based on the sponsor code and applicable * sponsor hierarchy the sponsor is in * @param sponsorCode * @return */
Gets the set of PropAwardPersonRole entries based on the sponsor code and applicable sponsor hierarchy the sponsor is in
getRolesByHierarchy
{ "repo_name": "mukadder/kc", "path": "coeus-impl/src/main/java/org/kuali/coeus/common/framework/person/PropAwardPersonRoleService.java", "license": "agpl-3.0", "size": 2229 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
666,946
public final void showToolButton(@NotNull IsWidget button) { if (button != null) { toolbarHeader.setWidgetHidden(button.asWidget(), false); } }
final void function(@NotNull IsWidget button) { if (button != null) { toolbarHeader.setWidgetHidden(button.asWidget(), false); } }
/** * Sets button visible on part toolbar. * * @param button button */
Sets button visible on part toolbar
showToolButton
{ "repo_name": "gazarenkov/che-sketch", "path": "ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/parts/base/BaseView.java", "license": "epl-1.0", "size": 11127 }
[ "com.google.gwt.user.client.ui.IsWidget", "javax.validation.constraints.NotNull" ]
import com.google.gwt.user.client.ui.IsWidget; import javax.validation.constraints.NotNull;
import com.google.gwt.user.client.ui.*; import javax.validation.constraints.*;
[ "com.google.gwt", "javax.validation" ]
com.google.gwt; javax.validation;
2,445,257
protected static int convertType(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_TYPE_ATTRIBUTE}); } if (SVG_DISCRETE_VALUE.equals(s)) { return ComponentTransferFunction.DISCRETE; } if (SVG_IDENTITY_VALUE.equals(s)) { return ComponentTransferFunction.IDENTITY; } if (SVG_GAMMA_VALUE.equals(s)) { return ComponentTransferFunction.GAMMA; } if (SVG_LINEAR_VALUE.equals(s)) { return ComponentTransferFunction.LINEAR; } if (SVG_TABLE_VALUE.equals(s)) { return ComponentTransferFunction.TABLE; } throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TYPE_ATTRIBUTE, s}); } }
static int function(Element e, BridgeContext ctx) { String s = e.getAttributeNS(null, SVG_TYPE_ATTRIBUTE); if (s.length() == 0) { throw new BridgeException(ctx, e, ERR_ATTRIBUTE_MISSING, new Object[] {SVG_TYPE_ATTRIBUTE}); } if (SVG_DISCRETE_VALUE.equals(s)) { return ComponentTransferFunction.DISCRETE; } if (SVG_IDENTITY_VALUE.equals(s)) { return ComponentTransferFunction.IDENTITY; } if (SVG_GAMMA_VALUE.equals(s)) { return ComponentTransferFunction.GAMMA; } if (SVG_LINEAR_VALUE.equals(s)) { return ComponentTransferFunction.LINEAR; } if (SVG_TABLE_VALUE.equals(s)) { return ComponentTransferFunction.TABLE; } throw new BridgeException(ctx, e, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_TYPE_ATTRIBUTE, s}); } }
/** * Converts the type of the specified component transfert * function element. * * @param e the element that represents a component transfer function * @param ctx the BridgeContext to use for error information */
Converts the type of the specified component transfert function element
convertType
{ "repo_name": "sflyphotobooks/crp-batik", "path": "sources/org/apache/batik/bridge/SVGFeComponentTransferElementBridge.java", "license": "apache-2.0", "size": 13388 }
[ "org.apache.batik.ext.awt.image.ComponentTransferFunction", "org.w3c.dom.Element" ]
import org.apache.batik.ext.awt.image.ComponentTransferFunction; import org.w3c.dom.Element;
import org.apache.batik.ext.awt.image.*; import org.w3c.dom.*;
[ "org.apache.batik", "org.w3c.dom" ]
org.apache.batik; org.w3c.dom;
1,891,273
@Override public void merge(Response other) { log.trace("Index-lookup merge called"); if (!(other instanceof IndexResponse)) { throw new IllegalArgumentException(String.format("Expected index response of class '%s' but got '%s'", getClass().toString(), other.getClass().toString())); } super.merge(other); IndexResponse indexResponse = (IndexResponse) other; outer: for (Pair<String, Integer> oPair : indexResponse.getIndex()) { for (Pair<String, Integer> tPair : getIndex()) { if (oPair.getKey().equals(tPair.getKey())) { tPair.setValue(tPair.getValue() + oPair.getValue()); continue outer; } } getIndex().add(oPair); } } private static class SensitiveComparator implements Comparator<Pair<String, Integer>>, Serializable { private static final long serialVersionUID = 798341696165L; private Collator collator = null; public SensitiveComparator(Collator collator) { this.collator = collator; } public SensitiveComparator() { }
void function(Response other) { log.trace(STR); if (!(other instanceof IndexResponse)) { throw new IllegalArgumentException(String.format(STR, getClass().toString(), other.getClass().toString())); } super.merge(other); IndexResponse indexResponse = (IndexResponse) other; outer: for (Pair<String, Integer> oPair : indexResponse.getIndex()) { for (Pair<String, Integer> tPair : getIndex()) { if (oPair.getKey().equals(tPair.getKey())) { tPair.setValue(tPair.getValue() + oPair.getValue()); continue outer; } } getIndex().add(oPair); } } private static class SensitiveComparator implements Comparator<Pair<String, Integer>>, Serializable { private static final long serialVersionUID = 798341696165L; private Collator collator = null; public SensitiveComparator(Collator collator) { this.collator = collator; } public SensitiveComparator() { }
/** * Merge the other SearchResult into this result. * * @param other the index lookup result that should be merged into this. */
Merge the other SearchResult into this result
merge
{ "repo_name": "statsbiblioteket/summa", "path": "Core/src/main/java/dk/statsbiblioteket/summa/facetbrowser/api/IndexResponse.java", "license": "apache-2.0", "size": 10159 }
[ "com.ibm.icu.text.Collator", "dk.statsbiblioteket.summa.common.util.Pair", "dk.statsbiblioteket.summa.search.api.Response", "java.io.Serializable", "java.util.Comparator" ]
import com.ibm.icu.text.Collator; import dk.statsbiblioteket.summa.common.util.Pair; import dk.statsbiblioteket.summa.search.api.Response; import java.io.Serializable; import java.util.Comparator;
import com.ibm.icu.text.*; import dk.statsbiblioteket.summa.common.util.*; import dk.statsbiblioteket.summa.search.api.*; import java.io.*; import java.util.*;
[ "com.ibm.icu", "dk.statsbiblioteket.summa", "java.io", "java.util" ]
com.ibm.icu; dk.statsbiblioteket.summa; java.io; java.util;
2,201,241
@Test(timeout = 500) public void testSimpleRun() throws Exception { member = buildCohortMember(); EmptySubprocedure subproc = new EmptySubprocedure(member, mockListener); EmptySubprocedure spy = spy(subproc); when(mockBuilder.buildSubprocedure(op, data)).thenReturn(spy); // when we get a prepare, then start the commit phase addCommitAnswer(); // run the operation // build a new operation Subprocedure subproc1 = member.createSubprocedure(op, data); member.submitSubprocedure(subproc1); // and wait for it to finish subproc.waitForLocallyCompleted(); // make sure everything ran in order InOrder order = inOrder(mockMemberComms, spy); order.verify(spy).acquireBarrier(); order.verify(mockMemberComms).sendMemberAcquired(eq(spy)); order.verify(spy).insideBarrier(); order.verify(mockMemberComms).sendMemberCompleted(eq(spy), eq(data)); order.verify(mockMemberComms, never()).sendMemberAborted(eq(spy), any(ForeignException.class)); }
@Test(timeout = 500) void function() throws Exception { member = buildCohortMember(); EmptySubprocedure subproc = new EmptySubprocedure(member, mockListener); EmptySubprocedure spy = spy(subproc); when(mockBuilder.buildSubprocedure(op, data)).thenReturn(spy); addCommitAnswer(); Subprocedure subproc1 = member.createSubprocedure(op, data); member.submitSubprocedure(subproc1); subproc.waitForLocallyCompleted(); InOrder order = inOrder(mockMemberComms, spy); order.verify(spy).acquireBarrier(); order.verify(mockMemberComms).sendMemberAcquired(eq(spy)); order.verify(spy).insideBarrier(); order.verify(mockMemberComms).sendMemberCompleted(eq(spy), eq(data)); order.verify(mockMemberComms, never()).sendMemberAborted(eq(spy), any(ForeignException.class)); }
/** * Test the normal sub procedure execution case. */
Test the normal sub procedure execution case
testSimpleRun
{ "repo_name": "gustavoanatoly/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/procedure/TestProcedureMember.java", "license": "apache-2.0", "size": 17731 }
[ "org.apache.hadoop.hbase.errorhandling.ForeignException", "org.junit.Test", "org.mockito.InOrder", "org.mockito.Matchers", "org.mockito.Mockito" ]
import org.apache.hadoop.hbase.errorhandling.ForeignException; import org.junit.Test; import org.mockito.InOrder; import org.mockito.Matchers; import org.mockito.Mockito;
import org.apache.hadoop.hbase.errorhandling.*; import org.junit.*; import org.mockito.*;
[ "org.apache.hadoop", "org.junit", "org.mockito" ]
org.apache.hadoop; org.junit; org.mockito;
2,674,334
@SuppressWarnings("unchecked") @Nullable public <T> T fromYaml(String yaml, Class<T> type) { return (T) this.loadFromReader(new StreamReader(yaml), type); }
@SuppressWarnings(STR) <T> T function(String yaml, Class<T> type) { return (T) this.loadFromReader(new StreamReader(yaml), type); }
/** * Parse the only YAML document in a String and produce the corresponding * Java object. (Because the encoding in known BOM is not respected.) * * @param <T> * Class is defined by the second argument * @param yaml * YAML data to load from (BOM must not be present) * @param type * Class of the object to be created * * @return parsed object */
Parse the only YAML document in a String and produce the corresponding Java object. (Because the encoding in known BOM is not respected.)
fromYaml
{ "repo_name": "GotoFinal/diorite-configs-java8", "path": "src/main/java/org/diorite/config/serialization/snakeyaml/Yaml.java", "license": "mit", "size": 33096 }
[ "org.yaml.snakeyaml.reader.StreamReader" ]
import org.yaml.snakeyaml.reader.StreamReader;
import org.yaml.snakeyaml.reader.*;
[ "org.yaml.snakeyaml" ]
org.yaml.snakeyaml;
1,599,243
public void listTransferConfigs(com.google.cloud.bigquery.datatransfer.v1.ListTransferConfigsRequest request, io.grpc.stub.StreamObserver<com.google.cloud.bigquery.datatransfer.v1.ListTransferConfigsResponse> responseObserver) { asyncUnimplementedUnaryCall(getListTransferConfigsMethodHelper(), responseObserver); }
void function(com.google.cloud.bigquery.datatransfer.v1.ListTransferConfigsRequest request, io.grpc.stub.StreamObserver<com.google.cloud.bigquery.datatransfer.v1.ListTransferConfigsResponse> responseObserver) { asyncUnimplementedUnaryCall(getListTransferConfigsMethodHelper(), responseObserver); }
/** * <pre> * Returns information about all data transfers in the project. * </pre> */
<code> Returns information about all data transfers in the project. </code>
listTransferConfigs
{ "repo_name": "pongad/api-client-staging", "path": "generated/java/grpc-google-cloud-bigquerydatatransfer-v1/src/main/java/com/google/cloud/bigquery/datatransfer/v1/DataTransferServiceGrpc.java", "license": "bsd-3-clause", "size": 79279 }
[ "io.grpc.stub.ServerCalls" ]
import io.grpc.stub.ServerCalls;
import io.grpc.stub.*;
[ "io.grpc.stub" ]
io.grpc.stub;
1,034,044
public Properties getProperties() { return properties; }
Properties function() { return properties; }
/** * Gets this tasks configured properties. * * @return The Properties. */
Gets this tasks configured properties
getProperties
{ "repo_name": "ervandew/formic", "path": "src/java/org/formic/ant/type/Step.java", "license": "lgpl-2.1", "size": 2083 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
2,838,520
@javax.annotation.Nullable @ApiModelProperty(value = "") public V1SecretReference getControllerExpandSecretRef() { return controllerExpandSecretRef; }
@javax.annotation.Nullable @ApiModelProperty(value = "") V1SecretReference function() { return controllerExpandSecretRef; }
/** * Get controllerExpandSecretRef * * @return controllerExpandSecretRef */
Get controllerExpandSecretRef
getControllerExpandSecretRef
{ "repo_name": "kubernetes-client/java", "path": "kubernetes/src/main/java/io/kubernetes/client/openapi/models/V1CSIPersistentVolumeSource.java", "license": "apache-2.0", "size": 11268 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
839,348
public ClusterGroupExpression getClusterGroupExpression() { return clusterGroupExpression; }
ClusterGroupExpression function() { return clusterGroupExpression; }
/** * Gets the cluster group expression. */
Gets the cluster group expression
getClusterGroupExpression
{ "repo_name": "DariusX/camel", "path": "components/camel-ignite/src/main/java/org/apache/camel/component/ignite/events/IgniteEventsEndpoint.java", "license": "apache-2.0", "size": 5887 }
[ "org.apache.camel.component.ignite.ClusterGroupExpression" ]
import org.apache.camel.component.ignite.ClusterGroupExpression;
import org.apache.camel.component.ignite.*;
[ "org.apache.camel" ]
org.apache.camel;
1,927,298
public X509Certificate generate( PrivateKey key, SecureRandom random) throws CertificateEncodingException, IllegalStateException, NoSuchAlgorithmException, SignatureException, InvalidKeyException { TBSCertificate tbsCert = generateTbsCert(); byte[] signature; try { signature = X509Util.calculateSignature(sigOID, signatureAlgorithm, key, random, tbsCert); } catch (IOException e) { throw new ExtCertificateEncodingException("exception encoding TBS cert", e); } try { return generateJcaObject(tbsCert, signature); } catch (CertificateParsingException e) { throw new ExtCertificateEncodingException("exception producing certificate object", e); } }
X509Certificate function( PrivateKey key, SecureRandom random) throws CertificateEncodingException, IllegalStateException, NoSuchAlgorithmException, SignatureException, InvalidKeyException { TBSCertificate tbsCert = generateTbsCert(); byte[] signature; try { signature = X509Util.calculateSignature(sigOID, signatureAlgorithm, key, random, tbsCert); } catch (IOException e) { throw new ExtCertificateEncodingException(STR, e); } try { return generateJcaObject(tbsCert, signature); } catch (CertificateParsingException e) { throw new ExtCertificateEncodingException(STR, e); } }
/** * generate an X509 certificate, based on the current issuer and subject * using the default provider, and the passed in source of randomness * (if required). * <p> * <b>Note:</b> this differs from the deprecated method in that the default provider is * used - not "SC". * </p> */
generate an X509 certificate, based on the current issuer and subject using the default provider, and the passed in source of randomness (if required). Note: this differs from the deprecated method in that the default provider is used - not "SC".
generate
{ "repo_name": "Skywalker-11/spongycastle", "path": "prov/src/main/jdk1.1/org/spongycastle/x509/X509V3CertificateGenerator.java", "license": "mit", "size": 15205 }
[ "java.io.IOException", "java.security.InvalidKeyException", "java.security.NoSuchAlgorithmException", "java.security.PrivateKey", "java.security.SecureRandom", "java.security.SignatureException", "java.security.cert.CertificateEncodingException", "java.security.cert.CertificateParsingException", "ja...
import java.io.IOException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.SecureRandom; import java.security.SignatureException; import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateParsingException; import java.security.cert.X509Certificate; import org.spongycastle.asn1.x509.TBSCertificate;
import java.io.*; import java.security.*; import java.security.cert.*; import org.spongycastle.asn1.x509.*;
[ "java.io", "java.security", "org.spongycastle.asn1" ]
java.io; java.security; org.spongycastle.asn1;
1,401,705
Response post(URI uri) throws IOException;
Response post(URI uri) throws IOException;
/** * Perform an HTTP POST operation. * @param uri the destination URI (excluding any host/port) * @return the operation response * @throws IOException on IO error */
Perform an HTTP POST operation
post
{ "repo_name": "spring-projects/spring-boot", "path": "spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/HttpTransport.java", "license": "apache-2.0", "size": 4669 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
397,388
interface TemplateParameterLookup { Expression getParam(TemplateParam param);
interface TemplateParameterLookup { Expression getParam(TemplateParam param);
/** * Returns an expression for a given {@code @param} or {@code @inject} parameter. * * <p>The expression will be for a {@link SoyValueProvider}. */
Returns an expression for a given @param or @inject parameter. The expression will be for a <code>SoyValueProvider</code>
getParam
{ "repo_name": "rpatil26/closure-templates", "path": "java/src/com/google/template/soy/jbcsrc/TemplateParameterLookup.java", "license": "apache-2.0", "size": 2164 }
[ "com.google.template.soy.soytree.defn.TemplateParam" ]
import com.google.template.soy.soytree.defn.TemplateParam;
import com.google.template.soy.soytree.defn.*;
[ "com.google.template" ]
com.google.template;
586,343
@Test() public void testDITStructureRuleMalformed() throws Exception { final Entry schemaEntry = Schema.getDefaultStandardSchema().getSchemaEntry().duplicate(); schemaEntry.addAttribute(Schema.ATTR_DIT_STRUCTURE_RULE, "malformed"); final File schemaFile = createTempFile(schemaEntry.toLDIF()); final SchemaValidator schemaValidator = new SchemaValidator(); final List<String> errorMessages = new ArrayList<>(5); final Schema schema = schemaValidator.validateSchema(schemaFile, null, errorMessages); assertNotNull(schema); assertNotNull(schema.getAttributeType("dc")); assertFalse(errorMessages.isEmpty()); }
@Test() void function() throws Exception { final Entry schemaEntry = Schema.getDefaultStandardSchema().getSchemaEntry().duplicate(); schemaEntry.addAttribute(Schema.ATTR_DIT_STRUCTURE_RULE, STR); final File schemaFile = createTempFile(schemaEntry.toLDIF()); final SchemaValidator schemaValidator = new SchemaValidator(); final List<String> errorMessages = new ArrayList<>(5); final Schema schema = schemaValidator.validateSchema(schemaFile, null, errorMessages); assertNotNull(schema); assertNotNull(schema.getAttributeType("dc")); assertFalse(errorMessages.isEmpty()); }
/** * Tests the behavior for a schema entry that has a DIT structure rule * definition that is malformed. * * @throws Exception If an unexpected problem occurs. */
Tests the behavior for a schema entry that has a DIT structure rule definition that is malformed
testDITStructureRuleMalformed
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/ldap/sdk/schema/SchemaValidatorTestCase.java", "license": "gpl-2.0", "size": 262381 }
[ "com.unboundid.ldap.sdk.Entry", "java.io.File", "java.util.ArrayList", "java.util.List", "org.testng.annotations.Test" ]
import com.unboundid.ldap.sdk.Entry; import java.io.File; import java.util.ArrayList; import java.util.List; import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.*; import java.io.*; import java.util.*; import org.testng.annotations.*;
[ "com.unboundid.ldap", "java.io", "java.util", "org.testng.annotations" ]
com.unboundid.ldap; java.io; java.util; org.testng.annotations;
932,375
public void signal(String signal, IbisIdentifier... ibisIdentifiers) throws IOException;
void function(String signal, IbisIdentifier... ibisIdentifiers) throws IOException;
/** * Send a signal to one or more Ibisses. This results in a * {@link RegistryEventHandler#gotSignal(String,IbisIdentifier)} upcall on * all Ibis instances in the given list. It is up to the application to * react accordingly. * * @param signal * the value of the signal. Useful if more than one type of * signal is needed. * @param ibisIdentifiers * the ibisses to wich the signal is sent. if this parameter is * null, the signal is broadcasted to all ibisses currently in * the pool. * @exception IOException * is thrown in case of trouble. */
Send a signal to one or more Ibisses. This results in a <code>RegistryEventHandler#gotSignal(String,IbisIdentifier)</code> upcall on all Ibis instances in the given list. It is up to the application to react accordingly
signal
{ "repo_name": "interdroid/ibis-ipl", "path": "src/ibis/ipl/Registry.java", "license": "bsd-3-clause", "size": 10889 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
641,965
public void testGetStudyOrganization() { StudyOrganization organization = registerMockFor(StudyOrganization.class); organization.setStudy(simpleStudy); HealthcareSite healthcareSite = registerMockFor(HealthcareSite.class); EasyMock.expect(organization.getHealthcareSite()).andReturn( healthcareSite); EasyMock.expect(healthcareSite.getNCICode()).andReturn("NC010"); replayMocks(); simpleStudy.addStudyOrganization(organization); assertNotNull("study site found with nc010", simpleStudy .getStudyOrganization("NC010")); verifyMocks(); }
void function() { StudyOrganization organization = registerMockFor(StudyOrganization.class); organization.setStudy(simpleStudy); HealthcareSite healthcareSite = registerMockFor(HealthcareSite.class); EasyMock.expect(organization.getHealthcareSite()).andReturn( healthcareSite); EasyMock.expect(healthcareSite.getNCICode()).andReturn("NC010"); replayMocks(); simpleStudy.addStudyOrganization(organization); assertNotNull(STR, simpleStudy .getStudyOrganization("NC010")); verifyMocks(); }
/** * Test get study organization by nci identifier * */
Test get study organization by nci identifier
testGetStudyOrganization
{ "repo_name": "NCIP/c3pr", "path": "codebase/projects/core/test/src/java/edu/duke/cabig/c3pr/domain/StudyTestCase.java", "license": "bsd-3-clause", "size": 75546 }
[ "org.easymock.classextension.EasyMock" ]
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.*;
[ "org.easymock.classextension" ]
org.easymock.classextension;
36,039
public List<Assumption> getOptimisticAssumptions() { return Collections.unmodifiableList(optimisticAssumptions.peek()); }
List<Assumption> function() { return Collections.unmodifiableList(optimisticAssumptions.peek()); }
/** * Get the list of optimistic assumptions made * @return optimistic assumptions */
Get the list of optimistic assumptions made
getOptimisticAssumptions
{ "repo_name": "JetBrains/jdk8u_nashorn", "path": "src/jdk/nashorn/internal/ir/OptimisticLexicalContext.java", "license": "gpl-2.0", "size": 4095 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
330,861
public boolean isBreedingItem(ItemStack stack) { return stack.getItem() == Items.FISH; }
boolean function(ItemStack stack) { return stack.getItem() == Items.FISH; }
/** * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on * the animal type) */
Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on the animal type)
isBreedingItem
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/passive/EntityOcelot.java", "license": "lgpl-2.1", "size": 12280 }
[ "net.minecraft.init.Items", "net.minecraft.item.ItemStack" ]
import net.minecraft.init.Items; import net.minecraft.item.ItemStack;
import net.minecraft.init.*; import net.minecraft.item.*;
[ "net.minecraft.init", "net.minecraft.item" ]
net.minecraft.init; net.minecraft.item;
1,842,126
public MetadataResponse fetchMetadata() { final ClientRequest clientRequest = kafkaClient.newClientRequest( getAnyReadyBrokerId(), MetadataRequest.Builder.allTopics(), Time.SYSTEM.milliseconds(), true); final ClientResponse clientResponse = sendRequest(clientRequest); if (!clientResponse.hasResponse()) { throw new StreamsException("Empty response for client request."); } if (!(clientResponse.responseBody() instanceof MetadataResponse)) { throw new StreamsException("Inconsistent response type for internal topic metadata request. " + "Expected MetadataResponse but received " + clientResponse.responseBody().getClass().getName()); } final MetadataResponse metadataResponse = (MetadataResponse) clientResponse.responseBody(); return metadataResponse; }
MetadataResponse function() { final ClientRequest clientRequest = kafkaClient.newClientRequest( getAnyReadyBrokerId(), MetadataRequest.Builder.allTopics(), Time.SYSTEM.milliseconds(), true); final ClientResponse clientResponse = sendRequest(clientRequest); if (!clientResponse.hasResponse()) { throw new StreamsException(STR); } if (!(clientResponse.responseBody() instanceof MetadataResponse)) { throw new StreamsException(STR + STR + clientResponse.responseBody().getClass().getName()); } final MetadataResponse metadataResponse = (MetadataResponse) clientResponse.responseBody(); return metadataResponse; }
/** * Fetch the metadata for all topics */
Fetch the metadata for all topics
fetchMetadata
{ "repo_name": "zzwlstarby/mykafka", "path": "streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsKafkaClient.java", "license": "apache-2.0", "size": 17611 }
[ "org.apache.kafka.clients.ClientRequest", "org.apache.kafka.clients.ClientResponse", "org.apache.kafka.common.requests.MetadataRequest", "org.apache.kafka.common.requests.MetadataResponse", "org.apache.kafka.common.utils.Time", "org.apache.kafka.streams.errors.StreamsException" ]
import org.apache.kafka.clients.ClientRequest; import org.apache.kafka.clients.ClientResponse; import org.apache.kafka.common.requests.MetadataRequest; import org.apache.kafka.common.requests.MetadataResponse; import org.apache.kafka.common.utils.Time; import org.apache.kafka.streams.errors.StreamsException;
import org.apache.kafka.clients.*; import org.apache.kafka.common.requests.*; import org.apache.kafka.common.utils.*; import org.apache.kafka.streams.errors.*;
[ "org.apache.kafka" ]
org.apache.kafka;
579,710
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<SqlUserDefinedFunctionGetResultsInner> createUpdateSqlUserDefinedFunctionAsync( String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, Context context) { return beginCreateUpdateSqlUserDefinedFunctionAsync( resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<SqlUserDefinedFunctionGetResultsInner> function( String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, Context context) { return beginCreateUpdateSqlUserDefinedFunctionAsync( resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); }
/** * Create or update an Azure Cosmos DB SQL userDefinedFunction. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL * userDefinedFunction. * @param context The context to associate with this operation. * @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 an Azure Cosmos DB userDefinedFunction. */
Create or update an Azure Cosmos DB SQL userDefinedFunction
createUpdateSqlUserDefinedFunctionAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/implementation/SqlResourcesClientImpl.java", "license": "mit", "size": 547809 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.util.Context", "com.azure.resourcemanager.cosmos.fluent.models.SqlUserDefinedFunctionGetResultsInner", "com.azure.resourcemanager.cosmos.models.SqlUserDefinedFunctionCreateUpdateParameters" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; import com.azure.resourcemanager.cosmos.fluent.models.SqlUserDefinedFunctionGetResultsInner; import com.azure.resourcemanager.cosmos.models.SqlUserDefinedFunctionCreateUpdateParameters;
import com.azure.core.annotation.*; import com.azure.core.util.*; import com.azure.resourcemanager.cosmos.fluent.models.*; import com.azure.resourcemanager.cosmos.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,839,567
public List<AnonymizationRule> getAnonymizationRules(String accountId, String actorCrn) { LOGGER.debug("Try getting anonymization rules for {} by {}", accountId, actorCrn); return new ArrayList<>(); }
List<AnonymizationRule> function(String accountId, String actorCrn) { LOGGER.debug(STR, accountId, actorCrn); return new ArrayList<>(); }
/** * Gather anonymization rules for a specific account * NOTE: not supported yet on UMS side * * @param accountId account that owns the anonymization rules * @param actorCrn actor that requests to gather the anonymization rules * @return a list of anonymization rules for an UMS account */
Gather anonymization rules for a specific account
getAnonymizationRules
{ "repo_name": "hortonworks/cloudbreak", "path": "auth-connector/src/main/java/com/sequenceiq/cloudbreak/auth/altus/GrpcUmsClient.java", "license": "apache-2.0", "size": 47511 }
[ "com.sequenceiq.common.api.telemetry.model.AnonymizationRule", "java.util.ArrayList", "java.util.List" ]
import com.sequenceiq.common.api.telemetry.model.AnonymizationRule; import java.util.ArrayList; import java.util.List;
import com.sequenceiq.common.api.telemetry.model.*; import java.util.*;
[ "com.sequenceiq.common", "java.util" ]
com.sequenceiq.common; java.util;
1,247,983
private boolean isCheckpointFromParent(int operatorId, long wid) throws IOException { long[] wids = getParentWindowIds(operatorId); if (wids.length != 0) { return (wid <= wids[wids.length - 1]); } return false; }
boolean function(int operatorId, long wid) throws IOException { long[] wids = getParentWindowIds(operatorId); if (wids.length != 0) { return (wid <= wids[wids.length - 1]); } return false; }
/** * does the checkpoint belong to parent */
does the checkpoint belong to parent
isCheckpointFromParent
{ "repo_name": "apache/incubator-apex-core", "path": "engine/src/main/java/org/apache/apex/engine/util/CascadeStorageAgent.java", "license": "apache-2.0", "size": 6729 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,195,094
@Test public void testAuthorMentionSkipDisabledUser() throws Exception { List<User> users = createUsers(3); Blog topic = TestUtils.createRandomBlog(false, false, users.toArray(new User[users.size()])); User lastAuthor = users.remove(users.size() - 1); for (User user : users) { TestUtils.createAndStoreCommonNote(topic, user.getId(), UUID.randomUUID().toString()); } AuthenticationTestUtils.setManagerContext(); userManagement.changeUserStatusByManager(users.get(0).getId(), UserStatus.TEMPORARILY_DISABLED); AuthenticationTestUtils.setAuthentication(null); Long noteId = TestUtils.createAndStoreCommonNote(topic, lastAuthor.getId(), "some content " + NoteManagement.CONSTANT_MENTION_TOPIC_AUTHORS + " some more content"); Set<Long> notifiedUsers = processNote(noteId); Assert.assertEquals(notifiedUsers.size(), 1); Assert.assertTrue(notifiedUsers.contains(users.get(1).getId())); }
void function() throws Exception { List<User> users = createUsers(3); Blog topic = TestUtils.createRandomBlog(false, false, users.toArray(new User[users.size()])); User lastAuthor = users.remove(users.size() - 1); for (User user : users) { TestUtils.createAndStoreCommonNote(topic, user.getId(), UUID.randomUUID().toString()); } AuthenticationTestUtils.setManagerContext(); userManagement.changeUserStatusByManager(users.get(0).getId(), UserStatus.TEMPORARILY_DISABLED); AuthenticationTestUtils.setAuthentication(null); Long noteId = TestUtils.createAndStoreCommonNote(topic, lastAuthor.getId(), STR + NoteManagement.CONSTANT_MENTION_TOPIC_AUTHORS + STR); Set<Long> notifiedUsers = processNote(noteId); Assert.assertEquals(notifiedUsers.size(), 1); Assert.assertTrue(notifiedUsers.contains(users.get(1).getId())); }
/** * Test that authors which are now disabled are not notified. */
Test that authors which are now disabled are not notified
testAuthorMentionSkipDisabledUser
{ "repo_name": "Communote/communote-server", "path": "communote/tests/all-versions/integration/src/test/java/com/communote/server/core/note/processor/TopicNotificationNoteProcessorTest.java", "license": "apache-2.0", "size": 8497 }
[ "com.communote.server.core.blog.NoteManagement", "com.communote.server.model.blog.Blog", "com.communote.server.model.user.User", "com.communote.server.model.user.UserStatus", "com.communote.server.test.util.AuthenticationTestUtils", "com.communote.server.test.util.TestUtils", "java.util.List", "java.u...
import com.communote.server.core.blog.NoteManagement; import com.communote.server.model.blog.Blog; import com.communote.server.model.user.User; import com.communote.server.model.user.UserStatus; import com.communote.server.test.util.AuthenticationTestUtils; import com.communote.server.test.util.TestUtils; import java.util.List; import java.util.Set; import java.util.UUID; import org.testng.Assert;
import com.communote.server.core.blog.*; import com.communote.server.model.blog.*; import com.communote.server.model.user.*; import com.communote.server.test.util.*; import java.util.*; import org.testng.*;
[ "com.communote.server", "java.util", "org.testng" ]
com.communote.server; java.util; org.testng;
2,832,209
public CommandLauncher createComputerLauncher(EnvVars env) throws URISyntaxException, MalformedURLException { int sz = jenkins.getNodes().size(); return new CommandLauncher( String.format("\"%s/bin/java\" %s -jar \"%s\"", System.getProperty("java.home"), SLAVE_DEBUG_PORT>0 ? " -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address="+(SLAVE_DEBUG_PORT+sz): "", new File(jenkins.getJnlpJars("slave.jar").getURL().toURI()).getAbsolutePath()), env); }
CommandLauncher function(EnvVars env) throws URISyntaxException, MalformedURLException { int sz = jenkins.getNodes().size(); return new CommandLauncher( String.format("\"%s/bin/java\STR%s\STRjava.homeSTR -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=STRSTRslave.jar").getURL().toURI()).getAbsolutePath()), env); }
/** * Creates a {@link hudson.slaves.CommandLauncher} for launching a slave locally. * * @param env * Environment variables to add to the slave process. Can be null. */
Creates a <code>hudson.slaves.CommandLauncher</code> for launching a slave locally
createComputerLauncher
{ "repo_name": "syl20bnr/jenkins", "path": "test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java", "license": "mit", "size": 82354 }
[ "hudson.slaves.CommandLauncher", "java.net.MalformedURLException", "java.net.URISyntaxException" ]
import hudson.slaves.CommandLauncher; import java.net.MalformedURLException; import java.net.URISyntaxException;
import hudson.slaves.*; import java.net.*;
[ "hudson.slaves", "java.net" ]
hudson.slaves; java.net;
1,613,269
public static void setBoardsDir(final File boards_dir_path) { lock.writeLock().lock(); boards_dir = boards_dir_path; lock.writeLock().unlock(); }
static void function(final File boards_dir_path) { lock.writeLock().lock(); boards_dir = boards_dir_path; lock.writeLock().unlock(); }
/** * Set the boards directory to an arbitrary location (<b>not</b> relative to * the data directory). * * @param boards * dir path The path to the boards directory. */
Set the boards directory to an arbitrary location (not relative to the data directory)
setBoardsDir
{ "repo_name": "LordHeldchen/SpaceBattleSimulation", "path": "Battleships/src/main/java/de/rauwolf/gaming/battleships/gui/blueprintDisplay/Configuration.java", "license": "gpl-3.0", "size": 15363 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
288,343
private Response.ResponseBuilder createViolationResponse(Set<ConstraintViolation<?>> violations) { log.debug("Validation completed. violations found: " + violations.size()); Map<String, String> responseObj = new HashMap<String, String>(); for (ConstraintViolation<?> violation : violations) { responseObj.put(violation.getPropertyPath().toString(), violation.getMessage()); } return Response.status(Response.Status.BAD_REQUEST).entity(responseObj); }
Response.ResponseBuilder function(Set<ConstraintViolation<?>> violations) { log.debug(STR + violations.size()); Map<String, String> responseObj = new HashMap<String, String>(); for (ConstraintViolation<?> violation : violations) { responseObj.put(violation.getPropertyPath().toString(), violation.getMessage()); } return Response.status(Response.Status.BAD_REQUEST).entity(responseObj); }
/** * Creates a JAX-RS "Bad Request" response including a map of all violation * fields, and their message. This can then be used by clients to show * violations. * * @param violations * A set of violations that needs to be reported * @return JAX-RS response containing all violations */
Creates a JAX-RS "Bad Request" response including a map of all violation fields, and their message. This can then be used by clients to show violations
createViolationResponse
{ "repo_name": "tkobayas/ebisu-lunch", "path": "ebisu-lunch-rest/src/main/java/com/github/tkobayas/ebisu/rest/RestaurantResource.java", "license": "apache-2.0", "size": 7041 }
[ "java.util.HashMap", "java.util.Map", "java.util.Set", "javax.validation.ConstraintViolation", "javax.ws.rs.core.Response" ]
import java.util.HashMap; import java.util.Map; import java.util.Set; import javax.validation.ConstraintViolation; import javax.ws.rs.core.Response;
import java.util.*; import javax.validation.*; import javax.ws.rs.core.*;
[ "java.util", "javax.validation", "javax.ws" ]
java.util; javax.validation; javax.ws;
711,836