method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
@Override
public void configure(TestElement element) {
if (smtpPanel == null){
smtpPanel = new SmtpPanel();
}
smtpPanel.setServer(element.getPropertyAsString(SmtpSampler.SERVER));
smtpPanel.setPort(element.getPropertyAsString(SmtpSampler.SERVER_PORT));
smtpPanel.setTimeout(element.getPropertyAsString(SmtpSampler.SERVER_TIMEOUT));
smtpPanel.setConnectionTimeout(element.getPropertyAsString(SmtpSampler.SERVER_CONNECTION_TIMEOUT));
smtpPanel.setMailFrom(element.getPropertyAsString(SmtpSampler.MAIL_FROM));
smtpPanel.setMailReplyTo(element.getPropertyAsString(SmtpSampler.MAIL_REPLYTO));
smtpPanel.setReceiverTo(element.getPropertyAsString(SmtpSampler.RECEIVER_TO));
smtpPanel.setReceiverCC(element.getPropertyAsString(SmtpSampler.RECEIVER_CC));
smtpPanel.setReceiverBCC(element.getPropertyAsString(SmtpSampler.RECEIVER_BCC));
smtpPanel.setBody(element.getPropertyAsString(SmtpSampler.MESSAGE));
smtpPanel.setPlainBody(element.getPropertyAsBoolean(SmtpSampler.PLAIN_BODY));
smtpPanel.setSubject(element.getPropertyAsString(SmtpSampler.SUBJECT));
smtpPanel.setSuppressSubject(element.getPropertyAsBoolean(SmtpSampler.SUPPRESS_SUBJECT));
smtpPanel.setIncludeTimestamp(element.getPropertyAsBoolean(SmtpSampler.INCLUDE_TIMESTAMP));
JMeterProperty headers = element.getProperty(SmtpSampler.HEADER_FIELDS);
if (headers instanceof CollectionProperty) { // Might be NullProperty
smtpPanel.setHeaderFields((CollectionProperty)headers);
} else {
smtpPanel.setHeaderFields(new CollectionProperty());
}
smtpPanel.setAttachments(element.getPropertyAsString(SmtpSampler.ATTACH_FILE));
smtpPanel.setUseEmlMessage(element.getPropertyAsBoolean(SmtpSampler.USE_EML));
smtpPanel.setEmlMessage(element.getPropertyAsString(SmtpSampler.EML_MESSAGE_TO_SEND));
SecuritySettingsPanel secPanel = smtpPanel.getSecuritySettingsPanel();
secPanel.configure(element);
smtpPanel.setUseAuth(element.getPropertyAsBoolean(SmtpSampler.USE_AUTH));
smtpPanel.setUsername(element.getPropertyAsString(SmtpSampler.USERNAME));
smtpPanel.setPassword(element.getPropertyAsString(SmtpSampler.PASSWORD));
smtpPanel.setMessageSizeStatistic(element.getPropertyAsBoolean(SmtpSampler.MESSAGE_SIZE_STATS));
smtpPanel.setEnableDebug(element.getPropertyAsBoolean(SmtpSampler.ENABLE_DEBUG));
super.configure(element);
} | void function(TestElement element) { if (smtpPanel == null){ smtpPanel = new SmtpPanel(); } smtpPanel.setServer(element.getPropertyAsString(SmtpSampler.SERVER)); smtpPanel.setPort(element.getPropertyAsString(SmtpSampler.SERVER_PORT)); smtpPanel.setTimeout(element.getPropertyAsString(SmtpSampler.SERVER_TIMEOUT)); smtpPanel.setConnectionTimeout(element.getPropertyAsString(SmtpSampler.SERVER_CONNECTION_TIMEOUT)); smtpPanel.setMailFrom(element.getPropertyAsString(SmtpSampler.MAIL_FROM)); smtpPanel.setMailReplyTo(element.getPropertyAsString(SmtpSampler.MAIL_REPLYTO)); smtpPanel.setReceiverTo(element.getPropertyAsString(SmtpSampler.RECEIVER_TO)); smtpPanel.setReceiverCC(element.getPropertyAsString(SmtpSampler.RECEIVER_CC)); smtpPanel.setReceiverBCC(element.getPropertyAsString(SmtpSampler.RECEIVER_BCC)); smtpPanel.setBody(element.getPropertyAsString(SmtpSampler.MESSAGE)); smtpPanel.setPlainBody(element.getPropertyAsBoolean(SmtpSampler.PLAIN_BODY)); smtpPanel.setSubject(element.getPropertyAsString(SmtpSampler.SUBJECT)); smtpPanel.setSuppressSubject(element.getPropertyAsBoolean(SmtpSampler.SUPPRESS_SUBJECT)); smtpPanel.setIncludeTimestamp(element.getPropertyAsBoolean(SmtpSampler.INCLUDE_TIMESTAMP)); JMeterProperty headers = element.getProperty(SmtpSampler.HEADER_FIELDS); if (headers instanceof CollectionProperty) { smtpPanel.setHeaderFields((CollectionProperty)headers); } else { smtpPanel.setHeaderFields(new CollectionProperty()); } smtpPanel.setAttachments(element.getPropertyAsString(SmtpSampler.ATTACH_FILE)); smtpPanel.setUseEmlMessage(element.getPropertyAsBoolean(SmtpSampler.USE_EML)); smtpPanel.setEmlMessage(element.getPropertyAsString(SmtpSampler.EML_MESSAGE_TO_SEND)); SecuritySettingsPanel secPanel = smtpPanel.getSecuritySettingsPanel(); secPanel.configure(element); smtpPanel.setUseAuth(element.getPropertyAsBoolean(SmtpSampler.USE_AUTH)); smtpPanel.setUsername(element.getPropertyAsString(SmtpSampler.USERNAME)); smtpPanel.setPassword(element.getPropertyAsString(SmtpSampler.PASSWORD)); smtpPanel.setMessageSizeStatistic(element.getPropertyAsBoolean(SmtpSampler.MESSAGE_SIZE_STATS)); smtpPanel.setEnableDebug(element.getPropertyAsBoolean(SmtpSampler.ENABLE_DEBUG)); super.configure(element); } | /**
* Copy the data from the test element to the GUI, method has to be implemented by interface
* @param element Test-element to be used as data-input
* @see org.apache.jmeter.gui.AbstractJMeterGuiComponent#configure(org.apache.jmeter.testelement.TestElement)
*/ | Copy the data from the test element to the GUI, method has to be implemented by interface | configure | {
"repo_name": "hizhangqi/jmeter-1",
"path": "src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpSamplerGui.java",
"license": "apache-2.0",
"size": 8505
} | [
"org.apache.jmeter.protocol.smtp.sampler.SmtpSampler",
"org.apache.jmeter.testelement.TestElement",
"org.apache.jmeter.testelement.property.CollectionProperty",
"org.apache.jmeter.testelement.property.JMeterProperty"
] | import org.apache.jmeter.protocol.smtp.sampler.SmtpSampler; import org.apache.jmeter.testelement.TestElement; import org.apache.jmeter.testelement.property.CollectionProperty; import org.apache.jmeter.testelement.property.JMeterProperty; | import org.apache.jmeter.protocol.smtp.sampler.*; import org.apache.jmeter.testelement.*; import org.apache.jmeter.testelement.property.*; | [
"org.apache.jmeter"
] | org.apache.jmeter; | 1,206,217 |
private JButton createArrowButton() {
JButton button = new JButton("arrow", iconArrow[COLLAPSED]);
button.setBorder(BorderFactory.createEmptyBorder(0, 1, 5, 1));
button.setVerticalTextPosition(AbstractButton.CENTER);
button.setHorizontalTextPosition(AbstractButton.LEFT);
button.setMargin(new Insets(0, 0, 3, 0));
// Use the same font as that used in the titled border font
Font font;
if (Utils.isMac()) {
font = new Font("SansSerif", Font.BOLD, 14);
} else {
font = new Font("SansSerif", Font.BOLD, 15);
}
button.setFont(font);
button.setFocusable(false);
button.setContentAreaFilled(false);
button.addActionListener(new CollapsiblePanel.ExpandAndCollapseAction());
button.setCursor(new Cursor(Cursor.HAND_CURSOR));
return button;
}
private class ExpandAndCollapseAction extends AbstractAction implements ActionListener, ItemListener {
public static final long serialVersionUID = -343231; | JButton function() { JButton button = new JButton("arrow", iconArrow[COLLAPSED]); button.setBorder(BorderFactory.createEmptyBorder(0, 1, 5, 1)); button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.LEFT); button.setMargin(new Insets(0, 0, 3, 0)); Font font; if (Utils.isMac()) { font = new Font(STR, Font.BOLD, 14); } else { font = new Font(STR, Font.BOLD, 15); } button.setFont(font); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(new CollapsiblePanel.ExpandAndCollapseAction()); button.setCursor(new Cursor(Cursor.HAND_CURSOR)); return button; } private class ExpandAndCollapseAction extends AbstractAction implements ActionListener, ItemListener { public static final long serialVersionUID = -343231; | /**
* Returns a button with an arrow icon and a collapse/expand action listener.
*/ | Returns a button with an arrow icon and a collapse/expand action listener | createArrowButton | {
"repo_name": "LexMinecraft/Launcher",
"path": "src/main/java/com/atlauncher/gui/components/CollapsiblePanel.java",
"license": "gpl-3.0",
"size": 17120
} | [
"com.atlauncher.utils.Utils",
"java.awt.Cursor",
"java.awt.Font",
"java.awt.Insets",
"java.awt.event.ActionListener",
"java.awt.event.ItemListener",
"javax.swing.AbstractAction",
"javax.swing.AbstractButton",
"javax.swing.BorderFactory",
"javax.swing.JButton"
] | import com.atlauncher.utils.Utils; import java.awt.Cursor; import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionListener; import java.awt.event.ItemListener; import javax.swing.AbstractAction; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.JButton; | import com.atlauncher.utils.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; | [
"com.atlauncher.utils",
"java.awt",
"javax.swing"
] | com.atlauncher.utils; java.awt; javax.swing; | 2,061,549 |
//<editor-fold defaultstate="collapsed" desc="Hashcode Equals and Comparable">
@Override
public int hashCode() {
int hash = 7;
hash = 97 * hash + Objects.hashCode(this.value);
return hash;
} | int function() { int hash = 7; hash = 97 * hash + Objects.hashCode(this.value); return hash; } | /**
* Hash code is based upon the value.
* <p>
* @return a unique hash code from the value.
*/ | Hash code is based upon the value. | hashCode | {
"repo_name": "KeyBridge/lib-openssrf",
"path": "src/main/java/us/gov/dod/standard/ssrf/_3_1/metadata/domains/S35.java",
"license": "apache-2.0",
"size": 3868
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 1,205,342 |
private static List<LogicalVariable> orderColumnsToVariables(List<OrderColumn> orderColumns) {
List<LogicalVariable> columns = new ArrayList<>();
for (OrderColumn oc : orderColumns) {
columns.add(oc.getColumn());
}
return columns;
} | static List<LogicalVariable> function(List<OrderColumn> orderColumns) { List<LogicalVariable> columns = new ArrayList<>(); for (OrderColumn oc : orderColumns) { columns.add(oc.getColumn()); } return columns; } | /**
* Converts a list of OrderColumns to a list of LogicalVariables.
*
* @param orderColumns
* , a list of OrderColumns
* @return the list of LogicalVariables
*/ | Converts a list of OrderColumns to a list of LogicalVariables | orderColumnsToVariables | {
"repo_name": "waans11/incubator-asterixdb",
"path": "hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/properties/PropertiesUtil.java",
"license": "apache-2.0",
"size": 12359
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable"
] | import java.util.ArrayList; import java.util.List; import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable; | import java.util.*; import org.apache.hyracks.algebricks.core.algebra.base.*; | [
"java.util",
"org.apache.hyracks"
] | java.util; org.apache.hyracks; | 2,253,453 |
@Test
public void testMemStore() throws Exception {
HTableDescriptor htd =
hbu.createTableDescriptor(name.getMethodName(), 2, 1000, 1, KeepDeletedCells.FALSE);
HRegion region = hbu.createLocalHRegion(htd, null, null);
// 2s in the past
long ts = EnvironmentEdgeManager.currentTime() - 2000;
try {
// 2nd version
Put p = new Put(T1, ts-2);
p.add(c0, c0, T2);
region.put(p);
// 3rd version
p = new Put(T1, ts-1);
p.add(c0, c0, T3);
region.put(p);
// 4th version
p = new Put(T1, ts);
p.add(c0, c0, T4);
region.put(p);
// now flush/compact
region.flushcache();
region.compactStores(true);
// now put the first version (backdated)
p = new Put(T1, ts-3);
p.add(c0, c0, T1);
region.put(p);
// now the latest change is in the memstore,
// but it is not the latest version
Result r = region.get(new Get(T1));
checkResult(r, c0, T4);
Get g = new Get(T1);
g.setMaxVersions();
r = region.get(g); // this'll use ScanWildcardColumnTracker
checkResult(r, c0, T4,T3);
g = new Get(T1);
g.setMaxVersions();
g.addColumn(c0, c0);
r = region.get(g); // this'll use ExplicitColumnTracker
checkResult(r, c0, T4,T3);
p = new Put(T1, ts+1);
p.add(c0, c0, T5);
region.put(p);
// now the latest version is in the memstore
g = new Get(T1);
g.setMaxVersions();
r = region.get(g); // this'll use ScanWildcardColumnTracker
checkResult(r, c0, T5,T4);
g = new Get(T1);
g.setMaxVersions();
g.addColumn(c0, c0);
r = region.get(g); // this'll use ExplicitColumnTracker
checkResult(r, c0, T5,T4);
} finally {
HRegion.closeHRegion(region);
}
} | void function() throws Exception { HTableDescriptor htd = hbu.createTableDescriptor(name.getMethodName(), 2, 1000, 1, KeepDeletedCells.FALSE); HRegion region = hbu.createLocalHRegion(htd, null, null); long ts = EnvironmentEdgeManager.currentTime() - 2000; try { Put p = new Put(T1, ts-2); p.add(c0, c0, T2); region.put(p); p = new Put(T1, ts-1); p.add(c0, c0, T3); region.put(p); p = new Put(T1, ts); p.add(c0, c0, T4); region.put(p); region.flushcache(); region.compactStores(true); p = new Put(T1, ts-3); p.add(c0, c0, T1); region.put(p); Result r = region.get(new Get(T1)); checkResult(r, c0, T4); Get g = new Get(T1); g.setMaxVersions(); r = region.get(g); checkResult(r, c0, T4,T3); g = new Get(T1); g.setMaxVersions(); g.addColumn(c0, c0); r = region.get(g); checkResult(r, c0, T4,T3); p = new Put(T1, ts+1); p.add(c0, c0, T5); region.put(p); g = new Get(T1); g.setMaxVersions(); r = region.get(g); checkResult(r, c0, T5,T4); g = new Get(T1); g.setMaxVersions(); g.addColumn(c0, c0); r = region.get(g); checkResult(r, c0, T5,T4); } finally { HRegion.closeHRegion(region); } } | /**
* Make sure the memstor behaves correctly with minimum versions
*/ | Make sure the memstor behaves correctly with minimum versions | testMemStore | {
"repo_name": "grokcoder/pbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java",
"license": "apache-2.0",
"size": 13016
} | [
"org.apache.hadoop.hbase.HTableDescriptor",
"org.apache.hadoop.hbase.KeepDeletedCells",
"org.apache.hadoop.hbase.client.Get",
"org.apache.hadoop.hbase.client.Put",
"org.apache.hadoop.hbase.client.Result",
"org.apache.hadoop.hbase.util.EnvironmentEdgeManager"
] | import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.KeepDeletedCells; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; | import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 971,226 |
EAttribute getCompositeScreen_TopLevelCOS(); | EAttribute getCompositeScreen_TopLevelCOS(); | /**
* Returns the meta object for the attribute '{@link com.odcgroup.edge.t24ui.CompositeScreen#isTopLevelCOS <em>Top Level COS</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Top Level COS</em>'.
* @see com.odcgroup.edge.t24ui.CompositeScreen#isTopLevelCOS()
* @see #getCompositeScreen()
* @generated
*/ | Returns the meta object for the attribute '<code>com.odcgroup.edge.t24ui.CompositeScreen#isTopLevelCOS Top Level COS</code>'. | getCompositeScreen_TopLevelCOS | {
"repo_name": "debabratahazra/DS",
"path": "designstudio/components/edge/core/com.odcgroup.edge.t24ui.model/ecore-gen/com/odcgroup/edge/t24ui/T24UIPackage.java",
"license": "epl-1.0",
"size": 15906
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 425,761 |
private boolean isPluginAvailable(String category, String pluginID) {
//check feature availability of model managers
if (category.equals("de.ovgu.cide.features")) {
if (activeFeatureManager == null)
activeFeatureManager = FeatureModelManager.getInstance().getActiveFeatureModelProvider();
if (activeFeatureManager == null)
return false;
if (pluginID.equals(activeFeatureManager.getId())) {
return true;
}
}
//check availability of language extensions
if (category.equals("de.ovgu.cide.languages")) {
if (availLanguages == null)
availLanguages = LanguageExtensionManager.getInstance().getEnabledLanguageExtensions();
if (availLanguages == null)
return false;
for (LanguageExtensionProxy langExtProxy : availLanguages) {
if (pluginID.equals(langExtProxy.getId())) {
return true;
}
}
}
return false;
} | boolean function(String category, String pluginID) { if (category.equals(STR)) { if (activeFeatureManager == null) activeFeatureManager = FeatureModelManager.getInstance().getActiveFeatureModelProvider(); if (activeFeatureManager == null) return false; if (pluginID.equals(activeFeatureManager.getId())) { return true; } } if (category.equals(STR)) { if (availLanguages == null) availLanguages = LanguageExtensionManager.getInstance().getEnabledLanguageExtensions(); if (availLanguages == null) return false; for (LanguageExtensionProxy langExtProxy : availLanguages) { if (pluginID.equals(langExtProxy.getId())) { return true; } } } return false; } | /**
* This method needs to be extended if you would like to check availablity of further plugin
* categories. Currently only "de.ovgu.cide.features" and "de.ovgu.cide.languages" are checked.
*
* @param category
* @param pluginID
* @return
*/ | This method needs to be extended if you would like to check availablity of further plugin categories. Currently only "de.ovgu.cide.features" and "de.ovgu.cide.languages" are checked | isPluginAvailable | {
"repo_name": "ckaestne/CIDE",
"path": "CIDE_Samples/src/de/ovgu/cide/samples/wizards/SampleNewWizardPage.java",
"license": "gpl-3.0",
"size": 32926
} | [
"de.ovgu.cide.features.FeatureModelManager",
"de.ovgu.cide.languages.LanguageExtensionManager",
"de.ovgu.cide.languages.LanguageExtensionProxy"
] | import de.ovgu.cide.features.FeatureModelManager; import de.ovgu.cide.languages.LanguageExtensionManager; import de.ovgu.cide.languages.LanguageExtensionProxy; | import de.ovgu.cide.features.*; import de.ovgu.cide.languages.*; | [
"de.ovgu.cide"
] | de.ovgu.cide; | 1,725,363 |
private float getValue(Matrix matrix, int whichValue) {
matrix.getValues(mMatrixValues);
return mMatrixValues[whichValue];
} | float function(Matrix matrix, int whichValue) { matrix.getValues(mMatrixValues); return mMatrixValues[whichValue]; } | /**
* Helper method that 'unpacks' a Matrix and returns the required value
*
* @param matrix - Matrix to unpack
* @param whichValue - Which value from Matrix.M* to return
* @return float - returned value
*/ | Helper method that 'unpacks' a Matrix and returns the required value | getValue | {
"repo_name": "hellcharmer/REMOVING",
"path": "app/src/main/java/com/example/charmer/moving/photoView/PhotoViewAttacher.java",
"license": "apache-2.0",
"size": 39867
} | [
"android.graphics.Matrix"
] | import android.graphics.Matrix; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 552,813 |
public void deleteVaultInfo(String vaultName) {
Iterator<VaultInfo> it = getVaults().iterator();
while (it.hasNext()) {
VaultInfo v = it.next();
if (v.getVaultMetadata().getVaultName().equals(vaultName)) {
it.remove();
saveCache();
log.debug("Removed vault " + vaultName + " from cache.");
break;
}
}
} | void function(String vaultName) { Iterator<VaultInfo> it = getVaults().iterator(); while (it.hasNext()) { VaultInfo v = it.next(); if (v.getVaultMetadata().getVaultName().equals(vaultName)) { it.remove(); saveCache(); log.debug(STR + vaultName + STR); break; } } } | /**
* Remove vault from cache
*
* @param vaultName
*/ | Remove vault from cache | deleteVaultInfo | {
"repo_name": "lekkas/glacier-jclient",
"path": "src/main/java/org/glacierjclient/operations/cache/model/LocalCache.java",
"license": "mit",
"size": 10395
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,681,773 |
@Test
public void testRowSizeNullValues() throws Exception{
int numberColumns = 200;
int numberRows = 1000;
List<String[]> input = new LinkedList<>();
for(int rowIndex=0; rowIndex<numberRows; rowIndex++){
String[] row = new String[numberColumns];
input.add(row);
}
CSVReader reader = TableModelTestUtils.createReader(input);
List<ColumnModel> columns = new LinkedList<>();
// Create some columns
for(int i=0; i<numberColumns; i++){
columns.add(TableModelTestUtils.createColumn(i));
}
// Create the iterator.
Iterator<SparseRowDto> iterator = new CSVToRowIterator(columns, reader, false, null);
long startMemory = getMemoryUsed();
List<SparseRowDto> rows = new LinkedList<>();
for(int i=0; i<numberRows; i++){
rows.add(iterator.next());
}
long endMemory = getMemoryUsed();
int calcuatedSize = TableModelUtils.calculateActualRowSize(rows.get(0));
long sizePerRow = (endMemory - startMemory)/numberRows;
System.out.println("Measured size: "+sizePerRow+" bytes, calculated size: "+calcuatedSize+" bytes");
assertTrue(calcuatedSize > sizePerRow, "Calculated memory: "+calcuatedSize+" bytes actual memory: "+sizePerRow+" bytes");
}
| void function() throws Exception{ int numberColumns = 200; int numberRows = 1000; List<String[]> input = new LinkedList<>(); for(int rowIndex=0; rowIndex<numberRows; rowIndex++){ String[] row = new String[numberColumns]; input.add(row); } CSVReader reader = TableModelTestUtils.createReader(input); List<ColumnModel> columns = new LinkedList<>(); for(int i=0; i<numberColumns; i++){ columns.add(TableModelTestUtils.createColumn(i)); } Iterator<SparseRowDto> iterator = new CSVToRowIterator(columns, reader, false, null); long startMemory = getMemoryUsed(); List<SparseRowDto> rows = new LinkedList<>(); for(int i=0; i<numberRows; i++){ rows.add(iterator.next()); } long endMemory = getMemoryUsed(); int calcuatedSize = TableModelUtils.calculateActualRowSize(rows.get(0)); long sizePerRow = (endMemory - startMemory)/numberRows; System.out.println(STR+sizePerRow+STR+calcuatedSize+STR); assertTrue(calcuatedSize > sizePerRow, STR+calcuatedSize+STR+sizePerRow+STR); } | /**
* Test added for PLFM-4284 which was caused by incorrect row size
* calculations for empty rows.
* @throws Exception
*/ | Test added for PLFM-4284 which was caused by incorrect row size calculations for empty rows | testRowSizeNullValues | {
"repo_name": "xschildw/Synapse-Repository-Services",
"path": "services/repository-managers/src/test/java/org/sagebionetworks/repo/manager/table/TableEntityManagerTest.java",
"license": "apache-2.0",
"size": 82016
} | [
"au.com.bytecode.opencsv.CSVReader",
"java.util.Iterator",
"java.util.LinkedList",
"java.util.List",
"org.junit.jupiter.api.Assertions",
"org.sagebionetworks.repo.model.dbo.dao.table.CSVToRowIterator",
"org.sagebionetworks.repo.model.dbo.dao.table.TableModelTestUtils",
"org.sagebionetworks.repo.model.table.ColumnModel",
"org.sagebionetworks.repo.model.table.SparseRowDto",
"org.sagebionetworks.table.cluster.utils.TableModelUtils"
] | import au.com.bytecode.opencsv.CSVReader; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.junit.jupiter.api.Assertions; import org.sagebionetworks.repo.model.dbo.dao.table.CSVToRowIterator; import org.sagebionetworks.repo.model.dbo.dao.table.TableModelTestUtils; import org.sagebionetworks.repo.model.table.ColumnModel; import org.sagebionetworks.repo.model.table.SparseRowDto; import org.sagebionetworks.table.cluster.utils.TableModelUtils; | import au.com.bytecode.opencsv.*; import java.util.*; import org.junit.jupiter.api.*; import org.sagebionetworks.repo.model.dbo.dao.table.*; import org.sagebionetworks.repo.model.table.*; import org.sagebionetworks.table.cluster.utils.*; | [
"au.com.bytecode",
"java.util",
"org.junit.jupiter",
"org.sagebionetworks.repo",
"org.sagebionetworks.table"
] | au.com.bytecode; java.util; org.junit.jupiter; org.sagebionetworks.repo; org.sagebionetworks.table; | 1,512,086 |
public void updateDatabaseUploadResult(RemoteOperationResult uploadResult, UploadFileOperation upload) {
// result: success or fail notification
Log_OC.d(TAG, "updateDataseUploadResult uploadResult: " + uploadResult + " upload: " + upload);
if (uploadResult.isCancelled()) {
removeUpload(
upload.getAccount().name,
upload.getRemotePath()
);
} else {
String localPath = (FileUploader.LOCAL_BEHAVIOUR_MOVE == upload.getLocalBehaviour())
? upload.getStoragePath() : null;
if (uploadResult.isSuccess()) {
updateUploadStatus(
upload.getOCUploadId(),
UploadStatus.UPLOAD_SUCCEEDED,
UploadResult.UPLOADED,
upload.getRemotePath(),
localPath
);
} else {
updateUploadStatus(
upload.getOCUploadId(),
UploadStatus.UPLOAD_FAILED,
UploadResult.fromOperationResult(uploadResult),
upload.getRemotePath(),
localPath
);
}
}
} | void function(RemoteOperationResult uploadResult, UploadFileOperation upload) { Log_OC.d(TAG, STR + uploadResult + STR + upload); if (uploadResult.isCancelled()) { removeUpload( upload.getAccount().name, upload.getRemotePath() ); } else { String localPath = (FileUploader.LOCAL_BEHAVIOUR_MOVE == upload.getLocalBehaviour()) ? upload.getStoragePath() : null; if (uploadResult.isSuccess()) { updateUploadStatus( upload.getOCUploadId(), UploadStatus.UPLOAD_SUCCEEDED, UploadResult.UPLOADED, upload.getRemotePath(), localPath ); } else { updateUploadStatus( upload.getOCUploadId(), UploadStatus.UPLOAD_FAILED, UploadResult.fromOperationResult(uploadResult), upload.getRemotePath(), localPath ); } } } | /**
* Updates the persistent upload database with upload result.
*/ | Updates the persistent upload database with upload result | updateDatabaseUploadResult | {
"repo_name": "PauloSantos13/android",
"path": "src/com/owncloud/android/datamodel/UploadsStorageManager.java",
"license": "gpl-2.0",
"size": 20479
} | [
"com.owncloud.android.db.UploadResult",
"com.owncloud.android.files.services.FileUploader",
"com.owncloud.android.lib.common.operations.RemoteOperationResult",
"com.owncloud.android.operations.UploadFileOperation"
] | import com.owncloud.android.db.UploadResult; import com.owncloud.android.files.services.FileUploader; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.operations.UploadFileOperation; | import com.owncloud.android.db.*; import com.owncloud.android.files.services.*; import com.owncloud.android.lib.common.operations.*; import com.owncloud.android.operations.*; | [
"com.owncloud.android"
] | com.owncloud.android; | 1,881,460 |
private static Color loadColor(String id) {
String colorString = store.getString(id);
String[] colors = colorString.split(",");
colors[0] = colors[0].trim();
colors[1] = colors[1].trim();
colors[2] = colors[2].trim();
if (colors.length == 3) {
return new Color(null, Integer.parseInt(colors[0]),
Integer.parseInt(colors[1]), Integer.parseInt(colors[2]));
} else {
return null;
}
}
private ColorManager() {
} | static Color function(String id) { String colorString = store.getString(id); String[] colors = colorString.split(","); colors[0] = colors[0].trim(); colors[1] = colors[1].trim(); colors[2] = colors[2].trim(); if (colors.length == 3) { return new Color(null, Integer.parseInt(colors[0]), Integer.parseInt(colors[1]), Integer.parseInt(colors[2])); } else { return null; } } private ColorManager() { } | /**
* Load the color from the specified color id.
*
* @param id Color in the form "r,g,b"
* @return The {@link Color} for the given id.
*/ | Load the color from the specified color id | loadColor | {
"repo_name": "FraunhoferESK/ernest-eclipse-integration",
"path": "de.fraunhofer.esk.ernest.visualization.ganttchart/src/de/fraunhofer/esk/ernest/visualization/ganttchart/data/constraintview/ColorManager.java",
"license": "epl-1.0",
"size": 3668
} | [
"org.eclipse.swt.graphics.Color"
] | import org.eclipse.swt.graphics.Color; | import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,696,616 |
private Object _evaluateLeftLessRight(Object element, String lvalue,
String rvalue) {
if (element instanceof List) {
return evaluateLeftLessRight((List) element, lvalue, rvalue);
} else {
return evaluateLeftLessRight((StructuredContent) element, lvalue,
rvalue);
}
} | Object function(Object element, String lvalue, String rvalue) { if (element instanceof List) { return evaluateLeftLessRight((List) element, lvalue, rvalue); } else { return evaluateLeftLessRight((StructuredContent) element, lvalue, rvalue); } } | /**
* This internal method simply makes a type safe call the the proper
* abstract method based on the type of element passed.
*
* @param element either a StructuredContent or List object.
* @param lvalue lvalue of predicate expression
* @param rvalue rvalue of predicate expression
* @return either a StructuredContent or List object.
* @see #evaluateLeftLessRight(StructuredContent, String, String)
* @see #evaluateLeftLessRight(List, String, String)
*/ | This internal method simply makes a type safe call the the proper abstract method based on the type of element passed | _evaluateLeftLessRight | {
"repo_name": "JrmyDev/CodenameOne",
"path": "CodenameOne/src/com/codename1/processing/AbstractEvaluator.java",
"license": "gpl-2.0",
"size": 19710
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,362,645 |
JdiValue getValue() throws DebuggerException; | JdiValue getValue() throws DebuggerException; | /**
* Get value of variable.
*
* @return value
* @throws DebuggerException
* if an error occurs
*/ | Get value of variable | getValue | {
"repo_name": "kaloyan-raev/che",
"path": "plugins/plugin-java-debugger/che-plugin-java-debugger-server/src/main/java/org/eclipse/che/plugin/jdb/server/JdiVariable.java",
"license": "epl-1.0",
"size": 2024
} | [
"org.eclipse.che.api.debugger.server.exceptions.DebuggerException"
] | import org.eclipse.che.api.debugger.server.exceptions.DebuggerException; | import org.eclipse.che.api.debugger.server.exceptions.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 2,027,675 |
public void setCOM(float[] c, Body body)
{
mass.setC(c, body);
}
| void function(float[] c, Body body) { mass.setC(c, body); } | /**
* Set the mass and apply it to a body
*/ | Set the mass and apply it to a body | setCOM | {
"repo_name": "ArticulatedSocialAgentsPlatform/HmiCore",
"path": "HmiPhysics/src/hmi/physics/ode/OdeMass.java",
"license": "lgpl-3.0",
"size": 4398
} | [
"org.odejava.Body"
] | import org.odejava.Body; | import org.odejava.*; | [
"org.odejava"
] | org.odejava; | 1,762,790 |
@Adjacency(label = SPRING_CONFIGURATION, direction = Direction.IN)
public SpringConfigurationFileModel getSpringConfiguration(); | @Adjacency(label = SPRING_CONFIGURATION, direction = Direction.IN) SpringConfigurationFileModel function(); | /**
* The Spring configuration file in which this Spring Bean was defined.
*/ | The Spring configuration file in which this Spring Bean was defined | getSpringConfiguration | {
"repo_name": "sgilda/windup",
"path": "rules-java-ee/addon/src/main/java/org/jboss/windup/rules/apps/javaee/model/SpringBeanModel.java",
"license": "epl-1.0",
"size": 1996
} | [
"com.tinkerpop.blueprints.Direction",
"com.tinkerpop.frames.Adjacency"
] | import com.tinkerpop.blueprints.Direction; import com.tinkerpop.frames.Adjacency; | import com.tinkerpop.blueprints.*; import com.tinkerpop.frames.*; | [
"com.tinkerpop.blueprints",
"com.tinkerpop.frames"
] | com.tinkerpop.blueprints; com.tinkerpop.frames; | 2,282,348 |
public com.iucn.whp.dbservice.model.whp_sites_indigenous_communities deletewhp_sites_indigenous_communities(
com.iucn.whp.dbservice.model.whp_sites_indigenous_communities whp_sites_indigenous_communities)
throws com.liferay.portal.kernel.exception.SystemException; | com.iucn.whp.dbservice.model.whp_sites_indigenous_communities function( com.iucn.whp.dbservice.model.whp_sites_indigenous_communities whp_sites_indigenous_communities) throws com.liferay.portal.kernel.exception.SystemException; | /**
* Deletes the whp_sites_indigenous_communities from the database. Also notifies the appropriate model listeners.
*
* @param whp_sites_indigenous_communities the whp_sites_indigenous_communities
* @return the whp_sites_indigenous_communities that was removed
* @throws SystemException if a system exception occurred
*/ | Deletes the whp_sites_indigenous_communities from the database. Also notifies the appropriate model listeners | deletewhp_sites_indigenous_communities | {
"repo_name": "iucn-whp/world-heritage-outlook",
"path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/service/com/iucn/whp/dbservice/service/whp_sites_indigenous_communitiesLocalService.java",
"license": "gpl-2.0",
"size": 12644
} | [
"com.liferay.portal.kernel.exception.SystemException"
] | import com.liferay.portal.kernel.exception.SystemException; | import com.liferay.portal.kernel.exception.*; | [
"com.liferay.portal"
] | com.liferay.portal; | 188,313 |
public final boolean post(@NonNull Runnable r) {
return mExec.post(wrapRunnable(r));
} | final boolean function(@NonNull Runnable r) { return mExec.post(wrapRunnable(r)); } | /**
* Causes the Runnable r to be added to the message queue.
* The runnable will be run on the thread to which this handler is
* attached.
*
* @param r The Runnable that will be executed.
*
* @return Returns true if the Runnable was successfully placed in to the
* message queue. Returns false on failure, usually because the
* looper processing the message queue is exiting.
*/ | Causes the Runnable r to be added to the message queue. The runnable will be run on the thread to which this handler is attached | post | {
"repo_name": "liulei-0911/LLApp",
"path": "utils/src/main/java/com/heaton/liulei/utils/utils/WeakHandler.java",
"license": "apache-2.0",
"size": 19287
} | [
"android.support.annotation.NonNull"
] | import android.support.annotation.NonNull; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 2,798,394 |
private List<EntityIdValue> getItemIdValueList(StatementGroup statementGroup) {
List<EntityIdValue> result = new ArrayList<>(statementGroup.size());
for (Statement s : statementGroup) {
Value v = s.getValue();
if (v instanceof EntityIdValue) {
result.add((EntityIdValue) v);
}
}
return result;
} | List<EntityIdValue> function(StatementGroup statementGroup) { List<EntityIdValue> result = new ArrayList<>(statementGroup.size()); for (Statement s : statementGroup) { Value v = s.getValue(); if (v instanceof EntityIdValue) { result.add((EntityIdValue) v); } } return result; } | /**
* Helper method that extracts the list of all {@link ItemIdValue} objects
* that are used as values in the given statement group.
*
* @param statementGroup
* the {@link StatementGroup} to extract the data from
* @return the list of values
*/ | Helper method that extracts the list of all <code>ItemIdValue</code> objects that are used as values in the given statement group | getItemIdValueList | {
"repo_name": "Wikidata/Wikidata-Toolkit",
"path": "wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java",
"license": "apache-2.0",
"size": 14250
} | [
"java.util.ArrayList",
"java.util.List",
"org.wikidata.wdtk.datamodel.interfaces.EntityIdValue",
"org.wikidata.wdtk.datamodel.interfaces.Statement",
"org.wikidata.wdtk.datamodel.interfaces.StatementGroup",
"org.wikidata.wdtk.datamodel.interfaces.Value"
] | import java.util.ArrayList; import java.util.List; import org.wikidata.wdtk.datamodel.interfaces.EntityIdValue; import org.wikidata.wdtk.datamodel.interfaces.Statement; import org.wikidata.wdtk.datamodel.interfaces.StatementGroup; import org.wikidata.wdtk.datamodel.interfaces.Value; | import java.util.*; import org.wikidata.wdtk.datamodel.interfaces.*; | [
"java.util",
"org.wikidata.wdtk"
] | java.util; org.wikidata.wdtk; | 2,912,708 |
private boolean isJSProject(IProject project) {
try {
return project.hasNature(JavaScriptCore.NATURE_ID);
}
catch (CoreException e) {
return false;
}
}
| boolean function(IProject project) { try { return project.hasNature(JavaScriptCore.NATURE_ID); } catch (CoreException e) { return false; } } | /**
* Checks if the specified project is a web project.
*
* @param project project to be checked
* @return true if the project is web project, otherwise false
*/ | Checks if the specified project is a web project | isJSProject | {
"repo_name": "boniatillo-com/PhaserEditor",
"path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/wizards/NewJSFileWizardPage.java",
"license": "epl-1.0",
"size": 9336
} | [
"org.eclipse.core.resources.IProject",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.wst.jsdt.core.JavaScriptCore"
] | import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.wst.jsdt.core.JavaScriptCore; | import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.wst.jsdt.core.*; | [
"org.eclipse.core",
"org.eclipse.wst"
] | org.eclipse.core; org.eclipse.wst; | 824,015 |
public CommandResult put(Revision revision) {
Optional<RevisionTree> existing = load(revision.getContent(), LockMode.RMW);
RevisionTree updated;
if (!existing.isPresent()) {
if (!revision.getParents().isEmpty()) {
throw new ConflictException();
}
updated = new RevisionTreeBuilder()
.add(revision)
.build();
} else {
if (existing.get().contains(revision.getRevision())) {
updated = existing.get();
} else if (!existing.get().getHead().equals(revision.getParents())) {
throw new ConflictException();
} else {
updated = existing.get()
.add(revision)
.merge();
}
}
return save(existing, updated);
} | CommandResult function(Revision revision) { Optional<RevisionTree> existing = load(revision.getContent(), LockMode.RMW); RevisionTree updated; if (!existing.isPresent()) { if (!revision.getParents().isEmpty()) { throw new ConflictException(); } updated = new RevisionTreeBuilder() .add(revision) .build(); } else { if (existing.get().contains(revision.getRevision())) { updated = existing.get(); } else if (!existing.get().getHead().equals(revision.getParents())) { throw new ConflictException(); } else { updated = existing.get() .add(revision) .merge(); } } return save(existing, updated); } | /**
* Adds a new revision.
*
* @param revision Revision to add.
* @return Actual result.
*/ | Adds a new revision | put | {
"repo_name": "elasticlib/elasticlib",
"path": "elasticlib-node/src/main/java/org/elasticlib/node/repository/RevisionManager.java",
"license": "apache-2.0",
"size": 6718
} | [
"com.sleepycat.je.LockMode",
"java.util.Optional",
"org.elasticlib.common.exception.ConflictException",
"org.elasticlib.common.model.CommandResult",
"org.elasticlib.common.model.Revision",
"org.elasticlib.common.model.RevisionTree"
] | import com.sleepycat.je.LockMode; import java.util.Optional; import org.elasticlib.common.exception.ConflictException; import org.elasticlib.common.model.CommandResult; import org.elasticlib.common.model.Revision; import org.elasticlib.common.model.RevisionTree; | import com.sleepycat.je.*; import java.util.*; import org.elasticlib.common.exception.*; import org.elasticlib.common.model.*; | [
"com.sleepycat.je",
"java.util",
"org.elasticlib.common"
] | com.sleepycat.je; java.util; org.elasticlib.common; | 1,481,932 |
@Deprecated
public static synchronized void initializeFromURI(
final URI uri,
final ClientConfiguration config) {
try {
regionMetadata = loadMetadataFromURI(uri, config);
} catch (IOException exception) {
throw new SdkClientException(
"Error parsing region metadata from " + uri,
exception);
}
} | static synchronized void function( final URI uri, final ClientConfiguration config) { try { regionMetadata = loadMetadataFromURI(uri, config); } catch (IOException exception) { throw new SdkClientException( STR + uri, exception); } } | /**
* Loads a set of region metadata by downloading an XML file from the
* given URI and parsing it.
*
* @param uri the uri of the XML file to parse
* @param config configuration for the HTTP client to use to fetch the file
* @throws SdkClientException on error
*/ | Loads a set of region metadata by downloading an XML file from the given URI and parsing it | initializeFromURI | {
"repo_name": "loremipsumdolor/CastFast",
"path": "src/com/amazonaws/regions/RegionUtils.java",
"license": "mit",
"size": 11498
} | [
"com.amazonaws.ClientConfiguration",
"com.amazonaws.SdkClientException",
"java.io.IOException"
] | import com.amazonaws.ClientConfiguration; import com.amazonaws.SdkClientException; import java.io.IOException; | import com.amazonaws.*; import java.io.*; | [
"com.amazonaws",
"java.io"
] | com.amazonaws; java.io; | 2,074,654 |
public static Playlist loadPlaylistFromFileByName(DirectoryManager directoryManager,
IDbDataPortal dbDataPortal, String name, String playerModelName) throws IOException {
File file = new File(directoryManager.getPlaylistDirectory(playerModelName), name + ".m3u");
return loadPlaylistFromFile(dbDataPortal, file);
} | static Playlist function(DirectoryManager directoryManager, IDbDataPortal dbDataPortal, String name, String playerModelName) throws IOException { File file = new File(directoryManager.getPlaylistDirectory(playerModelName), name + ".m3u"); return loadPlaylistFromFile(dbDataPortal, file); } | /**
* Loads a {@link Playlist} from a file with the given name
*
* @param dbDataPortal
* The database data portal which will be used
* @param name
* The name ({@link String}) of the playlist file to be loaded
* @return A {@link Playlist} from a file with the given name
*/ | Loads a <code>Playlist</code> from a file with the given name | loadPlaylistFromFileByName | {
"repo_name": "kuhnmi/jukefox",
"path": "JukefoxModel/src/ch/ethz/dcg/jukefox/data/playlist/PlaylistReader.java",
"license": "gpl-3.0",
"size": 7536
} | [
"ch.ethz.dcg.jukefox.data.db.IDbDataPortal",
"ch.ethz.dcg.jukefox.manager.DirectoryManager",
"ch.ethz.dcg.jukefox.model.collection.Playlist",
"java.io.File",
"java.io.IOException"
] | import ch.ethz.dcg.jukefox.data.db.IDbDataPortal; import ch.ethz.dcg.jukefox.manager.DirectoryManager; import ch.ethz.dcg.jukefox.model.collection.Playlist; import java.io.File; import java.io.IOException; | import ch.ethz.dcg.jukefox.data.db.*; import ch.ethz.dcg.jukefox.manager.*; import ch.ethz.dcg.jukefox.model.collection.*; import java.io.*; | [
"ch.ethz.dcg",
"java.io"
] | ch.ethz.dcg; java.io; | 2,889,369 |
private void dropConflict(Conflict c, Statement stmt, Set<Conflict> alreadyDropped) throws SQLException {
Iterator<Conflict> it = c.getDependants().iterator();
while (it.hasNext()) {
Conflict c2 = (Conflict) it.next();
dropConflict(c2, stmt, alreadyDropped);
}
if (!alreadyDropped.contains(c)) {
alreadyDropped.add(c);
if (logger.isDebugEnabled())
logger.debug("Dropping conflict "+c+" with SQL: "+c.getSqlDropStatement());
lastSQLStatement = c.getSqlDropStatement();
stmt.executeUpdate(c.getSqlDropStatement());
}
} | void function(Conflict c, Statement stmt, Set<Conflict> alreadyDropped) throws SQLException { Iterator<Conflict> it = c.getDependants().iterator(); while (it.hasNext()) { Conflict c2 = (Conflict) it.next(); dropConflict(c2, stmt, alreadyDropped); } if (!alreadyDropped.contains(c)) { alreadyDropped.add(c); if (logger.isDebugEnabled()) logger.debug(STR+c+STR+c.getSqlDropStatement()); lastSQLStatement = c.getSqlDropStatement(); stmt.executeUpdate(c.getSqlDropStatement()); } } | /**
* Recursively drops the given conflict and all its dependencies. This is a
* subroutine of the public dropConflicting() method.
* @param c
* @param stmt
*/ | Recursively drops the given conflict and all its dependencies. This is a subroutine of the public dropConflicting() method | dropConflict | {
"repo_name": "amitkr/power-architect",
"path": "src/main/java/ca/sqlpower/architect/ddl/ConflictResolver.java",
"license": "gpl-3.0",
"size": 16296
} | [
"java.sql.SQLException",
"java.sql.Statement",
"java.util.Iterator",
"java.util.Set"
] | import java.sql.SQLException; import java.sql.Statement; import java.util.Iterator; import java.util.Set; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 1,814,287 |
@SuppressWarnings(value = "unchecked")
public Response executeExceptionMapper(Throwable exception)
{
ExceptionMapper mapper = null;
Class causeClass = exception.getClass();
while (mapper == null) {
if (causeClass == null) break;
mapper = providerFactory.getExceptionMappers().get(causeClass);
if (mapper == null) causeClass = causeClass.getSuperclass();
}
if (mapper != null) {
mapperExecuted = true;
Response jaxrsResponse = mapper.toResponse(exception);
if (jaxrsResponse == null) {
jaxrsResponse = Response.status(204).build();
}
return jaxrsResponse;
}
return null;
}
| @SuppressWarnings(value = STR) Response function(Throwable exception) { ExceptionMapper mapper = null; Class causeClass = exception.getClass(); while (mapper == null) { if (causeClass == null) break; mapper = providerFactory.getExceptionMappers().get(causeClass); if (mapper == null) causeClass = causeClass.getSuperclass(); } if (mapper != null) { mapperExecuted = true; Response jaxrsResponse = mapper.toResponse(exception); if (jaxrsResponse == null) { jaxrsResponse = Response.status(204).build(); } return jaxrsResponse; } return null; } | /**
* Execute an ExceptionMapper if one exists for the given exception. Recurse to base class if not found
*
* @param exception
* @return true if an ExceptionMapper was found and executed
*/ | Execute an ExceptionMapper if one exists for the given exception. Recurse to base class if not found | executeExceptionMapper | {
"repo_name": "awhitford/Resteasy",
"path": "resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/ExceptionHandler.java",
"license": "apache-2.0",
"size": 9863
} | [
"javax.ws.rs.core.Response",
"javax.ws.rs.ext.ExceptionMapper"
] | import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; | import javax.ws.rs.core.*; import javax.ws.rs.ext.*; | [
"javax.ws"
] | javax.ws; | 1,588,882 |
@Scheduled(cron = "0 0 1 * * ?")
public void removeNotActivatedUsers() {
ZonedDateTime now = ZonedDateTime.now();
List<User> users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minusDays(3));
for (User user : users) {
log.debug("Deleting not activated user {}", user.getLogin());
userRepository.delete(user);
}
} | @Scheduled(cron = STR) void function() { ZonedDateTime now = ZonedDateTime.now(); List<User> users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minusDays(3)); for (User user : users) { log.debug(STR, user.getLogin()); userRepository.delete(user); } } | /**
* Not activated users should be automatically deleted after 3 days.
* <p/>
* <p>
* This is scheduled to get fired everyday, at 01:00 (am).
* </p>
*/ | Not activated users should be automatically deleted after 3 days. This is scheduled to get fired everyday, at 01:00 (am). | removeNotActivatedUsers | {
"repo_name": "andreicristianpetcu/ingkey",
"path": "src/main/java/ro/ing/ingkey/service/UserService.java",
"license": "agpl-3.0",
"size": 7336
} | [
"java.time.ZonedDateTime",
"java.util.List",
"org.springframework.scheduling.annotation.Scheduled",
"ro.ing.ingkey.domain.User"
] | import java.time.ZonedDateTime; import java.util.List; import org.springframework.scheduling.annotation.Scheduled; import ro.ing.ingkey.domain.User; | import java.time.*; import java.util.*; import org.springframework.scheduling.annotation.*; import ro.ing.ingkey.domain.*; | [
"java.time",
"java.util",
"org.springframework.scheduling",
"ro.ing.ingkey"
] | java.time; java.util; org.springframework.scheduling; ro.ing.ingkey; | 2,448,555 |
@SuppressWarnings({ "rawtypes", "unchecked" })
public void setMetaData(IMetaData metadata) throws FileNotFoundException,
IOException; | @SuppressWarnings({ STR, STR }) void function(IMetaData metadata) throws FileNotFoundException, IOException; | /**
* Sets the metadata
*
* @param metadata Metadata object
* @throws FileNotFoundException File not found
* @throws IOException Any other I/O exception
*/ | Sets the metadata | setMetaData | {
"repo_name": "OpenCorrelate/red5load",
"path": "red5/src/main/java/org/red5/io/flv/IFLV.java",
"license": "lgpl-3.0",
"size": 3914
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"org.red5.io.flv.meta.IMetaData"
] | import java.io.FileNotFoundException; import java.io.IOException; import org.red5.io.flv.meta.IMetaData; | import java.io.*; import org.red5.io.flv.meta.*; | [
"java.io",
"org.red5.io"
] | java.io; org.red5.io; | 754,295 |
@Override
public void deleteContainer(long containerID)
throws IOException {
Preconditions.checkState(containerID >= 0,
"Container ID cannot be negative");
SCMDeleteContainerRequestProto request = SCMDeleteContainerRequestProto
.newBuilder()
.setContainerID(containerID)
.build();
try {
rpcProxy.deleteContainer(NULL_RPC_CONTROLLER, request);
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
} | void function(long containerID) throws IOException { Preconditions.checkState(containerID >= 0, STR); SCMDeleteContainerRequestProto request = SCMDeleteContainerRequestProto .newBuilder() .setContainerID(containerID) .build(); try { rpcProxy.deleteContainer(NULL_RPC_CONTROLLER, request); } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); } } | /**
* Ask SCM to delete a container by name. SCM will remove
* the container mapping in its database.
*
* @param containerID
* @throws IOException
*/ | Ask SCM to delete a container by name. SCM will remove the container mapping in its database | deleteContainer | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java",
"license": "apache-2.0",
"size": 12399
} | [
"com.google.common.base.Preconditions",
"com.google.protobuf.ServiceException",
"java.io.IOException",
"org.apache.hadoop.ipc.ProtobufHelper"
] | import com.google.common.base.Preconditions; import com.google.protobuf.ServiceException; import java.io.IOException; import org.apache.hadoop.ipc.ProtobufHelper; | import com.google.common.base.*; import com.google.protobuf.*; import java.io.*; import org.apache.hadoop.ipc.*; | [
"com.google.common",
"com.google.protobuf",
"java.io",
"org.apache.hadoop"
] | com.google.common; com.google.protobuf; java.io; org.apache.hadoop; | 1,722,615 |
public void setCharacteristicNotification(BluetoothGattCharacteristic characteristic,
boolean enabled) {
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
Log.w(TAG, "BluetoothAdapter not initialized");
return;
}
mBluetoothGatt.setCharacteristicNotification(characteristic, enabled);
//
// This is specific to Heart Rate Measurement.
// if (UUID_HEART_RATE_MEASUREMENT.equals(characteristic.getUuid())) {
// BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
// UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
// descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
// mBluetoothGatt.writeDescriptor(descriptor);
// }
// if (UUID_SERVICE.equals(characteristic.getUuid())) {
// BluetoothGattDescriptor descriptor = characteristic.getDescriptor(UUID_NOTIFY);
// descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
// mBluetoothGatt.writeDescriptor(descriptor);
// }
}
| void function(BluetoothGattCharacteristic characteristic, boolean enabled) { if (mBluetoothAdapter == null mBluetoothGatt == null) { Log.w(TAG, STR); return; } mBluetoothGatt.setCharacteristicNotification(characteristic, enabled); } | /**
* Enables or disables notification on a give characteristic.
*
* @param characteristic Characteristic to act on.
* @param enabled If true, enable notification. False otherwise.
*/ | Enables or disables notification on a give characteristic | setCharacteristicNotification | {
"repo_name": "lvjing2/MarkBit",
"path": "app/src/main/java/com/liwn/zzl/markbit/bluetooth/BluetoothLeService.java",
"license": "agpl-3.0",
"size": 17811
} | [
"android.bluetooth.BluetoothGattCharacteristic",
"android.util.Log"
] | import android.bluetooth.BluetoothGattCharacteristic; import android.util.Log; | import android.bluetooth.*; import android.util.*; | [
"android.bluetooth",
"android.util"
] | android.bluetooth; android.util; | 2,519,016 |
public static String formatIPAddressForURI(InetAddress inet){
if(inet == null){
throw new IllegalArgumentException();
}
if(inet instanceof Inet4Address){
return inet.getHostAddress();
} else if (inet instanceof Inet6Address){
return '[' + formatAddress(inet) + ']';
} else {
return inet.getHostAddress();
}
} | static String function(InetAddress inet){ if(inet == null){ throw new IllegalArgumentException(); } if(inet instanceof Inet4Address){ return inet.getHostAddress(); } else if (inet instanceof Inet6Address){ return '[' + formatAddress(inet) + ']'; } else { return inet.getHostAddress(); } } | /**
* Formats input address. For IPV4 returns simply host address, for IPV6 formats address according to <a
* href="http://tools.ietf.org/html/rfc5952">RFC5952</a> rules. It embeds IPV6 address in '[', ']'.
*
* @param inet
* @return
*/ | Formats input address. For IPV4 returns simply host address, for IPV6 formats address according to RFC5952 rules. It embeds IPV6 address in '[', ']' | formatIPAddressForURI | {
"repo_name": "JiriOndrusek/wildfly-core",
"path": "network/src/main/java/org/jboss/as/network/NetworkUtils.java",
"license": "lgpl-2.1",
"size": 16502
} | [
"java.net.Inet4Address",
"java.net.Inet6Address",
"java.net.InetAddress"
] | import java.net.Inet4Address; import java.net.Inet6Address; import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 335,446 |
static String printModuleType(ModuleType moduleType) {
StringBuilder writer = new StringBuilder();
printChars(writer, '-', 100, true);
writer.append(moduleType.getUID() + "\n");
printChars(writer, '-', 100, true);
writer.append("UID");
printChars(writer, ' ', 27, false);
writer.append(moduleType.getUID() + "\n");
String label = moduleType.getLabel();
if (label != null) {
writer.append("LABEL");
printChars(writer, ' ', 25, false);
writer.append(label + "\n");
}
String description = moduleType.getDescription();
if (description != null) {
writer.append("DESCRIPTION");
printChars(writer, ' ', 19, false);
writer.append(description + "\n");
}
writer.append("VISIBILITY");
printChars(writer, ' ', 20, false);
writer.append(moduleType.getVisibility() + "\n");
Set<String> tags = moduleType.getTags();
if (tags != null && !tags.isEmpty()) {
writer.append("TAGS");
printChars(writer, ' ', 26, false);
writer.append(makeString(tags) + "\n");
}
Set<ConfigDescriptionParameter> cd = moduleType.getConfigurationDescription();
if (cd != null && !cd.isEmpty()) {
writer.append("CONFIGURATION_DESCRIPTIONS");
printChars(writer, ' ', 4, false);
writer.append(printConfigurationDescription(cd) + "\n");
}
if (moduleType instanceof TriggerType) {
Set<Output> outputs = ((TriggerType) moduleType).getOutputs();
if (outputs != null && !outputs.isEmpty()) {
writer.append("OUTPUTS");
printChars(writer, ' ', 23, false);
writer.append(makeString(outputs) + "\n");
}
}
if (moduleType instanceof ConditionType) {
Set<Input> inputs = ((ConditionType) moduleType).getInputs();
if (inputs != null && !inputs.isEmpty()) {
writer.append("INPUTS");
printChars(writer, ' ', 24, false);
writer.append(makeString(inputs) + "\n");
}
}
if (moduleType instanceof ActionType) {
Set<Input> inputs = ((ActionType) moduleType).getInputs();
if (inputs != null && !inputs.isEmpty()) {
writer.append("INPUTS");
printChars(writer, ' ', 24, false);
writer.append(makeString(inputs) + "\n");
}
Set<Output> outputs = ((ActionType) moduleType).getOutputs();
if (outputs != null && !outputs.isEmpty()) {
writer.append("OUTPUTS");
printChars(writer, ' ', 23, false);
writer.append(makeString(outputs) + "\n");
}
}
if (moduleType instanceof CompositeTriggerType) {
List<Trigger> triggers = ((CompositeTriggerType) moduleType).getModules();
if (triggers != null && !triggers.isEmpty()) {
writer.append("TRIGGERS");
printChars(writer, ' ', 22, false);
int last = triggers.size();
for (Trigger trigger : triggers) {
writer.append(printModule(trigger));
last--;
if (last > 0)
printChars(writer, ' ', 30, false);
}
}
}
if (moduleType instanceof CompositeConditionType) {
List<Condition> conditions = ((CompositeConditionType) moduleType).getModules();
if (conditions != null && !conditions.isEmpty()) {
writer.append("CONDITIONS");
printChars(writer, ' ', 20, false);
int last = conditions.size();
for (Condition condition : conditions) {
writer.append(printModule(condition));
last--;
if (last > 0)
printChars(writer, ' ', 30, false);
}
}
}
if (moduleType instanceof CompositeActionType) {
List<Action> actions = ((CompositeActionType) moduleType).getModules();
if (actions != null && !actions.isEmpty()) {
writer.append("ACTIONS");
printChars(writer, ' ', 23, false);
int last = actions.size();
for (Action action : actions) {
writer.append(printModule(action));
last--;
if (last > 0)
printChars(writer, ' ', 30, false);
}
}
}
printChars(writer, '-', 100, true);
return writer.toString();
} | static String printModuleType(ModuleType moduleType) { StringBuilder writer = new StringBuilder(); printChars(writer, '-', 100, true); writer.append(moduleType.getUID() + "\n"); printChars(writer, '-', 100, true); writer.append("UID"); printChars(writer, ' ', 27, false); writer.append(moduleType.getUID() + "\n"); String label = moduleType.getLabel(); if (label != null) { writer.append("LABEL"); printChars(writer, ' ', 25, false); writer.append(label + "\n"); } String description = moduleType.getDescription(); if (description != null) { writer.append(STR); printChars(writer, ' ', 19, false); writer.append(description + "\n"); } writer.append(STR); printChars(writer, ' ', 20, false); writer.append(moduleType.getVisibility() + "\n"); Set<String> tags = moduleType.getTags(); if (tags != null && !tags.isEmpty()) { writer.append("TAGS"); printChars(writer, ' ', 26, false); writer.append(makeString(tags) + "\n"); } Set<ConfigDescriptionParameter> cd = moduleType.getConfigurationDescription(); if (cd != null && !cd.isEmpty()) { writer.append(STR); printChars(writer, ' ', 4, false); writer.append(printConfigurationDescription(cd) + "\n"); } if (moduleType instanceof TriggerType) { Set<Output> outputs = ((TriggerType) moduleType).getOutputs(); if (outputs != null && !outputs.isEmpty()) { writer.append(STR); printChars(writer, ' ', 23, false); writer.append(makeString(outputs) + "\n"); } } if (moduleType instanceof ConditionType) { Set<Input> inputs = ((ConditionType) moduleType).getInputs(); if (inputs != null && !inputs.isEmpty()) { writer.append(STR); printChars(writer, ' ', 24, false); writer.append(makeString(inputs) + "\n"); } } if (moduleType instanceof ActionType) { Set<Input> inputs = ((ActionType) moduleType).getInputs(); if (inputs != null && !inputs.isEmpty()) { writer.append(STR); printChars(writer, ' ', 24, false); writer.append(makeString(inputs) + "\n"); } Set<Output> outputs = ((ActionType) moduleType).getOutputs(); if (outputs != null && !outputs.isEmpty()) { writer.append(STR); printChars(writer, ' ', 23, false); writer.append(makeString(outputs) + "\n"); } } if (moduleType instanceof CompositeTriggerType) { List<Trigger> triggers = ((CompositeTriggerType) moduleType).getModules(); if (triggers != null && !triggers.isEmpty()) { writer.append(STR); printChars(writer, ' ', 22, false); int last = triggers.size(); for (Trigger trigger : triggers) { writer.append(printModule(trigger)); last--; if (last > 0) printChars(writer, ' ', 30, false); } } } if (moduleType instanceof CompositeConditionType) { List<Condition> conditions = ((CompositeConditionType) moduleType).getModules(); if (conditions != null && !conditions.isEmpty()) { writer.append(STR); printChars(writer, ' ', 20, false); int last = conditions.size(); for (Condition condition : conditions) { writer.append(printModule(condition)); last--; if (last > 0) printChars(writer, ' ', 30, false); } } } if (moduleType instanceof CompositeActionType) { List<Action> actions = ((CompositeActionType) moduleType).getModules(); if (actions != null && !actions.isEmpty()) { writer.append(STR); printChars(writer, ' ', 23, false); int last = actions.size(); for (Action action : actions) { writer.append(printModule(action)); last--; if (last > 0) printChars(writer, ' ', 30, false); } } } printChars(writer, '-', 100, true); return writer.toString(); } | /**
* This method is responsible for printing the {@link ModuleType}.
*
* @param moduleType the {@link ModuleType} for printing.
* @return a formated string, representing the {@link ModuleType}.
*/ | This method is responsible for printing the <code>ModuleType</code> | printModuleType | {
"repo_name": "danchom/smarthome",
"path": "bundles/automation/org.eclipse.smarthome.automation.commands/src/main/java/org/eclipse/smarthome/automation/commands/Printer.java",
"license": "epl-1.0",
"size": 27901
} | [
"java.util.List",
"java.util.Set",
"org.eclipse.smarthome.automation.Action",
"org.eclipse.smarthome.automation.Condition",
"org.eclipse.smarthome.automation.Trigger",
"org.eclipse.smarthome.automation.type.ActionType",
"org.eclipse.smarthome.automation.type.CompositeActionType",
"org.eclipse.smarthome.automation.type.CompositeConditionType",
"org.eclipse.smarthome.automation.type.CompositeTriggerType",
"org.eclipse.smarthome.automation.type.ConditionType",
"org.eclipse.smarthome.automation.type.Input",
"org.eclipse.smarthome.automation.type.ModuleType",
"org.eclipse.smarthome.automation.type.Output",
"org.eclipse.smarthome.automation.type.TriggerType",
"org.eclipse.smarthome.config.core.ConfigDescriptionParameter"
] | import java.util.List; import java.util.Set; import org.eclipse.smarthome.automation.Action; import org.eclipse.smarthome.automation.Condition; import org.eclipse.smarthome.automation.Trigger; import org.eclipse.smarthome.automation.type.ActionType; import org.eclipse.smarthome.automation.type.CompositeActionType; import org.eclipse.smarthome.automation.type.CompositeConditionType; import org.eclipse.smarthome.automation.type.CompositeTriggerType; import org.eclipse.smarthome.automation.type.ConditionType; import org.eclipse.smarthome.automation.type.Input; import org.eclipse.smarthome.automation.type.ModuleType; import org.eclipse.smarthome.automation.type.Output; import org.eclipse.smarthome.automation.type.TriggerType; import org.eclipse.smarthome.config.core.ConfigDescriptionParameter; | import java.util.*; import org.eclipse.smarthome.automation.*; import org.eclipse.smarthome.automation.type.*; import org.eclipse.smarthome.config.core.*; | [
"java.util",
"org.eclipse.smarthome"
] | java.util; org.eclipse.smarthome; | 1,949,223 |
final RPAction action = new RPAction();
action.put("type", "away");
if (remainder.length() != 0) {
action.put("message", remainder);
}
ClientSingletonRepository.getClientFramework().send(action);
return true;
} | final RPAction action = new RPAction(); action.put("type", "away"); if (remainder.length() != 0) { action.put(STR, remainder); } ClientSingletonRepository.getClientFramework().send(action); return true; } | /**
* Execute an away command.
*
* @param params
* The formal parameters.
* @param remainder
* Line content after parameters.
*
* @return <code>true</code> if command was handled.
*/ | Execute an away command | execute | {
"repo_name": "sourceress-project/archestica",
"path": "src/games/stendhal/client/actions/AwayAction.java",
"license": "gpl-2.0",
"size": 2004
} | [
"games.stendhal.client.ClientSingletonRepository"
] | import games.stendhal.client.ClientSingletonRepository; | import games.stendhal.client.*; | [
"games.stendhal.client"
] | games.stendhal.client; | 206,261 |
default void checkCanDeleteFromTable(ConnectorTransactionHandle transactionHandle, Identity identity, SchemaTableName tableName)
{
denyDeleteTable(tableName.toString());
} | default void checkCanDeleteFromTable(ConnectorTransactionHandle transactionHandle, Identity identity, SchemaTableName tableName) { denyDeleteTable(tableName.toString()); } | /**
* Check if identity is allowed to delete from the specified table in this catalog.
*
* @throws com.facebook.presto.spi.security.AccessDeniedException if not allowed
*/ | Check if identity is allowed to delete from the specified table in this catalog | checkCanDeleteFromTable | {
"repo_name": "marsorp/blog",
"path": "presto166/presto-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorAccessControl.java",
"license": "apache-2.0",
"size": 9922
} | [
"com.facebook.presto.spi.SchemaTableName",
"com.facebook.presto.spi.security.AccessDeniedException",
"com.facebook.presto.spi.security.Identity"
] | import com.facebook.presto.spi.SchemaTableName; import com.facebook.presto.spi.security.AccessDeniedException; import com.facebook.presto.spi.security.Identity; | import com.facebook.presto.spi.*; import com.facebook.presto.spi.security.*; | [
"com.facebook.presto"
] | com.facebook.presto; | 1,408,658 |
EReference getAdditiveExpression_Left(); | EReference getAdditiveExpression_Left(); | /**
* Returns the meta object for the containment reference '{@link com.euclideanspace.spad.editor.AdditiveExpression#getLeft <em>Left</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>Left</em>'.
* @see com.euclideanspace.spad.editor.AdditiveExpression#getLeft()
* @see #getAdditiveExpression()
* @generated
*/ | Returns the meta object for the containment reference '<code>com.euclideanspace.spad.editor.AdditiveExpression#getLeft Left</code>'. | getAdditiveExpression_Left | {
"repo_name": "martinbaker/euclideanspace",
"path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/editor/EditorPackage.java",
"license": "agpl-3.0",
"size": 593321
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,228,859 |
public CountDownLatch getAccountAttributesAsync(Integer accountId, AsyncCallback<com.mozu.api.contracts.customer.CustomerAttributeCollection> callback) throws Exception
{
return getAccountAttributesAsync( accountId, null, null, null, null, null, callback);
} | CountDownLatch function(Integer accountId, AsyncCallback<com.mozu.api.contracts.customer.CustomerAttributeCollection> callback) throws Exception { return getAccountAttributesAsync( accountId, null, null, null, null, null, callback); } | /**
* Retrieves the list of customer account attributes.
* <p><pre><code>
* CustomerAttribute customerattribute = new CustomerAttribute();
* CountDownLatch latch = customerattribute.getAccountAttributes( accountId, callback );
* latch.await() * </code></pre></p>
* @param accountId Unique identifier of the customer account.
* @param callback callback handler for asynchronous operations
* @return com.mozu.api.contracts.customer.CustomerAttributeCollection
* @see com.mozu.api.contracts.customer.CustomerAttributeCollection
*/ | Retrieves the list of customer account attributes. <code><code> CustomerAttribute customerattribute = new CustomerAttribute(); CountDownLatch latch = customerattribute.getAccountAttributes( accountId, callback ); latch.await() * </code></code> | getAccountAttributesAsync | {
"repo_name": "bhewett/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/customer/accounts/CustomerAttributeResource.java",
"license": "mit",
"size": 20192
} | [
"com.mozu.api.AsyncCallback",
"java.util.concurrent.CountDownLatch"
] | import com.mozu.api.AsyncCallback; import java.util.concurrent.CountDownLatch; | import com.mozu.api.*; import java.util.concurrent.*; | [
"com.mozu.api",
"java.util"
] | com.mozu.api; java.util; | 1,147,516 |
final InputColumn<?>[] columnArray = columns.toArray(new InputColumn<?>[columns.size()]);
final String[] headers = new String[columnArray.length];
for (int i = 0; i < headers.length; i++) {
headers[i] = columnArray[i].getName();
}
return getWriter(filename, headers, ',', '"', '\\', true, columnArray);
} | final InputColumn<?>[] columnArray = columns.toArray(new InputColumn<?>[columns.size()]); final String[] headers = new String[columnArray.length]; for (int i = 0; i < headers.length; i++) { headers[i] = columnArray[i].getName(); } return getWriter(filename, headers, ',', '"', '\\', true, columnArray); } | /**
* Creates a CSV output writer with default configuration
*
* @param filename
* @param columns
* @return
*/ | Creates a CSV output writer with default configuration | getWriter | {
"repo_name": "anandswarupv/DataCleaner",
"path": "engine/core/src/main/java/org/datacleaner/output/csv/CsvOutputWriterFactory.java",
"license": "lgpl-3.0",
"size": 5039
} | [
"org.datacleaner.api.InputColumn"
] | import org.datacleaner.api.InputColumn; | import org.datacleaner.api.*; | [
"org.datacleaner.api"
] | org.datacleaner.api; | 48,836 |
EClass getTerminatorServiceDeclaration(); | EClass getTerminatorServiceDeclaration(); | /**
* Returns the meta object for class '{@link org.xtuml.bp.xtext.masl.masl.structure.TerminatorServiceDeclaration <em>Terminator Service Declaration</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Terminator Service Declaration</em>'.
* @see org.xtuml.bp.xtext.masl.masl.structure.TerminatorServiceDeclaration
* @generated
*/ | Returns the meta object for class '<code>org.xtuml.bp.xtext.masl.masl.structure.TerminatorServiceDeclaration Terminator Service Declaration</code>'. | getTerminatorServiceDeclaration | {
"repo_name": "lwriemen/bridgepoint",
"path": "src/org.xtuml.bp.xtext.masl.parent/org.xtuml.bp.xtext.masl/emf-gen/org/xtuml/bp/xtext/masl/masl/structure/StructurePackage.java",
"license": "apache-2.0",
"size": 189771
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,703,179 |
@Test
@InSequence(1)
public void testDatabaseCertLoginModule() throws Exception {
testLoginWithCertificate(APP_NAME);
} | @InSequence(1) void function() throws Exception { testLoginWithCertificate(APP_NAME); } | /**
* Test authentication against application which uses security domain with
* configured {@link DatabaseCertLoginModule}.
*
*/ | Test authentication against application which uses security domain with configured <code>DatabaseCertLoginModule</code> | testDatabaseCertLoginModule | {
"repo_name": "tomazzupan/wildfly",
"path": "testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/web/ssl/DatabaseCertLoginModuleTestCase.java",
"license": "lgpl-2.1",
"size": 10942
} | [
"org.jboss.arquillian.junit.InSequence"
] | import org.jboss.arquillian.junit.InSequence; | import org.jboss.arquillian.junit.*; | [
"org.jboss.arquillian"
] | org.jboss.arquillian; | 2,730,300 |
new Test();
}
public Test() {
try {
String ftpServlet = "http://"
+ InetAddress.getLocalHost().getHostAddress()
+ ":8080/ftpServlet";
AssetRegistry.getInstance().addFileTransferListener(this);
AssetRegistry.getInstance().registerAsset(ftpServlet,
UUID.randomUUID().toString(), "C:\\123\\vvv.mpg");
// AssetRegistry.getInstance().getAsset("http://"+InetAddress.getLocalHost().getHostAddress()+":8080/FileServer",
// "vvv.mpg", "C:/1");
} catch (IOException e) {
e.printStackTrace();
}
}
| new Test(); } public Test() { try { String ftpServlet = STR:8080/ftpServletSTRC:\\123\\vvv.mpg"); } catch (IOException e) { e.printStackTrace(); } } | /**
* The main method.
*
* @param args
* the arguments
*/ | The main method | main | {
"repo_name": "synergynet/synergynet2.5",
"path": "synergynet2.5/src/main/java/apps/mtdesktop/fileutility/Test.java",
"license": "bsd-3-clause",
"size": 2381
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 207,280 |
public void setMenuItemLoggerPanel(JCheckBoxMenuItem menuItemLoggerPanel) {
this.menuItemLoggerPanel = menuItemLoggerPanel;
} | void function(JCheckBoxMenuItem menuItemLoggerPanel) { this.menuItemLoggerPanel = menuItemLoggerPanel; } | /**
* Set the menu item LoggerPanel.
* @param menuItemLoggerPanel The menu item LoggerPanel
*/ | Set the menu item LoggerPanel | setMenuItemLoggerPanel | {
"repo_name": "d0k1/jmeter",
"path": "src/core/org/apache/jmeter/gui/GuiPackage.java",
"license": "apache-2.0",
"size": 29206
} | [
"javax.swing.JCheckBoxMenuItem"
] | import javax.swing.JCheckBoxMenuItem; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 364,707 |
@Test(expected=IllegalDocumentTypeException.class)
public void testCreateInactiveDocumentType() throws Exception {
// the CreatedDocumentInactive document type is inactive and should not be able to
// be initiated for a new document
WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "CreatedDocumentInactive");
} | @Test(expected=IllegalDocumentTypeException.class) void function() throws Exception { WorkflowDocumentFactory.createDocument(getPrincipalIdForName(STR), STR); } | /**
* Tests the attempt to create a document from a document type with no routing path.
*/ | Tests the attempt to create a document from a document type with no routing path | testCreateInactiveDocumentType | {
"repo_name": "bhutchinson/rice",
"path": "rice-middleware/it/kew/src/test/java/org/kuali/rice/kew/actions/CreateDocumentTest.java",
"license": "apache-2.0",
"size": 4048
} | [
"org.junit.Test",
"org.kuali.rice.kew.api.WorkflowDocumentFactory",
"org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException"
] | import org.junit.Test; import org.kuali.rice.kew.api.WorkflowDocumentFactory; import org.kuali.rice.kew.api.doctype.IllegalDocumentTypeException; | import org.junit.*; import org.kuali.rice.kew.api.*; import org.kuali.rice.kew.api.doctype.*; | [
"org.junit",
"org.kuali.rice"
] | org.junit; org.kuali.rice; | 1,848,497 |
public Builder addAllBindings(List<Binding> bindings) {
if (this.bindings == null) {
this.bindings = new LinkedList<>();
}
this.bindings.addAll(bindings);
return this;
} | Builder function(List<Binding> bindings) { if (this.bindings == null) { this.bindings = new LinkedList<>(); } this.bindings.addAll(bindings); return this; } | /**
* Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to
* specify bindings.
*/ | Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to specify bindings | addAllBindings | {
"repo_name": "vam-google/google-cloud-java",
"path": "google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/GlobalSetPolicyRequest.java",
"license": "apache-2.0",
"size": 7209
} | [
"java.util.LinkedList",
"java.util.List"
] | import java.util.LinkedList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 626,839 |
EAttribute getStatement_OpeningDate(); | EAttribute getStatement_OpeningDate(); | /**
* Returns the meta object for the attribute '{@link org.nasdanika.examples.bank.Statement#getOpeningDate <em>Opening Date</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Opening Date</em>'.
* @see org.nasdanika.examples.bank.Statement#getOpeningDate()
* @see #getStatement()
* @generated
*/ | Returns the meta object for the attribute '<code>org.nasdanika.examples.bank.Statement#getOpeningDate Opening Date</code>'. | getStatement_OpeningDate | {
"repo_name": "Nasdanika/examples",
"path": "org.nasdanika.examples.bank/src/org/nasdanika/examples/bank/BankPackage.java",
"license": "epl-1.0",
"size": 69780
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,165,142 |
public static boolean actionRevertedSuccessfully(SQLException exception) {
return !(exception instanceof ProxyException) || !exception.iterator().hasNext();
} | static boolean function(SQLException exception) { return !(exception instanceof ProxyException) !exception.iterator().hasNext(); } | /**
* Sometimes is useful to know whether failed action was reverted successfully and there are no inconsistencies in databases.
* @param exception sql exception (or proxy exception) thrown by proxy driver
* @return whether action was reverted successfully
*/ | Sometimes is useful to know whether failed action was reverted successfully and there are no inconsistencies in databases | actionRevertedSuccessfully | {
"repo_name": "dude65/jdbc_proxy_driver",
"path": "src/main/java/org/fit/proxy/jdbc/exception/ProxyExceptionUtils.java",
"license": "apache-2.0",
"size": 2287
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,061,865 |
WebDriver get(DesiredCapabilities capabilities); | WebDriver get(DesiredCapabilities capabilities); | /**
* Get a a {@link WebDriver} instance.
*
* @param capabilities
* @return
*/ | Get a a <code>WebDriver</code> instance | get | {
"repo_name": "lhong375/aura",
"path": "aura/src/test/java/org/auraframework/test/WebDriverProvider.java",
"license": "apache-2.0",
"size": 1743
} | [
"org.openqa.selenium.WebDriver",
"org.openqa.selenium.remote.DesiredCapabilities"
] | import org.openqa.selenium.WebDriver; import org.openqa.selenium.remote.DesiredCapabilities; | import org.openqa.selenium.*; import org.openqa.selenium.remote.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 65,315 |
Preconditions.checkNotNull(resultMap, key);
return resultMap.get(key);
} | Preconditions.checkNotNull(resultMap, key); return resultMap.get(key); } | /**
* Get a successfully evaluated value.
*/ | Get a successfully evaluated value | get | {
"repo_name": "aehlig/bazel",
"path": "src/main/java/com/google/devtools/build/skyframe/EvaluationResult.java",
"license": "apache-2.0",
"size": 6804
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,527,886 |
public static boolean isNext(final Buffer buffer, final byte b) throws IOException {
return buffer.hasReadableBytes() && buffer.peekByte() == b;
} | static boolean function(final Buffer buffer, final byte b) throws IOException { return buffer.hasReadableBytes() && buffer.peekByte() == b; } | /**
* Will check whether the next readable byte in the buffer is a certain byte
*
* @param buffer
* the buffer to peek into
* @param b
* the byte we are checking is the next byte in the buffer to be
* read
* @return true if the next byte to read indeed is what we hope it is
*/ | Will check whether the next readable byte in the buffer is a certain byte | isNext | {
"repo_name": "aboutsip/pkts",
"path": "pkts-sip/src/main/java/io/pkts/packet/sip/impl/SipParser.java",
"license": "mit",
"size": 86189
} | [
"io.pkts.buffer.Buffer",
"java.io.IOException"
] | import io.pkts.buffer.Buffer; import java.io.IOException; | import io.pkts.buffer.*; import java.io.*; | [
"io.pkts.buffer",
"java.io"
] | io.pkts.buffer; java.io; | 2,310,480 |
ImmutableSet<Artifact> getOrphanArtifacts(); | ImmutableSet<Artifact> getOrphanArtifacts(); | /**
* Returns the set of orphan Artifacts (i.e. Artifacts without generating action). Should only be
* called after the ConfiguredTarget is created.
*/ | Returns the set of orphan Artifacts (i.e. Artifacts without generating action). Should only be called after the ConfiguredTarget is created | getOrphanArtifacts | {
"repo_name": "mrdomino/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java",
"license": "apache-2.0",
"size": 6293
} | [
"com.google.common.collect.ImmutableSet",
"com.google.devtools.build.lib.actions.Artifact"
] | import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.actions.Artifact; | import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; | [
"com.google.common",
"com.google.devtools"
] | com.google.common; com.google.devtools; | 701,322 |
private NamedList<Object> getReplicationDetails(boolean showSlaveDetails) {
NamedList<Object> details = new SimpleOrderedMap<Object>();
NamedList<Object> master = new SimpleOrderedMap<Object>();
NamedList<Object> slave = new SimpleOrderedMap<Object>();
details.add("indexSize", NumberUtils.readableSize(getIndexSize()));
details.add("indexPath", core.getIndexDir());
details.add(CMD_SHOW_COMMITS, getCommits());
details.add("isMaster", String.valueOf(isMaster));
details.add("isSlave", String.valueOf(isSlave));
long[] versionAndGeneration = getIndexVersion();
details.add("indexVersion", versionAndGeneration[0]);
details.add(GENERATION, versionAndGeneration[1]);
IndexCommit commit = indexCommitPoint; // make a copy so it won't change
if (isMaster) {
if (includeConfFiles != null) master.add(CONF_FILES, includeConfFiles);
master.add(REPLICATE_AFTER, getReplicateAfterStrings());
master.add("replicationEnabled", String.valueOf(replicationEnabled.get()));
}
if (isMaster && commit != null) {
master.add("replicatableGeneration", commit.getGeneration());
}
SnapPuller snapPuller = tempSnapPuller;
if (snapPuller != null) {
Properties props = loadReplicationProperties();
if (showSlaveDetails) {
try {
NamedList nl = snapPuller.getDetails();
slave.add("masterDetails", nl.get(CMD_DETAILS));
} catch (Exception e) {
LOG.warn(
"Exception while invoking 'details' method for replication on master ",
e);
slave.add(ERR_STATUS, "invalid_master");
}
}
slave.add(MASTER_URL, snapPuller.getMasterUrl());
if (snapPuller.getPollInterval() != null) {
slave.add(SnapPuller.POLL_INTERVAL, snapPuller.getPollInterval());
}
if (snapPuller.getNextScheduledExecTime() != null && !isPollingDisabled()) {
slave.add(NEXT_EXECUTION_AT, new Date(snapPuller.getNextScheduledExecTime()).toString());
} else if (isPollingDisabled()) {
slave.add(NEXT_EXECUTION_AT, "Polling disabled");
}
addVal(slave, SnapPuller.INDEX_REPLICATED_AT, props, Date.class);
addVal(slave, SnapPuller.INDEX_REPLICATED_AT_LIST, props, List.class);
addVal(slave, SnapPuller.REPLICATION_FAILED_AT_LIST, props, List.class);
addVal(slave, SnapPuller.TIMES_INDEX_REPLICATED, props, Integer.class);
addVal(slave, SnapPuller.CONF_FILES_REPLICATED, props, Integer.class);
addVal(slave, SnapPuller.TIMES_CONFIG_REPLICATED, props, Integer.class);
addVal(slave, SnapPuller.CONF_FILES_REPLICATED_AT, props, Integer.class);
addVal(slave, SnapPuller.LAST_CYCLE_BYTES_DOWNLOADED, props, Long.class);
addVal(slave, SnapPuller.TIMES_FAILED, props, Integer.class);
addVal(slave, SnapPuller.REPLICATION_FAILED_AT, props, Date.class);
addVal(slave, SnapPuller.PREVIOUS_CYCLE_TIME_TAKEN, props, Long.class);
slave.add("currentDate", new Date().toString());
slave.add("isPollingDisabled", String.valueOf(isPollingDisabled()));
boolean isReplicating = isReplicating();
slave.add("isReplicating", String.valueOf(isReplicating));
if (isReplicating) {
try {
long bytesToDownload = 0;
List<String> filesToDownload = new ArrayList<String>();
for (Map<String, Object> file : snapPuller.getFilesToDownload()) {
filesToDownload.add((String) file.get(NAME));
bytesToDownload += (Long) file.get(SIZE);
}
//get list of conf files to download
for (Map<String, Object> file : snapPuller.getConfFilesToDownload()) {
filesToDownload.add((String) file.get(NAME));
bytesToDownload += (Long) file.get(SIZE);
}
slave.add("filesToDownload", filesToDownload);
slave.add("numFilesToDownload", String.valueOf(filesToDownload.size()));
slave.add("bytesToDownload", NumberUtils.readableSize(bytesToDownload));
long bytesDownloaded = 0;
List<String> filesDownloaded = new ArrayList<String>();
for (Map<String, Object> file : snapPuller.getFilesDownloaded()) {
filesDownloaded.add((String) file.get(NAME));
bytesDownloaded += (Long) file.get(SIZE);
}
//get list of conf files downloaded
for (Map<String, Object> file : snapPuller.getConfFilesDownloaded()) {
filesDownloaded.add((String) file.get(NAME));
bytesDownloaded += (Long) file.get(SIZE);
}
Map<String, Object> currentFile = snapPuller.getCurrentFile();
String currFile = null;
long currFileSize = 0, currFileSizeDownloaded = 0;
float percentDownloaded = 0;
if (currentFile != null) {
currFile = (String) currentFile.get(NAME);
currFileSize = (Long) currentFile.get(SIZE);
if (currentFile.containsKey("bytesDownloaded")) {
currFileSizeDownloaded = (Long) currentFile.get("bytesDownloaded");
bytesDownloaded += currFileSizeDownloaded;
if (currFileSize > 0)
percentDownloaded = (currFileSizeDownloaded * 100) / currFileSize;
}
}
slave.add("filesDownloaded", filesDownloaded);
slave.add("numFilesDownloaded", String.valueOf(filesDownloaded.size()));
long estimatedTimeRemaining = 0;
if (snapPuller.getReplicationStartTime() > 0) {
slave.add("replicationStartTime", new Date(snapPuller.getReplicationStartTime()).toString());
}
long elapsed = getTimeElapsed(snapPuller);
slave.add("timeElapsed", String.valueOf(elapsed) + "s");
if (bytesDownloaded > 0)
estimatedTimeRemaining = ((bytesToDownload - bytesDownloaded) * elapsed) / bytesDownloaded;
float totalPercent = 0;
long downloadSpeed = 0;
if (bytesToDownload > 0)
totalPercent = (bytesDownloaded * 100) / bytesToDownload;
if (elapsed > 0)
downloadSpeed = (bytesDownloaded / elapsed);
if (currFile != null)
slave.add("currentFile", currFile);
slave.add("currentFileSize", NumberUtils.readableSize(currFileSize));
slave.add("currentFileSizeDownloaded", NumberUtils.readableSize(currFileSizeDownloaded));
slave.add("currentFileSizePercent", String.valueOf(percentDownloaded));
slave.add("bytesDownloaded", NumberUtils.readableSize(bytesDownloaded));
slave.add("totalPercent", String.valueOf(totalPercent));
slave.add("timeRemaining", String.valueOf(estimatedTimeRemaining) + "s");
slave.add("downloadSpeed", NumberUtils.readableSize(downloadSpeed));
} catch (Exception e) {
LOG.error("Exception while writing replication details: ", e);
}
}
}
if (isMaster)
details.add("master", master);
if (slave.size() > 0)
details.add("slave", slave);
NamedList snapshotStats = snapShootDetails;
if (snapshotStats != null)
details.add(CMD_BACKUP, snapshotStats);
return details;
} | NamedList<Object> function(boolean showSlaveDetails) { NamedList<Object> details = new SimpleOrderedMap<Object>(); NamedList<Object> master = new SimpleOrderedMap<Object>(); NamedList<Object> slave = new SimpleOrderedMap<Object>(); details.add(STR, NumberUtils.readableSize(getIndexSize())); details.add(STR, core.getIndexDir()); details.add(CMD_SHOW_COMMITS, getCommits()); details.add(STR, String.valueOf(isMaster)); details.add(STR, String.valueOf(isSlave)); long[] versionAndGeneration = getIndexVersion(); details.add(STR, versionAndGeneration[0]); details.add(GENERATION, versionAndGeneration[1]); IndexCommit commit = indexCommitPoint; if (isMaster) { if (includeConfFiles != null) master.add(CONF_FILES, includeConfFiles); master.add(REPLICATE_AFTER, getReplicateAfterStrings()); master.add(STR, String.valueOf(replicationEnabled.get())); } if (isMaster && commit != null) { master.add(STR, commit.getGeneration()); } SnapPuller snapPuller = tempSnapPuller; if (snapPuller != null) { Properties props = loadReplicationProperties(); if (showSlaveDetails) { try { NamedList nl = snapPuller.getDetails(); slave.add(STR, nl.get(CMD_DETAILS)); } catch (Exception e) { LOG.warn( STR, e); slave.add(ERR_STATUS, STR); } } slave.add(MASTER_URL, snapPuller.getMasterUrl()); if (snapPuller.getPollInterval() != null) { slave.add(SnapPuller.POLL_INTERVAL, snapPuller.getPollInterval()); } if (snapPuller.getNextScheduledExecTime() != null && !isPollingDisabled()) { slave.add(NEXT_EXECUTION_AT, new Date(snapPuller.getNextScheduledExecTime()).toString()); } else if (isPollingDisabled()) { slave.add(NEXT_EXECUTION_AT, STR); } addVal(slave, SnapPuller.INDEX_REPLICATED_AT, props, Date.class); addVal(slave, SnapPuller.INDEX_REPLICATED_AT_LIST, props, List.class); addVal(slave, SnapPuller.REPLICATION_FAILED_AT_LIST, props, List.class); addVal(slave, SnapPuller.TIMES_INDEX_REPLICATED, props, Integer.class); addVal(slave, SnapPuller.CONF_FILES_REPLICATED, props, Integer.class); addVal(slave, SnapPuller.TIMES_CONFIG_REPLICATED, props, Integer.class); addVal(slave, SnapPuller.CONF_FILES_REPLICATED_AT, props, Integer.class); addVal(slave, SnapPuller.LAST_CYCLE_BYTES_DOWNLOADED, props, Long.class); addVal(slave, SnapPuller.TIMES_FAILED, props, Integer.class); addVal(slave, SnapPuller.REPLICATION_FAILED_AT, props, Date.class); addVal(slave, SnapPuller.PREVIOUS_CYCLE_TIME_TAKEN, props, Long.class); slave.add(STR, new Date().toString()); slave.add(STR, String.valueOf(isPollingDisabled())); boolean isReplicating = isReplicating(); slave.add(STR, String.valueOf(isReplicating)); if (isReplicating) { try { long bytesToDownload = 0; List<String> filesToDownload = new ArrayList<String>(); for (Map<String, Object> file : snapPuller.getFilesToDownload()) { filesToDownload.add((String) file.get(NAME)); bytesToDownload += (Long) file.get(SIZE); } for (Map<String, Object> file : snapPuller.getConfFilesToDownload()) { filesToDownload.add((String) file.get(NAME)); bytesToDownload += (Long) file.get(SIZE); } slave.add(STR, filesToDownload); slave.add(STR, String.valueOf(filesToDownload.size())); slave.add(STR, NumberUtils.readableSize(bytesToDownload)); long bytesDownloaded = 0; List<String> filesDownloaded = new ArrayList<String>(); for (Map<String, Object> file : snapPuller.getFilesDownloaded()) { filesDownloaded.add((String) file.get(NAME)); bytesDownloaded += (Long) file.get(SIZE); } for (Map<String, Object> file : snapPuller.getConfFilesDownloaded()) { filesDownloaded.add((String) file.get(NAME)); bytesDownloaded += (Long) file.get(SIZE); } Map<String, Object> currentFile = snapPuller.getCurrentFile(); String currFile = null; long currFileSize = 0, currFileSizeDownloaded = 0; float percentDownloaded = 0; if (currentFile != null) { currFile = (String) currentFile.get(NAME); currFileSize = (Long) currentFile.get(SIZE); if (currentFile.containsKey(STR)) { currFileSizeDownloaded = (Long) currentFile.get(STR); bytesDownloaded += currFileSizeDownloaded; if (currFileSize > 0) percentDownloaded = (currFileSizeDownloaded * 100) / currFileSize; } } slave.add(STR, filesDownloaded); slave.add(STR, String.valueOf(filesDownloaded.size())); long estimatedTimeRemaining = 0; if (snapPuller.getReplicationStartTime() > 0) { slave.add(STR, new Date(snapPuller.getReplicationStartTime()).toString()); } long elapsed = getTimeElapsed(snapPuller); slave.add(STR, String.valueOf(elapsed) + "s"); if (bytesDownloaded > 0) estimatedTimeRemaining = ((bytesToDownload - bytesDownloaded) * elapsed) / bytesDownloaded; float totalPercent = 0; long downloadSpeed = 0; if (bytesToDownload > 0) totalPercent = (bytesDownloaded * 100) / bytesToDownload; if (elapsed > 0) downloadSpeed = (bytesDownloaded / elapsed); if (currFile != null) slave.add(STR, currFile); slave.add(STR, NumberUtils.readableSize(currFileSize)); slave.add(STR, NumberUtils.readableSize(currFileSizeDownloaded)); slave.add(STR, String.valueOf(percentDownloaded)); slave.add(STR, NumberUtils.readableSize(bytesDownloaded)); slave.add(STR, String.valueOf(totalPercent)); slave.add(STR, String.valueOf(estimatedTimeRemaining) + "s"); slave.add(STR, NumberUtils.readableSize(downloadSpeed)); } catch (Exception e) { LOG.error(STR, e); } } } if (isMaster) details.add(STR, master); if (slave.size() > 0) details.add("slave", slave); NamedList snapshotStats = snapShootDetails; if (snapshotStats != null) details.add(CMD_BACKUP, snapshotStats); return details; } | /**
* Used for showing statistics and progress information.
*/ | Used for showing statistics and progress information | getReplicationDetails | {
"repo_name": "netboynb/search-core",
"path": "src/main/java/org/apache/solr/handler/ReplicationHandler.java",
"license": "apache-2.0",
"size": 48992
} | [
"java.util.ArrayList",
"java.util.Date",
"java.util.List",
"java.util.Map",
"java.util.Properties",
"org.apache.lucene.index.IndexCommit",
"org.apache.solr.common.util.NamedList",
"org.apache.solr.common.util.SimpleOrderedMap",
"org.apache.solr.util.NumberUtils"
] | import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Properties; import org.apache.lucene.index.IndexCommit; import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.SimpleOrderedMap; import org.apache.solr.util.NumberUtils; | import java.util.*; import org.apache.lucene.index.*; import org.apache.solr.common.util.*; import org.apache.solr.util.*; | [
"java.util",
"org.apache.lucene",
"org.apache.solr"
] | java.util; org.apache.lucene; org.apache.solr; | 139,274 |
public void updateAccount(Account account, Connection con); | void function(Account account, Connection con); | /**
*
* Overloading method, does the same as updateAccount(account) but uses specified
* connection, useful for using this method as a part of a transaction.
*
*
* @param account
* Account object with all specified atributes. If not specified throws IllegalArgumentException.
* @param con
* Passed sql connection, if using this method as a part of a transaction,
* autocommit should be set to false.
*/ | Overloading method, does the same as updateAccount(account) but uses specified connection, useful for using this method as a part of a transaction | updateAccount | {
"repo_name": "MarekVan/pv168",
"path": "src/main/java/pv168/AccountManager.java",
"license": "mit",
"size": 4884
} | [
"java.sql.Connection"
] | import java.sql.Connection; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,110,096 |
@Test
public void UnhealthyResource() throws Exception {
TestPool pool = new TestPool(DynamicResourcePool.Options.defaultOptions());
Resource resource = pool.acquire();
Assert.assertEquals(0, resource.mInteger.intValue());
resource.setInteger(Resource.INVALID_RESOURCE);
pool.release(resource);
resource = pool.acquire();
// The 0-th resource is not acquired because it is unhealthy.
Assert.assertEquals(1, resource.mInteger.intValue());
} | void function() throws Exception { TestPool pool = new TestPool(DynamicResourcePool.Options.defaultOptions()); Resource resource = pool.acquire(); Assert.assertEquals(0, resource.mInteger.intValue()); resource.setInteger(Resource.INVALID_RESOURCE); pool.release(resource); resource = pool.acquire(); Assert.assertEquals(1, resource.mInteger.intValue()); } | /**
* Tests the logic that invalid resource won't be acquired.
*/ | Tests the logic that invalid resource won't be acquired | UnhealthyResource | {
"repo_name": "Reidddddd/alluxio",
"path": "core/common/src/test/java/alluxio/resource/DynamicResourcePoolTest.java",
"license": "apache-2.0",
"size": 9181
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 365,862 |
public static Executor create(World world, Matcher matcher,
BuiltinManager builtinMan, Handler logHandler) {
Executor executor = new Executor();
executor.setWorld(world);
executor.setMatcher(matcher);
executor.setBuiltinMan(builtinMan);
executor.setConfig(world.getConfig());
executor.setLogHandler(logHandler);
return executor;
}
| static Executor function(World world, Matcher matcher, BuiltinManager builtinMan, Handler logHandler) { Executor executor = new Executor(); executor.setWorld(world); executor.setMatcher(matcher); executor.setBuiltinMan(builtinMan); executor.setConfig(world.getConfig()); executor.setLogHandler(logHandler); return executor; } | /**
* Create a new executor from a given world, a matcher and a built-in manager
*
* @param world The world to execute
* @param matcher The matcher to match
* @param builtinMan The built-in manager to call built-in
* @param out The output
* @return Returns the executing environment
*/ | Create a new executor from a given world, a matcher and a built-in manager | create | {
"repo_name": "lshadowflarel/smash",
"path": "src/net/sf/xet/nxet/executor/Executor.java",
"license": "gpl-3.0",
"size": 58150
} | [
"java.util.logging.Handler",
"net.sf.xet.nxet.builtin.BuiltinManager",
"net.sf.xet.nxet.core.World",
"net.sf.xet.nxet.matcher.Matcher"
] | import java.util.logging.Handler; import net.sf.xet.nxet.builtin.BuiltinManager; import net.sf.xet.nxet.core.World; import net.sf.xet.nxet.matcher.Matcher; | import java.util.logging.*; import net.sf.xet.nxet.builtin.*; import net.sf.xet.nxet.core.*; import net.sf.xet.nxet.matcher.*; | [
"java.util",
"net.sf.xet"
] | java.util; net.sf.xet; | 1,638,332 |
public Call<ResponseBody> postRequiredArrayHeaderAsync(List<String> headerParameter, final ServiceCallback<Error> serviceCallback) {
if (headerParameter == null) {
serviceCallback.failure(new IllegalArgumentException("Parameter headerParameter is required and cannot be null."));
return null;
} | Call<ResponseBody> function(List<String> headerParameter, final ServiceCallback<Error> serviceCallback) { if (headerParameter == null) { serviceCallback.failure(new IllegalArgumentException(STR)); return null; } | /**
* Test explicitly required array. Please put a header 'headerParameter' => null and the client library should throw before the request is sent.
*
* @param headerParameter the List<String> value
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link Call} object
*/ | Test explicitly required array. Please put a header 'headerParameter' => null and the client library should throw before the request is sent | postRequiredArrayHeaderAsync | {
"repo_name": "vulcansteel/autorest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/requiredoptional/ExplicitOperationsImpl.java",
"license": "mit",
"size": 53908
} | [
"com.microsoft.rest.ServiceCallback",
"com.squareup.okhttp.ResponseBody",
"java.util.List"
] | import com.microsoft.rest.ServiceCallback; import com.squareup.okhttp.ResponseBody; import java.util.List; | import com.microsoft.rest.*; import com.squareup.okhttp.*; import java.util.*; | [
"com.microsoft.rest",
"com.squareup.okhttp",
"java.util"
] | com.microsoft.rest; com.squareup.okhttp; java.util; | 473,128 |
public Observable<ServiceResponse<PrivateEndpointConnectionInner>> getPrivateEndpointConnectionWithServiceResponseAsync(String resourceGroupName, String serviceName, String peConnectionName, String expand) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (serviceName == null) {
throw new IllegalArgumentException("Parameter serviceName is required and cannot be null.");
}
if (peConnectionName == null) {
throw new IllegalArgumentException("Parameter peConnectionName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
} | Observable<ServiceResponse<PrivateEndpointConnectionInner>> function(String resourceGroupName, String serviceName, String peConnectionName, String expand) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (serviceName == null) { throw new IllegalArgumentException(STR); } if (peConnectionName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } | /**
* Get the specific private end point connection by specific private link service in the resource group.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the private link service.
* @param peConnectionName The name of the private end point connection.
* @param expand Expands referenced resources.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PrivateEndpointConnectionInner object
*/ | Get the specific private end point connection by specific private link service in the resource group | getPrivateEndpointConnectionWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/PrivateLinkServicesInner.java",
"license": "mit",
"size": 162539
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,327,115 |
protected void checkJta() throws IgniteCheckedException {
ctx.jta().checkJta();
} | void function() throws IgniteCheckedException { ctx.jta().checkJta(); } | /**
* Checks if cache is working in JTA transaction and enlist cache as XAResource if necessary.
*
* @throws IgniteCheckedException In case of error.
*/ | Checks if cache is working in JTA transaction and enlist cache as XAResource if necessary | checkJta | {
"repo_name": "BiryukovVA/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java",
"license": "apache-2.0",
"size": 229217
} | [
"org.apache.ignite.IgniteCheckedException"
] | import org.apache.ignite.IgniteCheckedException; | import org.apache.ignite.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,473,424 |
@SuppressWarnings("unchecked")
public CmsList<CmsListItem> getParentList() {
Widget parent = getParent();
if (parent == null) {
return null;
}
return (CmsList<CmsListItem>)parent;
} | @SuppressWarnings(STR) CmsList<CmsListItem> function() { Widget parent = getParent(); if (parent == null) { return null; } return (CmsList<CmsListItem>)parent; } | /**
* Returns the parent list.<p>
*
* @return the parent list
*/ | Returns the parent list | getParentList | {
"repo_name": "it-tavis/opencms-core",
"path": "src-gwt/org/opencms/gwt/client/ui/CmsListItem.java",
"license": "lgpl-2.1",
"size": 20030
} | [
"com.google.gwt.user.client.ui.Widget"
] | import com.google.gwt.user.client.ui.Widget; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 129,706 |
public List getLetterGradeRows() {
return letterGradeRows;
} | List function() { return letterGradeRows; } | /**
* Grading scale used if grade entry by letter
* @return
*/ | Grading scale used if grade entry by letter | getLetterGradeRows | {
"repo_name": "harfalm/Sakai-10.1",
"path": "gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/GradebookSetupBean.java",
"license": "apache-2.0",
"size": 41653
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,089,973 |
@Nullable
public ItemStack findMatchingRecipe(InventoryCrafting craftMatrix, World worldIn) {
for (IRecipe irecipe : this.recipes) {
if (irecipe.matches(craftMatrix, worldIn)) {
return irecipe.getCraftingResult(craftMatrix);
}
}
return null;
} | ItemStack function(InventoryCrafting craftMatrix, World worldIn) { for (IRecipe irecipe : this.recipes) { if (irecipe.matches(craftMatrix, worldIn)) { return irecipe.getCraftingResult(craftMatrix); } } return null; } | /**
* Retrieves an ItemStack that has multiple recipes for it.
*/ | Retrieves an ItemStack that has multiple recipes for it | findMatchingRecipe | {
"repo_name": "cj3636/TheNewJourney",
"path": "src/main/java/com/thenewjourney/compat/jei/arcane/ArcaneCraftingManager.java",
"license": "lgpl-2.1",
"size": 4903
} | [
"net.minecraft.inventory.InventoryCrafting",
"net.minecraft.item.ItemStack",
"net.minecraft.item.crafting.IRecipe",
"net.minecraft.world.World"
] | import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; | import net.minecraft.inventory.*; import net.minecraft.item.*; import net.minecraft.item.crafting.*; import net.minecraft.world.*; | [
"net.minecraft.inventory",
"net.minecraft.item",
"net.minecraft.world"
] | net.minecraft.inventory; net.minecraft.item; net.minecraft.world; | 1,336,880 |
InputStream getFile(String path)
throws IOException; | InputStream getFile(String path) throws IOException; | /**
* Returns input stream with the data from path.
*
* @param path
* path of the source file
* @return input stream of file
* @throws IOException
* when some error occurs
*/ | Returns input stream with the data from path | getFile | {
"repo_name": "psnc-dl/darceo",
"path": "dsa/common/src/main/java/pl/psnc/synat/dsa/DataStorageClient.java",
"license": "gpl-3.0",
"size": 5622
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,871,776 |
public void setPreconditionDes(String precondDesValue) throws SdpException
{
if (precondDesValue == null)
throw new SdpException("The Precondition \"des\" attribute value is null");
else if (preconditionAttributes == null)
throw new SdpException("The Precondition Attributes is null");
else
{
try
{
String[] attributes = precondDesValue.split(" ");
// which is this length?! of the string or the []?
setPreconditionDes( attributes[1], // strength-tag
attributes[2], // status-type
attributes[3] // direction-tag
);
}
catch (ArrayIndexOutOfBoundsException ex)
{
throw new SdpException
("Error spliting the \"des\" attribute into words", ex);
}
}
} | void function(String precondDesValue) throws SdpException { if (precondDesValue == null) throw new SdpException(STRdes\STR); else if (preconditionAttributes == null) throw new SdpException(STR); else { try { String[] attributes = precondDesValue.split(" "); setPreconditionDes( attributes[1], attributes[2], attributes[3] ); } catch (ArrayIndexOutOfBoundsException ex) { throw new SdpException (STRdes\STR, ex); } } } | /**
* <p>Set attribute line for desired precondition state, given
* a string value encoded like the "des" attribute value</p>
*
* @param precondDesValue - a string with the value for a "des" attribute
* @throws SdpException
*/ | Set attribute line for desired precondition state, given a string value encoded like the "des" attribute value | setPreconditionDes | {
"repo_name": "fhg-fokus-nubomedia/signaling-plane",
"path": "modules/lib-sip/src/main/java/gov/nist/javax/sdp/fields/PreconditionFields.java",
"license": "apache-2.0",
"size": 22608
} | [
"javax.sdp.SdpException"
] | import javax.sdp.SdpException; | import javax.sdp.*; | [
"javax.sdp"
] | javax.sdp; | 1,201,146 |
private static void initNBTTagCompound(ItemStack itemStack)
{
if (!itemStack.hasTagCompound())
{
itemStack.setTagCompound(new NBTTagCompound());
}
} | static void function(ItemStack itemStack) { if (!itemStack.hasTagCompound()) { itemStack.setTagCompound(new NBTTagCompound()); } } | /**
* Initializes the NBT Tag Compound for the given ItemStack if it is null
*
* @param itemStack
* The ItemStack for which its NBT Tag Compound is being checked for initialization
*/ | Initializes the NBT Tag Compound for the given ItemStack if it is null | initNBTTagCompound | {
"repo_name": "thebrightspark/BitsAndBobs",
"path": "src/main/java/com/brightspark/bitsandbobs/util/NBTHelper.java",
"license": "gpl-2.0",
"size": 6734
} | [
"net.minecraft.item.ItemStack",
"net.minecraft.nbt.NBTTagCompound"
] | import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; | import net.minecraft.item.*; import net.minecraft.nbt.*; | [
"net.minecraft.item",
"net.minecraft.nbt"
] | net.minecraft.item; net.minecraft.nbt; | 1,247,079 |
private static void changeDocToDocx(List<String> files) {
logger.warn("转换doc为docx文件开始 ...");
for (int i = 0; i < files.size(); i++) {
if (files.get(i).endsWith("doc")) {
logger.warn("正在转换文件 " + files.get(i));
DocToDocx.docToDocx(files.get(i));
files.set(i, files.get(i) + "x");
}
}
logger.warn("转换doc为docx文件结束 ...");
} | static void function(List<String> files) { logger.warn(STR); for (int i = 0; i < files.size(); i++) { if (files.get(i).endsWith("doc")) { logger.warn(STR + files.get(i)); DocToDocx.docToDocx(files.get(i)); files.set(i, files.get(i) + "x"); } } logger.warn(STR); } | /**
* doc -> docx
*
* @param files all files selected by users
*/ | doc -> docx | changeDocToDocx | {
"repo_name": "chilejiang1024/word-pdf",
"path": "src/com/thunisoft/hyyd/util/Util.java",
"license": "mit",
"size": 8406
} | [
"com.thunisoft.hyyd.transform.DocToDocx",
"java.util.List"
] | import com.thunisoft.hyyd.transform.DocToDocx; import java.util.List; | import com.thunisoft.hyyd.transform.*; import java.util.*; | [
"com.thunisoft.hyyd",
"java.util"
] | com.thunisoft.hyyd; java.util; | 2,780,012 |
public List<DoubleProperty> getPotions() {
return potions;
} | List<DoubleProperty> function() { return potions; } | /**
* Returns user's potions.
* @return user's potions.
*/ | Returns user's potions | getPotions | {
"repo_name": "zsoltpete/Decisions",
"path": "src/main/java/com/petez/decisions/Models/User.java",
"license": "mit",
"size": 6621
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,344,654 |
public String toMetadataPath( ProjectReference reference ); | String function( ProjectReference reference ); | /**
* Given a {@link ProjectReference}, return the path to the metadata for
* the project.
*
* @param reference the reference to use.
* @return the path to the metadata file, or null if no metadata is appropriate.
*/ | Given a <code>ProjectReference</code>, return the path to the metadata for the project | toMetadataPath | {
"repo_name": "hiredman/archiva",
"path": "archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java",
"license": "apache-2.0",
"size": 8069
} | [
"org.apache.maven.archiva.model.ProjectReference"
] | import org.apache.maven.archiva.model.ProjectReference; | import org.apache.maven.archiva.model.*; | [
"org.apache.maven"
] | org.apache.maven; | 264,474 |
@Override
public void finer(final Marker marker, final String message, final Object... parameters) {
logWrapper.logIfEnabled(loggerName, Level.TRACE, marker, message, parameters);
} | void function(final Marker marker, final String message, final Object... parameters) { logWrapper.logIfEnabled(loggerName, Level.TRACE, marker, message, parameters); } | /**
* Logs a message with parameters at the {@code Level.TRACE} level.
*
* @param marker the marker data specific to this log statement
* @param message the message to log; the format depends on the message factory.
* @param parameters parameters to the message.
*/ | Logs a message with parameters at the Level.TRACE level | finer | {
"repo_name": "PurelyApplied/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/logging/log4j/LogWriterLogger.java",
"license": "apache-2.0",
"size": 56907
} | [
"org.apache.logging.log4j.Level",
"org.apache.logging.log4j.Marker"
] | import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Marker; | import org.apache.logging.log4j.*; | [
"org.apache.logging"
] | org.apache.logging; | 2,215,498 |
@Test
public void similarityTest()
throws IOException {
final int factor = 50001;
final File file1 = TestResourcesUtils.getTestResourceFile("InsideDoc/Lenna.png");
final File file2 = TestResourcesUtils.getTestResourceFile("InsideDoc/Doc_Lenna.docx");
final boolean printHashes = true;
UniformFuzzyHash hash1 = new UniformFuzzyHash(file1, factor);
UniformFuzzyHash hash2 = new UniformFuzzyHash(file2, factor);
if (printHashes) {
System.out.println(hash1);
System.out.println(hash2);
System.out.println();
}
for (SimilarityTypes similarityType : SimilarityTypes.values()) {
System.out.println(String.format(
"%s: %s",
similarityType.getName(),
ToStringUtils.formatDecimal(hash1.similarity(hash2, similarityType))));
}
}
| void function() throws IOException { final int factor = 50001; final File file1 = TestResourcesUtils.getTestResourceFile(STR); final File file2 = TestResourcesUtils.getTestResourceFile(STR); final boolean printHashes = true; UniformFuzzyHash hash1 = new UniformFuzzyHash(file1, factor); UniformFuzzyHash hash2 = new UniformFuzzyHash(file2, factor); if (printHashes) { System.out.println(hash1); System.out.println(hash2); System.out.println(); } for (SimilarityTypes similarityType : SimilarityTypes.values()) { System.out.println(String.format( STR, similarityType.getName(), ToStringUtils.formatDecimal(hash1.similarity(hash2, similarityType)))); } } | /**
* Similarity test.
* Tests all the similarity types between two hashes computed over two test resource files.
*
* @throws IOException In case an exception occurs reading a test resource file.
*/ | Similarity test. Tests all the similarity types between two hashes computed over two test resource files | similarityTest | {
"repo_name": "s3curitybug/similarity-uniform-fuzzy-hash",
"path": "src/test/java/com/github/s3curitybug/similarityuniformfuzzyhash/UniformFuzzyHashTest.java",
"license": "apache-2.0",
"size": 3129
} | [
"com.github.s3curitybug.similarityuniformfuzzyhash.UniformFuzzyHash",
"java.io.File",
"java.io.IOException"
] | import com.github.s3curitybug.similarityuniformfuzzyhash.UniformFuzzyHash; import java.io.File; import java.io.IOException; | import com.github.s3curitybug.similarityuniformfuzzyhash.*; import java.io.*; | [
"com.github.s3curitybug",
"java.io"
] | com.github.s3curitybug; java.io; | 182,284 |
public void displayBluetoothStatus() {
if (isBluetoothEnabled()) {
txtStatusBluetooth
.setContentDescription(getString(R.string.txtStatusBluetooth));
attachListener(txtStatusBluetooth);
} else {
viewBeforeBluetooth.setVisibility(View.GONE);
txtStatusBluetooth.setVisibility(View.GONE);
}
} | void function() { if (isBluetoothEnabled()) { txtStatusBluetooth .setContentDescription(getString(R.string.txtStatusBluetooth)); attachListener(txtStatusBluetooth); } else { viewBeforeBluetooth.setVisibility(View.GONE); txtStatusBluetooth.setVisibility(View.GONE); } } | /**
* Displays whether Bluetooth is on. If it is off, this status is not
* displayed.
*/ | Displays whether Bluetooth is on. If it is off, this status is not displayed | displayBluetoothStatus | {
"repo_name": "saurabh2590/EasyAccess",
"path": "src/org/easyaccess/status/StatusApp.java",
"license": "apache-2.0",
"size": 37410
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,581,849 |
// Arrange
// Act
final Set<Class<?>> fieldTypes = testee.getFieldTypes();
// Assert
assertThat(fieldTypes).hasSize(1).contains(String.class);
}
/**
* Test method for
* {@link de.ppi.fuwesta.spring.mvc.formatter.NonEmptyStringAnnotationFormatterFactory#getPrinter(de.ppi.fuwesta.spring.mvc.formatter.NonEmpty, java.lang.Class)} | final Set<Class<?>> fieldTypes = testee.getFieldTypes(); assertThat(fieldTypes).hasSize(1).contains(String.class); } /** * Test method for * {@link de.ppi.fuwesta.spring.mvc.formatter.NonEmptyStringAnnotationFormatterFactory#getPrinter(de.ppi.fuwesta.spring.mvc.formatter.NonEmpty, java.lang.Class)} | /**
* Test method for
* {@link de.ppi.fuwesta.spring.mvc.formatter.NonEmptyStringAnnotationFormatterFactory#getFieldTypes()}
* .
*/ | Test method for <code>de.ppi.fuwesta.spring.mvc.formatter.NonEmptyStringAnnotationFormatterFactory#getFieldTypes()</code> | testGetFieldTypes | {
"repo_name": "opensource21/fuwesta",
"path": "fuwesta-core/src/test/java/de/ppi/fuwesta/spring/mvc/formatter/NonEmptyStringAnnotationFormatterFactoryTest.java",
"license": "apache-2.0",
"size": 2371
} | [
"de.ppi.fuwesta.spring.mvc.formatter.NonEmptyStringAnnotationFormatterFactory",
"java.util.Set",
"org.assertj.core.api.Assertions",
"org.junit.Test"
] | import de.ppi.fuwesta.spring.mvc.formatter.NonEmptyStringAnnotationFormatterFactory; import java.util.Set; import org.assertj.core.api.Assertions; import org.junit.Test; | import de.ppi.fuwesta.spring.mvc.formatter.*; import java.util.*; import org.assertj.core.api.*; import org.junit.*; | [
"de.ppi.fuwesta",
"java.util",
"org.assertj.core",
"org.junit"
] | de.ppi.fuwesta; java.util; org.assertj.core; org.junit; | 380,255 |
protected void initConfig() {
CollectorConfiguration config = configurationService.getCollector(null, null, null, null);
if (config != null) {
configLastUpdated = System.currentTimeMillis();
filterManager = new FilterManager(config);
try {
processorManager = new ProcessorManager(config);
} catch (Throwable t) {
if (t != null) {
log.log(Level.SEVERE, "Failed to initialise Process Manager", t);
}
}
initRefreshCycle();
} else {
// Wait for a period of time and try doing the initial config again
Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
public Thread newThread(Runnable r) {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
} | void function() { CollectorConfiguration config = configurationService.getCollector(null, null, null, null); if (config != null) { configLastUpdated = System.currentTimeMillis(); filterManager = new FilterManager(config); try { processorManager = new ProcessorManager(config); } catch (Throwable t) { if (t != null) { log.log(Level.SEVERE, STR, t); } } initRefreshCycle(); } else { Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = Executors.defaultThreadFactory().newThread(r); t.setDaemon(true); return t; } | /**
* This method initialises the configuration.
*/ | This method initialises the configuration | initConfig | {
"repo_name": "hawkular/hawkular-btm",
"path": "client/collector/src/main/java/org/hawkular/apm/client/collector/internal/DefaultTraceCollector.java",
"license": "apache-2.0",
"size": 61575
} | [
"java.util.concurrent.Executors",
"java.util.concurrent.ThreadFactory",
"org.hawkular.apm.api.logging.Logger",
"org.hawkular.apm.api.model.config.CollectorConfiguration"
] | import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import org.hawkular.apm.api.logging.Logger; import org.hawkular.apm.api.model.config.CollectorConfiguration; | import java.util.concurrent.*; import org.hawkular.apm.api.logging.*; import org.hawkular.apm.api.model.config.*; | [
"java.util",
"org.hawkular.apm"
] | java.util; org.hawkular.apm; | 1,589,865 |
private void storeScrollBarPositions() {
MainFrame mainFrame = RapidMinerGUI.getMainFrame();
if (mainFrame != null) {
DockableState[] states = mainFrame.getDockingDesktop().getContext().getDockables();
for (DockableState state : states) {
Dockable dockable = state.getDockable();
if (dockable.getComponent() instanceof Container) {
JScrollPane scrollPane = findScrollPane((Container) dockable.getComponent());
if (scrollPane != null) {
ScrollBarsPosition scrollBarsPosition = new ScrollBarsPosition(
scrollPane.getVerticalScrollBar().getValue(),
scrollPane.getHorizontalScrollBar().getValue());
scrollBarsPositions.put(dockable.getDockKey().getKey(), scrollBarsPosition);
}
}
}
}
}
/**
* This method will apply scroll positions to all {@link JScrollPane}s which were previously
* saved by {@link #storeScrollBarPositions()} | void function() { MainFrame mainFrame = RapidMinerGUI.getMainFrame(); if (mainFrame != null) { DockableState[] states = mainFrame.getDockingDesktop().getContext().getDockables(); for (DockableState state : states) { Dockable dockable = state.getDockable(); if (dockable.getComponent() instanceof Container) { JScrollPane scrollPane = findScrollPane((Container) dockable.getComponent()); if (scrollPane != null) { ScrollBarsPosition scrollBarsPosition = new ScrollBarsPosition( scrollPane.getVerticalScrollBar().getValue(), scrollPane.getHorizontalScrollBar().getValue()); scrollBarsPositions.put(dockable.getDockKey().getKey(), scrollBarsPosition); } } } } } /** * This method will apply scroll positions to all {@link JScrollPane}s which were previously * saved by {@link #storeScrollBarPositions()} | /**
* This method saves scroll positions of all {@link JScrollPane}s in the current Perspective.
*/ | This method saves scroll positions of all <code>JScrollPane</code>s in the current Perspective | storeScrollBarPositions | {
"repo_name": "rapidminer/rapidminer-studio",
"path": "src/main/java/com/rapidminer/gui/PerspectiveProperties.java",
"license": "agpl-3.0",
"size": 8589
} | [
"com.vlsolutions.swing.docking.Dockable",
"com.vlsolutions.swing.docking.DockableState",
"java.awt.Container",
"javax.swing.JScrollPane"
] | import com.vlsolutions.swing.docking.Dockable; import com.vlsolutions.swing.docking.DockableState; import java.awt.Container; import javax.swing.JScrollPane; | import com.vlsolutions.swing.docking.*; import java.awt.*; import javax.swing.*; | [
"com.vlsolutions.swing",
"java.awt",
"javax.swing"
] | com.vlsolutions.swing; java.awt; javax.swing; | 2,320,776 |
public static Version createVersion(Platform platform, Locale locale) {
return createVersion(platform, null, locale);
} | static Version function(Platform platform, Locale locale) { return createVersion(platform, null, locale); } | /**
* Creates the version.
*
* @param platform the platform.
* @param locale the version default locale.
* @return the new created version.
*/ | Creates the version | createVersion | {
"repo_name": "lorislab/appky",
"path": "appky-application/src/main/java/org/lorislab/appky/application/factory/ApplicationObjectFactory.java",
"license": "apache-2.0",
"size": 9591
} | [
"java.util.Locale",
"org.lorislab.appky.application.model.Platform",
"org.lorislab.appky.application.model.Version"
] | import java.util.Locale; import org.lorislab.appky.application.model.Platform; import org.lorislab.appky.application.model.Version; | import java.util.*; import org.lorislab.appky.application.model.*; | [
"java.util",
"org.lorislab.appky"
] | java.util; org.lorislab.appky; | 1,722,855 |
public ArrayList<URITemplate> getAllURITemplates(String apiContext, String version) throws APIManagementException {
if(APIUtil.isAdvanceThrottlingEnabled()) {
return getAllURITemplatesAdvancedThrottle(apiContext, version);
} else {
return getAllURITemplatesOldThrottle(apiContext, version);
}
} | ArrayList<URITemplate> function(String apiContext, String version) throws APIManagementException { if(APIUtil.isAdvanceThrottlingEnabled()) { return getAllURITemplatesAdvancedThrottle(apiContext, version); } else { return getAllURITemplatesOldThrottle(apiContext, version); } } | /**
* returns all URL templates define for all active(PUBLISHED) APIs.
*/ | returns all URL templates define for all active(PUBLISHED) APIs | getAllURITemplates | {
"repo_name": "dhanuka84/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java",
"license": "apache-2.0",
"size": 461690
} | [
"java.util.ArrayList",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.api.model.URITemplate",
"org.wso2.carbon.apimgt.impl.utils.APIUtil"
] | import java.util.ArrayList; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.URITemplate; import org.wso2.carbon.apimgt.impl.utils.APIUtil; | import java.util.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.utils.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 2,822,694 |
@Test
public void testIntercept_nullResponse() throws IOException {
interceptor.interceptResponse(null);
verify(reportServiceLogger, never()).logRequest(Matchers.anyString(), any(GenericUrl.class),
any(HttpContent.class), any(GenericData.class), anyBoolean());
} | void function() throws IOException { interceptor.interceptResponse(null); verify(reportServiceLogger, never()).logRequest(Matchers.anyString(), any(GenericUrl.class), any(HttpContent.class), any(GenericData.class), anyBoolean()); } | /**
* Asserts that no report service logger calls are made for a null response.
*/ | Asserts that no report service logger calls are made for a null response | testIntercept_nullResponse | {
"repo_name": "raja15792/googleads-java-lib",
"path": "modules/ads_lib/src/test/java/com/google/api/ads/adwords/lib/utils/ReportResponseInterceptorTest.java",
"license": "apache-2.0",
"size": 6081
} | [
"com.google.api.client.http.GenericUrl",
"com.google.api.client.http.HttpContent",
"com.google.api.client.util.GenericData",
"java.io.IOException",
"org.mockito.Matchers",
"org.mockito.Mockito"
] | import com.google.api.client.http.GenericUrl; import com.google.api.client.http.HttpContent; import com.google.api.client.util.GenericData; import java.io.IOException; import org.mockito.Matchers; import org.mockito.Mockito; | import com.google.api.client.http.*; import com.google.api.client.util.*; import java.io.*; import org.mockito.*; | [
"com.google.api",
"java.io",
"org.mockito"
] | com.google.api; java.io; org.mockito; | 939,352 |
public ComponentTransferFunction getBlueFunction(){
return functions[BLUE];
} | ComponentTransferFunction function(){ return functions[BLUE]; } | /**
* Returns the transfer function for the blue channel
*/ | Returns the transfer function for the blue channel | getBlueFunction | {
"repo_name": "shyamalschandra/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/renderable/ComponentTransferRable8Bit.java",
"license": "apache-2.0",
"size": 8044
} | [
"org.apache.flex.forks.batik.ext.awt.image.ComponentTransferFunction"
] | import org.apache.flex.forks.batik.ext.awt.image.ComponentTransferFunction; | import org.apache.flex.forks.batik.ext.awt.image.*; | [
"org.apache.flex"
] | org.apache.flex; | 411,443 |
public void writeLog(String message){
try {
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
System.out.println(LOG_PATH);
Files.write(Paths.get(LOG_PATH), ("[" + (dateFormat.format(Calendar.getInstance().getTime())) + "]" + message +
System.getProperty("line.separator")).getBytes(),
StandardOpenOption.APPEND);
} catch (IOException e) {
e.printStackTrace();
}
}
| void function(String message){ try { DateFormat dateFormat = new SimpleDateFormat(STR); System.out.println(LOG_PATH); Files.write(Paths.get(LOG_PATH), ("[" + (dateFormat.format(Calendar.getInstance().getTime())) + "]" + message + System.getProperty(STR)).getBytes(), StandardOpenOption.APPEND); } catch (IOException e) { e.printStackTrace(); } } | /**
* Auxiliary method to write a message into a log file.
* @param message, the string to write into the file.
*/ | Auxiliary method to write a message into a log file | writeLog | {
"repo_name": "cjortegon/Fresificator",
"path": "Next_Fruit/src/co/edu/icesi/nextfruit/modules/machinelearning/WekaClassifier.java",
"license": "mit",
"size": 9422
} | [
"java.io.IOException",
"java.nio.file.Files",
"java.nio.file.Paths",
"java.nio.file.StandardOpenOption",
"java.text.DateFormat",
"java.text.SimpleDateFormat",
"java.util.Calendar"
] | import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; | import java.io.*; import java.nio.file.*; import java.text.*; import java.util.*; | [
"java.io",
"java.nio",
"java.text",
"java.util"
] | java.io; java.nio; java.text; java.util; | 552,531 |
@Override
protected void onSaveInstanceState(Bundle outState) {
Log.d("BaseActivity: ", "onSavedInstanceState: called");
// Add the values which need to be saved from the drawer to the bundle.
outState = mNavDrawer.saveInstanceState(outState);
super.onSaveInstanceState(outState);
} | void function(Bundle outState) { Log.d(STR, STR); outState = mNavDrawer.saveInstanceState(outState); super.onSaveInstanceState(outState); } | /**
* Save state of the NabDrawer.
* @param outState state saved.
*/ | Save state of the NabDrawer | onSaveInstanceState | {
"repo_name": "darvid7/ForkMe-Mobile",
"path": "ForkMe-Mobile/app/src/main/java/dlei/forkme/gui/activities/BaseActivity.java",
"license": "mit",
"size": 8890
} | [
"android.os.Bundle",
"android.util.Log"
] | import android.os.Bundle; import android.util.Log; | import android.os.*; import android.util.*; | [
"android.os",
"android.util"
] | android.os; android.util; | 1,380,838 |
@NotNull PsiClassType createType(@NotNull PsiClass aClass); | @NotNull PsiClassType createType(@NotNull PsiClass aClass); | /**
* Creates a class type for the specified class.
*
* @param aClass the class for which the class type is created.
* @return the class type instance.
*/ | Creates a class type for the specified class | createType | {
"repo_name": "joewalnes/idea-community",
"path": "java/openapi/src/com/intellij/psi/PsiElementFactory.java",
"license": "apache-2.0",
"size": 23064
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 1,765,448 |
public void errorCr(final Reconciliation reconciliation, final Message msg, final Throwable t) {
logger.logIfEnabled(FQCN, ERROR, reconciliation.getMarker(), msg, t);
} | void function(final Reconciliation reconciliation, final Message msg, final Throwable t) { logger.logIfEnabled(FQCN, ERROR, reconciliation.getMarker(), msg, t); } | /**
* Logs a message with the specific Marker at the {@code ERROR} level.
*
* @param reconciliation The reconciliation
* @param msg the message string to be logged
* @param t A Throwable or null.
*/ | Logs a message with the specific Marker at the ERROR level | errorCr | {
"repo_name": "ppatierno/kaas",
"path": "operator-common/src/main/java/io/strimzi/operator/common/ReconciliationLogger.java",
"license": "apache-2.0",
"size": 352724
} | [
"org.apache.logging.log4j.message.Message"
] | import org.apache.logging.log4j.message.Message; | import org.apache.logging.log4j.message.*; | [
"org.apache.logging"
] | org.apache.logging; | 399,509 |
public String renderHTML(Block block)
{
WikiPrinter printer = new DefaultWikiPrinter();
htmlBlockRenderer.render(block, printer);
return printer.toString();
} | String function(Block block) { WikiPrinter printer = new DefaultWikiPrinter(); htmlBlockRenderer.render(block, printer); return printer.toString(); } | /**
* Render a block to HTML syntax.
*
* @param block block to render
* @return the HTML rendered version of the block
*/ | Render a block to HTML syntax | renderHTML | {
"repo_name": "xwiki/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-notifiers/xwiki-platform-notifications-notifiers-default/src/main/java/org/xwiki/notifications/notifiers/internal/email/EmailTemplateRenderer.java",
"license": "lgpl-2.1",
"size": 7771
} | [
"org.xwiki.rendering.block.Block",
"org.xwiki.rendering.renderer.printer.DefaultWikiPrinter",
"org.xwiki.rendering.renderer.printer.WikiPrinter"
] | import org.xwiki.rendering.block.Block; import org.xwiki.rendering.renderer.printer.DefaultWikiPrinter; import org.xwiki.rendering.renderer.printer.WikiPrinter; | import org.xwiki.rendering.block.*; import org.xwiki.rendering.renderer.printer.*; | [
"org.xwiki.rendering"
] | org.xwiki.rendering; | 1,874,127 |
@Nullable
public SignIn get() throws ClientException {
return send(HttpMethod.GET, null);
} | SignIn function() throws ClientException { return send(HttpMethod.GET, null); } | /**
* Gets the SignIn from the service
*
* @return the SignIn from the request
* @throws ClientException this exception occurs if the request was unable to complete for any reason
*/ | Gets the SignIn from the service | get | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/SignInRequest.java",
"license": "mit",
"size": 6060
} | [
"com.microsoft.graph.core.ClientException",
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.SignIn"
] | import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.SignIn; | import com.microsoft.graph.core.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; | [
"com.microsoft.graph"
] | com.microsoft.graph; | 2,916,156 |
void sessionCreated( Session session ); | void sessionCreated( Session session ); | /**
* Notification event indicating that a server has connected with the server.
* @param session the connected session of a server
*/ | Notification event indicating that a server has connected with the server | sessionCreated | {
"repo_name": "guusdk/Openfire",
"path": "xmppserver/src/main/java/org/jivesoftware/openfire/event/ServerSessionEventListener.java",
"license": "apache-2.0",
"size": 1399
} | [
"org.jivesoftware.openfire.session.Session"
] | import org.jivesoftware.openfire.session.Session; | import org.jivesoftware.openfire.session.*; | [
"org.jivesoftware.openfire"
] | org.jivesoftware.openfire; | 573,054 |
public static AwsEc2Template getInstanceFromResourcesDir(final String jsonFilePath) throws FileNotFoundException {
return getInstance(ResourceLoader.getResourcePath(AwsEc2Template.class, jsonFilePath));
}
public String getName() {return name; } | static AwsEc2Template function(final String jsonFilePath) throws FileNotFoundException { return getInstance(ResourceLoader.getResourcePath(AwsEc2Template.class, jsonFilePath)); } public String getName() {return name; } | /**
* Gets an AWS EC2 Instance from a JSON file inside the application's resource directory.
* @param jsonFilePath the relative path to the JSON file representing the template with
* configurations for an AWS EC2 Instance
* @return the AWS EC2 Instance from the JSON file
*/ | Gets an AWS EC2 Instance from a JSON file inside the application's resource directory | getInstanceFromResourcesDir | {
"repo_name": "RaysaOliveira/cloudsim-plus",
"path": "cloudsim-plus/src/main/java/org/cloudsimplus/vmtemplates/AwsEc2Template.java",
"license": "gpl-3.0",
"size": 6019
} | [
"java.io.FileNotFoundException",
"org.cloudbus.cloudsim.util.ResourceLoader"
] | import java.io.FileNotFoundException; import org.cloudbus.cloudsim.util.ResourceLoader; | import java.io.*; import org.cloudbus.cloudsim.util.*; | [
"java.io",
"org.cloudbus.cloudsim"
] | java.io; org.cloudbus.cloudsim; | 2,490,534 |
private void makeExtraBackup() {
// when no extrabackup is requested, leave method
if (!settings.getExtraBackup()) {
return;
}
// retrieve backup-directory
File backuppath = settings.getExtraBackupPath();
// when the path does not exist, leave...
if (null == backuppath) {
// log error
Constants.zknlogger.log(Level.WARNING, "The file path to the extra backup (which is created when closing the application) is null! Extra backup could not be created!");
return;
}
if (!backuppath.exists()) {
// log error
Constants.zknlogger.log(Level.WARNING, "Could not save extra backup to {0}. The file path to the extra backup (which is created when closing the application) does not exist! Extra backup could not be created!", backuppath.toString());
return;
}
// get filename and find out where extension begins, so we can retrieve the filename
File datafile = settings.getFilePath();
// if we have a valid file-path, go on...
if (datafile != null) {
// create a backup-filename, that consists of the data-file's filename
String backupfilename = datafile.getName();
// retrieve os-separator-char
String sepchar = String.valueOf(File.separatorChar);
// add additional separator-char if the file-path does not contain a trailing separator char
if (!backuppath.toString().endsWith(sepchar)) {
backupfilename = sepchar + backupfilename;
}
// create final backup-file-path
File backupfile = new File(backuppath.toString() + backupfilename);
// if backup-filepath is identical with the data-filepath, we don't create an extra backup
// to prevent overwriting the file...
if (backupfile.toString().equalsIgnoreCase(datafile.toString())) {
// log error
Constants.zknlogger.log(Level.WARNING, "The file path of the extra backup (which is created when closing the application) equals the main data file name! To prevent overwriting the data file, the extra backup was not created!");
return;
}
try {
// copy data file
FileOperationsUtil.copyFile(datafile, backupfile, 4096);
// log file path and success
Constants.zknlogger.log(Level.INFO, "Extra-backup was copied to {0}", backupfile.toString());
// retrieve filepath of meta-file, i.e. the file that stores spellchecking, synonyms etc.
File metafile = settings.getMetaFilePath();
// check whether file exists
if (metafile != null && metafile.exists()) {
// get filename
String metafilename = "zettelkasten-data.zkd3";
if (!backuppath.toString().endsWith(sepchar)) {
metafilename = sepchar + metafilename;
}
// create backupfilepath
File backupmetafile = new File(backuppath.toString() + metafilename);
// copy meta-file
FileOperationsUtil.copyFile(metafile, backupmetafile, 4096);
// log file path and success
Constants.zknlogger.log(Level.INFO, "Extra-backup meta-data was copied to {0}", backupmetafile.toString());
} else {
// log error
Constants.zknlogger.log(Level.WARNING, "Extra-backup meta-data does not exists and thus could not be created!");
}
} catch (IOException ex) {
Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage());
}
}
} | void function() { if (!settings.getExtraBackup()) { return; } File backuppath = settings.getExtraBackupPath(); if (null == backuppath) { Constants.zknlogger.log(Level.WARNING, STR); return; } if (!backuppath.exists()) { Constants.zknlogger.log(Level.WARNING, STR, backuppath.toString()); return; } File datafile = settings.getFilePath(); if (datafile != null) { String backupfilename = datafile.getName(); String sepchar = String.valueOf(File.separatorChar); if (!backuppath.toString().endsWith(sepchar)) { backupfilename = sepchar + backupfilename; } File backupfile = new File(backuppath.toString() + backupfilename); if (backupfile.toString().equalsIgnoreCase(datafile.toString())) { Constants.zknlogger.log(Level.WARNING, STR); return; } try { FileOperationsUtil.copyFile(datafile, backupfile, 4096); Constants.zknlogger.log(Level.INFO, STR, backupfile.toString()); File metafile = settings.getMetaFilePath(); if (metafile != null && metafile.exists()) { String metafilename = STR; if (!backuppath.toString().endsWith(sepchar)) { metafilename = sepchar + metafilename; } File backupmetafile = new File(backuppath.toString() + metafilename); FileOperationsUtil.copyFile(metafile, backupmetafile, 4096); Constants.zknlogger.log(Level.INFO, STR, backupmetafile.toString()); } else { Constants.zknlogger.log(Level.WARNING, STR); } } catch (IOException ex) { Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage()); } } } | /**
* This mehtod creates an additional backup of<br>
* - the data-file - the meta-data ({@code zettelkasten-data.zkd3}) when the
* user quits the application. These files are saved to a certain directory
* that is specified by the user.
*/ | This mehtod creates an additional backup of - the data-file - the meta-data (zettelkasten-data.zkd3) when the user quits the application. These files are saved to a certain directory that is specified by the user | makeExtraBackup | {
"repo_name": "ct2034/Zettelkasten",
"path": "src/de/danielluedecke/zettelkasten/ZettelkastenView.java",
"license": "gpl-3.0",
"size": 765056
} | [
"de.danielluedecke.zettelkasten.util.Constants",
"de.danielluedecke.zettelkasten.util.FileOperationsUtil",
"java.io.File",
"java.io.IOException",
"java.util.logging.Level"
] | import de.danielluedecke.zettelkasten.util.Constants; import de.danielluedecke.zettelkasten.util.FileOperationsUtil; import java.io.File; import java.io.IOException; import java.util.logging.Level; | import de.danielluedecke.zettelkasten.util.*; import java.io.*; import java.util.logging.*; | [
"de.danielluedecke.zettelkasten",
"java.io",
"java.util"
] | de.danielluedecke.zettelkasten; java.io; java.util; | 1,236,099 |
EnableConfirmSetupAction action = new EnableConfirmSetupAction();
ActionHelper ah = new ActionHelper();
ah.setUpAction(action);
ah.setupProcessPagination();
ah.getMapping().addForwardConfig(new ActionForward("enabled", "path", true));
ah.getUser().addPermanentRole(RoleFactory.ORG_ADMIN);
RhnSet set = RhnSetDecl.USERS.get(ah.getUser());
User one = UserTestUtils.createUser("testUser", ah.getUser().getOrg().getId());
User two = UserTestUtils.createUser("testUser", ah.getUser().getOrg().getId());
set.addElement(one.getId());
set.addElement(two.getId());
RhnSetManager.store(set);
//success
StateChange change = new StateChange();
StateChange change2 = new StateChange();
change.setState(UserFactory.DISABLED);
change2.setState(UserFactory.DISABLED);
Date now = new Date();
now.setTime(now.getTime() - 33000);
change.setDate(now);
change2.setDate(now);
change.setUser(one);
change2.setUser(two);
change.setChangedBy(ah.getUser());
change2.setChangedBy(ah.getUser());
one.addChange(change);
two.addChange(change2);
//Add parameter for list.
String listName = TagHelper.generateUniqueName(EnableConfirmSetupAction.LIST_NAME);
ah.getRequest().setupAddParameter(ListTagUtil.
makeSelectedItemsName(listName), "0");
ah.getRequest().setupAddParameter(ListTagUtil.
makePageItemsName(listName), "0");
ah.getRequest().setupAddParameter("dispatch", "dummyValue");
ActionForward af = ah.executeAction("execute", false);
assertEquals("enabled", af.getName());
} | EnableConfirmSetupAction action = new EnableConfirmSetupAction(); ActionHelper ah = new ActionHelper(); ah.setUpAction(action); ah.setupProcessPagination(); ah.getMapping().addForwardConfig(new ActionForward(STR, "path", true)); ah.getUser().addPermanentRole(RoleFactory.ORG_ADMIN); RhnSet set = RhnSetDecl.USERS.get(ah.getUser()); User one = UserTestUtils.createUser(STR, ah.getUser().getOrg().getId()); User two = UserTestUtils.createUser(STR, ah.getUser().getOrg().getId()); set.addElement(one.getId()); set.addElement(two.getId()); RhnSetManager.store(set); StateChange change = new StateChange(); StateChange change2 = new StateChange(); change.setState(UserFactory.DISABLED); change2.setState(UserFactory.DISABLED); Date now = new Date(); now.setTime(now.getTime() - 33000); change.setDate(now); change2.setDate(now); change.setUser(one); change2.setUser(two); change.setChangedBy(ah.getUser()); change2.setChangedBy(ah.getUser()); one.addChange(change); two.addChange(change2); String listName = TagHelper.generateUniqueName(EnableConfirmSetupAction.LIST_NAME); ah.getRequest().setupAddParameter(ListTagUtil. makeSelectedItemsName(listName), "0"); ah.getRequest().setupAddParameter(ListTagUtil. makePageItemsName(listName), "0"); ah.getRequest().setupAddParameter(STR, STR); ActionForward af = ah.executeAction(STR, false); assertEquals(STR, af.getName()); } | /**
* Setting "dispatch" to a non-null value.
* Expecting to return a "enabled" ActionForward.
* @throws Exception something bad happened
*/ | Setting "dispatch" to a non-null value. Expecting to return a "enabled" ActionForward | testExecute | {
"repo_name": "shastah/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/action/user/test/EnableConfirmSetupActionTest.java",
"license": "gpl-2.0",
"size": 3544
} | [
"com.redhat.rhn.domain.rhnset.RhnSet",
"com.redhat.rhn.domain.role.RoleFactory",
"com.redhat.rhn.domain.user.StateChange",
"com.redhat.rhn.domain.user.User",
"com.redhat.rhn.domain.user.UserFactory",
"com.redhat.rhn.frontend.action.user.EnableConfirmSetupAction",
"com.redhat.rhn.frontend.taglibs.list.ListTagUtil",
"com.redhat.rhn.frontend.taglibs.list.TagHelper",
"com.redhat.rhn.manager.rhnset.RhnSetDecl",
"com.redhat.rhn.manager.rhnset.RhnSetManager",
"com.redhat.rhn.testing.ActionHelper",
"com.redhat.rhn.testing.UserTestUtils",
"java.util.Date",
"org.apache.struts.action.ActionForward"
] | import com.redhat.rhn.domain.rhnset.RhnSet; import com.redhat.rhn.domain.role.RoleFactory; import com.redhat.rhn.domain.user.StateChange; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.domain.user.UserFactory; import com.redhat.rhn.frontend.action.user.EnableConfirmSetupAction; import com.redhat.rhn.frontend.taglibs.list.ListTagUtil; import com.redhat.rhn.frontend.taglibs.list.TagHelper; import com.redhat.rhn.manager.rhnset.RhnSetDecl; import com.redhat.rhn.manager.rhnset.RhnSetManager; import com.redhat.rhn.testing.ActionHelper; import com.redhat.rhn.testing.UserTestUtils; import java.util.Date; import org.apache.struts.action.ActionForward; | import com.redhat.rhn.domain.rhnset.*; import com.redhat.rhn.domain.role.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.action.user.*; import com.redhat.rhn.frontend.taglibs.list.*; import com.redhat.rhn.manager.rhnset.*; import com.redhat.rhn.testing.*; import java.util.*; import org.apache.struts.action.*; | [
"com.redhat.rhn",
"java.util",
"org.apache.struts"
] | com.redhat.rhn; java.util; org.apache.struts; | 937,045 |
public Adapter createEObjectAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for the default case.
* <!-- begin-user-doc --> This
* default implementation returns null. <!-- end-user-doc -->
*
* @return the new adapter.
* @generated
*/ | Creates a new adapter for the default case. This default implementation returns null. | createEObjectAdapter | {
"repo_name": "edgarmueller/emfstore-rest",
"path": "bundles/org.eclipse.emf.emfstore.server.model/src/org/eclipse/emf/emfstore/internal/server/model/accesscontrol/util/AccesscontrolAdapterFactory.java",
"license": "epl-1.0",
"size": 8677
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,073,457 |
public static BigInteger[] remainder(BigInteger[] dividends, BigInteger divisor) {
if (dividends == null) return null;
BigInteger[] results = new BigInteger[dividends.length];
for (int i = 0; i < dividends.length; i++) {
results[i] = remainder(dividends[i], divisor);
}
return results;
} | static BigInteger[] function(BigInteger[] dividends, BigInteger divisor) { if (dividends == null) return null; BigInteger[] results = new BigInteger[dividends.length]; for (int i = 0; i < dividends.length; i++) { results[i] = remainder(dividends[i], divisor); } return results; } | /**
* Returns the remainder from dividing the given dividends by the divisor.
*
* @param dividends The integers to be divided.
* @param divisor The integer to divide by.
* @return The remainders from dividing the dividends by the divisor.
*/ | Returns the remainder from dividing the given dividends by the divisor | remainder | {
"repo_name": "Permafrost/Tundra.java",
"path": "src/main/java/permafrost/tundra/math/BigIntegerHelper.java",
"license": "mit",
"size": 22329
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 256,504 |
public void removeSubscriber(Object clientId, String selector, String subtopicString, String endpointId)
{
MessageClient client = null;
try
{
synchronized (allSubscriptionsLock)
{
// Do a simple lookup first to avoid the creation of a new MessageClient instance
// in the following call to getMessageClient() if the subscription is already removed.
client = allSubscriptions.get(clientId);
if (client == null) // Subscription was already removed.
return;
// Re-get in order to track refs correctly.
client = getMessageClient(clientId, endpointId);
}
Subtopic subtopic = getSubtopic(subtopicString);
TopicSubscription topicSub;
Map<Object, MessageClient> subs;
Map<Subtopic, TopicSubscription> map = null;
if (subtopic == null)
{
topicSub = globalSubscribers;
}
else
{
if (subtopic.containsSubtopicWildcard())
map = subscribersPerSubtopicWildcard;
else
map = subscribersPerSubtopic;
topicSub = map.get(subtopic);
if (topicSub == null)
throw new MessageException("Client: " + clientId + " not subscribed to subtopic: " + subtopic);
}
if (selector == null)
subs = topicSub.defaultSubscriptions;
else
subs = topicSub.selectorSubscriptions.get(selector);
if (subs == null || subs.get(clientId) == null)
throw new MessageException("Client: " + clientId + " not subscribed to destination with selector: " + selector);
synchronized (this)
{
subs.remove(clientId);
if (subs.isEmpty() &&
destination.isClustered() && destination.getServerSettings().getRoutingMode() == RoutingMode.SERVER_TO_SERVER)
sendSubscriptionToPeer(false, selector, subtopicString);
if (subs.isEmpty())
{
if (selector != null)
{
if (topicSub.selectorSubscriptions != null && !topicSub.selectorSubscriptions.isEmpty())
topicSub.selectorSubscriptions.remove(selector);
}
if (subtopic != null &&
(topicSub.selectorSubscriptions == null || topicSub.selectorSubscriptions.isEmpty()) &&
(topicSub.defaultSubscriptions == null || topicSub.defaultSubscriptions.isEmpty()))
{
if ((topicSub.selectorSubscriptions == null || topicSub.selectorSubscriptions.isEmpty()) &&
(topicSub.defaultSubscriptions == null || topicSub.defaultSubscriptions.isEmpty()))
map.remove(subtopic);
}
}
}
if (client.removeSubscription(selector, subtopicString))
{
allSubscriptions.remove(clientId);
client.invalidate(); // Destroy the MessageClient.
}
}
finally
{
if (client != null)
releaseMessageClient(client);
}
} | void function(Object clientId, String selector, String subtopicString, String endpointId) { MessageClient client = null; try { synchronized (allSubscriptionsLock) { client = allSubscriptions.get(clientId); if (client == null) return; client = getMessageClient(clientId, endpointId); } Subtopic subtopic = getSubtopic(subtopicString); TopicSubscription topicSub; Map<Object, MessageClient> subs; Map<Subtopic, TopicSubscription> map = null; if (subtopic == null) { topicSub = globalSubscribers; } else { if (subtopic.containsSubtopicWildcard()) map = subscribersPerSubtopicWildcard; else map = subscribersPerSubtopic; topicSub = map.get(subtopic); if (topicSub == null) throw new MessageException(STR + clientId + STR + subtopic); } if (selector == null) subs = topicSub.defaultSubscriptions; else subs = topicSub.selectorSubscriptions.get(selector); if (subs == null subs.get(clientId) == null) throw new MessageException(STR + clientId + STR + selector); synchronized (this) { subs.remove(clientId); if (subs.isEmpty() && destination.isClustered() && destination.getServerSettings().getRoutingMode() == RoutingMode.SERVER_TO_SERVER) sendSubscriptionToPeer(false, selector, subtopicString); if (subs.isEmpty()) { if (selector != null) { if (topicSub.selectorSubscriptions != null && !topicSub.selectorSubscriptions.isEmpty()) topicSub.selectorSubscriptions.remove(selector); } if (subtopic != null && (topicSub.selectorSubscriptions == null topicSub.selectorSubscriptions.isEmpty()) && (topicSub.defaultSubscriptions == null topicSub.defaultSubscriptions.isEmpty())) { if ((topicSub.selectorSubscriptions == null topicSub.selectorSubscriptions.isEmpty()) && (topicSub.defaultSubscriptions == null topicSub.defaultSubscriptions.isEmpty())) map.remove(subtopic); } } } if (client.removeSubscription(selector, subtopicString)) { allSubscriptions.remove(clientId); client.invalidate(); } } finally { if (client != null) releaseMessageClient(client); } } | /**
* Remove a subscriber.
*
* @param clientId the client id
* @param selector the selector
* @param subtopicString the subtopic
* @param endpointId the endpoint
*/ | Remove a subscriber | removeSubscriber | {
"repo_name": "apache/flex-blazeds",
"path": "core/src/main/java/flex/messaging/services/messaging/SubscriptionManager.java",
"license": "apache-2.0",
"size": 34126
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 512,897 |
@Override
public QualifierHierarchy createQualifierHierarchy(MultiGraphFactory factory) {
return new UnitsQualifierHierarchy(factory, AnnotationUtils.fromClass(elements, UnitsBottom.class));
}
protected class UnitsQualifierHierarchy extends GraphQualifierHierarchy {
public UnitsQualifierHierarchy(MultiGraphFactory mgf,
AnnotationMirror bottom) {
super(mgf, bottom);
} | QualifierHierarchy function(MultiGraphFactory factory) { return new UnitsQualifierHierarchy(factory, AnnotationUtils.fromClass(elements, UnitsBottom.class)); } protected class UnitsQualifierHierarchy extends GraphQualifierHierarchy { public UnitsQualifierHierarchy(MultiGraphFactory mgf, AnnotationMirror bottom) { super(mgf, bottom); } | /**
* Set the Bottom qualifier as the bottom of the hierarchy.
*/ | Set the Bottom qualifier as the bottom of the hierarchy | createQualifierHierarchy | {
"repo_name": "atomicknight/checker-framework",
"path": "checker/src/org/checkerframework/checker/units/UnitsAnnotatedTypeFactory.java",
"license": "gpl-2.0",
"size": 23341
} | [
"javax.lang.model.element.AnnotationMirror",
"org.checkerframework.checker.units.qual.UnitsBottom",
"org.checkerframework.framework.type.QualifierHierarchy",
"org.checkerframework.framework.util.GraphQualifierHierarchy",
"org.checkerframework.framework.util.MultiGraphQualifierHierarchy",
"org.checkerframework.javacutil.AnnotationUtils"
] | import javax.lang.model.element.AnnotationMirror; import org.checkerframework.checker.units.qual.UnitsBottom; import org.checkerframework.framework.type.QualifierHierarchy; import org.checkerframework.framework.util.GraphQualifierHierarchy; import org.checkerframework.framework.util.MultiGraphQualifierHierarchy; import org.checkerframework.javacutil.AnnotationUtils; | import javax.lang.model.element.*; import org.checkerframework.checker.units.qual.*; import org.checkerframework.framework.type.*; import org.checkerframework.framework.util.*; import org.checkerframework.javacutil.*; | [
"javax.lang",
"org.checkerframework.checker",
"org.checkerframework.framework",
"org.checkerframework.javacutil"
] | javax.lang; org.checkerframework.checker; org.checkerframework.framework; org.checkerframework.javacutil; | 2,006,709 |
public String getCurrentTimestampSQLFunctionName() {
// the standard SQL function name is current_timestamp...
return "current_timestamp";
}
// SQLException support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* Build an instance of the SQLExceptionConverter preferred by this dialect for
* converting SQLExceptions into Hibernate's JDBCException hierarchy.
* <p/>
* The preferred method is to not override this method; if possible,
* {@link #buildSQLExceptionConversionDelegate()} should be overridden
* instead.
*
* If this method is not overridden, the default SQLExceptionConverter
* implementation executes 3 SQLException converter delegates:
* <ol>
* <li>a "static" delegate based on the JDBC 4 defined SQLException hierarchy;</li>
* <li>the vendor-specific delegate returned by {@link #buildSQLExceptionConversionDelegate()};
* (it is strongly recommended that specific Dialect implementations
* override {@link #buildSQLExceptionConversionDelegate()})</li>
* <li>a delegate that interprets SQLState codes for either X/Open or SQL-2003 codes,
* depending on java.sql.DatabaseMetaData#getSQLStateType</li>
* </ol>
* <p/>
* If this method is overridden, it is strongly recommended that the
* returned {@link SQLExceptionConverter} interpret SQL errors based on
* vendor-specific error codes rather than the SQLState since the
* interpretation is more accurate when using vendor-specific ErrorCodes.
*
* @return The Dialect's preferred SQLExceptionConverter, or null to
* indicate that the default {@link SQLExceptionConverter} should be used.
*
* @see {@link #buildSQLExceptionConversionDelegate()} | String function() { return STR; } /** * Build an instance of the SQLExceptionConverter preferred by this dialect for * converting SQLExceptions into Hibernate's JDBCException hierarchy. * <p/> * The preferred method is to not override this method; if possible, * {@link #buildSQLExceptionConversionDelegate()} should be overridden * instead. * * If this method is not overridden, the default SQLExceptionConverter * implementation executes 3 SQLException converter delegates: * <ol> * <li>a STR delegate based on the JDBC 4 defined SQLException hierarchy;</li> * <li>the vendor-specific delegate returned by {@link #buildSQLExceptionConversionDelegate()}; * (it is strongly recommended that specific Dialect implementations * override {@link #buildSQLExceptionConversionDelegate()})</li> * <li>a delegate that interprets SQLState codes for either X/Open or SQL-2003 codes, * depending on java.sql.DatabaseMetaData#getSQLStateType</li> * </ol> * <p/> * If this method is overridden, it is strongly recommended that the * returned {@link SQLExceptionConverter} interpret SQL errors based on * vendor-specific error codes rather than the SQLState since the * interpretation is more accurate when using vendor-specific ErrorCodes. * * @return The Dialect's preferred SQLExceptionConverter, or null to * indicate that the default {@link SQLExceptionConverter} should be used. * * @see {@link #buildSQLExceptionConversionDelegate()} | /**
* The name of the database-specific SQL function for retrieving the
* current timestamp.
*
* @return The function name.
*/ | The name of the database-specific SQL function for retrieving the current timestamp | getCurrentTimestampSQLFunctionName | {
"repo_name": "kevin-chen-hw/LDAE",
"path": "com.huawei.soa.ldae/src/main/java/org/hibernate/dialect/Dialect.java",
"license": "lgpl-2.1",
"size": 93279
} | [
"java.sql.SQLException",
"org.hibernate.exception.spi.SQLExceptionConverter"
] | import java.sql.SQLException; import org.hibernate.exception.spi.SQLExceptionConverter; | import java.sql.*; import org.hibernate.exception.spi.*; | [
"java.sql",
"org.hibernate.exception"
] | java.sql; org.hibernate.exception; | 1,336,953 |
@Test
public void testValuesContainWithNullValue() {
StringChecker instance = StringChecker.valuesContain("a string");
assertFalse(instance.valueIsCompatibleWith(null));
} | void function() { StringChecker instance = StringChecker.valuesContain(STR); assertFalse(instance.valueIsCompatibleWith(null)); } | /**
* Verifies that <code>valuesContain</code> do not match null string if the
* reference is not null.
*/ | Verifies that <code>valuesContain</code> do not match null string if the reference is not null | testValuesContainWithNullValue | {
"repo_name": "vmware/lmock",
"path": "tests/com/vmware/lmock/test/StringCheckerTest.java",
"license": "apache-2.0",
"size": 6234
} | [
"com.vmware.lmock.checker.StringChecker",
"org.junit.Assert"
] | import com.vmware.lmock.checker.StringChecker; import org.junit.Assert; | import com.vmware.lmock.checker.*; import org.junit.*; | [
"com.vmware.lmock",
"org.junit"
] | com.vmware.lmock; org.junit; | 2,799,096 |
EReference getCCGR_OpTmh(); | EReference getCCGR_OpTmh(); | /**
* Returns the meta object for the reference '{@link substationStandard.LNNodes.LNGroupC.CCGR#getOpTmh <em>Op Tmh</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Op Tmh</em>'.
* @see substationStandard.LNNodes.LNGroupC.CCGR#getOpTmh()
* @see #getCCGR()
* @generated
*/ | Returns the meta object for the reference '<code>substationStandard.LNNodes.LNGroupC.CCGR#getOpTmh Op Tmh</code>'. | getCCGR_OpTmh | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/substationStandard/LNNodes/LNGroupC/LNGroupCPackage.java",
"license": "mit",
"size": 45797
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 780,865 |
public static OvsdbMap ovsdbMap(Map map) {
return new OvsdbMap(map);
}
| static OvsdbMap function(Map map) { return new OvsdbMap(map); } | /**
* convert Map into OvsdbMap.
* @param map java.util.Map
* @return OvsdbMap
*/ | convert Map into OvsdbMap | ovsdbMap | {
"repo_name": "kuangrewawa/OnosFw",
"path": "ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java",
"license": "apache-2.0",
"size": 2232
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,328,722 |
@CalledByNative("FaviconImageCallback")
public void onFaviconAvailable(Bitmap image, String iconUrl);
} | @CalledByNative(STR) void function(Bitmap image, String iconUrl); } | /**
* This method will be called when the result favicon is ready.
* @param image Favicon image.
* @param iconUrl Favicon image's icon url.
*/ | This method will be called when the result favicon is ready | onFaviconAvailable | {
"repo_name": "danakj/chromium",
"path": "chrome/android/java/src/org/chromium/chrome/browser/favicon/FaviconHelper.java",
"license": "bsd-3-clause",
"size": 6688
} | [
"android.graphics.Bitmap",
"org.chromium.base.annotations.CalledByNative"
] | import android.graphics.Bitmap; import org.chromium.base.annotations.CalledByNative; | import android.graphics.*; import org.chromium.base.annotations.*; | [
"android.graphics",
"org.chromium.base"
] | android.graphics; org.chromium.base; | 804,104 |
@Test
public void doServeResourceUseBrowserContentTest()
throws PortletException, IOException, PortletContainerException {
MockHttpServletRequest request = new MockHttpServletRequest();
request.addHeader("If-None-Match", "123456");
MockHttpServletResponse response = new MockHttpServletResponse();
TestingCacheState<CachedPortletResourceData<Long>, Long> cacheState =
new TestingCacheState<CachedPortletResourceData<Long>, Long>();
cacheState.setUseBrowserData(true);
CacheControl cacheControl = cacheState.getCacheControl();
cacheControl.setUseCachedContent(true);
cacheControl.setExpirationTime(300);
cacheControl.setETag("123456");
final String output = "{ \"hello\": \"world\" }";
final CachedPortletData<Long> cachedPortletData =
new CachedPortletData<Long>(
1000l,
output,
null,
"application/json",
false,
cacheControl.getETag(),
cacheControl.getExpirationTime());
final CachedPortletResourceData<Long> cachedPortletResourceData =
new CachedPortletResourceData<Long>(
cachedPortletData, Collections.EMPTY_MAP, null, null, null, null);
cacheState.setCachedPortletData(cachedPortletResourceData);
setupPortletExecutionMocks(request);
when(portletCacheControlService.getPortletResourceState(request, portletWindowId))
.thenReturn(cacheState);
ResourcePortletOutputHandler handler = new ResourcePortletOutputHandler(response);
portletRenderer.doServeResource(portletWindowId, request, response, handler);
//byte [] fromResponse = response.getContentAsByteArray();
Assert.assertEquals(0, response.getContentLength());
Assert.assertEquals(304, response.getStatus());
verify(portletCacheControlService, times(1))
.getPortletResourceState(request, portletWindowId);
verifyNoMoreInteractions(portletContainer, portletCacheControlService);
} | void function() throws PortletException, IOException, PortletContainerException { MockHttpServletRequest request = new MockHttpServletRequest(); request.addHeader(STR, STR); MockHttpServletResponse response = new MockHttpServletResponse(); TestingCacheState<CachedPortletResourceData<Long>, Long> cacheState = new TestingCacheState<CachedPortletResourceData<Long>, Long>(); cacheState.setUseBrowserData(true); CacheControl cacheControl = cacheState.getCacheControl(); cacheControl.setUseCachedContent(true); cacheControl.setExpirationTime(300); cacheControl.setETag(STR); final String output = STRhello\STRworld\STR; final CachedPortletData<Long> cachedPortletData = new CachedPortletData<Long>( 1000l, output, null, STR, false, cacheControl.getETag(), cacheControl.getExpirationTime()); final CachedPortletResourceData<Long> cachedPortletResourceData = new CachedPortletResourceData<Long>( cachedPortletData, Collections.EMPTY_MAP, null, null, null, null); cacheState.setCachedPortletData(cachedPortletResourceData); setupPortletExecutionMocks(request); when(portletCacheControlService.getPortletResourceState(request, portletWindowId)) .thenReturn(cacheState); ResourcePortletOutputHandler handler = new ResourcePortletOutputHandler(response); portletRenderer.doServeResource(portletWindowId, request, response, handler); Assert.assertEquals(0, response.getContentLength()); Assert.assertEquals(304, response.getStatus()); verify(portletCacheControlService, times(1)) .getPortletResourceState(request, portletWindowId); verifyNoMoreInteractions(portletContainer, portletCacheControlService); } | /**
* Same as {@link #doServeResourceCachedContentValidationMethodTest()}, but simulate browser
* sending If-None-Match header that matches the etag. Verify no content returned and a 304
* status code.
*
* @throws PortletException
* @throws IOException
* @throws PortletContainerException
*/ | Same as <code>#doServeResourceCachedContentValidationMethodTest()</code>, but simulate browser sending If-None-Match header that matches the etag. Verify no content returned and a 304 status code | doServeResourceUseBrowserContentTest | {
"repo_name": "jhelmer-unicon/uPortal",
"path": "uportal-war/src/test/java/org/apereo/portal/portlet/rendering/PortletRendererImplTest.java",
"license": "apache-2.0",
"size": 47152
} | [
"java.io.IOException",
"java.util.Collections",
"javax.portlet.CacheControl",
"javax.portlet.PortletException",
"junit.framework.Assert",
"org.apache.pluto.container.PortletContainerException",
"org.apereo.portal.portlet.container.cache.CachedPortletData",
"org.apereo.portal.portlet.container.cache.CachedPortletResourceData",
"org.mockito.Mockito",
"org.springframework.mock.web.MockHttpServletRequest",
"org.springframework.mock.web.MockHttpServletResponse"
] | import java.io.IOException; import java.util.Collections; import javax.portlet.CacheControl; import javax.portlet.PortletException; import junit.framework.Assert; import org.apache.pluto.container.PortletContainerException; import org.apereo.portal.portlet.container.cache.CachedPortletData; import org.apereo.portal.portlet.container.cache.CachedPortletResourceData; import org.mockito.Mockito; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; | import java.io.*; import java.util.*; import javax.portlet.*; import junit.framework.*; import org.apache.pluto.container.*; import org.apereo.portal.portlet.container.cache.*; import org.mockito.*; import org.springframework.mock.web.*; | [
"java.io",
"java.util",
"javax.portlet",
"junit.framework",
"org.apache.pluto",
"org.apereo.portal",
"org.mockito",
"org.springframework.mock"
] | java.io; java.util; javax.portlet; junit.framework; org.apache.pluto; org.apereo.portal; org.mockito; org.springframework.mock; | 2,512,301 |
public T caseClassifier(Classifier object) {
return null;
}
| T function(Classifier object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>Classifier</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Classifier</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'Classifier'. This implementation returns null; returning a non-null result will terminate the switch. | caseClassifier | {
"repo_name": "MenthorTools/ontouml",
"path": "net.menthor.onto2.ontouml/src-gen/net/menthor/onto2/ontouml/util/OntoumlSwitch.java",
"license": "mit",
"size": 21065
} | [
"net.menthor.onto2.ontouml.Classifier"
] | import net.menthor.onto2.ontouml.Classifier; | import net.menthor.onto2.ontouml.*; | [
"net.menthor.onto2"
] | net.menthor.onto2; | 2,126,063 |
public List<FeedbackQuestionAttributes> getFeedbackQuestionsForInstructor(
String feedbackSessionName, String courseId, String userEmail)
throws EntityDoesNotExistException {
if (fsLogic.getFeedbackSession(feedbackSessionName, courseId) == null) {
throw new EntityDoesNotExistException(
"Trying to get questions for a feedback session that does not exist.");
}
if (fsLogic.isCreatorOfSession(feedbackSessionName, courseId, userEmail)) {
return getFeedbackQuestionsForCreatorInstructor(feedbackSessionName, courseId);
}
List<FeedbackQuestionAttributes> questions = new ArrayList<>();
InstructorAttributes instructor = instructorsLogic.getInstructorForEmail(courseId, userEmail);
boolean isInstructor = instructor != null;
if (isInstructor) {
questions.addAll(fqDb.getFeedbackQuestionsForGiverType(
feedbackSessionName, courseId, FeedbackParticipantType.INSTRUCTORS));
}
questions.sort(null);
return questions;
} | List<FeedbackQuestionAttributes> function( String feedbackSessionName, String courseId, String userEmail) throws EntityDoesNotExistException { if (fsLogic.getFeedbackSession(feedbackSessionName, courseId) == null) { throw new EntityDoesNotExistException( STR); } if (fsLogic.isCreatorOfSession(feedbackSessionName, courseId, userEmail)) { return getFeedbackQuestionsForCreatorInstructor(feedbackSessionName, courseId); } List<FeedbackQuestionAttributes> questions = new ArrayList<>(); InstructorAttributes instructor = instructorsLogic.getInstructorForEmail(courseId, userEmail); boolean isInstructor = instructor != null; if (isInstructor) { questions.addAll(fqDb.getFeedbackQuestionsForGiverType( feedbackSessionName, courseId, FeedbackParticipantType.INSTRUCTORS)); } questions.sort(null); return questions; } | /**
* Gets a {@code List} of all questions for the given session for an
* instructor to view/submit.
*/ | Gets a List of all questions for the given session for an instructor to view/submit | getFeedbackQuestionsForInstructor | {
"repo_name": "xpdavid/teammates",
"path": "src/main/java/teammates/logic/core/FeedbackQuestionsLogic.java",
"license": "gpl-2.0",
"size": 36204
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 154,893 |
public void setWatches(long relativeZxid, List<String> dataWatches,
List<String> existWatches, List<String> childWatches, Watcher watcher) {
dataTree.setWatches(relativeZxid, dataWatches, existWatches, childWatches, watcher);
} | void function(long relativeZxid, List<String> dataWatches, List<String> existWatches, List<String> childWatches, Watcher watcher) { dataTree.setWatches(relativeZxid, dataWatches, existWatches, childWatches, watcher); } | /**
* set watches on the datatree
* @param relativeZxid the relative zxid that client has seen
* @param dataWatches the data watches the client wants to reset
* @param existWatches the exists watches the client wants to reset
* @param childWatches the child watches the client wants to reset
* @param watcher the watcher function
*/ | set watches on the datatree | setWatches | {
"repo_name": "ExactTargetDev/zookeeper",
"path": "src/java/main/org/apache/zookeeper/server/ZKDatabase.java",
"license": "apache-2.0",
"size": 15459
} | [
"java.util.List",
"org.apache.zookeeper.Watcher"
] | import java.util.List; import org.apache.zookeeper.Watcher; | import java.util.*; import org.apache.zookeeper.*; | [
"java.util",
"org.apache.zookeeper"
] | java.util; org.apache.zookeeper; | 1,523,869 |
public ActionForward applyAction(ActionMapping mapping,
ActionForm formIn,
HttpServletRequest request,
HttpServletResponse response) {
String guestAction = request.getParameter("guestAction");
String actionToTake = (String)GUEST_ACTIONS.get(guestAction);
return virtualAction(mapping, formIn, request, response, actionToTake);
} | ActionForward function(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { String guestAction = request.getParameter(STR); String actionToTake = (String)GUEST_ACTIONS.get(guestAction); return virtualAction(mapping, formIn, request, response, actionToTake); } | /**
* Called when the Apply Action button is pressed, determines the path
* of execution based on the action options dropdown.
*
* @param mapping ActionMapping
* @param formIn ActionForm
* @param request ServletRequest
* @param response ServletResponse
* @return The ActionForward to go to next.
*/ | Called when the Apply Action button is pressed, determines the path of execution based on the action options dropdown | applyAction | {
"repo_name": "colloquium/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/action/systems/virtualization/VirtualGuestsListAction.java",
"license": "gpl-2.0",
"size": 9924
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.ActionForward",
"org.apache.struts.action.ActionMapping"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; | import javax.servlet.http.*; import org.apache.struts.action.*; | [
"javax.servlet",
"org.apache.struts"
] | javax.servlet; org.apache.struts; | 2,282,448 |
@Override default GunType getGunType() {
return GunType.ASSULT_RIFLE;
} | @Override default GunType getGunType() { return GunType.ASSULT_RIFLE; } | /**
* This is the type of gun.
*
* @return Gun type
*/ | This is the type of gun | getGunType | {
"repo_name": "TeddyDev/MCNetwork",
"path": "Gta/src/main/java/me/lukebingham/gta/weapon/gun/type/AssultRifle.java",
"license": "gpl-3.0",
"size": 1064
} | [
"me.lukebingham.gta.weapon.gun.GunType"
] | import me.lukebingham.gta.weapon.gun.GunType; | import me.lukebingham.gta.weapon.gun.*; | [
"me.lukebingham.gta"
] | me.lukebingham.gta; | 2,472,956 |
public void ifPresent(@NotNull final Consumer<TValue> consumer) {
if (hasValue) {
consumer.accept(value);
}
}
// endregion | void function(@NotNull final Consumer<TValue> consumer) { if (hasValue) { consumer.accept(value); } } | /**
* Calls the given {@link Consumer} if this {@link ValueContainer} currently has a value.
*
* @param consumer the {@link Consumer} to use for this {@link ValueContainer}s {@link #value} if it has one.
*/ | Calls the given <code>Consumer</code> if this <code>ValueContainer</code> currently has a value | ifPresent | {
"repo_name": "Xyanid/bindableFX",
"path": "src/main/java/de/saxsys/bindablefx/ValueContainer.java",
"license": "apache-2.0",
"size": 2668
} | [
"java.util.function.Consumer",
"org.jetbrains.annotations.NotNull"
] | import java.util.function.Consumer; import org.jetbrains.annotations.NotNull; | import java.util.function.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.jetbrains.annotations"
] | java.util; org.jetbrains.annotations; | 2,589,750 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.